@danxbot/ui 2.1.1 → 2.2.1
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/index.js +6382 -6123
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/components/RecordCard.d.ts +153 -0
- package/dist/types/components/kanban/KanbanBoard.d.ts +40 -0
- package/dist/types/components/kanban/recipe.d.ts +49 -0
- package/dist/types/components/kanban/resolve.d.ts +31 -0
- package/dist/types/components/kanban/types.d.ts +45 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { ReactNode, Ref } from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
import { type VariantProps } from "tailwind-variants";
|
|
4
|
+
declare const record: import("tailwind-variants").TVReturnType<{
|
|
5
|
+
emphasis: {
|
|
6
|
+
none: {
|
|
7
|
+
root: string;
|
|
8
|
+
};
|
|
9
|
+
accent: {
|
|
10
|
+
root: string;
|
|
11
|
+
};
|
|
12
|
+
warning: {
|
|
13
|
+
root: string;
|
|
14
|
+
};
|
|
15
|
+
danger: {
|
|
16
|
+
root: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
interactive: {
|
|
20
|
+
true: {
|
|
21
|
+
root: string[];
|
|
22
|
+
};
|
|
23
|
+
false: {};
|
|
24
|
+
};
|
|
25
|
+
selected: {
|
|
26
|
+
true: {
|
|
27
|
+
root: string;
|
|
28
|
+
};
|
|
29
|
+
false: {};
|
|
30
|
+
};
|
|
31
|
+
}, {
|
|
32
|
+
root: string[];
|
|
33
|
+
top: string;
|
|
34
|
+
identifier: string;
|
|
35
|
+
title: string;
|
|
36
|
+
subtitle: string;
|
|
37
|
+
badges: string;
|
|
38
|
+
metrics: string;
|
|
39
|
+
metricLabel: string;
|
|
40
|
+
metricValue: string;
|
|
41
|
+
footer: string;
|
|
42
|
+
}, undefined, {
|
|
43
|
+
emphasis: {
|
|
44
|
+
none: {
|
|
45
|
+
root: string;
|
|
46
|
+
};
|
|
47
|
+
accent: {
|
|
48
|
+
root: string;
|
|
49
|
+
};
|
|
50
|
+
warning: {
|
|
51
|
+
root: string;
|
|
52
|
+
};
|
|
53
|
+
danger: {
|
|
54
|
+
root: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
interactive: {
|
|
58
|
+
true: {
|
|
59
|
+
root: string[];
|
|
60
|
+
};
|
|
61
|
+
false: {};
|
|
62
|
+
};
|
|
63
|
+
selected: {
|
|
64
|
+
true: {
|
|
65
|
+
root: string;
|
|
66
|
+
};
|
|
67
|
+
false: {};
|
|
68
|
+
};
|
|
69
|
+
}, {
|
|
70
|
+
root: string[];
|
|
71
|
+
top: string;
|
|
72
|
+
identifier: string;
|
|
73
|
+
title: string;
|
|
74
|
+
subtitle: string;
|
|
75
|
+
badges: string;
|
|
76
|
+
metrics: string;
|
|
77
|
+
metricLabel: string;
|
|
78
|
+
metricValue: string;
|
|
79
|
+
footer: string;
|
|
80
|
+
}, import("tailwind-variants").TVReturnTypeLike<{
|
|
81
|
+
emphasis: {
|
|
82
|
+
none: {
|
|
83
|
+
root: string;
|
|
84
|
+
};
|
|
85
|
+
accent: {
|
|
86
|
+
root: string;
|
|
87
|
+
};
|
|
88
|
+
warning: {
|
|
89
|
+
root: string;
|
|
90
|
+
};
|
|
91
|
+
danger: {
|
|
92
|
+
root: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
interactive: {
|
|
96
|
+
true: {
|
|
97
|
+
root: string[];
|
|
98
|
+
};
|
|
99
|
+
false: {};
|
|
100
|
+
};
|
|
101
|
+
selected: {
|
|
102
|
+
true: {
|
|
103
|
+
root: string;
|
|
104
|
+
};
|
|
105
|
+
false: {};
|
|
106
|
+
};
|
|
107
|
+
}, {
|
|
108
|
+
root: string[];
|
|
109
|
+
top: string;
|
|
110
|
+
identifier: string;
|
|
111
|
+
title: string;
|
|
112
|
+
subtitle: string;
|
|
113
|
+
badges: string;
|
|
114
|
+
metrics: string;
|
|
115
|
+
metricLabel: string;
|
|
116
|
+
metricValue: string;
|
|
117
|
+
footer: string;
|
|
118
|
+
}>>;
|
|
119
|
+
export interface RecordCardMetric {
|
|
120
|
+
label: ReactNode;
|
|
121
|
+
value: ReactNode;
|
|
122
|
+
}
|
|
123
|
+
export interface RecordCardProps extends VariantProps<typeof record> {
|
|
124
|
+
/** The record's own id — rendered mono, above the title. */
|
|
125
|
+
identifier?: ReactNode;
|
|
126
|
+
title: ReactNode;
|
|
127
|
+
/** What kind of record this is, or who it belongs to. One line. */
|
|
128
|
+
subtitle?: ReactNode;
|
|
129
|
+
/** State chips. A slot, so their tones and behaviour stay the consumer's. */
|
|
130
|
+
badges?: ReactNode;
|
|
131
|
+
/** The numbers worth seeing without opening the record. */
|
|
132
|
+
metrics?: readonly RecordCardMetric[];
|
|
133
|
+
/** Leading — an icon, an avatar, or a drag handle. */
|
|
134
|
+
media?: ReactNode;
|
|
135
|
+
/** Trailing, top-aligned — a menu. */
|
|
136
|
+
action?: ReactNode;
|
|
137
|
+
/** A last line under a rule: an assignee, a timestamp, a count. */
|
|
138
|
+
footer?: ReactNode;
|
|
139
|
+
/**
|
|
140
|
+
* Render as something else — an `<a>` for a card that navigates.
|
|
141
|
+
*
|
|
142
|
+
* Prefer this over `onClick` when the card leads somewhere: a link can be
|
|
143
|
+
* opened in a new tab, copied, and read out as a link, and a button that
|
|
144
|
+
* calls `navigate` can do none of those.
|
|
145
|
+
*/
|
|
146
|
+
render?: useRender.RenderProp;
|
|
147
|
+
className?: string;
|
|
148
|
+
children?: ReactNode;
|
|
149
|
+
ref?: Ref<HTMLElement>;
|
|
150
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
151
|
+
}
|
|
152
|
+
export declare function RecordCard({ identifier, title, subtitle, badges, metrics, media, action, footer, emphasis, interactive, selected, render, className, children, ref, ...props }: RecordCardProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
153
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { DragSessionCallbacks } from "../../lib/dnd";
|
|
3
|
+
import type { KanbanLane, KanbanMove, KanbanRefusal } from "./types";
|
|
4
|
+
export type { KanbanLane, KanbanMove, KanbanRefusal };
|
|
5
|
+
export interface KanbanBoardProps<T> extends Omit<DragSessionCallbacks, "onDragEnd"> {
|
|
6
|
+
/**
|
|
7
|
+
* What this board is a board OF — "Case pipeline", "Release queue".
|
|
8
|
+
*
|
|
9
|
+
* It names the horizontal scroller, which is a tab stop because a board wider
|
|
10
|
+
* than the screen is otherwise unreachable by keyboard. An unlabelled stop
|
|
11
|
+
* announces as "group" and gives nobody a reason to be there, which is why
|
|
12
|
+
* this is required rather than optional.
|
|
13
|
+
*/
|
|
14
|
+
label: string;
|
|
15
|
+
lanes: readonly KanbanLane<T>[];
|
|
16
|
+
getItemId: (item: T) => string;
|
|
17
|
+
/**
|
|
18
|
+
* A speakable name for one record — "SS-2026-0412, M.R.".
|
|
19
|
+
*
|
|
20
|
+
* Required rather than optional. It is what every announcement says, and the
|
|
21
|
+
* fallback for a missing one is the id, which is speakable and never right.
|
|
22
|
+
*/
|
|
23
|
+
itemLabel: (item: T) => string;
|
|
24
|
+
renderItem: (item: T) => ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* The card while it is being carried. Defaults to `renderItem`.
|
|
27
|
+
*
|
|
28
|
+
* Worth overriding when the resting card is dense: the clone is moving, often
|
|
29
|
+
* under a cursor, and the two or three fields that identify the record are
|
|
30
|
+
* the only ones anybody reads off it.
|
|
31
|
+
*/
|
|
32
|
+
renderDragging?: (item: T) => ReactNode;
|
|
33
|
+
onMove: (move: KanbanMove) => void;
|
|
34
|
+
/** Called INSTEAD of `onMove` when the destination lane carries a `refusal`. */
|
|
35
|
+
onRefuse?: (refusal: KanbanRefusal) => void;
|
|
36
|
+
/** Shown in a lane with no cards. */
|
|
37
|
+
emptyLane?: ReactNode;
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
export declare function KanbanBoard<T>({ label, lanes, getItemId, itemLabel, renderItem, renderDragging, onMove, onRefuse, emptyLane, className, ...callbacks }: KanbanBoardProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare const kanban: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
refusing: {
|
|
3
|
+
true: {
|
|
4
|
+
lane: string;
|
|
5
|
+
};
|
|
6
|
+
false: {};
|
|
7
|
+
};
|
|
8
|
+
}, {
|
|
9
|
+
root: string;
|
|
10
|
+
lane: string;
|
|
11
|
+
laneHeader: string;
|
|
12
|
+
laneLabel: string;
|
|
13
|
+
laneHint: string;
|
|
14
|
+
laneItems: string;
|
|
15
|
+
laneEmpty: string;
|
|
16
|
+
laneRefusal: string;
|
|
17
|
+
}, undefined, {
|
|
18
|
+
refusing: {
|
|
19
|
+
true: {
|
|
20
|
+
lane: string;
|
|
21
|
+
};
|
|
22
|
+
false: {};
|
|
23
|
+
};
|
|
24
|
+
}, {
|
|
25
|
+
root: string;
|
|
26
|
+
lane: string;
|
|
27
|
+
laneHeader: string;
|
|
28
|
+
laneLabel: string;
|
|
29
|
+
laneHint: string;
|
|
30
|
+
laneItems: string;
|
|
31
|
+
laneEmpty: string;
|
|
32
|
+
laneRefusal: string;
|
|
33
|
+
}, import("tailwind-variants").TVReturnTypeLike<{
|
|
34
|
+
refusing: {
|
|
35
|
+
true: {
|
|
36
|
+
lane: string;
|
|
37
|
+
};
|
|
38
|
+
false: {};
|
|
39
|
+
};
|
|
40
|
+
}, {
|
|
41
|
+
root: string;
|
|
42
|
+
lane: string;
|
|
43
|
+
laneHeader: string;
|
|
44
|
+
laneLabel: string;
|
|
45
|
+
laneHint: string;
|
|
46
|
+
laneItems: string;
|
|
47
|
+
laneEmpty: string;
|
|
48
|
+
laneRefusal: string;
|
|
49
|
+
}>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { DragEndEvent } from "../../lib/dnd";
|
|
2
|
+
import type { KanbanLane, KanbanMove, KanbanRefusal } from "./types";
|
|
3
|
+
export type KanbanDrop =
|
|
4
|
+
/** Nothing happened: the card was put back where it came from. */
|
|
5
|
+
{
|
|
6
|
+
kind: "none";
|
|
7
|
+
} | {
|
|
8
|
+
kind: "refused";
|
|
9
|
+
refusal: KanbanRefusal;
|
|
10
|
+
} | {
|
|
11
|
+
kind: "move";
|
|
12
|
+
move: KanbanMove;
|
|
13
|
+
};
|
|
14
|
+
export declare function resolveKanbanDrop<T>(lanes: readonly KanbanLane<T>[], event: DragEndEvent): KanbanDrop;
|
|
15
|
+
export interface KanbanDropHandlers {
|
|
16
|
+
onMove: (move: KanbanMove) => void;
|
|
17
|
+
onRefuse?: (refusal: KanbanRefusal) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolve a drop and hand it to exactly one of the two callbacks.
|
|
21
|
+
*
|
|
22
|
+
* The dispatch is here rather than inline in the component because it is the
|
|
23
|
+
* other half of the same decision, and the half a resolver test cannot see: a
|
|
24
|
+
* board that resolved "refused" correctly and then called `onMove` anyway would
|
|
25
|
+
* keep every test in `resolveKanbanDrop` green while writing the move the
|
|
26
|
+
* refusal was supposed to stop. Found by mutation — the inline version was the
|
|
27
|
+
* one thing in this component nothing failed on.
|
|
28
|
+
*
|
|
29
|
+
* EXACTLY ONE, OR NEITHER. Never both.
|
|
30
|
+
*/
|
|
31
|
+
export declare function handleKanbanDrop<T>(lanes: readonly KanbanLane<T>[], event: DragEndEvent, handlers: KanbanDropHandlers): KanbanDrop;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface KanbanLane<T> {
|
|
3
|
+
id: string;
|
|
4
|
+
/** Spoken in every announcement about this lane, and shown on it. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** What the lane means. One line, under the label. */
|
|
7
|
+
hint?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Work-in-progress ceiling.
|
|
10
|
+
*
|
|
11
|
+
* ABSENT MEANS NO CEILING. Not a large number standing in for one: a lane
|
|
12
|
+
* whose limit is 99 renders "3 / 99", which asks the reader to work out that
|
|
13
|
+
* 99 was never a real ceiling. Omit the prop and the lane shows a plain
|
|
14
|
+
* count.
|
|
15
|
+
*/
|
|
16
|
+
limit?: number;
|
|
17
|
+
/** In the order they should appear. Their index is what a move reports. */
|
|
18
|
+
items: readonly T[];
|
|
19
|
+
/**
|
|
20
|
+
* Why a card may not be dropped here. Absent means the lane accepts drops.
|
|
21
|
+
*
|
|
22
|
+
* Written for the person who would have tried — "needs the case.decide
|
|
23
|
+
* permission", not "forbidden". It is shown on the lane before anyone drags,
|
|
24
|
+
* and passed back verbatim through `onRefuse`.
|
|
25
|
+
*/
|
|
26
|
+
refusal?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface KanbanMove {
|
|
29
|
+
id: string;
|
|
30
|
+
from: {
|
|
31
|
+
lane: string;
|
|
32
|
+
index: number;
|
|
33
|
+
};
|
|
34
|
+
/** `index` is the position in the destination lane WITHOUT the moved card. */
|
|
35
|
+
to: {
|
|
36
|
+
lane: string;
|
|
37
|
+
index: number;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export interface KanbanRefusal {
|
|
41
|
+
id: string;
|
|
42
|
+
lane: string;
|
|
43
|
+
/** Verbatim from the lane's `refusal`. */
|
|
44
|
+
reason: string;
|
|
45
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export { Combobox, ComboboxItem, ComboboxGroup, MultiCombobox, type ComboboxProp
|
|
|
37
37
|
export { Select, SelectItem, SelectGroup, SelectSeparator, type SelectProps, type SelectItemProps, type SelectGroupProps, } from "./components/Select";
|
|
38
38
|
export { StatusSelect, type StatusSelectProps, type StatusOption } from "./components/StatusSelect";
|
|
39
39
|
export { Card, CardHeader, CardFooter, type CardProps, type CardHeaderProps, } from "./components/Card";
|
|
40
|
+
export { RecordCard, type RecordCardProps, type RecordCardMetric, } from "./components/RecordCard";
|
|
40
41
|
export { Tabs, TabList, Tab, TabPanel, type TabsProps, type TabListProps, type TabProps, type TabPanelProps, } from "./components/Tabs";
|
|
41
42
|
export { Accordion, AccordionItem, type AccordionProps, type AccordionItemProps, } from "./components/Accordion";
|
|
42
43
|
export { Breadcrumb, Pagination, type BreadcrumbProps, type PaginationProps, type Crumb, } from "./components/Navigation";
|
|
@@ -66,6 +67,7 @@ export { toggleBold, toggleItalic, toggleCode, toggleStrike, toggleInline, setHe
|
|
|
66
67
|
export { tokenize, listLanguages, resolveLanguage, defineGrammar, registerGrammar, checkCoverage, type Token, type TokenType, type Grammar, type Rule, } from "./lib/syntax";
|
|
67
68
|
export { parseMarkdown, MarkdownNodes, sanitizeHref, type MdNode, type MdInline, type MdCodeRenderer, } from "./lib/syntax/markdown";
|
|
68
69
|
export { DragDrop, DragDropContainer, DragDropItem, DragDropHandle, DragDropOverlay, type DragDropProps, type DragDropContainerProps, type DragDropItemProps, type DragDropHandleProps, type DragDropOverlayProps, } from "./components/DragDrop";
|
|
70
|
+
export { KanbanBoard, type KanbanBoardProps, type KanbanLane, type KanbanMove, type KanbanRefusal, } from "./components/kanban/KanbanBoard";
|
|
69
71
|
export { DEFAULT_DRAG_STRINGS, DRAG_INSTRUCTIONS_ID, DragInstructions, DragLiveRegion, DragSession, DragSessionProvider, applyMove, attachAutoScroll, attachKeyboardSensor, attachPointerSensor, attachSessionWindowListeners, isNoOp, resolveTarget, sameTarget, scrollVelocity, useCreateDragSession, useDragAnnouncements, useDragSession, useDragState, useDraggable, useDropContainer, type ContainerId, type DragAxis, type DragCancelEvent, type DragEndEvent, type DragId, type DragMode, type DragPhase, type DragSessionCallbacks, type DragStartEvent, type DragState, type AutoScrollOptions, type DragAnnouncementContext, type DragAnnouncementOptions, type DragAnnouncements, type DragInstructionsProps, type DragLiveRegionProps, type DragStrings, type DropTarget, type KeyboardSensorOptions, type PointerActivation, } from "./lib/dnd";
|
|
70
72
|
export type { MessageRole, MessagePart, MessagePartType, TextPart, CodePart, ReasoningPart, ToolPart, ToolStatus, FilePart, ComponentPart, ChatFile, ChatMessage, RenderContext, PartRenderer, PartRenderers, ChatComponentRenderer, ChatComponents, } from "./components/chat/types";
|
|
71
73
|
export { Chat, ChatPopover, type ChatProps, type ChatPopoverProps, type ChatSurface, } from "./components/chat/Chat";
|