@danxbot/ui 1.0.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/LICENSE +21 -0
- package/README.md +126 -0
- package/dist/fonts/bricolage-grotesque-0.woff2 +0 -0
- package/dist/fonts/bricolage-grotesque-1.woff2 +0 -0
- package/dist/fonts/bricolage-grotesque-2.woff2 +0 -0
- package/dist/fonts/figtree-0.woff2 +0 -0
- package/dist/fonts/figtree-1.woff2 +0 -0
- package/dist/fonts/figtree-2.woff2 +0 -0
- package/dist/fonts/figtree-3.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-0.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-1.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-10.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-11.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-2.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-3.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-4.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-5.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-6.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-7.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-8.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-9.woff2 +0 -0
- package/dist/fonts.css +187 -0
- package/dist/index.js +42425 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +190 -0
- package/dist/types/components/Accordion.d.ts +15 -0
- package/dist/types/components/AppShell.d.ts +58 -0
- package/dist/types/components/Avatar.d.ts +154 -0
- package/dist/types/components/Badge.d.ts +73 -0
- package/dist/types/components/Button.d.ts +103 -0
- package/dist/types/components/Card.d.ts +193 -0
- package/dist/types/components/Choice.d.ts +112 -0
- package/dist/types/components/CodeEditor.d.ts +86 -0
- package/dist/types/components/Combobox.d.ts +37 -0
- package/dist/types/components/CommandPalette.d.ts +33 -0
- package/dist/types/components/DatePicker.d.ts +20 -0
- package/dist/types/components/Dialog.d.ts +117 -0
- package/dist/types/components/DragDrop.d.ts +60 -0
- package/dist/types/components/ErrorBoundary.d.ts +16 -0
- package/dist/types/components/Field.d.ts +37 -0
- package/dist/types/components/FileUpload.d.ts +22 -0
- package/dist/types/components/Icon.d.ts +40 -0
- package/dist/types/components/Input.d.ts +120 -0
- package/dist/types/components/Loading.d.ts +83 -0
- package/dist/types/components/MarkdownEditor.d.ts +24 -0
- package/dist/types/components/Menu.d.ts +57 -0
- package/dist/types/components/Navigation.d.ts +46 -0
- package/dist/types/components/NumberInput.d.ts +88 -0
- package/dist/types/components/OTPInput.d.ts +11 -0
- package/dist/types/components/Panel.d.ts +94 -0
- package/dist/types/components/Popover.d.ts +64 -0
- package/dist/types/components/Progress.d.ts +178 -0
- package/dist/types/components/Select.d.ts +53 -0
- package/dist/types/components/Slider.d.ts +203 -0
- package/dist/types/components/Spinner.d.ts +29 -0
- package/dist/types/components/Stat.d.ts +98 -0
- package/dist/types/components/StatusSelect.d.ts +23 -0
- package/dist/types/components/Surface.d.ts +110 -0
- package/dist/types/components/Table.d.ts +46 -0
- package/dist/types/components/Tabs.d.ts +84 -0
- package/dist/types/components/ThemeMenu.d.ts +4 -0
- package/dist/types/components/Toast.d.ts +46 -0
- package/dist/types/components/Toggle.d.ts +65 -0
- package/dist/types/components/Tree.d.ts +20 -0
- package/dist/types/components/calendar/CalendarMonth.d.ts +33 -0
- package/dist/types/components/calendar/CalendarTimeGrid.d.ts +75 -0
- package/dist/types/components/calendar/EventActions.d.ts +17 -0
- package/dist/types/components/calendar/format.d.ts +43 -0
- package/dist/types/components/calendar/index.d.ts +9 -0
- package/dist/types/components/calendar/palette.d.ts +17 -0
- package/dist/types/components/calendar/use-calendar-drag.d.ts +54 -0
- package/dist/types/components/calendar/use-event-keyboard.d.ts +24 -0
- package/dist/types/components/calendar/use-grid-navigation.d.ts +47 -0
- package/dist/types/components/calendar/use-now.d.ts +20 -0
- package/dist/types/components/chat/Attachment.d.ts +49 -0
- package/dist/types/components/chat/Chat.d.ts +60 -0
- package/dist/types/components/chat/Composer.d.ts +29 -0
- package/dist/types/components/chat/ContextMeter.d.ts +55 -0
- package/dist/types/components/chat/EffortControl.d.ts +23 -0
- package/dist/types/components/chat/Markdown.d.ts +22 -0
- package/dist/types/components/chat/Message.d.ts +59 -0
- package/dist/types/components/chat/MessageScroller.d.ts +13 -0
- package/dist/types/components/chat/ModelSelector.d.ts +44 -0
- package/dist/types/components/chat/types.d.ts +155 -0
- package/dist/types/components/code-editor/context.d.ts +32 -0
- package/dist/types/components/code-editor/editing.d.ts +39 -0
- package/dist/types/components/code-editor/highlight.d.ts +20 -0
- package/dist/types/components/code-editor/recipe.d.ts +109 -0
- package/dist/types/components/code-editor/state.d.ts +14 -0
- package/dist/types/components/drag-drop/context.d.ts +45 -0
- package/dist/types/components/drag-drop/recipe.d.ts +121 -0
- package/dist/types/components/drag-drop/shift.d.ts +66 -0
- package/dist/types/components/markdown/Affordances.d.ts +76 -0
- package/dist/types/components/rbac/AccountMenu.d.ts +8 -0
- package/dist/types/components/rbac/DevToolsPopover.d.ts +5 -0
- package/dist/types/components/rbac/ProfilePage.d.ts +1 -0
- package/dist/types/components/rbac/RBACProvider.d.ts +64 -0
- package/dist/types/components/rbac/RolePermissionMatrix.d.ts +6 -0
- package/dist/types/components/rbac/RolesPermissionsPage.d.ts +1 -0
- package/dist/types/components/rbac/index.d.ts +7 -0
- package/dist/types/components/rbac/types.d.ts +26 -0
- package/dist/types/components/roadmap/PhaseManager.d.ts +19 -0
- package/dist/types/components/roadmap/RoadmapItemCard.d.ts +45 -0
- package/dist/types/components/roadmap/RoadmapPage.d.ts +9 -0
- package/dist/types/components/roadmap/RoadmapSwimlaneBoard.d.ts +9 -0
- package/dist/types/components/roadmap/UseCaseCard.d.ts +14 -0
- package/dist/types/components/roadmap/UseCaseLedgerPage.d.ts +21 -0
- package/dist/types/components/roadmap/chip-tones.d.ts +2 -0
- package/dist/types/components/roadmap/derive.d.ts +12 -0
- package/dist/types/components/roadmap/index.d.ts +9 -0
- package/dist/types/components/roadmap/types.d.ts +54 -0
- package/dist/types/icons/data.d.ts +1318 -0
- package/dist/types/index.d.ts +97 -0
- package/dist/types/lib/calendar/band-packer.d.ts +53 -0
- package/dist/types/lib/calendar/drag.d.ts +125 -0
- package/dist/types/lib/calendar/index.d.ts +4 -0
- package/dist/types/lib/calendar/lane-packer.d.ts +88 -0
- package/dist/types/lib/calendar/segments.d.ts +91 -0
- package/dist/types/lib/calendar/types.d.ts +166 -0
- package/dist/types/lib/cn.d.ts +7 -0
- package/dist/types/lib/dnd/announce.d.ts +132 -0
- package/dist/types/lib/dnd/autoscroll.d.ts +88 -0
- package/dist/types/lib/dnd/geometry.d.ts +78 -0
- package/dist/types/lib/dnd/index.d.ts +16 -0
- package/dist/types/lib/dnd/sensors/gesture.d.ts +37 -0
- package/dist/types/lib/dnd/sensors/keyboard.d.ts +50 -0
- package/dist/types/lib/dnd/sensors/pointer.d.ts +59 -0
- package/dist/types/lib/dnd/session.d.ts +99 -0
- package/dist/types/lib/dnd/types.d.ts +162 -0
- package/dist/types/lib/dnd/use-drag.d.ts +56 -0
- package/dist/types/lib/icons.d.ts +40 -0
- package/dist/types/lib/markdown/caret-map.d.ts +48 -0
- package/dist/types/lib/markdown/caret.d.ts +6 -0
- package/dist/types/lib/markdown/commands.d.ts +170 -0
- package/dist/types/lib/markdown/convert.d.ts +82 -0
- package/dist/types/lib/markdown/dom.d.ts +67 -0
- package/dist/types/lib/markdown/edit.d.ts +16 -0
- package/dist/types/lib/markdown/history.d.ts +47 -0
- package/dist/types/lib/markdown/hotkeys.d.ts +39 -0
- package/dist/types/lib/markdown/input.d.ts +15 -0
- package/dist/types/lib/markdown/keys.d.ts +34 -0
- package/dist/types/lib/markdown/paste.d.ts +9 -0
- package/dist/types/lib/markdown/position.d.ts +43 -0
- package/dist/types/lib/markdown/project.d.ts +88 -0
- package/dist/types/lib/markdown/reconcile.d.ts +63 -0
- package/dist/types/lib/markdown/surface.d.ts +177 -0
- package/dist/types/lib/persist.d.ts +40 -0
- package/dist/types/lib/preferences.d.ts +80 -0
- package/dist/types/lib/sim/createSimStore.d.ts +18 -0
- package/dist/types/lib/sim/index.d.ts +5 -0
- package/dist/types/lib/sim/latency.d.ts +10 -0
- package/dist/types/lib/sim/registry.d.ts +14 -0
- package/dist/types/lib/sim/settings.d.ts +11 -0
- package/dist/types/lib/sim/types.d.ts +3 -0
- package/dist/types/lib/syntax/index.d.ts +16 -0
- package/dist/types/lib/syntax/languages/bash.d.ts +1 -0
- package/dist/types/lib/syntax/languages/css.d.ts +1 -0
- package/dist/types/lib/syntax/languages/html.d.ts +17 -0
- package/dist/types/lib/syntax/languages/index.d.ts +33 -0
- package/dist/types/lib/syntax/languages/javascript.d.ts +22 -0
- package/dist/types/lib/syntax/languages/json.d.ts +1 -0
- package/dist/types/lib/syntax/languages/mongodb.d.ts +1 -0
- package/dist/types/lib/syntax/languages/plain.d.ts +9 -0
- package/dist/types/lib/syntax/languages/sql.d.ts +4 -0
- package/dist/types/lib/syntax/languages/vue.d.ts +1 -0
- package/dist/types/lib/syntax/languages/yaml.d.ts +1 -0
- package/dist/types/lib/syntax/markdown/frames.d.ts +145 -0
- package/dist/types/lib/syntax/markdown/grammar.d.ts +1 -0
- package/dist/types/lib/syntax/markdown/index.d.ts +4 -0
- package/dist/types/lib/syntax/markdown/inline.d.ts +21 -0
- package/dist/types/lib/syntax/markdown/parse.d.ts +11 -0
- package/dist/types/lib/syntax/markdown/render.d.ts +19 -0
- package/dist/types/lib/syntax/markdown/spans.d.ts +84 -0
- package/dist/types/lib/syntax/markdown/types.d.ts +108 -0
- package/dist/types/lib/syntax/registry.d.ts +37 -0
- package/dist/types/lib/syntax/tokenize.d.ts +17 -0
- package/dist/types/lib/syntax/types.d.ts +119 -0
- package/dist/types/lib/time/index.d.ts +3 -0
- package/dist/types/lib/time/plain.d.ts +61 -0
- package/dist/types/lib/time/types.d.ts +87 -0
- package/dist/types/lib/time/zone.d.ts +97 -0
- package/dist/types/lib/use-media-query.d.ts +29 -0
- package/package.json +130 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Ref } from "react";
|
|
2
|
+
import { Toggle as BaseToggle } from "@base-ui/react/toggle";
|
|
3
|
+
import { ToggleGroup as BaseToggleGroup } from "@base-ui/react/toggle-group";
|
|
4
|
+
import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
|
|
5
|
+
import { type VariantProps } from "tailwind-variants";
|
|
6
|
+
declare const toggle: import("tailwind-variants").TVReturnType<{
|
|
7
|
+
size: {
|
|
8
|
+
sm: "h-control-sm px-2.5 text-xs";
|
|
9
|
+
md: "h-control-md px-3 text-sm";
|
|
10
|
+
lg: "h-control-lg px-4 text-md";
|
|
11
|
+
};
|
|
12
|
+
iconOnly: {
|
|
13
|
+
true: "px-0 aspect-square";
|
|
14
|
+
false: "";
|
|
15
|
+
};
|
|
16
|
+
}, undefined, string[], {
|
|
17
|
+
size: {
|
|
18
|
+
sm: "h-control-sm px-2.5 text-xs";
|
|
19
|
+
md: "h-control-md px-3 text-sm";
|
|
20
|
+
lg: "h-control-lg px-4 text-md";
|
|
21
|
+
};
|
|
22
|
+
iconOnly: {
|
|
23
|
+
true: "px-0 aspect-square";
|
|
24
|
+
false: "";
|
|
25
|
+
};
|
|
26
|
+
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
27
|
+
size: {
|
|
28
|
+
sm: "h-control-sm px-2.5 text-xs";
|
|
29
|
+
md: "h-control-md px-3 text-sm";
|
|
30
|
+
lg: "h-control-lg px-4 text-md";
|
|
31
|
+
};
|
|
32
|
+
iconOnly: {
|
|
33
|
+
true: "px-0 aspect-square";
|
|
34
|
+
false: "";
|
|
35
|
+
};
|
|
36
|
+
}, undefined>>;
|
|
37
|
+
export interface ToggleProps extends Omit<BaseToggle.Props, "className" | "render">, VariantProps<typeof toggle> {
|
|
38
|
+
className?: string;
|
|
39
|
+
ref?: Ref<HTMLButtonElement>;
|
|
40
|
+
}
|
|
41
|
+
export declare function Toggle({ size, iconOnly, className, children, ref, ...props }: ToggleProps): import("react").JSX.Element;
|
|
42
|
+
export interface ToggleGroupProps extends Omit<BaseToggleGroup.Props, "className" | "render"> {
|
|
43
|
+
className?: string;
|
|
44
|
+
/** Segmented gives the group a shared inset background. */
|
|
45
|
+
variant?: "plain" | "segmented";
|
|
46
|
+
ref?: Ref<HTMLDivElement>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A set of related toggles.
|
|
50
|
+
*
|
|
51
|
+
* `multiple` decides the meaning: false makes it a single choice (list
|
|
52
|
+
* view OR grid view), true makes it independent formats (bold AND italic).
|
|
53
|
+
* There is no separate "type" prop, because the multiplicity IS the type.
|
|
54
|
+
*/
|
|
55
|
+
export declare function ToggleGroup({ className, variant, children, ref, ...props }: ToggleGroupProps): import("react").JSX.Element;
|
|
56
|
+
export interface ToolbarProps extends Omit<BaseToolbar.Root.Props, "className" | "render"> {
|
|
57
|
+
className?: string;
|
|
58
|
+
ref?: Ref<HTMLDivElement>;
|
|
59
|
+
}
|
|
60
|
+
export declare function Toolbar({ className, children, ref, ...props }: ToolbarProps): import("react").JSX.Element;
|
|
61
|
+
/** A hairline between groups of toolbar controls. */
|
|
62
|
+
export declare function ToolbarSeparator({ className }: {
|
|
63
|
+
className?: string;
|
|
64
|
+
}): import("react").JSX.Element;
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type IconName } from "./Icon";
|
|
3
|
+
export type TreeNode = {
|
|
4
|
+
id: string;
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
icon?: IconName;
|
|
7
|
+
/** Trailing content — a count, a status dot, a menu. */
|
|
8
|
+
meta?: ReactNode;
|
|
9
|
+
children?: TreeNode[];
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export interface TreeProps {
|
|
13
|
+
nodes: TreeNode[];
|
|
14
|
+
/** Ids expanded on first render. */
|
|
15
|
+
defaultExpanded?: string[];
|
|
16
|
+
selectedId?: string;
|
|
17
|
+
onSelect?: (node: TreeNode) => void;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function Tree({ nodes, defaultExpanded, selectedId, onSelect, className }: TreeProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { addDays, startOfMonth, type PlainDate, type TimeZone } from "@/lib/time";
|
|
3
|
+
import type { CalendarEvent } from "@/lib/calendar/types";
|
|
4
|
+
export interface CalendarMonthProps {
|
|
5
|
+
/** Any day in the month to display. */
|
|
6
|
+
month: PlainDate;
|
|
7
|
+
/** The zone every timed event is interpreted in. Required — there is no default. */
|
|
8
|
+
zone: TimeZone;
|
|
9
|
+
events: readonly CalendarEvent[];
|
|
10
|
+
/** 0 = Sunday. No default anywhere up the stack — see `startOfWeek`. */
|
|
11
|
+
weekStartsOn?: number;
|
|
12
|
+
/** Today, for the highlight. Omit in tests so snapshots do not rot. */
|
|
13
|
+
today?: PlainDate;
|
|
14
|
+
selectedDate?: PlainDate;
|
|
15
|
+
onSelectDate?: (day: PlainDate) => void;
|
|
16
|
+
onSelectEvent?: (event: CalendarEvent) => void;
|
|
17
|
+
/** Fired when navigation or paging leaves the displayed month. */
|
|
18
|
+
onMonthChange?: (month: PlainDate) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Most bar rows a cell may show, INCLUDING the row the "+N more" link takes.
|
|
21
|
+
* See `packBand`; the affordance is counted so it cannot be drawn over an event.
|
|
22
|
+
*/
|
|
23
|
+
maxEventRows?: number;
|
|
24
|
+
locale?: string;
|
|
25
|
+
/** Replace a chip's contents. The chip itself — button, label, colour — stays ours. */
|
|
26
|
+
renderEvent?: (event: CalendarEvent) => ReactNode;
|
|
27
|
+
className?: string;
|
|
28
|
+
/** Accessible name for the grid. */
|
|
29
|
+
label?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function CalendarMonth({ month: monthProp, zone, events, weekStartsOn, today, selectedDate, onSelectDate, onSelectEvent, onMonthChange, maxEventRows, locale, renderEvent, className, label, }: CalendarMonthProps): import("react").JSX.Element;
|
|
32
|
+
/** The first day of the month `date` falls in — re-exported for consumers paging. */
|
|
33
|
+
export { startOfMonth, addDays };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type PlainDate, type TimeZone } from "@/lib/time";
|
|
3
|
+
import type { CalendarEvent } from "@/lib/calendar/types";
|
|
4
|
+
import type { Instant } from "@/lib/time";
|
|
5
|
+
export interface CalendarTimeGridProps {
|
|
6
|
+
/** The days to show. One for Day view, seven for Week. */
|
|
7
|
+
days: readonly PlainDate[];
|
|
8
|
+
zone: TimeZone;
|
|
9
|
+
events: readonly CalendarEvent[];
|
|
10
|
+
today?: PlainDate;
|
|
11
|
+
onSelectEvent?: (event: CalendarEvent) => void;
|
|
12
|
+
/** Minutes per rail. 60 by default — see `snapMinutes` for why they differ. */
|
|
13
|
+
slotMinutes?: number;
|
|
14
|
+
/** Pixel height of one rail. The column's total height is derived from it. */
|
|
15
|
+
slotHeightPx?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Hour the grid scrolls to on load. 8 by default.
|
|
18
|
+
*
|
|
19
|
+
* Applied on the RANGE's identity, not on every render. react-big-calendar
|
|
20
|
+
* re-runs its scroll effect on render, so selecting an event snaps the user
|
|
21
|
+
* back to 8am — an open issue, and a genuinely maddening one.
|
|
22
|
+
*/
|
|
23
|
+
scrollToHour?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Rows the all-day band may show before it scrolls internally.
|
|
26
|
+
*
|
|
27
|
+
* REQUIRED TO BE FINITE. An uncapped band eats the container and makes the
|
|
28
|
+
* time grid unreachable — an open FullCalendar bug, and react-big-calendar's
|
|
29
|
+
* default is literally `Infinity`.
|
|
30
|
+
*/
|
|
31
|
+
maxAllDayRows?: number;
|
|
32
|
+
/** Most lanes a batch of overlapping events may divide into. */
|
|
33
|
+
maxLanes?: number;
|
|
34
|
+
/** `cascade` is the Google look and the default. */
|
|
35
|
+
overlapMode?: "cascade" | "split";
|
|
36
|
+
/** Fix the now-indicator for a screenshot. */
|
|
37
|
+
nowInstant?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Minutes a drag snaps to. DELIBERATELY INDEPENDENT of `slotMinutes`.
|
|
40
|
+
*
|
|
41
|
+
* FullCalendar, react-big-calendar and Schedule-X all couple snap to the rail
|
|
42
|
+
* spacing; Google and Mobiscroll do not, and Google is 15-minute snap on
|
|
43
|
+
* 60-minute rails — the combination that feels right. Retrofitting the split
|
|
44
|
+
* is a rewrite, so the two are separate values.
|
|
45
|
+
*/
|
|
46
|
+
snapMinutes?: number;
|
|
47
|
+
/** Commit a move or a resize. Omit to make the grid read-only. */
|
|
48
|
+
onEventChange?: (event: CalendarEvent, next: CalendarEvent) => void;
|
|
49
|
+
/** Commit a drag-to-create. Omit to disable creating. */
|
|
50
|
+
onCreate?: (range: {
|
|
51
|
+
start: Instant;
|
|
52
|
+
endExclusive: Instant;
|
|
53
|
+
}) => void;
|
|
54
|
+
/** Announcements for the live region. The grid renders its own if omitted. */
|
|
55
|
+
onAnnounce?: (message: string) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Whether clicking an editable event opens the move/resize action menu.
|
|
58
|
+
*
|
|
59
|
+
* ON BY DEFAULT WHEN THE GRID IS EDITABLE, AND TURNING IT OFF FAILS WCAG 2.2
|
|
60
|
+
* SC 2.5.7 unless you provide an equivalent. That criterion asks for a
|
|
61
|
+
* single-pointer, NON-DRAGGING route to every outcome a drag can produce, and
|
|
62
|
+
* it is assessed independently of keyboard access — a keyboard equivalent does
|
|
63
|
+
* not satisfy it. This menu is that route. See `EventActions` for why the
|
|
64
|
+
* pointer path is tier one and the keyboard is not.
|
|
65
|
+
*
|
|
66
|
+
* Set false ONLY when your `onSelectEvent` opens something that offers the
|
|
67
|
+
* same three outcomes: a new day, a new start, a new length.
|
|
68
|
+
*/
|
|
69
|
+
eventActions?: boolean;
|
|
70
|
+
locale?: string;
|
|
71
|
+
renderEvent?: (event: CalendarEvent) => ReactNode;
|
|
72
|
+
className?: string;
|
|
73
|
+
label?: string;
|
|
74
|
+
}
|
|
75
|
+
export declare function CalendarTimeGrid({ days, zone, events, today, onSelectEvent, slotMinutes, slotHeightPx, scrollToHour, maxAllDayRows, maxLanes, overlapMode, nowInstant, snapMinutes, onEventChange, onCreate, onAnnounce, eventActions, locale, renderEvent, className, label, }: CalendarTimeGridProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type PlainDate, type TimeZone } from "@/lib/time";
|
|
2
|
+
import type { TimedEvent } from "@/lib/calendar/types";
|
|
3
|
+
export interface EventActionsProps {
|
|
4
|
+
event: TimedEvent;
|
|
5
|
+
zone: TimeZone;
|
|
6
|
+
/** The days the view is showing — the destinations "Move to" offers. */
|
|
7
|
+
days: readonly PlainDate[];
|
|
8
|
+
/** Same step the drag snaps to, so the two paths reach the same positions. */
|
|
9
|
+
snapMinutes?: number;
|
|
10
|
+
/** Longest duration offered, in minutes. */
|
|
11
|
+
maxDurationMinutes?: number;
|
|
12
|
+
onApply: (next: TimedEvent) => void;
|
|
13
|
+
onClose?: () => void;
|
|
14
|
+
locale?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function EventActions({ event, zone, days, snapMinutes, maxDurationMinutes, onApply, onClose, locale, className, }: EventActionsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { isoDateString, type Instant, type PlainDate, type TimeZone } from "@/lib/time";
|
|
2
|
+
import type { CalendarEvent } from "@/lib/calendar/types";
|
|
3
|
+
/** `Monday` / `Mon` / `M`, in the viewer's locale. */
|
|
4
|
+
export declare function weekdayName(date: PlainDate, width: "long" | "short" | "narrow", locale?: string): string;
|
|
5
|
+
/** `15` — the number in the cell. */
|
|
6
|
+
export declare function dayNumber(date: PlainDate, locale?: string): string;
|
|
7
|
+
/** `June 2026` — the view's title. */
|
|
8
|
+
export declare function monthTitle(date: PlainDate, locale?: string): string;
|
|
9
|
+
/** `Monday, 15 June 2026` — a cell's accessible name starts with this. */
|
|
10
|
+
export declare function longDate(date: PlainDate, locale?: string): string;
|
|
11
|
+
/** `9:30 AM` in the calendar's zone — never the host's. */
|
|
12
|
+
export declare function timeOfDay(instant: Instant, zone: TimeZone, locale?: string, withMinutes?: boolean): string;
|
|
13
|
+
/** `GMT−6` — the label above the hour gutter. */
|
|
14
|
+
export declare function zoneLabel(zone: TimeZone, at: Instant, locale?: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* The human range of an event: `15–17 June`, `9:30 – 10:30 AM`, `All day`.
|
|
17
|
+
*
|
|
18
|
+
* THE ONLY PLACE THE EXCLUSIVE END BECOMES AN INCLUSIVE ONE. An all-day event
|
|
19
|
+
* stored 15th → 16th is ONE day and reads "15 June"; stored 15th → 18th it
|
|
20
|
+
* reads "15 – 17 June". Getting this wrong in the other direction is the
|
|
21
|
+
* most-reported bug in calendar interoperability, so it happens once, here,
|
|
22
|
+
* where a test can point at it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatDateRange(event: CalendarEvent, zone: TimeZone, locale?: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* A cell's accessible name: `Monday, 15 June 2026, 3 events`.
|
|
27
|
+
*
|
|
28
|
+
* THE COUNT IS PART OF THE NAME, and that is the difference between a grid a
|
|
29
|
+
* screen-reader user can skim and one they must enter cell by cell to discover
|
|
30
|
+
* is empty. Arrowing across a month hearing "14. 15. 16." tells them nothing
|
|
31
|
+
* about where the work is.
|
|
32
|
+
*/
|
|
33
|
+
export declare function cellLabel(date: PlainDate, eventCount: number, locale?: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* An event chip's accessible name.
|
|
36
|
+
*
|
|
37
|
+
* Title, then the range, then the calendar's colour LABEL — the last so that
|
|
38
|
+
* two identically-titled events on different calendars are distinguishable
|
|
39
|
+
* without seeing the colour.
|
|
40
|
+
*/
|
|
41
|
+
export declare function eventLabel(event: CalendarEvent, zone: TimeZone, paletteLabel: string | undefined, locale?: string): string;
|
|
42
|
+
/** Stable React key for a day. */
|
|
43
|
+
export declare const keyForDay: typeof isoDateString;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { CalendarMonth, type CalendarMonthProps } from "./CalendarMonth";
|
|
2
|
+
export { CalendarTimeGrid, type CalendarTimeGridProps } from "./CalendarTimeGrid";
|
|
3
|
+
export { useNow, type UseNowOptions } from "./use-now";
|
|
4
|
+
export { EventActions, type EventActionsProps } from "./EventActions";
|
|
5
|
+
export { useCalendarDrag, type CalendarDragOptions, type CalendarDragState, } from "./use-calendar-drag";
|
|
6
|
+
export { useEventKeyboard, type EventKeyboardOptions, type EventKeyboardState, } from "./use-event-keyboard";
|
|
7
|
+
export { EVENT_PALETTE, DEFAULT_PALETTE_KEY, isPaletteKey, paletteFor } from "./palette";
|
|
8
|
+
export { cellLabel, dayNumber, eventLabel, formatDateRange, longDate, monthTitle, timeOfDay, weekdayName, zoneLabel, } from "./format";
|
|
9
|
+
export { initialFocusDay, isInMonth, nextDayForKey, useGridNavigation, type GridNavigation, type GridNavigationOptions, } from "./use-grid-navigation";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EventPalette, PaletteEntry } from "@/lib/calendar/types";
|
|
2
|
+
export declare const EVENT_PALETTE: EventPalette;
|
|
3
|
+
export declare const DEFAULT_PALETTE_KEY = "iris";
|
|
4
|
+
/**
|
|
5
|
+
* The swatch for a key, falling back to the default for an unknown one.
|
|
6
|
+
*
|
|
7
|
+
* A FALLBACK RATHER THAN A THROW, deliberately, and this is the one place in
|
|
8
|
+
* the calendar where that is the right call. Event data arrives from a server
|
|
9
|
+
* and an unrecognised colour key is a data problem, not a programming error —
|
|
10
|
+
* refusing to render the whole month because one event has a stale key would
|
|
11
|
+
* turn a cosmetic mismatch into an outage. The event still renders, still
|
|
12
|
+
* carries its title and time, and is still reachable; only its colour is
|
|
13
|
+
* generic.
|
|
14
|
+
*/
|
|
15
|
+
export declare function paletteFor(key: string | undefined): PaletteEntry;
|
|
16
|
+
/** Whether a key names a real swatch — for a consumer validating its own data. */
|
|
17
|
+
export declare function isPaletteKey(key: string): boolean;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type ColumnRect } from "@/lib/calendar/drag";
|
|
2
|
+
import type { CalendarEvent, DragKind, EventDraft, TimedEvent } from "@/lib/calendar/types";
|
|
3
|
+
import type { Instant, PlainDate, TimeZone } from "@/lib/time";
|
|
4
|
+
export interface CalendarDragOptions {
|
|
5
|
+
readonly zone: TimeZone;
|
|
6
|
+
readonly days: readonly PlainDate[];
|
|
7
|
+
readonly snapMinutes: number;
|
|
8
|
+
/** Measure the day columns. Called at activation and on every scroll. */
|
|
9
|
+
readonly measure: () => ColumnRect[];
|
|
10
|
+
/** Commit. Not called for a gesture that changed nothing. */
|
|
11
|
+
readonly onCommit?: (event: CalendarEvent, next: TimedEvent) => void;
|
|
12
|
+
/** Commit a drag-to-create. */
|
|
13
|
+
readonly onCreate?: (range: {
|
|
14
|
+
start: Instant;
|
|
15
|
+
endExclusive: Instant;
|
|
16
|
+
day: PlainDate;
|
|
17
|
+
}) => void;
|
|
18
|
+
/** Fired on every committed slot change, for the live region. */
|
|
19
|
+
readonly onAnnounce?: (message: string) => void;
|
|
20
|
+
readonly locale?: string;
|
|
21
|
+
readonly disabled?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface CalendarDragState {
|
|
24
|
+
/** The gesture in flight, or null. */
|
|
25
|
+
readonly draft: EventDraft | null;
|
|
26
|
+
/** The rubber-band range while creating, or null. */
|
|
27
|
+
readonly creating: {
|
|
28
|
+
start: Instant;
|
|
29
|
+
endExclusive: Instant;
|
|
30
|
+
day: PlainDate;
|
|
31
|
+
} | null;
|
|
32
|
+
/** True while a resize would be refused — the view dims the preview. */
|
|
33
|
+
readonly invalid: boolean;
|
|
34
|
+
/** Wire an event chip. `kind` decides which edge, if any, is being moved. */
|
|
35
|
+
readonly bindEvent: (event: TimedEvent, kind: DragKind) => (node: HTMLElement | null) => void;
|
|
36
|
+
/** Wire the empty area of a day column, for drag-to-create. */
|
|
37
|
+
readonly bindCanvas: () => (node: HTMLElement | null) => void;
|
|
38
|
+
/** The event as it would be if dropped now — for the live preview. */
|
|
39
|
+
readonly preview: (event: TimedEvent) => TimedEvent;
|
|
40
|
+
/**
|
|
41
|
+
* The two questions the edge auto-scroll loop asks. Passed straight to
|
|
42
|
+
* `attachEdgeAutoScroll` — see its `AutoScrollDriver` for why re-feeding the
|
|
43
|
+
* point on scroll is the whole reason the second one exists.
|
|
44
|
+
*/
|
|
45
|
+
readonly getPoint: () => {
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
} | null;
|
|
49
|
+
readonly onScrolled: (point: {
|
|
50
|
+
x: number;
|
|
51
|
+
y: number;
|
|
52
|
+
}) => void;
|
|
53
|
+
}
|
|
54
|
+
export declare function useCalendarDrag(options: CalendarDragOptions): CalendarDragState;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type KeyboardEvent } from "react";
|
|
2
|
+
import { type CalendarDuration, type PlainDate, type TimeZone } from "@/lib/time";
|
|
3
|
+
import type { TimedEvent } from "@/lib/calendar/types";
|
|
4
|
+
export interface EventKeyboardOptions {
|
|
5
|
+
readonly zone: TimeZone;
|
|
6
|
+
/** Same step the drag snaps to, so both paths reach the same positions. */
|
|
7
|
+
readonly snapMinutes: number;
|
|
8
|
+
/** Days in view, for the day-change bounds and for the announcement. */
|
|
9
|
+
readonly days: readonly PlainDate[];
|
|
10
|
+
readonly onCommit: (event: TimedEvent, next: TimedEvent) => void;
|
|
11
|
+
readonly onAnnounce?: (message: string) => void;
|
|
12
|
+
readonly locale?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface EventKeyboardState {
|
|
15
|
+
/** The event currently held, or null. */
|
|
16
|
+
readonly grabbedId: string | null;
|
|
17
|
+
/** The pending delta while held. */
|
|
18
|
+
readonly delta: CalendarDuration;
|
|
19
|
+
/** Attach to an event chip. */
|
|
20
|
+
readonly onKeyDown: (event: TimedEvent, e: KeyboardEvent<HTMLElement>) => void;
|
|
21
|
+
/** The event as it would be if dropped now. */
|
|
22
|
+
readonly preview: (event: TimedEvent) => TimedEvent;
|
|
23
|
+
}
|
|
24
|
+
export declare function useEventKeyboard(options: EventKeyboardOptions): EventKeyboardState;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type KeyboardEvent } from "react";
|
|
2
|
+
import { comparePlainDate, type PlainDate } from "@/lib/time";
|
|
3
|
+
export interface GridNavigationOptions {
|
|
4
|
+
/** Any day in the displayed month. Used to clamp paging. */
|
|
5
|
+
readonly month: PlainDate;
|
|
6
|
+
readonly weekStartsOn: number;
|
|
7
|
+
/** Called when navigation lands outside the displayed month. */
|
|
8
|
+
readonly onMonthChange?: (month: PlainDate) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface GridNavigation {
|
|
11
|
+
/** The day that currently holds `tabIndex={0}`. Exactly one, always. */
|
|
12
|
+
readonly focusedDay: PlainDate;
|
|
13
|
+
readonly setFocusedDay: (day: PlainDate) => void;
|
|
14
|
+
/** True while the user is INSIDE a cell, interacting with its events. */
|
|
15
|
+
readonly insideCell: boolean;
|
|
16
|
+
readonly enterCell: () => void;
|
|
17
|
+
readonly leaveCell: () => void;
|
|
18
|
+
/** Attach to the table. Returns true when it consumed the event. */
|
|
19
|
+
readonly onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Which day a key moves to, or `null` when the key is not ours.
|
|
23
|
+
*
|
|
24
|
+
* PURE, AND EXPORTED, so the whole key map is testable without a DOM. Every
|
|
25
|
+
* binding below is APG-normative; the file header records the two it
|
|
26
|
+
* deliberately does not use.
|
|
27
|
+
*/
|
|
28
|
+
export declare function nextDayForKey(key: string, current: PlainDate, weekStartsOn: number, modifiers: {
|
|
29
|
+
ctrl: boolean;
|
|
30
|
+
shift: boolean;
|
|
31
|
+
meta: boolean;
|
|
32
|
+
}): PlainDate | null;
|
|
33
|
+
export declare function useGridNavigation(initialDay: PlainDate, options: GridNavigationOptions): GridNavigation;
|
|
34
|
+
/**
|
|
35
|
+
* The day that should carry `tabIndex={0}` when the grid has never been used.
|
|
36
|
+
*
|
|
37
|
+
* EXACTLY ONE CELL IS TABBABLE, ALWAYS — that is the roving-tabindex contract
|
|
38
|
+
* and the thing a probe should assert after every keypress. Preference order:
|
|
39
|
+
* the selected day, else today if the month contains it, else the 1st. Landing
|
|
40
|
+
* on today is what a user expects; landing on the 1st of a month they paged to
|
|
41
|
+
* is what they expect there.
|
|
42
|
+
*/
|
|
43
|
+
export declare function initialFocusDay(days: readonly PlainDate[], month: PlainDate, today: PlainDate | undefined, selected: PlainDate | undefined): PlainDate;
|
|
44
|
+
/** Whether `day` belongs to the displayed month rather than a neighbour. */
|
|
45
|
+
export declare function isInMonth(day: PlainDate, month: PlainDate): boolean;
|
|
46
|
+
/** Ordering helper for consumers rendering their own event lists. */
|
|
47
|
+
export { comparePlainDate };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface UseNowOptions {
|
|
2
|
+
/**
|
|
3
|
+
* How often the value should change, in ms. 60,000 for a minute-resolution
|
|
4
|
+
* indicator.
|
|
5
|
+
*/
|
|
6
|
+
readonly resolutionMs?: number;
|
|
7
|
+
/** Set false to freeze the value — for tests and visual baselines. */
|
|
8
|
+
readonly enabled?: boolean;
|
|
9
|
+
/** A fixed instant to report instead of the clock. Overrides `enabled`. */
|
|
10
|
+
readonly fixed?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* `Date.now()`, re-read on each boundary of `resolutionMs`.
|
|
14
|
+
*
|
|
15
|
+
* `fixed` exists because every visual baseline in this package is a screenshot:
|
|
16
|
+
* a now-indicator driven by the real clock moves a few pixels every minute and
|
|
17
|
+
* re-records itself forever, so the demo and the preview pass a fixed instant
|
|
18
|
+
* and the gate keeps gating.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useNow(options?: UseNowOptions): number;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ReactNode, type Ref } from "react";
|
|
2
|
+
import type { ChatFile } from "./types";
|
|
3
|
+
/** Binary units, because these are file sizes and every OS reports them this way. */
|
|
4
|
+
export declare function formatBytes(bytes: number): string;
|
|
5
|
+
export type AttachmentLayout = "tile" | "row";
|
|
6
|
+
export interface AttachmentProps {
|
|
7
|
+
file: ChatFile;
|
|
8
|
+
layout?: AttachmentLayout;
|
|
9
|
+
/** Overrides the size line — "Sheet 2 of 4", a page count, anything truer. */
|
|
10
|
+
meta?: ReactNode;
|
|
11
|
+
onRemove?: (file: ChatFile) => void;
|
|
12
|
+
onPreview?: (file: ChatFile) => void;
|
|
13
|
+
onDownload?: (file: ChatFile) => void;
|
|
14
|
+
/** Marks the file as the current selection in a gallery. */
|
|
15
|
+
selected?: boolean;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
ref?: Ref<HTMLDivElement>;
|
|
19
|
+
}
|
|
20
|
+
export declare function Attachment({ file, layout, meta, onRemove, onPreview, onDownload, selected, disabled, className, ref, }: AttachmentProps): import("react").JSX.Element;
|
|
21
|
+
export interface AttachmentPreviewProps {
|
|
22
|
+
file: ChatFile | null;
|
|
23
|
+
onOpenChange: (open: boolean) => void;
|
|
24
|
+
onDownload?: (file: ChatFile) => void;
|
|
25
|
+
/** Renders the body for a file this component cannot show itself. */
|
|
26
|
+
renderBody?: (file: ChatFile) => ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A file, opened.
|
|
30
|
+
*
|
|
31
|
+
* Deliberately narrow about what it displays: images, and anything the
|
|
32
|
+
* consumer hands it through `renderBody`. It does NOT attempt to preview PDFs,
|
|
33
|
+
* office documents or video by embedding them — an iframe pointed at an
|
|
34
|
+
* arbitrary attachment is a security surface, and a half-working preview is
|
|
35
|
+
* worse than an honest "open it" because people trust what they see.
|
|
36
|
+
*/
|
|
37
|
+
export declare function AttachmentPreview({ file, onOpenChange, onDownload, renderBody, }: AttachmentPreviewProps): import("react").JSX.Element;
|
|
38
|
+
export interface AttachmentListProps {
|
|
39
|
+
files: ChatFile[];
|
|
40
|
+
layout?: AttachmentLayout;
|
|
41
|
+
onRemove?: (file: ChatFile) => void;
|
|
42
|
+
onPreview?: (file: ChatFile) => void;
|
|
43
|
+
onDownload?: (file: ChatFile) => void;
|
|
44
|
+
/** Collapses to "+N more" past this count. */
|
|
45
|
+
max?: number;
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
className?: string;
|
|
48
|
+
}
|
|
49
|
+
export declare function AttachmentList({ files, layout, onRemove, onPreview, onDownload, max, disabled, className, }: AttachmentListProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ComposerProps } from "./Composer";
|
|
3
|
+
import { type MessageAction } from "./Message";
|
|
4
|
+
import { ModelSelector, type ChatModel } from "./ModelSelector";
|
|
5
|
+
import { type EffortLevel } from "./EffortControl";
|
|
6
|
+
import { type ContextSegment, type UsageLimit } from "./ContextMeter";
|
|
7
|
+
import type { ChatComponents, ChatMessage, PartRenderers } from "./types";
|
|
8
|
+
export type ChatSurface = "inline" | "sidebar" | "popover";
|
|
9
|
+
export interface ChatProps<TApp = unknown> extends Pick<ComposerProps, "value" | "onValueChange" | "onSubmit" | "files" | "onFilesAdded" | "onFileRemoved" | "busy" | "onStop" | "placeholder" | "disabled" | "error" | "accept"> {
|
|
10
|
+
messages: ChatMessage[];
|
|
11
|
+
/** Replaces a built-in part renderer. Partial — override one, keep the rest. */
|
|
12
|
+
renderers?: PartRenderers<TApp>;
|
|
13
|
+
/** Application components a message may address by name. */
|
|
14
|
+
components?: ChatComponents<TApp>;
|
|
15
|
+
/** Handed to every renderer at call time, so a module-scope registry still
|
|
16
|
+
reaches live application state. */
|
|
17
|
+
appContext?: TApp;
|
|
18
|
+
title?: ReactNode;
|
|
19
|
+
subtitle?: ReactNode;
|
|
20
|
+
/** Buttons in the header — new thread, settings, close. */
|
|
21
|
+
headerActions?: ReactNode;
|
|
22
|
+
/** Shown instead of the transcript when there are no messages. */
|
|
23
|
+
empty?: ReactNode;
|
|
24
|
+
models?: ChatModel[];
|
|
25
|
+
model?: string;
|
|
26
|
+
onModelChange?: (id: string) => void;
|
|
27
|
+
/** Switches under the model list — fast mode, thinking, and so on. */
|
|
28
|
+
modelOptions?: Parameters<typeof ModelSelector>[0]["options"];
|
|
29
|
+
effortLevels?: EffortLevel[];
|
|
30
|
+
effort?: string;
|
|
31
|
+
onEffortChange?: (id: string) => void;
|
|
32
|
+
context?: {
|
|
33
|
+
segments: ContextSegment[];
|
|
34
|
+
capacity: number;
|
|
35
|
+
limits?: UsageLimit[];
|
|
36
|
+
};
|
|
37
|
+
/** Per-message buttons. Copy is always present and is not listed here. */
|
|
38
|
+
messageActions?: MessageAction[];
|
|
39
|
+
showTimestamps?: boolean;
|
|
40
|
+
/** Status line above the composer — "Thinking…", "Running tests". */
|
|
41
|
+
status?: ReactNode;
|
|
42
|
+
hint?: ReactNode;
|
|
43
|
+
surface?: ChatSurface;
|
|
44
|
+
className?: string;
|
|
45
|
+
}
|
|
46
|
+
export declare function Chat<TApp = unknown>({ messages, renderers, components, appContext, title, subtitle, headerActions, empty, models, model, onModelChange, modelOptions, effortLevels, effort, onEffortChange, context, messageActions, showTimestamps, status, hint, surface, className, ...composer }: ChatProps<TApp>): import("react").JSX.Element;
|
|
47
|
+
export interface ChatPopoverProps<TApp = unknown> extends ChatProps<TApp> {
|
|
48
|
+
/** The control that opens it. Defaults to a floating round button. */
|
|
49
|
+
trigger?: ReactNode;
|
|
50
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
51
|
+
align?: "start" | "center" | "end";
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The same chat, anchored to a trigger.
|
|
55
|
+
*
|
|
56
|
+
* A popover rather than a fixed-position widget: anchoring is the positioning
|
|
57
|
+
* engine's job, and a hand-placed `bottom-6 right-6` panel is the version that
|
|
58
|
+
* ends up off screen on a short viewport or under a cookie banner.
|
|
59
|
+
*/
|
|
60
|
+
export declare function ChatPopover<TApp = unknown>({ trigger, side, align, ...chat }: ChatPopoverProps<TApp>): import("react").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ReactNode, type Ref } from "react";
|
|
2
|
+
import type { ChatFile } from "./types";
|
|
3
|
+
export interface ComposerProps {
|
|
4
|
+
value: string;
|
|
5
|
+
onValueChange: (value: string) => void;
|
|
6
|
+
onSubmit: (value: string, files: ChatFile[]) => void;
|
|
7
|
+
/** Staged files, shown above the text. */
|
|
8
|
+
files?: ChatFile[];
|
|
9
|
+
onFilesAdded?: (files: File[]) => void;
|
|
10
|
+
onFileRemoved?: (file: ChatFile) => void;
|
|
11
|
+
/** Streaming — the send button becomes stop. */
|
|
12
|
+
busy?: boolean;
|
|
13
|
+
onStop?: () => void;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** Blocks submit and explains why, under the field. */
|
|
17
|
+
error?: ReactNode;
|
|
18
|
+
/** Controls at the bottom-left — model, effort, context, whatever applies. */
|
|
19
|
+
toolbar?: ReactNode;
|
|
20
|
+
/** Extra buttons beside the attach button. */
|
|
21
|
+
leading?: ReactNode;
|
|
22
|
+
/** Hint at bottom-right, left of the send button. */
|
|
23
|
+
hint?: ReactNode;
|
|
24
|
+
accept?: string;
|
|
25
|
+
maxRows?: number;
|
|
26
|
+
className?: string;
|
|
27
|
+
ref?: Ref<HTMLTextAreaElement>;
|
|
28
|
+
}
|
|
29
|
+
export declare function Composer({ value, onValueChange, onSubmit, files, onFilesAdded, onFileRemoved, busy, onStop, placeholder, disabled, error, toolbar, leading, hint, accept, maxRows, className, ref, }: ComposerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface ContextSegment {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
tokens: number;
|
|
6
|
+
/** Any CSS colour. Defaults walk a fixed palette in declaration order. */
|
|
7
|
+
color?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 241_600 → "241.6k".
|
|
11
|
+
*
|
|
12
|
+
* One decimal all the way to 1M, and exact below 1k. Unlike a file size — where
|
|
13
|
+
* a tenth of a kilobyte is noise on a number nobody acts on — the tenth here is
|
|
14
|
+
* the digit that moves while you work: at 1M capacity, a whole percent is
|
|
15
|
+
* 10_000 tokens, so rounding to "242k" holds a figure still for several
|
|
16
|
+
* exchanges and makes a live meter look frozen.
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatTokens(tokens: number): string;
|
|
19
|
+
export interface UsageLimit {
|
|
20
|
+
id: string;
|
|
21
|
+
label: string;
|
|
22
|
+
/** 0–100. */
|
|
23
|
+
percent: number;
|
|
24
|
+
/** "Resets in 1 hr 46 min" — relative or absolute, whichever is clearer. */
|
|
25
|
+
resets?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ContextMeterProps {
|
|
28
|
+
segments: ContextSegment[];
|
|
29
|
+
/** Total window size in tokens. */
|
|
30
|
+
capacity: number;
|
|
31
|
+
/** Plan or rate limits, listed under the breakdown. */
|
|
32
|
+
limits?: UsageLimit[];
|
|
33
|
+
/** Fraction of capacity at which the bar turns amber, then red. */
|
|
34
|
+
warnAt?: number;
|
|
35
|
+
dangerAt?: number;
|
|
36
|
+
/** Renders the panel inline rather than behind a trigger row. */
|
|
37
|
+
inline?: boolean;
|
|
38
|
+
side?: "top" | "bottom";
|
|
39
|
+
align?: "start" | "center" | "end";
|
|
40
|
+
className?: string;
|
|
41
|
+
}
|
|
42
|
+
export declare function ContextMeter({ segments, capacity, limits, warnAt, dangerAt, inline, side, align, className, }: ContextMeterProps): import("react").JSX.Element;
|
|
43
|
+
/**
|
|
44
|
+
* A live status line for the composer — "Thinking…", "Ran 3 commands".
|
|
45
|
+
*
|
|
46
|
+
* Shimmer rather than a spinner: a spinner beside text competes with it for
|
|
47
|
+
* attention and adds a second thing moving in a row that already has one. The
|
|
48
|
+
* text saying what is happening IS the indicator.
|
|
49
|
+
*/
|
|
50
|
+
export interface ChatStatusProps {
|
|
51
|
+
children: ReactNode;
|
|
52
|
+
active?: boolean;
|
|
53
|
+
className?: string;
|
|
54
|
+
}
|
|
55
|
+
export declare function ChatStatus({ children, active, className }: ChatStatusProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface EffortLevel {
|
|
3
|
+
id: string;
|
|
4
|
+
/** "High" — appears on the trigger and above the slider. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** One line explaining the trade at this stop. */
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const DEFAULT_EFFORT_LEVELS: EffortLevel[];
|
|
10
|
+
export interface EffortControlProps {
|
|
11
|
+
levels?: EffortLevel[];
|
|
12
|
+
value: string;
|
|
13
|
+
onValueChange: (id: string) => void;
|
|
14
|
+
/** Explains the whole control, behind the header's help affordance. */
|
|
15
|
+
help?: ReactNode;
|
|
16
|
+
/** Renders the slider inline instead of behind a trigger button. */
|
|
17
|
+
inline?: boolean;
|
|
18
|
+
side?: "top" | "bottom";
|
|
19
|
+
align?: "start" | "center" | "end";
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function EffortControl({ levels, value, onValueChange, help, inline, side, align, disabled, className, }: EffortControlProps): import("react").JSX.Element;
|