@hyperpackai/hyperui 0.1.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 +82 -0
- package/dist/components/Accordion/index.d.ts +17 -0
- package/dist/components/Accordion/index.d.ts.map +1 -0
- package/dist/components/Accordion/index.js +46 -0
- package/dist/components/Alert/index.d.ts +13 -0
- package/dist/components/Alert/index.d.ts.map +1 -0
- package/dist/components/Alert/index.js +46 -0
- package/dist/components/AppBar/index.d.ts +19 -0
- package/dist/components/AppBar/index.d.ts.map +1 -0
- package/dist/components/AppBar/index.js +48 -0
- package/dist/components/AspectRatio/index.d.ts +8 -0
- package/dist/components/AspectRatio/index.d.ts.map +1 -0
- package/dist/components/AspectRatio/index.js +32 -0
- package/dist/components/Autocomplete/index.d.ts +21 -0
- package/dist/components/Autocomplete/index.d.ts.map +1 -0
- package/dist/components/Autocomplete/index.js +94 -0
- package/dist/components/Avatar/index.d.ts +12 -0
- package/dist/components/Avatar/index.d.ts.map +1 -0
- package/dist/components/Avatar/index.js +32 -0
- package/dist/components/AvatarGroup/index.d.ts +9 -0
- package/dist/components/AvatarGroup/index.d.ts.map +1 -0
- package/dist/components/AvatarGroup/index.js +24 -0
- package/dist/components/Backdrop/index.d.ts +10 -0
- package/dist/components/Backdrop/index.d.ts.map +1 -0
- package/dist/components/Backdrop/index.js +25 -0
- package/dist/components/Badge/index.d.ts +10 -0
- package/dist/components/Badge/index.d.ts.map +1 -0
- package/dist/components/Badge/index.js +30 -0
- package/dist/components/BottomNavigation/index.d.ts +16 -0
- package/dist/components/BottomNavigation/index.d.ts.map +1 -0
- package/dist/components/BottomNavigation/index.js +43 -0
- package/dist/components/Box/index.d.ts +21 -0
- package/dist/components/Box/index.d.ts.map +1 -0
- package/dist/components/Box/index.js +30 -0
- package/dist/components/Breadcrumb/index.d.ts +13 -0
- package/dist/components/Breadcrumb/index.d.ts.map +1 -0
- package/dist/components/Breadcrumb/index.js +19 -0
- package/dist/components/Button/index.d.ts +22 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/Button/index.js +93 -0
- package/dist/components/ButtonGroup/index.d.ts +9 -0
- package/dist/components/ButtonGroup/index.d.ts.map +1 -0
- package/dist/components/ButtonGroup/index.js +27 -0
- package/dist/components/Card/index.d.ts +14 -0
- package/dist/components/Card/index.d.ts.map +1 -0
- package/dist/components/Card/index.js +33 -0
- package/dist/components/Checkbox/index.d.ts +17 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -0
- package/dist/components/Checkbox/index.js +42 -0
- package/dist/components/Chip/index.d.ts +18 -0
- package/dist/components/Chip/index.d.ts.map +1 -0
- package/dist/components/Chip/index.js +60 -0
- package/dist/components/CircularProgress/index.d.ts +14 -0
- package/dist/components/CircularProgress/index.d.ts.map +1 -0
- package/dist/components/CircularProgress/index.js +58 -0
- package/dist/components/ClickAwayListener/index.d.ts +11 -0
- package/dist/components/ClickAwayListener/index.d.ts.map +1 -0
- package/dist/components/ClickAwayListener/index.js +31 -0
- package/dist/components/Code/index.d.ts +9 -0
- package/dist/components/Code/index.d.ts.map +1 -0
- package/dist/components/Code/index.js +50 -0
- package/dist/components/Collapse/index.d.ts +11 -0
- package/dist/components/Collapse/index.d.ts.map +1 -0
- package/dist/components/Collapse/index.js +30 -0
- package/dist/components/CommandPalette/index.d.ts +26 -0
- package/dist/components/CommandPalette/index.d.ts.map +1 -0
- package/dist/components/CommandPalette/index.js +141 -0
- package/dist/components/Container/index.d.ts +11 -0
- package/dist/components/Container/index.d.ts.map +1 -0
- package/dist/components/Container/index.js +18 -0
- package/dist/components/DashboardLayout/index.d.ts +15 -0
- package/dist/components/DashboardLayout/index.d.ts.map +1 -0
- package/dist/components/DashboardLayout/index.js +67 -0
- package/dist/components/DataTable/index.d.ts +27 -0
- package/dist/components/DataTable/index.d.ts.map +1 -0
- package/dist/components/DataTable/index.js +59 -0
- package/dist/components/Dialog/index.d.ts +19 -0
- package/dist/components/Dialog/index.d.ts.map +1 -0
- package/dist/components/Dialog/index.js +96 -0
- package/dist/components/Divider/index.d.ts +13 -0
- package/dist/components/Divider/index.d.ts.map +1 -0
- package/dist/components/Divider/index.js +40 -0
- package/dist/components/Drawer/index.d.ts +17 -0
- package/dist/components/Drawer/index.d.ts.map +1 -0
- package/dist/components/Drawer/index.js +77 -0
- package/dist/components/DropdownMenu/index.d.ts +25 -0
- package/dist/components/DropdownMenu/index.d.ts.map +1 -0
- package/dist/components/DropdownMenu/index.js +67 -0
- package/dist/components/EmptyState/index.d.ts +11 -0
- package/dist/components/EmptyState/index.d.ts.map +1 -0
- package/dist/components/EmptyState/index.js +53 -0
- package/dist/components/ErrorState/index.d.ts +12 -0
- package/dist/components/ErrorState/index.d.ts.map +1 -0
- package/dist/components/ErrorState/index.js +54 -0
- package/dist/components/Fab/index.d.ts +16 -0
- package/dist/components/Fab/index.d.ts.map +1 -0
- package/dist/components/Fab/index.js +39 -0
- package/dist/components/Fade/index.d.ts +10 -0
- package/dist/components/Fade/index.d.ts.map +1 -0
- package/dist/components/Fade/index.js +13 -0
- package/dist/components/FocusTrap/index.d.ts +11 -0
- package/dist/components/FocusTrap/index.d.ts.map +1 -0
- package/dist/components/FocusTrap/index.js +69 -0
- package/dist/components/FormControl/index.d.ts +34 -0
- package/dist/components/FormControl/index.d.ts.map +1 -0
- package/dist/components/FormControl/index.js +52 -0
- package/dist/components/GlobalSearch/index.d.ts +23 -0
- package/dist/components/GlobalSearch/index.d.ts.map +1 -0
- package/dist/components/GlobalSearch/index.js +91 -0
- package/dist/components/Grid/index.d.ts +19 -0
- package/dist/components/Grid/index.d.ts.map +1 -0
- package/dist/components/Grid/index.js +30 -0
- package/dist/components/Grow/index.d.ts +10 -0
- package/dist/components/Grow/index.d.ts.map +1 -0
- package/dist/components/Grow/index.js +13 -0
- package/dist/components/IconButton/index.d.ts +16 -0
- package/dist/components/IconButton/index.d.ts.map +1 -0
- package/dist/components/IconButton/index.js +43 -0
- package/dist/components/ImageList/index.d.ts +21 -0
- package/dist/components/ImageList/index.d.ts.map +1 -0
- package/dist/components/ImageList/index.js +39 -0
- package/dist/components/Input/index.d.ts +33 -0
- package/dist/components/Input/index.d.ts.map +1 -0
- package/dist/components/Input/index.js +45 -0
- package/dist/components/Kbd/index.d.ts +8 -0
- package/dist/components/Kbd/index.d.ts.map +1 -0
- package/dist/components/Kbd/index.js +41 -0
- package/dist/components/KeyboardShortcut/index.d.ts +20 -0
- package/dist/components/KeyboardShortcut/index.d.ts.map +1 -0
- package/dist/components/KeyboardShortcut/index.js +63 -0
- package/dist/components/Label/index.d.ts +10 -0
- package/dist/components/Label/index.d.ts.map +1 -0
- package/dist/components/Label/index.js +17 -0
- package/dist/components/LinearProgress/index.d.ts +13 -0
- package/dist/components/LinearProgress/index.d.ts.map +1 -0
- package/dist/components/LinearProgress/index.js +69 -0
- package/dist/components/Link/index.d.ts +16 -0
- package/dist/components/Link/index.d.ts.map +1 -0
- package/dist/components/Link/index.js +25 -0
- package/dist/components/List/index.d.ts +40 -0
- package/dist/components/List/index.d.ts.map +1 -0
- package/dist/components/List/index.js +70 -0
- package/dist/components/LoadingState/index.d.ts +11 -0
- package/dist/components/LoadingState/index.d.ts.map +1 -0
- package/dist/components/LoadingState/index.js +66 -0
- package/dist/components/Menu/index.d.ts +40 -0
- package/dist/components/Menu/index.d.ts.map +1 -0
- package/dist/components/Menu/index.js +103 -0
- package/dist/components/MobileStepper/index.d.ts +16 -0
- package/dist/components/MobileStepper/index.d.ts.map +1 -0
- package/dist/components/MobileStepper/index.js +67 -0
- package/dist/components/Modal/index.d.ts +14 -0
- package/dist/components/Modal/index.d.ts.map +1 -0
- package/dist/components/Modal/index.js +51 -0
- package/dist/components/Navbar/index.d.ts +14 -0
- package/dist/components/Navbar/index.d.ts.map +1 -0
- package/dist/components/Navbar/index.js +27 -0
- package/dist/components/NoSSR/index.d.ts +7 -0
- package/dist/components/NoSSR/index.d.ts.map +1 -0
- package/dist/components/NoSSR/index.js +9 -0
- package/dist/components/PageLayout/index.d.ts +13 -0
- package/dist/components/PageLayout/index.d.ts.map +1 -0
- package/dist/components/PageLayout/index.js +41 -0
- package/dist/components/Pagination/index.d.ts +11 -0
- package/dist/components/Pagination/index.d.ts.map +1 -0
- package/dist/components/Pagination/index.js +56 -0
- package/dist/components/Paper/index.d.ts +12 -0
- package/dist/components/Paper/index.d.ts.map +1 -0
- package/dist/components/Paper/index.js +24 -0
- package/dist/components/Popover/index.d.ts +13 -0
- package/dist/components/Popover/index.d.ts.map +1 -0
- package/dist/components/Popover/index.js +34 -0
- package/dist/components/Progress/index.d.ts +13 -0
- package/dist/components/Progress/index.d.ts.map +1 -0
- package/dist/components/Progress/index.js +40 -0
- package/dist/components/Radio/index.d.ts +7 -0
- package/dist/components/Radio/index.d.ts.map +1 -0
- package/dist/components/Radio/index.js +28 -0
- package/dist/components/Rating/index.d.ts +15 -0
- package/dist/components/Rating/index.d.ts.map +1 -0
- package/dist/components/Rating/index.js +41 -0
- package/dist/components/ResizablePanel/index.d.ts +16 -0
- package/dist/components/ResizablePanel/index.d.ts.map +1 -0
- package/dist/components/ResizablePanel/index.js +41 -0
- package/dist/components/ScrollArea/index.d.ts +12 -0
- package/dist/components/ScrollArea/index.d.ts.map +1 -0
- package/dist/components/ScrollArea/index.js +50 -0
- package/dist/components/Select/index.d.ts +23 -0
- package/dist/components/Select/index.d.ts.map +1 -0
- package/dist/components/Select/index.js +52 -0
- package/dist/components/Sheet/index.d.ts +15 -0
- package/dist/components/Sheet/index.d.ts.map +1 -0
- package/dist/components/Sheet/index.js +61 -0
- package/dist/components/Sidebar/index.d.ts +23 -0
- package/dist/components/Sidebar/index.d.ts.map +1 -0
- package/dist/components/Sidebar/index.js +37 -0
- package/dist/components/Skeleton/index.d.ts +9 -0
- package/dist/components/Skeleton/index.d.ts.map +1 -0
- package/dist/components/Skeleton/index.js +22 -0
- package/dist/components/Slide/index.d.ts +12 -0
- package/dist/components/Slide/index.d.ts.map +1 -0
- package/dist/components/Slide/index.js +21 -0
- package/dist/components/Slider/index.d.ts +19 -0
- package/dist/components/Slider/index.d.ts.map +1 -0
- package/dist/components/Slider/index.js +49 -0
- package/dist/components/Snackbar/index.d.ts +28 -0
- package/dist/components/Snackbar/index.d.ts.map +1 -0
- package/dist/components/Snackbar/index.js +71 -0
- package/dist/components/SpeedDial/index.d.ts +18 -0
- package/dist/components/SpeedDial/index.d.ts.map +1 -0
- package/dist/components/SpeedDial/index.js +71 -0
- package/dist/components/Spinner/index.d.ts +10 -0
- package/dist/components/Spinner/index.d.ts.map +1 -0
- package/dist/components/Spinner/index.js +67 -0
- package/dist/components/SplitPane/index.d.ts +11 -0
- package/dist/components/SplitPane/index.d.ts.map +1 -0
- package/dist/components/SplitPane/index.js +46 -0
- package/dist/components/Stack/index.d.ts +17 -0
- package/dist/components/Stack/index.d.ts.map +1 -0
- package/dist/components/Stack/index.js +30 -0
- package/dist/components/Stepper/index.d.ts +20 -0
- package/dist/components/Stepper/index.d.ts.map +1 -0
- package/dist/components/Stepper/index.js +66 -0
- package/dist/components/Switch/index.d.ts +13 -0
- package/dist/components/Switch/index.d.ts.map +1 -0
- package/dist/components/Switch/index.js +38 -0
- package/dist/components/Tabs/index.d.ts +20 -0
- package/dist/components/Tabs/index.d.ts.map +1 -0
- package/dist/components/Tabs/index.js +62 -0
- package/dist/components/TextField/index.d.ts +35 -0
- package/dist/components/TextField/index.d.ts.map +1 -0
- package/dist/components/TextField/index.js +69 -0
- package/dist/components/Textarea/index.d.ts +22 -0
- package/dist/components/Textarea/index.d.ts.map +1 -0
- package/dist/components/Textarea/index.js +27 -0
- package/dist/components/Timeline/index.d.ts +16 -0
- package/dist/components/Timeline/index.d.ts.map +1 -0
- package/dist/components/Timeline/index.js +30 -0
- package/dist/components/Toast/index.d.ts +34 -0
- package/dist/components/Toast/index.d.ts.map +1 -0
- package/dist/components/Toast/index.js +106 -0
- package/dist/components/ToggleButton/index.d.ts +21 -0
- package/dist/components/ToggleButton/index.d.ts.map +1 -0
- package/dist/components/ToggleButton/index.js +81 -0
- package/dist/components/Tooltip/index.d.ts +14 -0
- package/dist/components/Tooltip/index.d.ts.map +1 -0
- package/dist/components/Tooltip/index.js +47 -0
- package/dist/components/TreeView/index.d.ts +19 -0
- package/dist/components/TreeView/index.d.ts.map +1 -0
- package/dist/components/TreeView/index.js +50 -0
- package/dist/components/Typography/index.d.ts +17 -0
- package/dist/components/Typography/index.d.ts.map +1 -0
- package/dist/components/Typography/index.js +44 -0
- package/dist/components/VisuallyHidden/index.d.ts +7 -0
- package/dist/components/VisuallyHidden/index.d.ts.map +1 -0
- package/dist/components/VisuallyHidden/index.js +18 -0
- package/dist/components/Zoom/index.d.ts +10 -0
- package/dist/components/Zoom/index.d.ts.map +1 -0
- package/dist/components/Zoom/index.js +13 -0
- package/dist/components/ai.d.ts +133 -0
- package/dist/components/ai.d.ts.map +1 -0
- package/dist/components/ai.js +184 -0
- package/dist/components/charts.d.ts +143 -0
- package/dist/components/charts.d.ts.map +1 -0
- package/dist/components/charts.js +435 -0
- package/dist/components/data.d.ts +192 -0
- package/dist/components/data.d.ts.map +1 -0
- package/dist/components/data.js +581 -0
- package/dist/components/date.d.ts +73 -0
- package/dist/components/date.d.ts.map +1 -0
- package/dist/components/date.js +199 -0
- package/dist/components/enterprise.d.ts +246 -0
- package/dist/components/enterprise.d.ts.map +1 -0
- package/dist/components/enterprise.js +428 -0
- package/dist/components/form.d.ts +132 -0
- package/dist/components/form.d.ts.map +1 -0
- package/dist/components/form.js +380 -0
- package/dist/components/index.d.ts +173 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +107 -0
- package/dist/components/inputs.d.ts +169 -0
- package/dist/components/inputs.d.ts.map +1 -0
- package/dist/components/inputs.js +437 -0
- package/dist/components/layout.d.ts +224 -0
- package/dist/components/layout.d.ts.map +1 -0
- package/dist/components/layout.js +644 -0
- package/dist/components/overlay.d.ts +102 -0
- package/dist/components/overlay.d.ts.map +1 -0
- package/dist/components/overlay.js +318 -0
- package/dist/components/surfaces.d.ts +180 -0
- package/dist/components/surfaces.d.ts.map +1 -0
- package/dist/components/surfaces.js +423 -0
- package/dist/components/typography.d.ts +69 -0
- package/dist/components/typography.d.ts.map +1 -0
- package/dist/components/typography.js +206 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/portal.d.ts +3 -0
- package/dist/portal.d.ts.map +1 -0
- package/dist/portal.js +17 -0
- package/dist/theme/index.d.ts +31 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +258 -0
- package/dist/tokens/component.d.ts +124 -0
- package/dist/tokens/component.d.ts.map +1 -0
- package/dist/tokens/component.js +113 -0
- package/dist/tokens/index.d.ts +494 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/index.js +345 -0
- package/dist/tokens/primitives.d.ts +675 -0
- package/dist/tokens/primitives.d.ts.map +1 -0
- package/dist/tokens/primitives.js +356 -0
- package/dist/tokens/semantic.d.ts +252 -0
- package/dist/tokens/semantic.d.ts.map +1 -0
- package/dist/tokens/semantic.js +242 -0
- package/dist/tokens/themes.d.ts +18 -0
- package/dist/tokens/themes.d.ts.map +1 -0
- package/dist/tokens/themes.js +316 -0
- package/package.json +69 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { injectCSS, cn, h } from "../../theme/index.js";
|
|
2
|
+
const CSS = `
|
|
3
|
+
.hu-zoom { transition: transform var(--hu-duration) cubic-bezier(.34,1.56,.64,1), opacity var(--hu-duration) var(--hu-ease); transform-origin: center center; }
|
|
4
|
+
.hu-zoom--in { transform: scale(1); opacity: 1; }
|
|
5
|
+
.hu-zoom--out { transform: scale(0); opacity: 0; pointer-events: none; }
|
|
6
|
+
`;
|
|
7
|
+
export function Zoom(props) {
|
|
8
|
+
injectCSS("hu-zoom", CSS);
|
|
9
|
+
if (!props.in && props.unmountOnExit)
|
|
10
|
+
return null;
|
|
11
|
+
const style = props.timeout ? `transition-duration:${props.timeout}ms` : undefined;
|
|
12
|
+
return h("div", { class: cn("hu-zoom", props.in ? "hu-zoom--in" : "hu-zoom--out", props.class), style }, props.children);
|
|
13
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HyperUI AI Components
|
|
3
|
+
* AIChat · AIForm · AIGrid · AIChart
|
|
4
|
+
*/
|
|
5
|
+
import { type VNode } from "../theme/index.js";
|
|
6
|
+
import { type SelectOption } from "./Select/index.js";
|
|
7
|
+
export type AIMessageRole = "system" | "user" | "assistant" | "tool";
|
|
8
|
+
export interface AIMessage {
|
|
9
|
+
id: string;
|
|
10
|
+
role: AIMessageRole;
|
|
11
|
+
content: string;
|
|
12
|
+
timestamp?: string;
|
|
13
|
+
status?: "pending" | "streaming" | "complete" | "error";
|
|
14
|
+
}
|
|
15
|
+
export interface AIChatProps {
|
|
16
|
+
messages: AIMessage[];
|
|
17
|
+
prompt?: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
loading?: boolean;
|
|
22
|
+
class?: string;
|
|
23
|
+
onPromptChange?: (prompt: string) => void;
|
|
24
|
+
onSend?: (prompt: string) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare function AIChat(props: AIChatProps): VNode;
|
|
27
|
+
export interface AIFormField {
|
|
28
|
+
name: string;
|
|
29
|
+
label: string;
|
|
30
|
+
value?: string;
|
|
31
|
+
suggestion?: string;
|
|
32
|
+
confidence?: number;
|
|
33
|
+
options?: SelectOption[];
|
|
34
|
+
}
|
|
35
|
+
export interface AIFormProps {
|
|
36
|
+
fields: AIFormField[];
|
|
37
|
+
title?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
class?: string;
|
|
40
|
+
onFieldChange?: (name: string, value: string) => void;
|
|
41
|
+
onApplySuggestion?: (name: string, suggestion: string) => void;
|
|
42
|
+
}
|
|
43
|
+
export declare function AIForm(props: AIFormProps): VNode;
|
|
44
|
+
export interface AIGridColumn {
|
|
45
|
+
key: string;
|
|
46
|
+
header: string;
|
|
47
|
+
}
|
|
48
|
+
export interface AIGridInsight {
|
|
49
|
+
id: string;
|
|
50
|
+
title: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
severity?: "info" | "success" | "warning" | "error";
|
|
53
|
+
}
|
|
54
|
+
export interface AIGridProps {
|
|
55
|
+
columns: AIGridColumn[];
|
|
56
|
+
rows: Array<Record<string, unknown>>;
|
|
57
|
+
insights?: AIGridInsight[];
|
|
58
|
+
title?: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
class?: string;
|
|
61
|
+
onInsightClick?: (insight: AIGridInsight) => void;
|
|
62
|
+
}
|
|
63
|
+
export declare function AIGrid(props: AIGridProps): VNode;
|
|
64
|
+
export interface AIChartDatum {
|
|
65
|
+
label: string;
|
|
66
|
+
value: number;
|
|
67
|
+
}
|
|
68
|
+
export interface AIChartProps {
|
|
69
|
+
data: AIChartDatum[];
|
|
70
|
+
insights?: AIGridInsight[];
|
|
71
|
+
title?: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
class?: string;
|
|
74
|
+
onInsightClick?: (insight: AIGridInsight) => void;
|
|
75
|
+
}
|
|
76
|
+
export declare function AIChart(props: AIChartProps): VNode;
|
|
77
|
+
export interface AIDashboardMetric {
|
|
78
|
+
id: string;
|
|
79
|
+
label: string;
|
|
80
|
+
value: string | number;
|
|
81
|
+
trend?: string;
|
|
82
|
+
}
|
|
83
|
+
export interface AIDashboardProps {
|
|
84
|
+
metrics: AIDashboardMetric[];
|
|
85
|
+
insights?: AIGridInsight[];
|
|
86
|
+
columns?: number;
|
|
87
|
+
title?: string;
|
|
88
|
+
description?: string;
|
|
89
|
+
class?: string;
|
|
90
|
+
onInsightClick?: (insight: AIGridInsight) => void;
|
|
91
|
+
}
|
|
92
|
+
export declare function AIDashboard(props: AIDashboardProps): VNode;
|
|
93
|
+
export interface AIInsightsProps {
|
|
94
|
+
insights: AIGridInsight[];
|
|
95
|
+
title?: string;
|
|
96
|
+
description?: string;
|
|
97
|
+
class?: string;
|
|
98
|
+
onInsightClick?: (insight: AIGridInsight) => void;
|
|
99
|
+
}
|
|
100
|
+
export declare function AIInsights(props: AIInsightsProps): VNode;
|
|
101
|
+
export interface AIWizardStep {
|
|
102
|
+
id: string;
|
|
103
|
+
title: string;
|
|
104
|
+
description?: string;
|
|
105
|
+
content?: unknown;
|
|
106
|
+
status?: "pending" | "active" | "complete" | "error";
|
|
107
|
+
}
|
|
108
|
+
export interface AIWizardProps {
|
|
109
|
+
steps: AIWizardStep[];
|
|
110
|
+
activeStep?: string;
|
|
111
|
+
title?: string;
|
|
112
|
+
description?: string;
|
|
113
|
+
class?: string;
|
|
114
|
+
onStepChange?: (id: string) => void;
|
|
115
|
+
onComplete?: () => void;
|
|
116
|
+
}
|
|
117
|
+
export declare function AIWizard(props: AIWizardProps): VNode;
|
|
118
|
+
export interface AIReportSection {
|
|
119
|
+
id: string;
|
|
120
|
+
title: string;
|
|
121
|
+
content: string;
|
|
122
|
+
confidence?: number;
|
|
123
|
+
}
|
|
124
|
+
export interface AIReportProps {
|
|
125
|
+
sections: AIReportSection[];
|
|
126
|
+
title?: string;
|
|
127
|
+
description?: string;
|
|
128
|
+
generatedAt?: string;
|
|
129
|
+
class?: string;
|
|
130
|
+
onExport?: () => void;
|
|
131
|
+
}
|
|
132
|
+
export declare function AIReport(props: AIReportProps): VNode;
|
|
133
|
+
//# sourceMappingURL=ai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../src/components/ai.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAoB,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAGjE,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAiG9D,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;AAEr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IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,CA+BpD;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,CAqBpD"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HyperUI AI Components
|
|
3
|
+
* AIChat · AIForm · AIGrid · AIChart
|
|
4
|
+
*/
|
|
5
|
+
import { injectCSS, cn, h } from "../theme/index.js";
|
|
6
|
+
import { Button } from "./Button/index.js";
|
|
7
|
+
import { Input } from "./Input/index.js";
|
|
8
|
+
import { Select } from "./Select/index.js";
|
|
9
|
+
const AI_CSS = `
|
|
10
|
+
.hu-ai {
|
|
11
|
+
display: flex; flex-direction: column; gap: var(--hu-space-3);
|
|
12
|
+
padding: var(--hu-space-4); border: 1px solid var(--hu-border);
|
|
13
|
+
border-radius: var(--hu-radius-md); background: var(--hu-bg); color: var(--hu-text);
|
|
14
|
+
}
|
|
15
|
+
.hu-ai__header {
|
|
16
|
+
display: flex; align-items: flex-start; justify-content: space-between;
|
|
17
|
+
gap: var(--hu-space-3); flex-wrap: wrap;
|
|
18
|
+
}
|
|
19
|
+
.hu-ai__title { font-size: var(--hu-font-size-sm); font-weight: var(--hu-font-weight-semibold); color: var(--hu-text); }
|
|
20
|
+
.hu-ai__meta { font-size: var(--hu-font-size-xs); color: var(--hu-text-2); }
|
|
21
|
+
.hu-ai-chat__messages { display: flex; flex-direction: column; gap: var(--hu-space-2); max-height: 360px; overflow: auto; }
|
|
22
|
+
.hu-ai-message {
|
|
23
|
+
display: flex; flex-direction: column; gap: var(--hu-space-1);
|
|
24
|
+
max-width: 86%; padding: var(--hu-space-3); border: 1px solid var(--hu-border);
|
|
25
|
+
border-radius: var(--hu-radius); background: var(--hu-bg-2);
|
|
26
|
+
}
|
|
27
|
+
.hu-ai-message--user { align-self: flex-end; background: var(--hu-primary-bg); color: var(--hu-primary); }
|
|
28
|
+
.hu-ai-message--assistant { align-self: flex-start; }
|
|
29
|
+
.hu-ai-message__role { font-size: var(--hu-font-size-xs); font-weight: var(--hu-font-weight-semibold); color: var(--hu-text-2); }
|
|
30
|
+
.hu-ai-message__content { font-size: var(--hu-font-size-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
31
|
+
.hu-ai-chat__composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--hu-space-2); align-items: end; }
|
|
32
|
+
.hu-ai-form__fields,
|
|
33
|
+
.hu-ai-grid__insights,
|
|
34
|
+
.hu-ai-chart__insights { display: flex; flex-direction: column; gap: var(--hu-space-2); }
|
|
35
|
+
.hu-ai-form__field {
|
|
36
|
+
display: grid; grid-template-columns: minmax(160px, .6fr) minmax(0, 1fr);
|
|
37
|
+
gap: var(--hu-space-2); align-items: start; padding: var(--hu-space-3);
|
|
38
|
+
border: 1px solid var(--hu-border); border-radius: var(--hu-radius); background: var(--hu-bg-2);
|
|
39
|
+
}
|
|
40
|
+
.hu-ai-form__suggestion,
|
|
41
|
+
.hu-ai-insight {
|
|
42
|
+
padding: var(--hu-space-3); border: 1px solid var(--hu-border);
|
|
43
|
+
border-radius: var(--hu-radius); background: var(--hu-bg-2);
|
|
44
|
+
}
|
|
45
|
+
.hu-ai-insight__title { font-size: var(--hu-font-size-sm); font-weight: var(--hu-font-weight-semibold); }
|
|
46
|
+
.hu-ai-insight__body { font-size: var(--hu-font-size-xs); color: var(--hu-text-2); margin-top: 2px; }
|
|
47
|
+
.hu-ai-grid__table { overflow: auto; border: 1px solid var(--hu-border); border-radius: var(--hu-radius); }
|
|
48
|
+
.hu-ai-grid__table table { width: 100%; border-collapse: collapse; table-layout: fixed; }
|
|
49
|
+
.hu-ai-grid__table th,
|
|
50
|
+
.hu-ai-grid__table td {
|
|
51
|
+
padding: var(--hu-space-2) var(--hu-space-3); border-block-end: 1px solid var(--hu-border);
|
|
52
|
+
font-size: var(--hu-font-size-xs); text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
53
|
+
}
|
|
54
|
+
.hu-ai-grid__table th { background: var(--hu-bg-2); color: var(--hu-text-2); font-weight: var(--hu-font-weight-semibold); }
|
|
55
|
+
.hu-ai-chart__preview {
|
|
56
|
+
min-height: 180px; display: flex; align-items: center; justify-content: center;
|
|
57
|
+
border: 1px solid var(--hu-border); border-radius: var(--hu-radius);
|
|
58
|
+
background: var(--hu-bg-2);
|
|
59
|
+
}
|
|
60
|
+
.hu-ai-chart__bars { display: flex; align-items: end; gap: var(--hu-space-2); width: min(100%, 420px); height: 140px; }
|
|
61
|
+
.hu-ai-chart__bar { flex: 1; min-width: 12px; border-radius: var(--hu-radius) var(--hu-radius) 0 0; background: var(--hu-primary); }
|
|
62
|
+
.hu-ai-dashboard__grid {
|
|
63
|
+
display: grid; grid-template-columns: repeat(var(--hu-ai-dashboard-columns, 3), minmax(180px, 1fr));
|
|
64
|
+
gap: var(--hu-space-3);
|
|
65
|
+
}
|
|
66
|
+
.hu-ai-dashboard__metric {
|
|
67
|
+
padding: var(--hu-space-3); border: 1px solid var(--hu-border);
|
|
68
|
+
border-radius: var(--hu-radius); background: var(--hu-bg-2);
|
|
69
|
+
}
|
|
70
|
+
.hu-ai-dashboard__value { font-size: var(--hu-font-size-xl); font-weight: var(--hu-font-weight-semibold); color: var(--hu-text); }
|
|
71
|
+
.hu-ai-dashboard__label,
|
|
72
|
+
.hu-ai-wizard__step-meta,
|
|
73
|
+
.hu-ai-report__meta { font-size: var(--hu-font-size-xs); color: var(--hu-text-2); }
|
|
74
|
+
.hu-ai-insights__list,
|
|
75
|
+
.hu-ai-report__sections { display: flex; flex-direction: column; gap: var(--hu-space-2); }
|
|
76
|
+
.hu-ai-wizard__steps {
|
|
77
|
+
display: grid; grid-template-columns: minmax(180px, .7fr) minmax(0, 1.3fr);
|
|
78
|
+
gap: var(--hu-space-3);
|
|
79
|
+
}
|
|
80
|
+
.hu-ai-wizard__nav {
|
|
81
|
+
display: flex; flex-direction: column; gap: var(--hu-space-2);
|
|
82
|
+
}
|
|
83
|
+
.hu-ai-wizard__step {
|
|
84
|
+
padding: var(--hu-space-3); border: 1px solid var(--hu-border);
|
|
85
|
+
border-radius: var(--hu-radius); background: var(--hu-bg-2); text-align: start;
|
|
86
|
+
}
|
|
87
|
+
.hu-ai-wizard__step[aria-current="step"] { border-color: var(--hu-primary); box-shadow: 0 0 0 3px var(--hu-primary-bg); }
|
|
88
|
+
.hu-ai-wizard__panel,
|
|
89
|
+
.hu-ai-report__section {
|
|
90
|
+
padding: var(--hu-space-4); border: 1px solid var(--hu-border);
|
|
91
|
+
border-radius: var(--hu-radius); background: var(--hu-bg-2);
|
|
92
|
+
}
|
|
93
|
+
.hu-ai-wizard__actions,
|
|
94
|
+
.hu-ai-report__actions { display: flex; gap: var(--hu-space-2); flex-wrap: wrap; justify-content: flex-end; }
|
|
95
|
+
@media (max-width: 720px) {
|
|
96
|
+
.hu-ai-chat__composer,
|
|
97
|
+
.hu-ai-form__field,
|
|
98
|
+
.hu-ai-wizard__steps { grid-template-columns: minmax(0, 1fr); }
|
|
99
|
+
.hu-ai-dashboard__grid { grid-template-columns: minmax(0, 1fr); }
|
|
100
|
+
.hu-ai-message { max-width: 100%; }
|
|
101
|
+
}
|
|
102
|
+
`;
|
|
103
|
+
export function AIChat(props) {
|
|
104
|
+
injectCSS("hu-ai", AI_CSS);
|
|
105
|
+
const prompt = props.prompt ?? "";
|
|
106
|
+
return h("section", { class: cn("hu-ai hu-ai-chat", props.class), "aria-label": props.title ?? "AI chat" }, aiHeader(props.title ?? "AI chat", props.description ?? `${props.messages.length} messages`), h("div", { class: "hu-ai-chat__messages", role: "log", "aria-live": "polite" }, ...props.messages.map((message) => h("article", { key: message.id, class: cn("hu-ai-message", `hu-ai-message--${message.role}`) }, h("div", { class: "hu-ai-message__role" }, [message.role, message.status, message.timestamp].filter(Boolean).join(" · ")), h("div", { class: "hu-ai-message__content" }, message.content)))), h("div", { class: "hu-ai-chat__composer", role: "search" }, Input({
|
|
107
|
+
value: prompt,
|
|
108
|
+
placeholder: props.placeholder ?? "Ask AI...",
|
|
109
|
+
onInput: (e) => props.onPromptChange?.(e.target.value)
|
|
110
|
+
}), Button({
|
|
111
|
+
type: "button",
|
|
112
|
+
disabled: props.loading || prompt.trim().length === 0,
|
|
113
|
+
children: props.loading ? "Thinking" : "Send",
|
|
114
|
+
onClick: () => props.onSend?.(prompt)
|
|
115
|
+
})));
|
|
116
|
+
}
|
|
117
|
+
export function AIForm(props) {
|
|
118
|
+
injectCSS("hu-ai", AI_CSS);
|
|
119
|
+
return h("section", { class: cn("hu-ai hu-ai-form", props.class), "aria-label": props.title ?? "AI form" }, aiHeader(props.title ?? "AI form", props.description ?? `${props.fields.length} fields`), h("div", { class: "hu-ai-form__fields" }, ...props.fields.map((field) => h("div", { key: field.name, class: "hu-ai-form__field" }, h("div", {}, h("div", { class: "hu-ai-insight__title" }, field.label), field.confidence !== undefined && h("div", { class: "hu-ai__meta" }, `${field.confidence}% confidence`)), h("div", {}, field.options
|
|
120
|
+
? Select({
|
|
121
|
+
value: field.value,
|
|
122
|
+
options: field.options,
|
|
123
|
+
onChange: (e) => props.onFieldChange?.(field.name, e.target.value)
|
|
124
|
+
})
|
|
125
|
+
: Input({
|
|
126
|
+
value: field.value ?? "",
|
|
127
|
+
onInput: (e) => props.onFieldChange?.(field.name, e.target.value)
|
|
128
|
+
}), field.suggestion && h("div", { class: "hu-ai-form__suggestion" }, h("div", { class: "hu-ai-insight__body" }, field.suggestion), Button({ type: "button", size: "sm", variant: "secondary", children: "Apply", onClick: () => props.onApplySuggestion?.(field.name, field.suggestion) })))))));
|
|
129
|
+
}
|
|
130
|
+
export function AIGrid(props) {
|
|
131
|
+
injectCSS("hu-ai", AI_CSS);
|
|
132
|
+
return h("section", { class: cn("hu-ai hu-ai-grid", props.class), "aria-label": props.title ?? "AI grid" }, aiHeader(props.title ?? "AI grid", props.description ?? `${props.rows.length} rows`), h("div", { class: "hu-ai-grid__insights", "aria-label": "AI grid insights" }, ...(props.insights ?? []).map((insight) => renderInsight(insight, props.onInsightClick))), h("div", { class: "hu-ai-grid__table" }, h("table", {}, h("thead", {}, h("tr", {}, ...props.columns.map((column) => h("th", { key: column.key, scope: "col" }, column.header)))), h("tbody", {}, ...props.rows.map((row, index) => h("tr", { key: String(row["id"] ?? index) }, ...props.columns.map((column) => h("td", { key: column.key }, row[column.key] ?? ""))))))));
|
|
133
|
+
}
|
|
134
|
+
export function AIChart(props) {
|
|
135
|
+
injectCSS("hu-ai", AI_CSS);
|
|
136
|
+
const max = Math.max(1, ...props.data.map((datum) => datum.value));
|
|
137
|
+
return h("section", { class: cn("hu-ai hu-ai-chart", props.class), "aria-label": props.title ?? "AI chart" }, aiHeader(props.title ?? "AI chart", props.description ?? `${props.data.length} data points`), h("div", { class: "hu-ai-chart__insights", "aria-label": "AI chart insights" }, ...(props.insights ?? []).map((insight) => renderInsight(insight, props.onInsightClick))), h("div", { class: "hu-ai-chart__preview", role: "img", "aria-label": "AI generated chart preview" }, h("div", { class: "hu-ai-chart__bars" }, ...props.data.map((datum) => h("span", {
|
|
138
|
+
key: datum.label,
|
|
139
|
+
class: "hu-ai-chart__bar",
|
|
140
|
+
style: `height:${Math.max(4, datum.value / max * 100)}%`,
|
|
141
|
+
"aria-label": `${datum.label}: ${datum.value}`
|
|
142
|
+
})))));
|
|
143
|
+
}
|
|
144
|
+
export function AIDashboard(props) {
|
|
145
|
+
injectCSS("hu-ai", AI_CSS);
|
|
146
|
+
return h("section", {
|
|
147
|
+
class: cn("hu-ai hu-ai-dashboard", props.class),
|
|
148
|
+
style: `--hu-ai-dashboard-columns:${props.columns ?? 3}`,
|
|
149
|
+
"aria-label": props.title ?? "AI dashboard"
|
|
150
|
+
}, aiHeader(props.title ?? "AI dashboard", props.description ?? `${props.metrics.length} metrics`), h("div", { class: "hu-ai-dashboard__grid" }, ...props.metrics.map((metric) => h("article", { key: metric.id, class: "hu-ai-dashboard__metric" }, h("div", { class: "hu-ai-dashboard__value" }, metric.value), h("div", { class: "hu-ai-dashboard__label" }, metric.label), metric.trend && h("div", { class: "hu-ai-dashboard__label" }, metric.trend)))), h("div", { class: "hu-ai-insights__list", "aria-label": "AI dashboard insights" }, ...(props.insights ?? []).map((insight) => renderInsight(insight, props.onInsightClick))));
|
|
151
|
+
}
|
|
152
|
+
export function AIInsights(props) {
|
|
153
|
+
injectCSS("hu-ai", AI_CSS);
|
|
154
|
+
return h("section", { class: cn("hu-ai hu-ai-insights", props.class), "aria-label": props.title ?? "AI insights" }, aiHeader(props.title ?? "AI insights", props.description ?? `${props.insights.length} insights`), h("div", { class: "hu-ai-insights__list", role: "list" }, ...props.insights.map((insight) => h("div", { key: insight.id, role: "listitem" }, renderInsight(insight, props.onInsightClick)))));
|
|
155
|
+
}
|
|
156
|
+
export function AIWizard(props) {
|
|
157
|
+
injectCSS("hu-ai", AI_CSS);
|
|
158
|
+
const active = props.steps.find((step) => step.id === props.activeStep) ?? props.steps[0];
|
|
159
|
+
return h("section", { class: cn("hu-ai hu-ai-wizard", props.class), "aria-label": props.title ?? "AI wizard" }, aiHeader(props.title ?? "AI wizard", props.description ?? `${props.steps.length} steps`), h("div", { class: "hu-ai-wizard__steps" }, h("div", { class: "hu-ai-wizard__nav", role: "tablist", "aria-label": "AI wizard steps" }, ...props.steps.map((step) => h("button", {
|
|
160
|
+
key: step.id,
|
|
161
|
+
type: "button",
|
|
162
|
+
class: "hu-ai-wizard__step",
|
|
163
|
+
role: "tab",
|
|
164
|
+
"aria-current": active?.id === step.id ? "step" : undefined,
|
|
165
|
+
"aria-selected": active?.id === step.id ? "true" : "false",
|
|
166
|
+
onClick: () => props.onStepChange?.(step.id)
|
|
167
|
+
}, h("div", { class: "hu-ai-insight__title" }, step.title), h("div", { class: "hu-ai-wizard__step-meta" }, [step.status ?? "pending", step.description].filter(Boolean).join(" · "))))), h("div", { class: "hu-ai-wizard__panel", role: "tabpanel", "aria-label": active?.title ?? "Step" }, active?.content ?? active?.description ?? "", h("div", { class: "hu-ai-wizard__actions" }, props.onComplete && Button({ type: "button", children: "Complete", onClick: props.onComplete })))));
|
|
168
|
+
}
|
|
169
|
+
export function AIReport(props) {
|
|
170
|
+
injectCSS("hu-ai", AI_CSS);
|
|
171
|
+
return h("article", { class: cn("hu-ai hu-ai-report", props.class), "aria-label": props.title ?? "AI report" }, h("div", { class: "hu-ai__header" }, h("div", {}, h("div", { class: "hu-ai__title" }, props.title ?? "AI report"), h("div", { class: "hu-ai-report__meta" }, props.description ?? props.generatedAt ?? `${props.sections.length} sections`)), props.onExport && Button({ type: "button", size: "sm", children: "Export", onClick: props.onExport })), h("div", { class: "hu-ai-report__sections" }, ...props.sections.map((section) => h("section", { key: section.id, class: "hu-ai-report__section", "aria-label": section.title }, h("h3", { class: "hu-ai-insight__title" }, section.title), section.confidence !== undefined && h("div", { class: "hu-ai-report__meta" }, `${section.confidence}% confidence`), h("p", { class: "hu-ai-insight__body" }, section.content)))));
|
|
172
|
+
}
|
|
173
|
+
function aiHeader(title, meta) {
|
|
174
|
+
return h("div", { class: "hu-ai__header" }, h("div", {}, h("div", { class: "hu-ai__title" }, title), h("div", { class: "hu-ai__meta" }, meta)));
|
|
175
|
+
}
|
|
176
|
+
function renderInsight(insight, onClick) {
|
|
177
|
+
return h("article", {
|
|
178
|
+
key: insight.id,
|
|
179
|
+
class: cn("hu-ai-insight", insight.severity && `hu-ai-insight--${insight.severity}`),
|
|
180
|
+
role: "note",
|
|
181
|
+
tabindex: onClick ? 0 : undefined,
|
|
182
|
+
onClick: onClick ? () => onClick(insight) : undefined
|
|
183
|
+
}, h("div", { class: "hu-ai-insight__title" }, insight.title), insight.description && h("div", { class: "hu-ai-insight__body" }, insight.description));
|
|
184
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HyperUI Chart Components
|
|
3
|
+
* LineChart · BarChart · PieChart · Sparkline
|
|
4
|
+
*/
|
|
5
|
+
import { type VNode } from "../theme/index.js";
|
|
6
|
+
export interface ChartSizeProps {
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
class?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ChartSeriesPoint {
|
|
12
|
+
x: string | number;
|
|
13
|
+
y: number;
|
|
14
|
+
}
|
|
15
|
+
export interface ChartSeries {
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
data: ChartSeriesPoint[];
|
|
19
|
+
color?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface LineChartProps extends ChartSizeProps {
|
|
22
|
+
series: ChartSeries[];
|
|
23
|
+
title?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
showGrid?: boolean;
|
|
26
|
+
xLabel?: string;
|
|
27
|
+
yLabel?: string;
|
|
28
|
+
colors?: string[];
|
|
29
|
+
}
|
|
30
|
+
export interface BarChartDatum {
|
|
31
|
+
label: string;
|
|
32
|
+
value: number;
|
|
33
|
+
color?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface BarChartProps extends ChartSizeProps {
|
|
36
|
+
data: BarChartDatum[];
|
|
37
|
+
title?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
orientation?: "vertical" | "horizontal";
|
|
40
|
+
showGrid?: boolean;
|
|
41
|
+
color?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface PieChartDatum {
|
|
44
|
+
label: string;
|
|
45
|
+
value: number;
|
|
46
|
+
color?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface PieChartProps extends ChartSizeProps {
|
|
49
|
+
data: PieChartDatum[];
|
|
50
|
+
title?: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
donut?: boolean;
|
|
53
|
+
colors?: string[];
|
|
54
|
+
}
|
|
55
|
+
export interface SparklineProps extends ChartSizeProps {
|
|
56
|
+
data: number[];
|
|
57
|
+
label?: string;
|
|
58
|
+
color?: string;
|
|
59
|
+
strokeWidth?: number;
|
|
60
|
+
}
|
|
61
|
+
export interface AreaChartProps extends LineChartProps {
|
|
62
|
+
stacked?: boolean;
|
|
63
|
+
}
|
|
64
|
+
export interface RadarChartAxis {
|
|
65
|
+
key: string;
|
|
66
|
+
label: string;
|
|
67
|
+
max?: number;
|
|
68
|
+
}
|
|
69
|
+
export interface RadarChartSeries {
|
|
70
|
+
id: string;
|
|
71
|
+
label: string;
|
|
72
|
+
values: Record<string, number>;
|
|
73
|
+
color?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface RadarChartProps extends ChartSizeProps {
|
|
76
|
+
axes: RadarChartAxis[];
|
|
77
|
+
series: RadarChartSeries[];
|
|
78
|
+
title?: string;
|
|
79
|
+
description?: string;
|
|
80
|
+
levels?: number;
|
|
81
|
+
colors?: string[];
|
|
82
|
+
}
|
|
83
|
+
export interface HeatMapDatum {
|
|
84
|
+
x: string;
|
|
85
|
+
y: string;
|
|
86
|
+
value: number;
|
|
87
|
+
}
|
|
88
|
+
export interface HeatMapProps extends ChartSizeProps {
|
|
89
|
+
data: HeatMapDatum[];
|
|
90
|
+
title?: string;
|
|
91
|
+
description?: string;
|
|
92
|
+
min?: number;
|
|
93
|
+
max?: number;
|
|
94
|
+
colors?: [string, string];
|
|
95
|
+
}
|
|
96
|
+
export interface GaugeChartProps extends ChartSizeProps {
|
|
97
|
+
value: number;
|
|
98
|
+
min?: number;
|
|
99
|
+
max?: number;
|
|
100
|
+
title?: string;
|
|
101
|
+
description?: string;
|
|
102
|
+
label?: string;
|
|
103
|
+
color?: string;
|
|
104
|
+
}
|
|
105
|
+
export interface FinancialDatum {
|
|
106
|
+
date: string | number;
|
|
107
|
+
open: number;
|
|
108
|
+
high: number;
|
|
109
|
+
low: number;
|
|
110
|
+
close: number;
|
|
111
|
+
volume?: number;
|
|
112
|
+
}
|
|
113
|
+
export interface FinancialChartProps extends ChartSizeProps {
|
|
114
|
+
data: FinancialDatum[];
|
|
115
|
+
title?: string;
|
|
116
|
+
description?: string;
|
|
117
|
+
metric?: "close" | "open" | "high" | "low";
|
|
118
|
+
showVolume?: boolean;
|
|
119
|
+
showGrid?: boolean;
|
|
120
|
+
color?: string;
|
|
121
|
+
volumeColor?: string;
|
|
122
|
+
}
|
|
123
|
+
export interface CandlestickChartProps extends ChartSizeProps {
|
|
124
|
+
data: FinancialDatum[];
|
|
125
|
+
title?: string;
|
|
126
|
+
description?: string;
|
|
127
|
+
showVolume?: boolean;
|
|
128
|
+
showGrid?: boolean;
|
|
129
|
+
upColor?: string;
|
|
130
|
+
downColor?: string;
|
|
131
|
+
volumeColor?: string;
|
|
132
|
+
}
|
|
133
|
+
export declare function LineChart(props: LineChartProps): VNode;
|
|
134
|
+
export declare function BarChart(props: BarChartProps): VNode;
|
|
135
|
+
export declare function PieChart(props: PieChartProps): VNode;
|
|
136
|
+
export declare function AreaChart(props: AreaChartProps): VNode;
|
|
137
|
+
export declare function RadarChart(props: RadarChartProps): VNode;
|
|
138
|
+
export declare function HeatMap(props: HeatMapProps): VNode;
|
|
139
|
+
export declare function GaugeChart(props: GaugeChartProps): VNode;
|
|
140
|
+
export declare function FinancialChart(props: FinancialChartProps): VNode;
|
|
141
|
+
export declare function CandlestickChart(props: CandlestickChartProps): VNode;
|
|
142
|
+
export declare function Sparkline(props: SparklineProps): VNode;
|
|
143
|
+
//# sourceMappingURL=charts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"charts.d.ts","sourceRoot":"","sources":["../../src/components/charts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAoB,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAiCjE,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,IAAI,EAAE,aAAa,EAAE,CAAC;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