a2ui-react 0.3.0 → 0.4.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/dist/index.d.mts +32 -2
- package/dist/index.d.ts +32 -2
- package/dist/index.js +560 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +544 -9
- package/dist/index.mjs.map +1 -1
- package/dist/theme.css +42 -0
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { cva } from 'class-variance-authority';
|
|
|
6
6
|
import { clsx } from 'clsx';
|
|
7
7
|
import { twMerge } from 'tailwind-merge';
|
|
8
8
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
9
|
-
import { X, ChevronDown, ChevronUp, Check, Copy, Trash, Edit, Minus, Plus, Menu, Search, Settings, Download, ThumbsUp, Bookmark, Share, Star, Heart, HelpCircle, Moon, Sun, Bell, Phone, Mail, User, Home, ChevronRight, ChevronLeft, Flame, Zap, Square, Pause, Play, Cloud, icons } from 'lucide-react';
|
|
9
|
+
import { X, ChevronDown, ChevronUp, Check, Copy, Trash, Edit, Minus, Plus, Menu, Search, Settings, Download, ThumbsUp, Bookmark, Share, Star, Heart, HelpCircle, Moon, Sun, Bell, Phone, Mail, User, Home, ChevronRight, ChevronLeft, Flame, Zap, Square, Pause, Play, Cloud, icons, Loader2, Info, AlertCircle, XCircle, CheckCircle, Circle } from 'lucide-react';
|
|
10
10
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
11
11
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
12
12
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
@@ -16,6 +16,7 @@ import * as RechartsPrimitive from 'recharts';
|
|
|
16
16
|
import { AreaChart, CartesianGrid, XAxis, YAxis, Area, BarChart, Bar, Cell, LineChart, Line, PieChart, Pie } from 'recharts';
|
|
17
17
|
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
18
18
|
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
19
|
+
import ReactMarkdown from 'react-markdown';
|
|
19
20
|
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
20
21
|
|
|
21
22
|
// ../core/dist/index.mjs
|
|
@@ -1068,10 +1069,10 @@ function useReducedMotion() {
|
|
|
1068
1069
|
return prefersReducedMotion;
|
|
1069
1070
|
}
|
|
1070
1071
|
var variantStyles = {
|
|
1071
|
-
info: "bg-
|
|
1072
|
-
warning: "bg-
|
|
1073
|
-
error: "bg-
|
|
1074
|
-
success: "bg-
|
|
1072
|
+
info: "bg-info border-info-border text-info-foreground",
|
|
1073
|
+
warning: "bg-warning border-warning-border text-warning-foreground",
|
|
1074
|
+
error: "bg-error border-error-border text-error-foreground",
|
|
1075
|
+
success: "bg-success border-success-border text-success-foreground"
|
|
1075
1076
|
};
|
|
1076
1077
|
var variantIcons = {
|
|
1077
1078
|
info: "\u{1F4A1}",
|
|
@@ -1087,6 +1088,7 @@ var AlertRenderer = {
|
|
|
1087
1088
|
"div",
|
|
1088
1089
|
{
|
|
1089
1090
|
id,
|
|
1091
|
+
"data-a2ui-component": "Alert",
|
|
1090
1092
|
role: "alert",
|
|
1091
1093
|
className: cn("relative rounded-lg border p-4", variantStyles[variant]),
|
|
1092
1094
|
children: /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
|
|
@@ -1102,7 +1104,7 @@ var AlertRenderer = {
|
|
|
1102
1104
|
example: {
|
|
1103
1105
|
name: "Alert",
|
|
1104
1106
|
description: "Accessible alert component with screen reader announcement",
|
|
1105
|
-
category: "
|
|
1107
|
+
category: "display",
|
|
1106
1108
|
messages: [
|
|
1107
1109
|
{ createSurface: { surfaceId: "alert-example", root: "col-1" } },
|
|
1108
1110
|
{
|
|
@@ -1598,7 +1600,7 @@ var ProgressRenderer = {
|
|
|
1598
1600
|
const value = component.value;
|
|
1599
1601
|
const isIndeterminate = value === void 0;
|
|
1600
1602
|
const percentage = isIndeterminate ? 0 : Math.min(100, Math.max(0, value / max * 100));
|
|
1601
|
-
return /* @__PURE__ */ jsxs("div", { className: "w-full space-y-1", children: [
|
|
1603
|
+
return /* @__PURE__ */ jsxs("div", { "data-a2ui-component": "Progress", className: "w-full space-y-1", children: [
|
|
1602
1604
|
component.label && /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
1603
1605
|
/* @__PURE__ */ jsx("span", { children: component.label }),
|
|
1604
1606
|
!isIndeterminate && /* @__PURE__ */ jsxs("span", { children: [
|
|
@@ -1634,7 +1636,7 @@ var ProgressRenderer = {
|
|
|
1634
1636
|
example: {
|
|
1635
1637
|
name: "Progress",
|
|
1636
1638
|
description: "Accessible progress indicator with determinate and indeterminate states",
|
|
1637
|
-
category: "
|
|
1639
|
+
category: "display",
|
|
1638
1640
|
messages: [
|
|
1639
1641
|
{ createSurface: { surfaceId: "progress-example", root: "col-1" } },
|
|
1640
1642
|
{
|
|
@@ -7008,6 +7010,155 @@ var ModalRenderer = {
|
|
|
7008
7010
|
]
|
|
7009
7011
|
}
|
|
7010
7012
|
};
|
|
7013
|
+
var StepperRenderer = {
|
|
7014
|
+
type: "Stepper",
|
|
7015
|
+
render: ({ component, id }) => {
|
|
7016
|
+
const orientation = component.orientation || "horizontal";
|
|
7017
|
+
const activeStep = component.activeStep ?? 0;
|
|
7018
|
+
const getStepStatus = (index, step) => {
|
|
7019
|
+
if (step.status) return step.status;
|
|
7020
|
+
if (index < activeStep) return "completed";
|
|
7021
|
+
if (index === activeStep) return "current";
|
|
7022
|
+
return "pending";
|
|
7023
|
+
};
|
|
7024
|
+
const statusStyles = {
|
|
7025
|
+
pending: "border-muted-foreground/30 bg-background text-muted-foreground",
|
|
7026
|
+
current: "border-primary bg-primary text-primary-foreground",
|
|
7027
|
+
completed: "border-primary bg-primary text-primary-foreground",
|
|
7028
|
+
error: "border-destructive bg-destructive text-destructive-foreground"
|
|
7029
|
+
};
|
|
7030
|
+
const StatusIcon = ({ status }) => {
|
|
7031
|
+
switch (status) {
|
|
7032
|
+
case "completed":
|
|
7033
|
+
return /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" });
|
|
7034
|
+
case "error":
|
|
7035
|
+
return /* @__PURE__ */ jsx(X, { className: "h-4 w-4" });
|
|
7036
|
+
default:
|
|
7037
|
+
return /* @__PURE__ */ jsx(Circle, { className: "h-2 w-2 fill-current" });
|
|
7038
|
+
}
|
|
7039
|
+
};
|
|
7040
|
+
return /* @__PURE__ */ jsx(
|
|
7041
|
+
"div",
|
|
7042
|
+
{
|
|
7043
|
+
id,
|
|
7044
|
+
"data-a2ui-component": "Stepper",
|
|
7045
|
+
className: cn(
|
|
7046
|
+
"flex",
|
|
7047
|
+
orientation === "horizontal" ? "flex-row items-start" : "flex-col"
|
|
7048
|
+
),
|
|
7049
|
+
role: "list",
|
|
7050
|
+
"aria-label": "Progress steps",
|
|
7051
|
+
children: component.steps.map((step, index) => {
|
|
7052
|
+
const status = getStepStatus(index, step);
|
|
7053
|
+
const isLast = index === component.steps.length - 1;
|
|
7054
|
+
return /* @__PURE__ */ jsxs(
|
|
7055
|
+
"div",
|
|
7056
|
+
{
|
|
7057
|
+
className: cn(
|
|
7058
|
+
"flex",
|
|
7059
|
+
orientation === "horizontal" ? "flex-1 flex-col items-center" : "flex-row items-start"
|
|
7060
|
+
),
|
|
7061
|
+
role: "listitem",
|
|
7062
|
+
"aria-current": status === "current" ? "step" : void 0,
|
|
7063
|
+
children: [
|
|
7064
|
+
/* @__PURE__ */ jsxs(
|
|
7065
|
+
"div",
|
|
7066
|
+
{
|
|
7067
|
+
className: cn(
|
|
7068
|
+
"flex items-center",
|
|
7069
|
+
orientation === "horizontal" ? "flex-col" : "flex-row"
|
|
7070
|
+
),
|
|
7071
|
+
children: [
|
|
7072
|
+
/* @__PURE__ */ jsx(
|
|
7073
|
+
"div",
|
|
7074
|
+
{
|
|
7075
|
+
className: cn(
|
|
7076
|
+
"flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors",
|
|
7077
|
+
statusStyles[status]
|
|
7078
|
+
),
|
|
7079
|
+
children: /* @__PURE__ */ jsx(StatusIcon, { status })
|
|
7080
|
+
}
|
|
7081
|
+
),
|
|
7082
|
+
!isLast && /* @__PURE__ */ jsx(
|
|
7083
|
+
"div",
|
|
7084
|
+
{
|
|
7085
|
+
className: cn(
|
|
7086
|
+
"transition-colors",
|
|
7087
|
+
orientation === "horizontal" ? "mt-4 h-0.5 w-full min-w-[40px]" : "ml-4 h-full min-h-[40px] w-0.5",
|
|
7088
|
+
index < activeStep ? "bg-primary" : "bg-muted-foreground/30"
|
|
7089
|
+
)
|
|
7090
|
+
}
|
|
7091
|
+
)
|
|
7092
|
+
]
|
|
7093
|
+
}
|
|
7094
|
+
),
|
|
7095
|
+
/* @__PURE__ */ jsxs(
|
|
7096
|
+
"div",
|
|
7097
|
+
{
|
|
7098
|
+
className: cn(
|
|
7099
|
+
"text-center",
|
|
7100
|
+
orientation === "horizontal" ? "mt-2" : "ml-4"
|
|
7101
|
+
),
|
|
7102
|
+
children: [
|
|
7103
|
+
/* @__PURE__ */ jsx(
|
|
7104
|
+
"div",
|
|
7105
|
+
{
|
|
7106
|
+
className: cn(
|
|
7107
|
+
"text-sm font-medium",
|
|
7108
|
+
status === "current" ? "text-foreground" : "text-muted-foreground"
|
|
7109
|
+
),
|
|
7110
|
+
children: step.label
|
|
7111
|
+
}
|
|
7112
|
+
),
|
|
7113
|
+
step.description && /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground mt-0.5", children: step.description })
|
|
7114
|
+
]
|
|
7115
|
+
}
|
|
7116
|
+
)
|
|
7117
|
+
]
|
|
7118
|
+
},
|
|
7119
|
+
step.id
|
|
7120
|
+
);
|
|
7121
|
+
})
|
|
7122
|
+
}
|
|
7123
|
+
);
|
|
7124
|
+
},
|
|
7125
|
+
example: {
|
|
7126
|
+
name: "Stepper",
|
|
7127
|
+
description: "Step-by-step progress indicator for wizards and multi-step forms",
|
|
7128
|
+
category: "container",
|
|
7129
|
+
messages: [
|
|
7130
|
+
{ createSurface: { surfaceId: "stepper-demo", root: "root" } },
|
|
7131
|
+
{
|
|
7132
|
+
updateComponents: {
|
|
7133
|
+
surfaceId: "stepper-demo",
|
|
7134
|
+
components: [
|
|
7135
|
+
{
|
|
7136
|
+
id: "root",
|
|
7137
|
+
component: {
|
|
7138
|
+
type: "Column",
|
|
7139
|
+
id: "root",
|
|
7140
|
+
children: ["stepper"]
|
|
7141
|
+
}
|
|
7142
|
+
},
|
|
7143
|
+
{
|
|
7144
|
+
id: "stepper",
|
|
7145
|
+
component: {
|
|
7146
|
+
type: "Stepper",
|
|
7147
|
+
id: "stepper",
|
|
7148
|
+
activeStep: 1,
|
|
7149
|
+
steps: [
|
|
7150
|
+
{ id: "step1", label: "Account", description: "Create your account" },
|
|
7151
|
+
{ id: "step2", label: "Profile", description: "Set up your profile" },
|
|
7152
|
+
{ id: "step3", label: "Review", description: "Review and submit" }
|
|
7153
|
+
]
|
|
7154
|
+
}
|
|
7155
|
+
}
|
|
7156
|
+
]
|
|
7157
|
+
}
|
|
7158
|
+
}
|
|
7159
|
+
]
|
|
7160
|
+
}
|
|
7161
|
+
};
|
|
7011
7162
|
var TabsRenderer = {
|
|
7012
7163
|
type: "Tabs",
|
|
7013
7164
|
render: ({ component, children }) => {
|
|
@@ -7526,6 +7677,267 @@ var ImageRenderer = {
|
|
|
7526
7677
|
]
|
|
7527
7678
|
}
|
|
7528
7679
|
};
|
|
7680
|
+
var MarkdownRenderer = {
|
|
7681
|
+
type: "Markdown",
|
|
7682
|
+
render: ({ component, data }) => {
|
|
7683
|
+
const content = component.dataPath ? data.get(component.dataPath) ?? component.text : component.text;
|
|
7684
|
+
return /* @__PURE__ */ jsx(
|
|
7685
|
+
"div",
|
|
7686
|
+
{
|
|
7687
|
+
"data-a2ui-component": "Markdown",
|
|
7688
|
+
className: cn(
|
|
7689
|
+
"prose prose-sm dark:prose-invert max-w-none",
|
|
7690
|
+
// Headings
|
|
7691
|
+
"prose-headings:font-semibold prose-headings:tracking-tight",
|
|
7692
|
+
"prose-h1:text-3xl prose-h2:text-2xl prose-h3:text-xl",
|
|
7693
|
+
// Links
|
|
7694
|
+
"prose-a:text-primary prose-a:no-underline hover:prose-a:underline",
|
|
7695
|
+
// Code
|
|
7696
|
+
"prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:text-sm",
|
|
7697
|
+
"prose-pre:bg-muted prose-pre:border prose-pre:border-border",
|
|
7698
|
+
// Lists
|
|
7699
|
+
"prose-ul:my-2 prose-ol:my-2 prose-li:my-0",
|
|
7700
|
+
// Blockquotes
|
|
7701
|
+
"prose-blockquote:border-l-primary prose-blockquote:text-muted-foreground"
|
|
7702
|
+
),
|
|
7703
|
+
children: /* @__PURE__ */ jsx(ReactMarkdown, { children: content || "" })
|
|
7704
|
+
}
|
|
7705
|
+
);
|
|
7706
|
+
},
|
|
7707
|
+
example: {
|
|
7708
|
+
name: "Markdown",
|
|
7709
|
+
description: "Renders markdown content with full formatting support",
|
|
7710
|
+
category: "display",
|
|
7711
|
+
messages: [
|
|
7712
|
+
{ createSurface: { surfaceId: "markdown-demo", root: "root" } },
|
|
7713
|
+
{
|
|
7714
|
+
updateComponents: {
|
|
7715
|
+
surfaceId: "markdown-demo",
|
|
7716
|
+
components: [
|
|
7717
|
+
{
|
|
7718
|
+
id: "root",
|
|
7719
|
+
component: {
|
|
7720
|
+
type: "Column",
|
|
7721
|
+
id: "root",
|
|
7722
|
+
children: ["md"]
|
|
7723
|
+
}
|
|
7724
|
+
},
|
|
7725
|
+
{
|
|
7726
|
+
id: "md",
|
|
7727
|
+
component: {
|
|
7728
|
+
type: "Markdown",
|
|
7729
|
+
id: "md",
|
|
7730
|
+
text: `# Markdown Demo
|
|
7731
|
+
|
|
7732
|
+
This is a **bold** and *italic* text example.
|
|
7733
|
+
|
|
7734
|
+
## Features
|
|
7735
|
+
|
|
7736
|
+
- Headings (h1-h6)
|
|
7737
|
+
- **Bold** and *italic* text
|
|
7738
|
+
- [Links](https://example.com)
|
|
7739
|
+
- Lists (ordered and unordered)
|
|
7740
|
+
|
|
7741
|
+
### Code
|
|
7742
|
+
|
|
7743
|
+
Inline \`code\` and code blocks:
|
|
7744
|
+
|
|
7745
|
+
\`\`\`javascript
|
|
7746
|
+
const hello = "world";
|
|
7747
|
+
\`\`\`
|
|
7748
|
+
|
|
7749
|
+
> Blockquotes are also supported!
|
|
7750
|
+
`
|
|
7751
|
+
}
|
|
7752
|
+
}
|
|
7753
|
+
]
|
|
7754
|
+
}
|
|
7755
|
+
}
|
|
7756
|
+
]
|
|
7757
|
+
}
|
|
7758
|
+
};
|
|
7759
|
+
var SkeletonRenderer = {
|
|
7760
|
+
type: "Skeleton",
|
|
7761
|
+
render: ({ component, id }) => {
|
|
7762
|
+
const variant = component.variant || "rectangular";
|
|
7763
|
+
const variantClasses = {
|
|
7764
|
+
text: "rounded",
|
|
7765
|
+
circular: "rounded-full",
|
|
7766
|
+
rectangular: "rounded-md"
|
|
7767
|
+
};
|
|
7768
|
+
return /* @__PURE__ */ jsx(
|
|
7769
|
+
"div",
|
|
7770
|
+
{
|
|
7771
|
+
id,
|
|
7772
|
+
"data-a2ui-component": "Skeleton",
|
|
7773
|
+
role: "status",
|
|
7774
|
+
"aria-label": "Loading content",
|
|
7775
|
+
className: cn(
|
|
7776
|
+
"animate-pulse bg-muted",
|
|
7777
|
+
variantClasses[variant]
|
|
7778
|
+
),
|
|
7779
|
+
style: {
|
|
7780
|
+
width: component.width || "100%",
|
|
7781
|
+
height: component.height || (variant === "text" ? "1rem" : "100px")
|
|
7782
|
+
},
|
|
7783
|
+
children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading..." })
|
|
7784
|
+
}
|
|
7785
|
+
);
|
|
7786
|
+
},
|
|
7787
|
+
example: {
|
|
7788
|
+
name: "Skeleton",
|
|
7789
|
+
description: "Content placeholder while loading",
|
|
7790
|
+
category: "display",
|
|
7791
|
+
messages: [
|
|
7792
|
+
{ createSurface: { surfaceId: "skeleton-demo", root: "root" } },
|
|
7793
|
+
{
|
|
7794
|
+
updateComponents: {
|
|
7795
|
+
surfaceId: "skeleton-demo",
|
|
7796
|
+
components: [
|
|
7797
|
+
{
|
|
7798
|
+
id: "root",
|
|
7799
|
+
component: {
|
|
7800
|
+
type: "Column",
|
|
7801
|
+
id: "root",
|
|
7802
|
+
children: ["card-skeleton"]
|
|
7803
|
+
}
|
|
7804
|
+
},
|
|
7805
|
+
{
|
|
7806
|
+
id: "card-skeleton",
|
|
7807
|
+
component: {
|
|
7808
|
+
type: "Row",
|
|
7809
|
+
id: "card-skeleton",
|
|
7810
|
+
children: ["avatar", "content"],
|
|
7811
|
+
alignment: "start"
|
|
7812
|
+
}
|
|
7813
|
+
},
|
|
7814
|
+
{
|
|
7815
|
+
id: "avatar",
|
|
7816
|
+
component: {
|
|
7817
|
+
type: "Skeleton",
|
|
7818
|
+
id: "avatar",
|
|
7819
|
+
variant: "circular",
|
|
7820
|
+
width: "48px",
|
|
7821
|
+
height: "48px"
|
|
7822
|
+
}
|
|
7823
|
+
},
|
|
7824
|
+
{
|
|
7825
|
+
id: "content",
|
|
7826
|
+
component: {
|
|
7827
|
+
type: "Column",
|
|
7828
|
+
id: "content",
|
|
7829
|
+
children: ["line1", "line2"]
|
|
7830
|
+
}
|
|
7831
|
+
},
|
|
7832
|
+
{
|
|
7833
|
+
id: "line1",
|
|
7834
|
+
component: {
|
|
7835
|
+
type: "Skeleton",
|
|
7836
|
+
id: "line1",
|
|
7837
|
+
variant: "text",
|
|
7838
|
+
width: "200px",
|
|
7839
|
+
height: "1rem"
|
|
7840
|
+
}
|
|
7841
|
+
},
|
|
7842
|
+
{
|
|
7843
|
+
id: "line2",
|
|
7844
|
+
component: {
|
|
7845
|
+
type: "Skeleton",
|
|
7846
|
+
id: "line2",
|
|
7847
|
+
variant: "text",
|
|
7848
|
+
width: "150px",
|
|
7849
|
+
height: "1rem"
|
|
7850
|
+
}
|
|
7851
|
+
}
|
|
7852
|
+
]
|
|
7853
|
+
}
|
|
7854
|
+
}
|
|
7855
|
+
]
|
|
7856
|
+
}
|
|
7857
|
+
};
|
|
7858
|
+
var sizeClasses = {
|
|
7859
|
+
sm: "h-4 w-4",
|
|
7860
|
+
md: "h-6 w-6",
|
|
7861
|
+
lg: "h-10 w-10"
|
|
7862
|
+
};
|
|
7863
|
+
var SpinnerRenderer = {
|
|
7864
|
+
type: "Spinner",
|
|
7865
|
+
render: ({ component, id }) => {
|
|
7866
|
+
const size = component.size || "md";
|
|
7867
|
+
return /* @__PURE__ */ jsxs(
|
|
7868
|
+
"div",
|
|
7869
|
+
{
|
|
7870
|
+
id,
|
|
7871
|
+
"data-a2ui-component": "Spinner",
|
|
7872
|
+
role: "status",
|
|
7873
|
+
"aria-label": component.label || "Loading",
|
|
7874
|
+
className: "inline-flex items-center justify-center",
|
|
7875
|
+
children: [
|
|
7876
|
+
/* @__PURE__ */ jsx(
|
|
7877
|
+
Loader2,
|
|
7878
|
+
{
|
|
7879
|
+
className: cn("animate-spin text-muted-foreground", sizeClasses[size]),
|
|
7880
|
+
"aria-hidden": "true"
|
|
7881
|
+
}
|
|
7882
|
+
),
|
|
7883
|
+
component.label && /* @__PURE__ */ jsx("span", { className: "sr-only", children: component.label })
|
|
7884
|
+
]
|
|
7885
|
+
}
|
|
7886
|
+
);
|
|
7887
|
+
},
|
|
7888
|
+
example: {
|
|
7889
|
+
name: "Spinner",
|
|
7890
|
+
description: "Loading indicator with different sizes",
|
|
7891
|
+
category: "display",
|
|
7892
|
+
messages: [
|
|
7893
|
+
{ createSurface: { surfaceId: "spinner-demo", root: "root" } },
|
|
7894
|
+
{
|
|
7895
|
+
updateComponents: {
|
|
7896
|
+
surfaceId: "spinner-demo",
|
|
7897
|
+
components: [
|
|
7898
|
+
{
|
|
7899
|
+
id: "root",
|
|
7900
|
+
component: {
|
|
7901
|
+
type: "Row",
|
|
7902
|
+
id: "root",
|
|
7903
|
+
children: ["spinner-sm", "spinner-md", "spinner-lg"],
|
|
7904
|
+
distribution: "spaceAround",
|
|
7905
|
+
alignment: "center"
|
|
7906
|
+
}
|
|
7907
|
+
},
|
|
7908
|
+
{
|
|
7909
|
+
id: "spinner-sm",
|
|
7910
|
+
component: {
|
|
7911
|
+
type: "Spinner",
|
|
7912
|
+
id: "spinner-sm",
|
|
7913
|
+
size: "sm",
|
|
7914
|
+
label: "Loading small"
|
|
7915
|
+
}
|
|
7916
|
+
},
|
|
7917
|
+
{
|
|
7918
|
+
id: "spinner-md",
|
|
7919
|
+
component: {
|
|
7920
|
+
type: "Spinner",
|
|
7921
|
+
id: "spinner-md",
|
|
7922
|
+
size: "md",
|
|
7923
|
+
label: "Loading medium"
|
|
7924
|
+
}
|
|
7925
|
+
},
|
|
7926
|
+
{
|
|
7927
|
+
id: "spinner-lg",
|
|
7928
|
+
component: {
|
|
7929
|
+
type: "Spinner",
|
|
7930
|
+
id: "spinner-lg",
|
|
7931
|
+
size: "lg",
|
|
7932
|
+
label: "Loading large"
|
|
7933
|
+
}
|
|
7934
|
+
}
|
|
7935
|
+
]
|
|
7936
|
+
}
|
|
7937
|
+
}
|
|
7938
|
+
]
|
|
7939
|
+
}
|
|
7940
|
+
};
|
|
7529
7941
|
var TextRenderer = {
|
|
7530
7942
|
type: "Text",
|
|
7531
7943
|
render: ({ component, data }) => {
|
|
@@ -7639,6 +8051,122 @@ var TextRenderer = {
|
|
|
7639
8051
|
]
|
|
7640
8052
|
}
|
|
7641
8053
|
};
|
|
8054
|
+
var variantStyles2 = {
|
|
8055
|
+
default: "bg-background border-border",
|
|
8056
|
+
success: "bg-success border-success-border text-success-foreground",
|
|
8057
|
+
error: "bg-error border-error-border text-error-foreground",
|
|
8058
|
+
warning: "bg-warning border-warning-border text-warning-foreground",
|
|
8059
|
+
info: "bg-info border-info-border text-info-foreground"
|
|
8060
|
+
};
|
|
8061
|
+
var variantIcons2 = {
|
|
8062
|
+
default: null,
|
|
8063
|
+
success: CheckCircle,
|
|
8064
|
+
error: XCircle,
|
|
8065
|
+
warning: AlertCircle,
|
|
8066
|
+
info: Info
|
|
8067
|
+
};
|
|
8068
|
+
var ToastRenderer = {
|
|
8069
|
+
type: "Toast",
|
|
8070
|
+
render: ({ component, id, onAction }) => {
|
|
8071
|
+
const variant = component.variant || "default";
|
|
8072
|
+
const Icon2 = variantIcons2[variant];
|
|
8073
|
+
return /* @__PURE__ */ jsxs(
|
|
8074
|
+
"div",
|
|
8075
|
+
{
|
|
8076
|
+
id,
|
|
8077
|
+
"data-a2ui-component": "Toast",
|
|
8078
|
+
role: "alert",
|
|
8079
|
+
"aria-live": "polite",
|
|
8080
|
+
className: cn(
|
|
8081
|
+
"pointer-events-auto relative flex w-full max-w-sm items-start gap-3 rounded-lg border p-4 shadow-lg",
|
|
8082
|
+
variantStyles2[variant]
|
|
8083
|
+
),
|
|
8084
|
+
children: [
|
|
8085
|
+
Icon2 && /* @__PURE__ */ jsx(Icon2, { className: "h-5 w-5 flex-shrink-0 mt-0.5", "aria-hidden": "true" }),
|
|
8086
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-1", children: [
|
|
8087
|
+
component.title && /* @__PURE__ */ jsx("div", { className: "text-sm font-semibold text-foreground", children: component.title }),
|
|
8088
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: component.message }),
|
|
8089
|
+
component.actionLabel && component.action && /* @__PURE__ */ jsx(
|
|
8090
|
+
"button",
|
|
8091
|
+
{
|
|
8092
|
+
type: "button",
|
|
8093
|
+
onClick: () => onAction?.({ type: component.action, payload: { id: component.id } }),
|
|
8094
|
+
className: "text-sm font-medium text-primary hover:underline mt-2",
|
|
8095
|
+
children: component.actionLabel
|
|
8096
|
+
}
|
|
8097
|
+
)
|
|
8098
|
+
] }),
|
|
8099
|
+
/* @__PURE__ */ jsx(
|
|
8100
|
+
"button",
|
|
8101
|
+
{
|
|
8102
|
+
type: "button",
|
|
8103
|
+
onClick: () => onAction?.({ type: "toast.dismiss", payload: { id: component.id } }),
|
|
8104
|
+
className: "absolute right-2 top-2 rounded-md p-1 text-muted-foreground hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring",
|
|
8105
|
+
"aria-label": "Dismiss",
|
|
8106
|
+
children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
|
|
8107
|
+
}
|
|
8108
|
+
)
|
|
8109
|
+
]
|
|
8110
|
+
}
|
|
8111
|
+
);
|
|
8112
|
+
},
|
|
8113
|
+
example: {
|
|
8114
|
+
name: "Toast",
|
|
8115
|
+
description: "Notification toast with variants and optional action",
|
|
8116
|
+
category: "display",
|
|
8117
|
+
messages: [
|
|
8118
|
+
{ createSurface: { surfaceId: "toast-demo", root: "root" } },
|
|
8119
|
+
{
|
|
8120
|
+
updateComponents: {
|
|
8121
|
+
surfaceId: "toast-demo",
|
|
8122
|
+
components: [
|
|
8123
|
+
{
|
|
8124
|
+
id: "root",
|
|
8125
|
+
component: {
|
|
8126
|
+
type: "Column",
|
|
8127
|
+
id: "root",
|
|
8128
|
+
children: ["toast-success", "toast-error", "toast-info"]
|
|
8129
|
+
}
|
|
8130
|
+
},
|
|
8131
|
+
{
|
|
8132
|
+
id: "toast-success",
|
|
8133
|
+
component: {
|
|
8134
|
+
type: "Toast",
|
|
8135
|
+
id: "toast-success",
|
|
8136
|
+
variant: "success",
|
|
8137
|
+
title: "Success!",
|
|
8138
|
+
message: "Your changes have been saved."
|
|
8139
|
+
}
|
|
8140
|
+
},
|
|
8141
|
+
{
|
|
8142
|
+
id: "toast-error",
|
|
8143
|
+
component: {
|
|
8144
|
+
type: "Toast",
|
|
8145
|
+
id: "toast-error",
|
|
8146
|
+
variant: "error",
|
|
8147
|
+
title: "Error",
|
|
8148
|
+
message: "Something went wrong. Please try again.",
|
|
8149
|
+
actionLabel: "Retry",
|
|
8150
|
+
action: "retry"
|
|
8151
|
+
}
|
|
8152
|
+
},
|
|
8153
|
+
{
|
|
8154
|
+
id: "toast-info",
|
|
8155
|
+
component: {
|
|
8156
|
+
type: "Toast",
|
|
8157
|
+
id: "toast-info",
|
|
8158
|
+
variant: "info",
|
|
8159
|
+
message: "New version available!",
|
|
8160
|
+
actionLabel: "Update",
|
|
8161
|
+
action: "update"
|
|
8162
|
+
}
|
|
8163
|
+
}
|
|
8164
|
+
]
|
|
8165
|
+
}
|
|
8166
|
+
}
|
|
8167
|
+
]
|
|
8168
|
+
}
|
|
8169
|
+
};
|
|
7642
8170
|
var VideoRenderer = {
|
|
7643
8171
|
type: "Video",
|
|
7644
8172
|
render: ({ component }) => {
|
|
@@ -8919,6 +9447,12 @@ var shadcnRenderers = [
|
|
|
8919
9447
|
ColumnRenderer,
|
|
8920
9448
|
// Display
|
|
8921
9449
|
TextRenderer,
|
|
9450
|
+
MarkdownRenderer,
|
|
9451
|
+
SpinnerRenderer,
|
|
9452
|
+
SkeletonRenderer,
|
|
9453
|
+
ToastRenderer,
|
|
9454
|
+
AlertRenderer,
|
|
9455
|
+
ProgressRenderer,
|
|
8922
9456
|
ImageRenderer,
|
|
8923
9457
|
IconRenderer,
|
|
8924
9458
|
DividerRenderer,
|
|
@@ -8937,6 +9471,7 @@ var shadcnRenderers = [
|
|
|
8937
9471
|
CardRenderer,
|
|
8938
9472
|
ModalRenderer,
|
|
8939
9473
|
TabsRenderer,
|
|
9474
|
+
StepperRenderer,
|
|
8940
9475
|
ListRenderer,
|
|
8941
9476
|
// Charts
|
|
8942
9477
|
PieChartRenderer,
|
|
@@ -9072,6 +9607,6 @@ function createCompleteRegistry() {
|
|
|
9072
9607
|
// src/index.ts
|
|
9073
9608
|
var version = "0.1.0";
|
|
9074
9609
|
|
|
9075
|
-
export { A2UIContext, A2UIProvider, A2UISurface, AlertRenderer, AnimatedAccordionRenderer, AnimatedAvatarGroupRenderer, AnimatedButtonOverride, AnimatedCardOverride, AnimatedCardRenderer, AnimatedCheckboxOverride, AnimatedDialogRenderer, AnimatedModalOverride, AnimatedSelectOverride, AnimatedTabsOverride, AnimatedTabsRenderer, AnimatedTextOverride, AnimatedTooltipRenderer, AreaChartRenderer, ArticleRenderer, AsideRenderer, AuroraBackgroundRenderer, BarChartRenderer, BlurRevealTextRenderer, BubbleBackgroundRenderer, Button, Checkbox, ComponentRenderer, CopyButtonRenderer, CountUpRenderer, CursorRenderer, DEFAULT_CHART_COLORS, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, FireworksBackgroundRenderer, FlipButtonRenderer, FlipCardRenderer, FooterRenderer, GlowButtonRenderer, GradientBackgroundRenderer, GradientTextRenderer, GravityStarsBackgroundRenderer, HeaderRenderer, HexagonBackgroundRenderer, HoleBackgroundRenderer, IconButtonRenderer, Input, Label, LineChartRenderer, LiquidButtonRenderer, LiveRegionRenderer, MagneticButtonRenderer, MainRenderer, MessageParseError, MorphingIconRenderer, NavRenderer, ParticlesBackgroundRenderer, PieChartRenderer, ProgressRenderer, RippleButtonRenderer, SectionRenderer, ShimmerButtonRenderer, SkipLinkRenderer, SpotlightRenderer, StarsBackgroundRenderer, Tabs, TabsContent, TabsList, TabsTrigger, TextScrambleRenderer, Textarea, ThemeTogglerButtonRenderer, TypewriterTextRenderer, a11yRenderers, allAnimatedRenderers, allRenderers, animatedOverrides, animatedRenderers, buildChartConfig, buildMessages, buttonVariants, c, chartRenderers, cn, createAccessibleRegistry, createAnimatedRegistry, createCompleteRegistry, createFullyAnimatedRegistry, createRegistry, createShadcnRegistry, createStore, createStreamParser, getChartColor, getChartData, getDataByPath, isBeginRenderingMessage, isDataModelUpdateMessage, isDeleteSurfaceMessage, isSurfaceUpdateMessage, parseJSONL, parseMessage, setDataByPath, shadcnRenderers, transformToRechartsData, useA2UI, useAction, useContainerDimensions, useDataBinding, useReducedMotion, useSurface, version };
|
|
9610
|
+
export { A2UIContext, A2UIProvider, A2UISurface, AlertRenderer, AnimatedAccordionRenderer, AnimatedAvatarGroupRenderer, AnimatedButtonOverride, AnimatedCardOverride, AnimatedCardRenderer, AnimatedCheckboxOverride, AnimatedDialogRenderer, AnimatedModalOverride, AnimatedSelectOverride, AnimatedTabsOverride, AnimatedTabsRenderer, AnimatedTextOverride, AnimatedTooltipRenderer, AreaChartRenderer, ArticleRenderer, AsideRenderer, AudioPlayerRenderer, AuroraBackgroundRenderer, BarChartRenderer, BlurRevealTextRenderer, BubbleBackgroundRenderer, Button, CardRenderer, Checkbox, ComponentRenderer, CopyButtonRenderer, CountUpRenderer, CursorRenderer, DEFAULT_CHART_COLORS, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DividerRenderer, FireworksBackgroundRenderer, FlipButtonRenderer, FlipCardRenderer, FooterRenderer, GlowButtonRenderer, GradientBackgroundRenderer, GradientTextRenderer, GravityStarsBackgroundRenderer, HeaderRenderer, HexagonBackgroundRenderer, HoleBackgroundRenderer, IconButtonRenderer, IconRenderer, ImageRenderer, Input, Label, LineChartRenderer, LiquidButtonRenderer, ListRenderer, LiveRegionRenderer, MagneticButtonRenderer, MainRenderer, MarkdownRenderer, MessageParseError, ModalRenderer, MorphingIconRenderer, NavRenderer, ParticlesBackgroundRenderer, PieChartRenderer, ProgressRenderer, RippleButtonRenderer, SectionRenderer, ShimmerButtonRenderer, SkeletonRenderer, SkipLinkRenderer, SpinnerRenderer, SpotlightRenderer, StarsBackgroundRenderer, StepperRenderer, Tabs, TabsContent, TabsList, TabsRenderer, TabsTrigger, TextRenderer, TextScrambleRenderer, Textarea, ThemeTogglerButtonRenderer, ToastRenderer, TypewriterTextRenderer, VideoRenderer, a11yRenderers, allAnimatedRenderers, allRenderers, animatedOverrides, animatedRenderers, buildChartConfig, buildMessages, buttonVariants, c, chartRenderers, cn, createAccessibleRegistry, createAnimatedRegistry, createCompleteRegistry, createFullyAnimatedRegistry, createRegistry, createShadcnRegistry, createStore, createStreamParser, getChartColor, getChartData, getDataByPath, isBeginRenderingMessage, isDataModelUpdateMessage, isDeleteSurfaceMessage, isSurfaceUpdateMessage, parseJSONL, parseMessage, setDataByPath, shadcnRenderers, transformToRechartsData, useA2UI, useAction, useContainerDimensions, useDataBinding, useReducedMotion, useSurface, version };
|
|
9076
9611
|
//# sourceMappingURL=index.mjs.map
|
|
9077
9612
|
//# sourceMappingURL=index.mjs.map
|