@alexgorbatchev/shadcn 0.0.20 → 0.0.21
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 +16 -0
- package/dist/components/tree/index.d.ts +2 -0
- package/dist/components/tree/index.js +57 -0
- package/dist/event-calendar.css +83 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +1411 -708
- 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 +28 -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,434 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn2
|
|
3
|
+
} from "./chunk-cp2m7y7v.js";
|
|
4
|
+
import {
|
|
5
|
+
Badge2
|
|
6
|
+
} from "./chunk-wjx6zf94.js";
|
|
7
|
+
import {
|
|
8
|
+
Button2
|
|
9
|
+
} from "./chunk-73rkr9ct.js";
|
|
10
|
+
import {
|
|
11
|
+
NativeSelect2,
|
|
12
|
+
NativeSelectOption2
|
|
13
|
+
} from "./chunk-r9qrb6b6.js";
|
|
14
|
+
|
|
15
|
+
// src/components/Tabs.tsx
|
|
16
|
+
import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
|
|
17
|
+
import { cva } from "class-variance-authority";
|
|
18
|
+
import { jsx } from "react/jsx-runtime";
|
|
19
|
+
function Tabs2({ density, className, orientation = "horizontal", ...props }) {
|
|
20
|
+
return /* @__PURE__ */ jsx(TabsPrimitive.Root, {
|
|
21
|
+
"data-density": density,
|
|
22
|
+
"data-slot": "tabs",
|
|
23
|
+
orientation,
|
|
24
|
+
className: (state) => cn2("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col", typeof className === "function" ? className(state) : className),
|
|
25
|
+
...props
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
var tabsListVariants2 = cva("group/tabs-list inline-flex w-fit items-center justify-center rounded-sm p-px text-muted-foreground group-data-[orientation=horizontal]/tabs:h-control group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none", {
|
|
29
|
+
variants: {
|
|
30
|
+
variant: {
|
|
31
|
+
default: "bg-muted",
|
|
32
|
+
line: "gap-1 bg-transparent"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
variant: "default"
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
function TabsList2({ density, className, variant = "default", ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsx(TabsPrimitive.List, {
|
|
41
|
+
"data-density": density,
|
|
42
|
+
"data-slot": "tabs-list",
|
|
43
|
+
"data-variant": variant,
|
|
44
|
+
className: (state) => cn2(tabsListVariants2({ variant }), typeof className === "function" ? className(state) : className),
|
|
45
|
+
...props
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function TabsTrigger2({ density, className, ...props }) {
|
|
49
|
+
return /* @__PURE__ */ jsx(TabsPrimitive.Tab, {
|
|
50
|
+
"data-density": density,
|
|
51
|
+
"data-slot": "tabs-trigger",
|
|
52
|
+
className: (state) => cn2("relative inline-flex h-full flex-1 items-center justify-center gap-control-gap rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-colors group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pe-1 has-data-[icon=inline-start]:ps-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent", "data-active:bg-background data-active:text-foreground", "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-end-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100", typeof className === "function" ? className(state) : className),
|
|
53
|
+
...props
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function TabsContent2({ density, className, ...props }) {
|
|
57
|
+
return /* @__PURE__ */ jsx(TabsPrimitive.Panel, {
|
|
58
|
+
"data-density": density,
|
|
59
|
+
"data-slot": "tabs-content",
|
|
60
|
+
"data-scroll": "none",
|
|
61
|
+
className: (state) => cn2("flex-1 text-sm outline-none", typeof className === "function" ? className(state) : className),
|
|
62
|
+
...props
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/components/DragDropPreview.tsx
|
|
67
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
68
|
+
function DragDropPreview2({ labels, maxItems = 5 }) {
|
|
69
|
+
const limit = Math.max(1, Math.floor(maxItems));
|
|
70
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
71
|
+
"data-slot": "drag-drop-preview",
|
|
72
|
+
className: "flex w-max max-w-64 flex-col items-start gap-1",
|
|
73
|
+
children: [
|
|
74
|
+
labels.slice(0, limit).map((label, index) => /* @__PURE__ */ jsx2(Badge2, {
|
|
75
|
+
variant: "secondary",
|
|
76
|
+
density: "compact",
|
|
77
|
+
children: /* @__PURE__ */ jsx2("span", {
|
|
78
|
+
className: "max-w-60 truncate",
|
|
79
|
+
children: label
|
|
80
|
+
})
|
|
81
|
+
}, `${index}:${label}`)),
|
|
82
|
+
labels.length > limit && /* @__PURE__ */ jsxs(Badge2, {
|
|
83
|
+
variant: "secondary",
|
|
84
|
+
density: "compact",
|
|
85
|
+
children: [
|
|
86
|
+
"+",
|
|
87
|
+
labels.length - limit,
|
|
88
|
+
" more…"
|
|
89
|
+
]
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// src/components/DragDropProvider.tsx
|
|
96
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
97
|
+
import { flushSync } from "react-dom";
|
|
98
|
+
|
|
99
|
+
// src/drag-drop/DragDropContext.ts
|
|
100
|
+
import { createContext } from "react";
|
|
101
|
+
var DragDropContext = createContext(null);
|
|
102
|
+
|
|
103
|
+
// src/components/DragDropProvider.tsx
|
|
104
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
105
|
+
function DragDropProvider2({ children, maxPreviewItems = 5 }) {
|
|
106
|
+
const [active, setActive] = useState(null);
|
|
107
|
+
const [over, setOver] = useState(null);
|
|
108
|
+
const preview = useRef(null);
|
|
109
|
+
const end = useCallback(() => {
|
|
110
|
+
setActive(null);
|
|
111
|
+
setOver(null);
|
|
112
|
+
}, []);
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
window.addEventListener("dragend", end);
|
|
115
|
+
window.addEventListener("drop", end);
|
|
116
|
+
return () => {
|
|
117
|
+
window.removeEventListener("dragend", end);
|
|
118
|
+
window.removeEventListener("drop", end);
|
|
119
|
+
};
|
|
120
|
+
}, [end]);
|
|
121
|
+
const start = (event, item, effect) => {
|
|
122
|
+
event.dataTransfer.effectAllowed = effect;
|
|
123
|
+
event.dataTransfer.setData(item.type, JSON.stringify(item.data) ?? "null");
|
|
124
|
+
event.dataTransfer.setData("text/plain", item.labels.join(`
|
|
125
|
+
`));
|
|
126
|
+
flushSync(() => {
|
|
127
|
+
setActive(item);
|
|
128
|
+
setOver(null);
|
|
129
|
+
});
|
|
130
|
+
if (preview.current)
|
|
131
|
+
event.dataTransfer.setDragImage(preview.current, 12, 12);
|
|
132
|
+
};
|
|
133
|
+
const enter = (next) => setOver((current) => current?.id === next.id && current.type === next.type && current.isAlt === next.isAlt && current.effect === next.effect ? current : next);
|
|
134
|
+
const leave = (id) => setOver((current) => current?.id === id ? null : current);
|
|
135
|
+
return /* @__PURE__ */ jsxs2(DragDropContext, {
|
|
136
|
+
value: { active, over, start, end, enter, leave },
|
|
137
|
+
children: [
|
|
138
|
+
children,
|
|
139
|
+
/* @__PURE__ */ jsx3("div", {
|
|
140
|
+
ref: preview,
|
|
141
|
+
"aria-hidden": "true",
|
|
142
|
+
className: "pointer-events-none fixed -left-[10000px] top-0 w-max",
|
|
143
|
+
children: /* @__PURE__ */ jsx3(DragDropPreview2, {
|
|
144
|
+
labels: active?.labels ?? [],
|
|
145
|
+
maxItems: maxPreviewItems
|
|
146
|
+
})
|
|
147
|
+
}),
|
|
148
|
+
/* @__PURE__ */ jsx3("span", {
|
|
149
|
+
role: "status",
|
|
150
|
+
"aria-label": "Drag status",
|
|
151
|
+
className: "sr-only",
|
|
152
|
+
children: active && `${active.labels.length} ${active.labels.length === 1 ? "item" : "items"} being dragged`
|
|
153
|
+
})
|
|
154
|
+
]
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// src/hooks/useDragDrop.ts
|
|
159
|
+
import { useContext } from "react";
|
|
160
|
+
function useDragDrop2() {
|
|
161
|
+
const context = useContext(DragDropContext);
|
|
162
|
+
if (!context)
|
|
163
|
+
throw new Error("Drag and drop requires DragDropProvider.");
|
|
164
|
+
return context;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// src/hooks/useDragSource.ts
|
|
168
|
+
import { useId } from "react";
|
|
169
|
+
function useDragSource2({
|
|
170
|
+
type,
|
|
171
|
+
data,
|
|
172
|
+
labels,
|
|
173
|
+
effectAllowed = "copyMove",
|
|
174
|
+
disabled = false
|
|
175
|
+
}) {
|
|
176
|
+
const { active, start, end } = useDragDrop2();
|
|
177
|
+
const sourceId = useId();
|
|
178
|
+
return {
|
|
179
|
+
isDragging: active?.sourceId === sourceId,
|
|
180
|
+
props: {
|
|
181
|
+
draggable: !disabled,
|
|
182
|
+
onDragStart: (event) => {
|
|
183
|
+
if (event.defaultPrevented)
|
|
184
|
+
return;
|
|
185
|
+
event.stopPropagation();
|
|
186
|
+
if (disabled || labels.length === 0) {
|
|
187
|
+
event.preventDefault();
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
start(event, { sourceId, type, data, labels }, effectAllowed);
|
|
191
|
+
},
|
|
192
|
+
onDragEnd: end
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// src/components/DragSource.tsx
|
|
198
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
199
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
200
|
+
function DragSource2({
|
|
201
|
+
type,
|
|
202
|
+
data,
|
|
203
|
+
labels,
|
|
204
|
+
effectAllowed,
|
|
205
|
+
disabled,
|
|
206
|
+
render,
|
|
207
|
+
...props
|
|
208
|
+
}) {
|
|
209
|
+
const source = useDragSource2({ type, data, labels, effectAllowed, disabled });
|
|
210
|
+
return useRender({
|
|
211
|
+
defaultTagName: "div",
|
|
212
|
+
render,
|
|
213
|
+
props: mergeProps(props, source.props),
|
|
214
|
+
state: { slot: "drag-source", dragging: source.isDragging }
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// src/hooks/useDropTarget.ts
|
|
219
|
+
import { useId as useId2, useState as useState2 } from "react";
|
|
220
|
+
function useDropTarget2({ accept, canDrop, getDropEffect, onDrop }) {
|
|
221
|
+
const { active, over, enter, leave, end } = useDragDrop2();
|
|
222
|
+
const id = useId2();
|
|
223
|
+
const [feedback, setFeedback] = useState2(null);
|
|
224
|
+
return {
|
|
225
|
+
feedback,
|
|
226
|
+
type: over?.id === id ? over.type : null,
|
|
227
|
+
isOver: over?.id === id,
|
|
228
|
+
isAlt: over?.id === id && over.isAlt,
|
|
229
|
+
effect: over?.id === id ? over.effect : "none",
|
|
230
|
+
props: {
|
|
231
|
+
onDragOver: (event) => {
|
|
232
|
+
const type = accept.find((type) => event.dataTransfer.types.includes(type));
|
|
233
|
+
if (!type)
|
|
234
|
+
return;
|
|
235
|
+
event.stopPropagation();
|
|
236
|
+
const item = active?.type === type ? active : null;
|
|
237
|
+
const effect = item && canDrop && !canDrop(item) ? "none" : getDropEffect?.(item, event) ?? "move";
|
|
238
|
+
event.dataTransfer.dropEffect = effect;
|
|
239
|
+
if (effect === "none") {
|
|
240
|
+
leave(id);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
event.preventDefault();
|
|
244
|
+
setFeedback((current) => current?.type === type && current.isAlt === event.altKey && current.effect === effect ? current : { type, isAlt: event.altKey, effect });
|
|
245
|
+
enter({ id, type, isAlt: event.altKey, effect });
|
|
246
|
+
},
|
|
247
|
+
onDragLeave: (event) => {
|
|
248
|
+
if (!(event.relatedTarget instanceof Node) || !event.currentTarget.contains(event.relatedTarget))
|
|
249
|
+
leave(id);
|
|
250
|
+
},
|
|
251
|
+
onDrop: (event) => {
|
|
252
|
+
const type = accept.find((type) => event.dataTransfer.types.includes(type));
|
|
253
|
+
if (!type)
|
|
254
|
+
return;
|
|
255
|
+
event.stopPropagation();
|
|
256
|
+
event.preventDefault();
|
|
257
|
+
const raw = event.dataTransfer.getData(type);
|
|
258
|
+
let data;
|
|
259
|
+
try {
|
|
260
|
+
data = JSON.parse(raw);
|
|
261
|
+
} catch {
|
|
262
|
+
data = raw;
|
|
263
|
+
}
|
|
264
|
+
const item = { type, data, labels: active?.labels ?? [] };
|
|
265
|
+
leave(id);
|
|
266
|
+
end();
|
|
267
|
+
if (!canDrop || canDrop(item))
|
|
268
|
+
onDrop(item, event);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// src/components/DropTarget.tsx
|
|
275
|
+
import { useRender as useRender2 } from "@base-ui/react/use-render";
|
|
276
|
+
import { mergeProps as mergeProps2 } from "@base-ui/react/merge-props";
|
|
277
|
+
function DropTarget2({
|
|
278
|
+
accept,
|
|
279
|
+
canDrop,
|
|
280
|
+
getDropEffect,
|
|
281
|
+
onDrop,
|
|
282
|
+
render,
|
|
283
|
+
...props
|
|
284
|
+
}) {
|
|
285
|
+
const target = useDropTarget2({ accept, canDrop, getDropEffect, onDrop });
|
|
286
|
+
return useRender2({
|
|
287
|
+
defaultTagName: "div",
|
|
288
|
+
render,
|
|
289
|
+
props: mergeProps2(props, target.props),
|
|
290
|
+
state: { slot: "drop-target", over: target.isOver, effect: target.effect }
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// src/components/Kanban.tsx
|
|
295
|
+
import { useId as useId3 } from "react";
|
|
296
|
+
import { ArrowDownIcon, ArrowUpIcon } from "lucide-react";
|
|
297
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
298
|
+
function Kanban2({
|
|
299
|
+
label,
|
|
300
|
+
columns,
|
|
301
|
+
items,
|
|
302
|
+
onItemsChange,
|
|
303
|
+
renderItem,
|
|
304
|
+
canMove,
|
|
305
|
+
disabled,
|
|
306
|
+
density
|
|
307
|
+
}) {
|
|
308
|
+
const boardId = useId3();
|
|
309
|
+
const type = `application/x-kanban-${boardId.replaceAll(":", "").toLowerCase()}`;
|
|
310
|
+
const canDropInto = (data, columnId) => typeof data === "string" && !disabled && items.some((item) => item.id === data && (!canMove || canMove(item, columnId)));
|
|
311
|
+
const move = (id, columnId, beforeId) => {
|
|
312
|
+
const item = items.find((candidate) => candidate.id === id);
|
|
313
|
+
if (!item || disabled || !columns.some((column) => column.id === columnId) || canMove && !canMove(item, columnId) || id === beforeId)
|
|
314
|
+
return;
|
|
315
|
+
const remaining = items.filter((candidate) => candidate.id !== id);
|
|
316
|
+
const index = beforeId ? remaining.findIndex((candidate) => candidate.id === beforeId) : remaining.length;
|
|
317
|
+
remaining.splice(index < 0 ? remaining.length : index, 0, { ...item, columnId });
|
|
318
|
+
onItemsChange(remaining);
|
|
319
|
+
};
|
|
320
|
+
return /* @__PURE__ */ jsx4(DragDropProvider2, {
|
|
321
|
+
children: /* @__PURE__ */ jsx4("div", {
|
|
322
|
+
role: "region",
|
|
323
|
+
"aria-label": label,
|
|
324
|
+
"data-density": density,
|
|
325
|
+
className: "overflow-x-auto",
|
|
326
|
+
children: /* @__PURE__ */ jsx4("div", {
|
|
327
|
+
className: "grid min-w-max auto-cols-[18rem] grid-flow-col gap-4",
|
|
328
|
+
children: columns.map((column) => {
|
|
329
|
+
const cards = items.filter((item) => item.columnId === column.id);
|
|
330
|
+
return /* @__PURE__ */ jsxs3(DropTarget2, {
|
|
331
|
+
accept: [type],
|
|
332
|
+
canDrop: (item) => canDropInto(item.data, column.id),
|
|
333
|
+
onDrop: (item) => {
|
|
334
|
+
if (typeof item.data === "string")
|
|
335
|
+
move(item.data, column.id);
|
|
336
|
+
},
|
|
337
|
+
render: /* @__PURE__ */ jsx4("section", {
|
|
338
|
+
"aria-label": column.label,
|
|
339
|
+
"data-scroll": "none"
|
|
340
|
+
}),
|
|
341
|
+
className: "flex min-h-48 flex-col gap-3 rounded-sm border border-border bg-muted/30 p-3 data-over:border-primary",
|
|
342
|
+
children: [
|
|
343
|
+
/* @__PURE__ */ jsxs3("header", {
|
|
344
|
+
className: "flex items-center justify-between gap-2",
|
|
345
|
+
children: [
|
|
346
|
+
/* @__PURE__ */ jsx4("h2", {
|
|
347
|
+
className: "text-sm font-semibold",
|
|
348
|
+
children: column.label
|
|
349
|
+
}),
|
|
350
|
+
/* @__PURE__ */ jsx4(Badge2, {
|
|
351
|
+
variant: "secondary",
|
|
352
|
+
"aria-label": `${column.label} count`,
|
|
353
|
+
children: cards.length
|
|
354
|
+
})
|
|
355
|
+
]
|
|
356
|
+
}),
|
|
357
|
+
/* @__PURE__ */ jsx4("ol", {
|
|
358
|
+
className: "grid gap-2",
|
|
359
|
+
children: cards.map((item, index) => /* @__PURE__ */ jsx4("li", {
|
|
360
|
+
children: /* @__PURE__ */ jsx4(DropTarget2, {
|
|
361
|
+
accept: [type],
|
|
362
|
+
canDrop: (drag) => canDropInto(drag.data, column.id),
|
|
363
|
+
onDrop: (drag) => {
|
|
364
|
+
if (typeof drag.data === "string")
|
|
365
|
+
move(drag.data, column.id, item.id);
|
|
366
|
+
},
|
|
367
|
+
children: /* @__PURE__ */ jsxs3(DragSource2, {
|
|
368
|
+
type,
|
|
369
|
+
data: item.id,
|
|
370
|
+
labels: [item.title],
|
|
371
|
+
disabled,
|
|
372
|
+
className: "grid gap-3 rounded-sm border border-border bg-card p-3 text-sm data-dragging:opacity-50",
|
|
373
|
+
role: "group",
|
|
374
|
+
"aria-label": item.title,
|
|
375
|
+
"data-scroll": "none",
|
|
376
|
+
children: [
|
|
377
|
+
/* @__PURE__ */ jsx4("div", {
|
|
378
|
+
children: renderItem ? renderItem(item) : /* @__PURE__ */ jsx4("h3", {
|
|
379
|
+
className: "font-medium",
|
|
380
|
+
children: item.title
|
|
381
|
+
})
|
|
382
|
+
}),
|
|
383
|
+
/* @__PURE__ */ jsxs3("div", {
|
|
384
|
+
className: "flex items-center gap-1",
|
|
385
|
+
children: [
|
|
386
|
+
/* @__PURE__ */ jsx4(NativeSelect2, {
|
|
387
|
+
"aria-label": `Move ${item.title} to`,
|
|
388
|
+
value: column.id,
|
|
389
|
+
disabled,
|
|
390
|
+
onChange: (event) => move(item.id, event.target.value),
|
|
391
|
+
children: columns.map((target) => /* @__PURE__ */ jsx4(NativeSelectOption2, {
|
|
392
|
+
value: target.id,
|
|
393
|
+
disabled: Boolean(canMove && !canMove(item, target.id)),
|
|
394
|
+
children: target.label
|
|
395
|
+
}, target.id))
|
|
396
|
+
}),
|
|
397
|
+
/* @__PURE__ */ jsx4(Button2, {
|
|
398
|
+
type: "button",
|
|
399
|
+
variant: "ghost",
|
|
400
|
+
size: "icon-sm",
|
|
401
|
+
"aria-label": `Move ${item.title} up`,
|
|
402
|
+
disabled: disabled || index === 0,
|
|
403
|
+
onClick: () => move(item.id, column.id, cards[index - 1]?.id),
|
|
404
|
+
children: /* @__PURE__ */ jsx4(ArrowUpIcon, {})
|
|
405
|
+
}),
|
|
406
|
+
/* @__PURE__ */ jsx4(Button2, {
|
|
407
|
+
type: "button",
|
|
408
|
+
variant: "ghost",
|
|
409
|
+
size: "icon-sm",
|
|
410
|
+
"aria-label": `Move ${item.title} down`,
|
|
411
|
+
disabled: disabled || index === cards.length - 1,
|
|
412
|
+
onClick: () => move(cards[index + 1].id, column.id, item.id),
|
|
413
|
+
children: /* @__PURE__ */ jsx4(ArrowDownIcon, {})
|
|
414
|
+
})
|
|
415
|
+
]
|
|
416
|
+
})
|
|
417
|
+
]
|
|
418
|
+
})
|
|
419
|
+
})
|
|
420
|
+
}, item.id))
|
|
421
|
+
}),
|
|
422
|
+
!cards.length && /* @__PURE__ */ jsx4("p", {
|
|
423
|
+
className: "py-6 text-center text-sm text-muted-foreground",
|
|
424
|
+
children: "No items"
|
|
425
|
+
})
|
|
426
|
+
]
|
|
427
|
+
}, column.id);
|
|
428
|
+
})
|
|
429
|
+
})
|
|
430
|
+
})
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
export { Tabs2, tabsListVariants2, TabsList2, TabsTrigger2, TabsContent2, DragDropPreview2, DragDropProvider2, useDragDrop2, useDragSource2, DragSource2, useDropTarget2, DropTarget2, Kanban2 };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn2
|
|
3
|
+
} from "./chunk-cp2m7y7v.js";
|
|
4
|
+
|
|
5
|
+
// src/components/NativeSelect.tsx
|
|
6
|
+
import { ChevronDownIcon } from "lucide-react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
function NativeSelect2({
|
|
9
|
+
density,
|
|
10
|
+
className,
|
|
11
|
+
dir,
|
|
12
|
+
size = "default",
|
|
13
|
+
...props
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
16
|
+
dir,
|
|
17
|
+
className: cn2("group/native-select relative w-fit has-[select:disabled]:opacity-50", className),
|
|
18
|
+
"data-density": density,
|
|
19
|
+
"data-slot": "native-select-wrapper",
|
|
20
|
+
"data-size": size,
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ jsx("select", {
|
|
23
|
+
dir,
|
|
24
|
+
"data-slot": "native-select",
|
|
25
|
+
"data-size": size,
|
|
26
|
+
className: "h-control w-full min-w-0 appearance-none rounded-sm border border-input bg-secondary py-1 pe-8 ps-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive data-[size=sm]:h-control-sm data-[size=sm]:rounded-sm data-[size=sm]:py-0.5",
|
|
27
|
+
...props
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
30
|
+
className: "pointer-events-none absolute top-1/2 end-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none",
|
|
31
|
+
"aria-hidden": "true",
|
|
32
|
+
"data-slot": "native-select-icon"
|
|
33
|
+
})
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function NativeSelectOption2({ density, className, ...props }) {
|
|
38
|
+
return /* @__PURE__ */ jsx("option", {
|
|
39
|
+
"data-density": density,
|
|
40
|
+
"data-slot": "native-select-option",
|
|
41
|
+
className: cn2("bg-[Canvas] text-[CanvasText]", className),
|
|
42
|
+
...props
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function NativeSelectOptGroup2({ density, className, ...props }) {
|
|
46
|
+
return /* @__PURE__ */ jsx("optgroup", {
|
|
47
|
+
"data-density": density,
|
|
48
|
+
"data-slot": "native-select-optgroup",
|
|
49
|
+
className: cn2("bg-[Canvas] text-[CanvasText]", className),
|
|
50
|
+
...props
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { NativeSelect2, NativeSelectOption2, NativeSelectOptGroup2 };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { IDensityProps } from "../density/types.js";
|
|
3
|
+
type AccountAction = "profile" | "settings" | "sign-out";
|
|
4
|
+
type AccountMenuProps = IDensityProps & {
|
|
5
|
+
name: string;
|
|
6
|
+
email?: string;
|
|
7
|
+
image?: string;
|
|
8
|
+
onAction: (action: AccountAction) => void;
|
|
9
|
+
};
|
|
10
|
+
declare function AccountMenu({ name, email, image, onAction, density }: AccountMenuProps): ReactElement;
|
|
11
|
+
export { AccountMenu };
|
|
12
|
+
export type { AccountMenuProps, AccountAction };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CSSProperties, ReactElement, ReactNode } from "react";
|
|
2
|
+
import type { IDensityProps } from "../density/types.js";
|
|
3
|
+
type AppShellNavigationItem = {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
href: string;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
};
|
|
10
|
+
type AppShellProps = IDensityProps & {
|
|
11
|
+
navigation: readonly AppShellNavigationItem[];
|
|
12
|
+
brand: ReactNode;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
header?: ReactNode;
|
|
15
|
+
sidebarFooter?: ReactNode;
|
|
16
|
+
footer?: ReactNode;
|
|
17
|
+
height?: CSSProperties["height"];
|
|
18
|
+
defaultSidebarOpen?: boolean;
|
|
19
|
+
label?: string;
|
|
20
|
+
};
|
|
21
|
+
declare function AppShell({ navigation, brand, children, header, sidebarFooter, footer, height, defaultSidebarOpen, label, density, }: AppShellProps): ReactElement;
|
|
22
|
+
export { AppShell };
|
|
23
|
+
export type { AppShellNavigationItem, AppShellProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
2
|
+
import type { IDensityProps } from "../density/types.js";
|
|
3
|
+
type AuthFormMode = "sign-in" | "sign-up" | "reset-password";
|
|
4
|
+
type AuthFormValues = {
|
|
5
|
+
email: string;
|
|
6
|
+
password: string;
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
9
|
+
type AuthFormProps = IDensityProps & {
|
|
10
|
+
mode?: AuthFormMode;
|
|
11
|
+
onSubmit: (values: AuthFormValues) => void | Promise<void>;
|
|
12
|
+
footer?: ReactNode;
|
|
13
|
+
alternativeActions?: ReactNode;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
declare function AuthForm({ mode, onSubmit, footer, alternativeActions, disabled, density, }: AuthFormProps): ReactElement;
|
|
17
|
+
export { AuthForm };
|
|
18
|
+
export type { AuthFormProps, AuthFormMode, AuthFormValues };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { IDensityProps } from "../density/types.js";
|
|
3
|
+
type BarListItem = {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
value: number;
|
|
7
|
+
};
|
|
8
|
+
type BarListProps = IDensityProps & {
|
|
9
|
+
label: string;
|
|
10
|
+
items: readonly BarListItem[];
|
|
11
|
+
onItemSelect?: (item: BarListItem) => void;
|
|
12
|
+
valueFormatter?: (value: number) => string;
|
|
13
|
+
};
|
|
14
|
+
declare function BarList({ label, items, onItemSelect, valueFormatter, density, }: BarListProps): ReactElement;
|
|
15
|
+
export { BarList };
|
|
16
|
+
export type { BarListProps, BarListItem };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { IDensityProps } from "../density/types.js";
|
|
3
|
+
type UsageMetric = {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
used: number;
|
|
7
|
+
limit: number;
|
|
8
|
+
unit?: string;
|
|
9
|
+
};
|
|
10
|
+
type BillingUsageProps = IDensityProps & {
|
|
11
|
+
plan: string;
|
|
12
|
+
price: string;
|
|
13
|
+
period: string;
|
|
14
|
+
metrics: readonly UsageMetric[];
|
|
15
|
+
onManage: () => void;
|
|
16
|
+
pending?: boolean;
|
|
17
|
+
};
|
|
18
|
+
declare function BillingUsage({ plan, price, period, metrics, onManage, pending, density }: BillingUsageProps): ReactElement;
|
|
19
|
+
export { BillingUsage };
|
|
20
|
+
export type { BillingUsageProps, UsageMetric };
|
|
@@ -32,8 +32,9 @@ type ComboboxChipsProps = ComponentPropsWithRef<typeof ComboboxPrimitive.Chips>
|
|
|
32
32
|
declare function ComboboxChips({ density, className, ...props }: ComboboxChipsProps): ReactElement;
|
|
33
33
|
type ComboboxChipProps = ComboboxPrimitive.Chip.Props & {
|
|
34
34
|
showRemove?: boolean;
|
|
35
|
+
removeLabel?: string;
|
|
35
36
|
} & IDensityProps;
|
|
36
|
-
declare function ComboboxChip({ density, className, children, showRemove, ...props }: ComboboxChipProps): ReactElement;
|
|
37
|
+
declare function ComboboxChip({ density, className, children, showRemove, removeLabel, ...props }: ComboboxChipProps): ReactElement;
|
|
37
38
|
type ComboboxChipsInputProps = ComboboxPrimitive.Input.Props & IDensityProps;
|
|
38
39
|
declare function ComboboxChipsInput({ density, className, ...props }: ComboboxChipsInputProps): ReactElement;
|
|
39
40
|
export { Combobox, ComboboxInput, ComboboxContent, ComboboxList, ComboboxItem, ComboboxGroup, ComboboxLabel, ComboboxCollection, ComboboxEmpty, ComboboxSeparator, ComboboxChips, ComboboxChip, ComboboxChipsInput, ComboboxTrigger, ComboboxValue, };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
import type { IDensityProps } from "../density/types.js";
|
|
3
|
+
import { type StatCardProps } from "./StatCard.js";
|
|
4
|
+
type DashboardStat = Omit<StatCardProps, "density"> & {
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
type DashboardLayoutProps = IDensityProps & {
|
|
8
|
+
title: string;
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
actions?: ReactNode;
|
|
11
|
+
filters?: ReactNode;
|
|
12
|
+
stats: readonly DashboardStat[];
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
footer?: ReactNode;
|
|
15
|
+
};
|
|
16
|
+
declare function DashboardLayout({ title, description, actions, filters, stats, children, footer, density, }: DashboardLayoutProps): ReactElement;
|
|
17
|
+
export { DashboardLayout };
|
|
18
|
+
export type { DashboardLayoutProps, DashboardStat };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ILabelValue } from "../options/types.js";
|
|
2
|
+
import type { ReactElement } from "react";
|
|
3
|
+
import type { IDensityProps } from "../density/types.js";
|
|
4
|
+
type FilterDefinition = {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
options: readonly ILabelValue[];
|
|
8
|
+
};
|
|
9
|
+
type FilterBarProps = IDensityProps & {
|
|
10
|
+
label: string;
|
|
11
|
+
search: string;
|
|
12
|
+
onSearchChange: (value: string) => void;
|
|
13
|
+
filters: readonly FilterDefinition[];
|
|
14
|
+
value: Record<string, string>;
|
|
15
|
+
onValueChange: (value: Record<string, string>) => void;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
};
|
|
18
|
+
declare function FilterBar({ label, search, onSearchChange, filters, value, onValueChange, disabled, density, }: FilterBarProps): ReactElement;
|
|
19
|
+
export { FilterBar };
|
|
20
|
+
export type { FilterBarProps, FilterDefinition };
|