a2ui-react 0.3.0 → 0.5.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/README.md +9 -29
- package/dist/index.d.mts +32 -2
- package/dist/index.d.ts +32 -2
- package/dist/index.js +571 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +556 -16
- package/dist/index.mjs.map +1 -1
- package/dist/theme.css +42 -0
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -16,8 +16,11 @@ var SelectPrimitive = require('@radix-ui/react-select');
|
|
|
16
16
|
var RechartsPrimitive = require('recharts');
|
|
17
17
|
var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
|
|
18
18
|
var SeparatorPrimitive = require('@radix-ui/react-separator');
|
|
19
|
+
var ReactMarkdown = require('react-markdown');
|
|
19
20
|
var SliderPrimitive = require('@radix-ui/react-slider');
|
|
20
21
|
|
|
22
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
+
|
|
21
24
|
function _interopNamespace(e) {
|
|
22
25
|
if (e && e.__esModule) return e;
|
|
23
26
|
var n = Object.create(null);
|
|
@@ -45,6 +48,7 @@ var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive)
|
|
|
45
48
|
var RechartsPrimitive__namespace = /*#__PURE__*/_interopNamespace(RechartsPrimitive);
|
|
46
49
|
var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
|
|
47
50
|
var SeparatorPrimitive__namespace = /*#__PURE__*/_interopNamespace(SeparatorPrimitive);
|
|
51
|
+
var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
|
|
48
52
|
var SliderPrimitive__namespace = /*#__PURE__*/_interopNamespace(SliderPrimitive);
|
|
49
53
|
|
|
50
54
|
// ../core/dist/index.mjs
|
|
@@ -692,8 +696,13 @@ function A2UISurface({
|
|
|
692
696
|
const surface = useSurface(surfaceId);
|
|
693
697
|
const [loading, setLoading] = React7.useState(false);
|
|
694
698
|
const [error, setError] = React7.useState(null);
|
|
699
|
+
const processedMessagesRef = React7.useRef(null);
|
|
695
700
|
React7.useEffect(() => {
|
|
696
701
|
if (messages) {
|
|
702
|
+
if (messages === processedMessagesRef.current) {
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
processedMessagesRef.current = messages;
|
|
697
706
|
try {
|
|
698
707
|
for (const message of messages) {
|
|
699
708
|
processMessage(message, store);
|
|
@@ -1097,10 +1106,10 @@ function useReducedMotion() {
|
|
|
1097
1106
|
return prefersReducedMotion;
|
|
1098
1107
|
}
|
|
1099
1108
|
var variantStyles = {
|
|
1100
|
-
info: "bg-
|
|
1101
|
-
warning: "bg-
|
|
1102
|
-
error: "bg-
|
|
1103
|
-
success: "bg-
|
|
1109
|
+
info: "bg-info border-info-border text-info-foreground",
|
|
1110
|
+
warning: "bg-warning border-warning-border text-warning-foreground",
|
|
1111
|
+
error: "bg-error border-error-border text-error-foreground",
|
|
1112
|
+
success: "bg-success border-success-border text-success-foreground"
|
|
1104
1113
|
};
|
|
1105
1114
|
var variantIcons = {
|
|
1106
1115
|
info: "\u{1F4A1}",
|
|
@@ -1116,6 +1125,7 @@ var AlertRenderer = {
|
|
|
1116
1125
|
"div",
|
|
1117
1126
|
{
|
|
1118
1127
|
id,
|
|
1128
|
+
"data-a2ui-component": "Alert",
|
|
1119
1129
|
role: "alert",
|
|
1120
1130
|
className: cn("relative rounded-lg border p-4", variantStyles[variant]),
|
|
1121
1131
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3", children: [
|
|
@@ -1131,7 +1141,7 @@ var AlertRenderer = {
|
|
|
1131
1141
|
example: {
|
|
1132
1142
|
name: "Alert",
|
|
1133
1143
|
description: "Accessible alert component with screen reader announcement",
|
|
1134
|
-
category: "
|
|
1144
|
+
category: "display",
|
|
1135
1145
|
messages: [
|
|
1136
1146
|
{ createSurface: { surfaceId: "alert-example", root: "col-1" } },
|
|
1137
1147
|
{
|
|
@@ -1627,7 +1637,7 @@ var ProgressRenderer = {
|
|
|
1627
1637
|
const value = component.value;
|
|
1628
1638
|
const isIndeterminate = value === void 0;
|
|
1629
1639
|
const percentage = isIndeterminate ? 0 : Math.min(100, Math.max(0, value / max * 100));
|
|
1630
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full space-y-1", children: [
|
|
1640
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-a2ui-component": "Progress", className: "w-full space-y-1", children: [
|
|
1631
1641
|
component.label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
1632
1642
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: component.label }),
|
|
1633
1643
|
!isIndeterminate && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
@@ -1663,7 +1673,7 @@ var ProgressRenderer = {
|
|
|
1663
1673
|
example: {
|
|
1664
1674
|
name: "Progress",
|
|
1665
1675
|
description: "Accessible progress indicator with determinate and indeterminate states",
|
|
1666
|
-
category: "
|
|
1676
|
+
category: "display",
|
|
1667
1677
|
messages: [
|
|
1668
1678
|
{ createSurface: { surfaceId: "progress-example", root: "col-1" } },
|
|
1669
1679
|
{
|
|
@@ -4766,14 +4776,14 @@ var TextScrambleRenderer = {
|
|
|
4766
4776
|
type: "TextScramble",
|
|
4767
4777
|
render: ({ component }) => {
|
|
4768
4778
|
const [displayText, setDisplayText] = React7.useState(component.content);
|
|
4769
|
-
const
|
|
4779
|
+
const isAnimatingRef = React7.useRef(false);
|
|
4770
4780
|
const prefersReducedMotion = useReducedMotion();
|
|
4771
4781
|
const speed = component.speed || 30;
|
|
4772
4782
|
const characters = component.characters || defaultCharacters;
|
|
4773
4783
|
const trigger = component.trigger || "mount";
|
|
4774
|
-
const scramble = () => {
|
|
4775
|
-
if (prefersReducedMotion ||
|
|
4776
|
-
|
|
4784
|
+
const scramble = React7.useCallback(() => {
|
|
4785
|
+
if (prefersReducedMotion || isAnimatingRef.current) return;
|
|
4786
|
+
isAnimatingRef.current = true;
|
|
4777
4787
|
const target = component.content;
|
|
4778
4788
|
const length = target.length;
|
|
4779
4789
|
let iteration = 0;
|
|
@@ -4792,10 +4802,10 @@ var TextScrambleRenderer = {
|
|
|
4792
4802
|
if (iteration >= maxIterations) {
|
|
4793
4803
|
clearInterval(interval);
|
|
4794
4804
|
setDisplayText(target);
|
|
4795
|
-
|
|
4805
|
+
isAnimatingRef.current = false;
|
|
4796
4806
|
}
|
|
4797
4807
|
}, speed);
|
|
4798
|
-
};
|
|
4808
|
+
}, [component.content, characters, speed, prefersReducedMotion]);
|
|
4799
4809
|
React7.useEffect(() => {
|
|
4800
4810
|
if (trigger === "mount") {
|
|
4801
4811
|
scramble();
|
|
@@ -7037,6 +7047,155 @@ var ModalRenderer = {
|
|
|
7037
7047
|
]
|
|
7038
7048
|
}
|
|
7039
7049
|
};
|
|
7050
|
+
var StepperRenderer = {
|
|
7051
|
+
type: "Stepper",
|
|
7052
|
+
render: ({ component, id }) => {
|
|
7053
|
+
const orientation = component.orientation || "horizontal";
|
|
7054
|
+
const activeStep = component.activeStep ?? 0;
|
|
7055
|
+
const getStepStatus = (index, step) => {
|
|
7056
|
+
if (step.status) return step.status;
|
|
7057
|
+
if (index < activeStep) return "completed";
|
|
7058
|
+
if (index === activeStep) return "current";
|
|
7059
|
+
return "pending";
|
|
7060
|
+
};
|
|
7061
|
+
const statusStyles = {
|
|
7062
|
+
pending: "border-muted-foreground/30 bg-background text-muted-foreground",
|
|
7063
|
+
current: "border-primary bg-primary text-primary-foreground",
|
|
7064
|
+
completed: "border-primary bg-primary text-primary-foreground",
|
|
7065
|
+
error: "border-destructive bg-destructive text-destructive-foreground"
|
|
7066
|
+
};
|
|
7067
|
+
const StatusIcon = ({ status }) => {
|
|
7068
|
+
switch (status) {
|
|
7069
|
+
case "completed":
|
|
7070
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" });
|
|
7071
|
+
case "error":
|
|
7072
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" });
|
|
7073
|
+
default:
|
|
7074
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Circle, { className: "h-2 w-2 fill-current" });
|
|
7075
|
+
}
|
|
7076
|
+
};
|
|
7077
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7078
|
+
"div",
|
|
7079
|
+
{
|
|
7080
|
+
id,
|
|
7081
|
+
"data-a2ui-component": "Stepper",
|
|
7082
|
+
className: cn(
|
|
7083
|
+
"flex",
|
|
7084
|
+
orientation === "horizontal" ? "flex-row items-start" : "flex-col"
|
|
7085
|
+
),
|
|
7086
|
+
role: "list",
|
|
7087
|
+
"aria-label": "Progress steps",
|
|
7088
|
+
children: component.steps.map((step, index) => {
|
|
7089
|
+
const status = getStepStatus(index, step);
|
|
7090
|
+
const isLast = index === component.steps.length - 1;
|
|
7091
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7092
|
+
"div",
|
|
7093
|
+
{
|
|
7094
|
+
className: cn(
|
|
7095
|
+
"flex",
|
|
7096
|
+
orientation === "horizontal" ? "flex-1 flex-col items-center" : "flex-row items-start"
|
|
7097
|
+
),
|
|
7098
|
+
role: "listitem",
|
|
7099
|
+
"aria-current": status === "current" ? "step" : void 0,
|
|
7100
|
+
children: [
|
|
7101
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7102
|
+
"div",
|
|
7103
|
+
{
|
|
7104
|
+
className: cn(
|
|
7105
|
+
"flex items-center",
|
|
7106
|
+
orientation === "horizontal" ? "flex-col" : "flex-row"
|
|
7107
|
+
),
|
|
7108
|
+
children: [
|
|
7109
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7110
|
+
"div",
|
|
7111
|
+
{
|
|
7112
|
+
className: cn(
|
|
7113
|
+
"flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors",
|
|
7114
|
+
statusStyles[status]
|
|
7115
|
+
),
|
|
7116
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(StatusIcon, { status })
|
|
7117
|
+
}
|
|
7118
|
+
),
|
|
7119
|
+
!isLast && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7120
|
+
"div",
|
|
7121
|
+
{
|
|
7122
|
+
className: cn(
|
|
7123
|
+
"transition-colors",
|
|
7124
|
+
orientation === "horizontal" ? "mt-4 h-0.5 w-full min-w-[40px]" : "ml-4 h-full min-h-[40px] w-0.5",
|
|
7125
|
+
index < activeStep ? "bg-primary" : "bg-muted-foreground/30"
|
|
7126
|
+
)
|
|
7127
|
+
}
|
|
7128
|
+
)
|
|
7129
|
+
]
|
|
7130
|
+
}
|
|
7131
|
+
),
|
|
7132
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7133
|
+
"div",
|
|
7134
|
+
{
|
|
7135
|
+
className: cn(
|
|
7136
|
+
"text-center",
|
|
7137
|
+
orientation === "horizontal" ? "mt-2" : "ml-4"
|
|
7138
|
+
),
|
|
7139
|
+
children: [
|
|
7140
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7141
|
+
"div",
|
|
7142
|
+
{
|
|
7143
|
+
className: cn(
|
|
7144
|
+
"text-sm font-medium",
|
|
7145
|
+
status === "current" ? "text-foreground" : "text-muted-foreground"
|
|
7146
|
+
),
|
|
7147
|
+
children: step.label
|
|
7148
|
+
}
|
|
7149
|
+
),
|
|
7150
|
+
step.description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-muted-foreground mt-0.5", children: step.description })
|
|
7151
|
+
]
|
|
7152
|
+
}
|
|
7153
|
+
)
|
|
7154
|
+
]
|
|
7155
|
+
},
|
|
7156
|
+
step.id
|
|
7157
|
+
);
|
|
7158
|
+
})
|
|
7159
|
+
}
|
|
7160
|
+
);
|
|
7161
|
+
},
|
|
7162
|
+
example: {
|
|
7163
|
+
name: "Stepper",
|
|
7164
|
+
description: "Step-by-step progress indicator for wizards and multi-step forms",
|
|
7165
|
+
category: "container",
|
|
7166
|
+
messages: [
|
|
7167
|
+
{ createSurface: { surfaceId: "stepper-demo", root: "root" } },
|
|
7168
|
+
{
|
|
7169
|
+
updateComponents: {
|
|
7170
|
+
surfaceId: "stepper-demo",
|
|
7171
|
+
components: [
|
|
7172
|
+
{
|
|
7173
|
+
id: "root",
|
|
7174
|
+
component: {
|
|
7175
|
+
type: "Column",
|
|
7176
|
+
id: "root",
|
|
7177
|
+
children: ["stepper"]
|
|
7178
|
+
}
|
|
7179
|
+
},
|
|
7180
|
+
{
|
|
7181
|
+
id: "stepper",
|
|
7182
|
+
component: {
|
|
7183
|
+
type: "Stepper",
|
|
7184
|
+
id: "stepper",
|
|
7185
|
+
activeStep: 1,
|
|
7186
|
+
steps: [
|
|
7187
|
+
{ id: "step1", label: "Account", description: "Create your account" },
|
|
7188
|
+
{ id: "step2", label: "Profile", description: "Set up your profile" },
|
|
7189
|
+
{ id: "step3", label: "Review", description: "Review and submit" }
|
|
7190
|
+
]
|
|
7191
|
+
}
|
|
7192
|
+
}
|
|
7193
|
+
]
|
|
7194
|
+
}
|
|
7195
|
+
}
|
|
7196
|
+
]
|
|
7197
|
+
}
|
|
7198
|
+
};
|
|
7040
7199
|
var TabsRenderer = {
|
|
7041
7200
|
type: "Tabs",
|
|
7042
7201
|
render: ({ component, children }) => {
|
|
@@ -7555,6 +7714,267 @@ var ImageRenderer = {
|
|
|
7555
7714
|
]
|
|
7556
7715
|
}
|
|
7557
7716
|
};
|
|
7717
|
+
var MarkdownRenderer = {
|
|
7718
|
+
type: "Markdown",
|
|
7719
|
+
render: ({ component, data }) => {
|
|
7720
|
+
const content = component.dataPath ? data.get(component.dataPath) ?? component.text : component.text;
|
|
7721
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7722
|
+
"div",
|
|
7723
|
+
{
|
|
7724
|
+
"data-a2ui-component": "Markdown",
|
|
7725
|
+
className: cn(
|
|
7726
|
+
"prose prose-sm dark:prose-invert max-w-none",
|
|
7727
|
+
// Headings
|
|
7728
|
+
"prose-headings:font-semibold prose-headings:tracking-tight",
|
|
7729
|
+
"prose-h1:text-3xl prose-h2:text-2xl prose-h3:text-xl",
|
|
7730
|
+
// Links
|
|
7731
|
+
"prose-a:text-primary prose-a:no-underline hover:prose-a:underline",
|
|
7732
|
+
// Code
|
|
7733
|
+
"prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:text-sm",
|
|
7734
|
+
"prose-pre:bg-muted prose-pre:border prose-pre:border-border",
|
|
7735
|
+
// Lists
|
|
7736
|
+
"prose-ul:my-2 prose-ol:my-2 prose-li:my-0",
|
|
7737
|
+
// Blockquotes
|
|
7738
|
+
"prose-blockquote:border-l-primary prose-blockquote:text-muted-foreground"
|
|
7739
|
+
),
|
|
7740
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ReactMarkdown__default.default, { children: content || "" })
|
|
7741
|
+
}
|
|
7742
|
+
);
|
|
7743
|
+
},
|
|
7744
|
+
example: {
|
|
7745
|
+
name: "Markdown",
|
|
7746
|
+
description: "Renders markdown content with full formatting support",
|
|
7747
|
+
category: "display",
|
|
7748
|
+
messages: [
|
|
7749
|
+
{ createSurface: { surfaceId: "markdown-demo", root: "root" } },
|
|
7750
|
+
{
|
|
7751
|
+
updateComponents: {
|
|
7752
|
+
surfaceId: "markdown-demo",
|
|
7753
|
+
components: [
|
|
7754
|
+
{
|
|
7755
|
+
id: "root",
|
|
7756
|
+
component: {
|
|
7757
|
+
type: "Column",
|
|
7758
|
+
id: "root",
|
|
7759
|
+
children: ["md"]
|
|
7760
|
+
}
|
|
7761
|
+
},
|
|
7762
|
+
{
|
|
7763
|
+
id: "md",
|
|
7764
|
+
component: {
|
|
7765
|
+
type: "Markdown",
|
|
7766
|
+
id: "md",
|
|
7767
|
+
text: `# Markdown Demo
|
|
7768
|
+
|
|
7769
|
+
This is a **bold** and *italic* text example.
|
|
7770
|
+
|
|
7771
|
+
## Features
|
|
7772
|
+
|
|
7773
|
+
- Headings (h1-h6)
|
|
7774
|
+
- **Bold** and *italic* text
|
|
7775
|
+
- [Links](https://example.com)
|
|
7776
|
+
- Lists (ordered and unordered)
|
|
7777
|
+
|
|
7778
|
+
### Code
|
|
7779
|
+
|
|
7780
|
+
Inline \`code\` and code blocks:
|
|
7781
|
+
|
|
7782
|
+
\`\`\`javascript
|
|
7783
|
+
const hello = "world";
|
|
7784
|
+
\`\`\`
|
|
7785
|
+
|
|
7786
|
+
> Blockquotes are also supported!
|
|
7787
|
+
`
|
|
7788
|
+
}
|
|
7789
|
+
}
|
|
7790
|
+
]
|
|
7791
|
+
}
|
|
7792
|
+
}
|
|
7793
|
+
]
|
|
7794
|
+
}
|
|
7795
|
+
};
|
|
7796
|
+
var SkeletonRenderer = {
|
|
7797
|
+
type: "Skeleton",
|
|
7798
|
+
render: ({ component, id }) => {
|
|
7799
|
+
const variant = component.variant || "rectangular";
|
|
7800
|
+
const variantClasses = {
|
|
7801
|
+
text: "rounded",
|
|
7802
|
+
circular: "rounded-full",
|
|
7803
|
+
rectangular: "rounded-md"
|
|
7804
|
+
};
|
|
7805
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7806
|
+
"div",
|
|
7807
|
+
{
|
|
7808
|
+
id,
|
|
7809
|
+
"data-a2ui-component": "Skeleton",
|
|
7810
|
+
role: "status",
|
|
7811
|
+
"aria-label": "Loading content",
|
|
7812
|
+
className: cn(
|
|
7813
|
+
"animate-pulse bg-muted",
|
|
7814
|
+
variantClasses[variant]
|
|
7815
|
+
),
|
|
7816
|
+
style: {
|
|
7817
|
+
width: component.width || "100%",
|
|
7818
|
+
height: component.height || (variant === "text" ? "1rem" : "100px")
|
|
7819
|
+
},
|
|
7820
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading..." })
|
|
7821
|
+
}
|
|
7822
|
+
);
|
|
7823
|
+
},
|
|
7824
|
+
example: {
|
|
7825
|
+
name: "Skeleton",
|
|
7826
|
+
description: "Content placeholder while loading",
|
|
7827
|
+
category: "display",
|
|
7828
|
+
messages: [
|
|
7829
|
+
{ createSurface: { surfaceId: "skeleton-demo", root: "root" } },
|
|
7830
|
+
{
|
|
7831
|
+
updateComponents: {
|
|
7832
|
+
surfaceId: "skeleton-demo",
|
|
7833
|
+
components: [
|
|
7834
|
+
{
|
|
7835
|
+
id: "root",
|
|
7836
|
+
component: {
|
|
7837
|
+
type: "Column",
|
|
7838
|
+
id: "root",
|
|
7839
|
+
children: ["card-skeleton"]
|
|
7840
|
+
}
|
|
7841
|
+
},
|
|
7842
|
+
{
|
|
7843
|
+
id: "card-skeleton",
|
|
7844
|
+
component: {
|
|
7845
|
+
type: "Row",
|
|
7846
|
+
id: "card-skeleton",
|
|
7847
|
+
children: ["avatar", "content"],
|
|
7848
|
+
alignment: "start"
|
|
7849
|
+
}
|
|
7850
|
+
},
|
|
7851
|
+
{
|
|
7852
|
+
id: "avatar",
|
|
7853
|
+
component: {
|
|
7854
|
+
type: "Skeleton",
|
|
7855
|
+
id: "avatar",
|
|
7856
|
+
variant: "circular",
|
|
7857
|
+
width: "48px",
|
|
7858
|
+
height: "48px"
|
|
7859
|
+
}
|
|
7860
|
+
},
|
|
7861
|
+
{
|
|
7862
|
+
id: "content",
|
|
7863
|
+
component: {
|
|
7864
|
+
type: "Column",
|
|
7865
|
+
id: "content",
|
|
7866
|
+
children: ["line1", "line2"]
|
|
7867
|
+
}
|
|
7868
|
+
},
|
|
7869
|
+
{
|
|
7870
|
+
id: "line1",
|
|
7871
|
+
component: {
|
|
7872
|
+
type: "Skeleton",
|
|
7873
|
+
id: "line1",
|
|
7874
|
+
variant: "text",
|
|
7875
|
+
width: "200px",
|
|
7876
|
+
height: "1rem"
|
|
7877
|
+
}
|
|
7878
|
+
},
|
|
7879
|
+
{
|
|
7880
|
+
id: "line2",
|
|
7881
|
+
component: {
|
|
7882
|
+
type: "Skeleton",
|
|
7883
|
+
id: "line2",
|
|
7884
|
+
variant: "text",
|
|
7885
|
+
width: "150px",
|
|
7886
|
+
height: "1rem"
|
|
7887
|
+
}
|
|
7888
|
+
}
|
|
7889
|
+
]
|
|
7890
|
+
}
|
|
7891
|
+
}
|
|
7892
|
+
]
|
|
7893
|
+
}
|
|
7894
|
+
};
|
|
7895
|
+
var sizeClasses = {
|
|
7896
|
+
sm: "h-4 w-4",
|
|
7897
|
+
md: "h-6 w-6",
|
|
7898
|
+
lg: "h-10 w-10"
|
|
7899
|
+
};
|
|
7900
|
+
var SpinnerRenderer = {
|
|
7901
|
+
type: "Spinner",
|
|
7902
|
+
render: ({ component, id }) => {
|
|
7903
|
+
const size = component.size || "md";
|
|
7904
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7905
|
+
"div",
|
|
7906
|
+
{
|
|
7907
|
+
id,
|
|
7908
|
+
"data-a2ui-component": "Spinner",
|
|
7909
|
+
role: "status",
|
|
7910
|
+
"aria-label": component.label || "Loading",
|
|
7911
|
+
className: "inline-flex items-center justify-center",
|
|
7912
|
+
children: [
|
|
7913
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7914
|
+
lucideReact.Loader2,
|
|
7915
|
+
{
|
|
7916
|
+
className: cn("animate-spin text-muted-foreground", sizeClasses[size]),
|
|
7917
|
+
"aria-hidden": "true"
|
|
7918
|
+
}
|
|
7919
|
+
),
|
|
7920
|
+
component.label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: component.label })
|
|
7921
|
+
]
|
|
7922
|
+
}
|
|
7923
|
+
);
|
|
7924
|
+
},
|
|
7925
|
+
example: {
|
|
7926
|
+
name: "Spinner",
|
|
7927
|
+
description: "Loading indicator with different sizes",
|
|
7928
|
+
category: "display",
|
|
7929
|
+
messages: [
|
|
7930
|
+
{ createSurface: { surfaceId: "spinner-demo", root: "root" } },
|
|
7931
|
+
{
|
|
7932
|
+
updateComponents: {
|
|
7933
|
+
surfaceId: "spinner-demo",
|
|
7934
|
+
components: [
|
|
7935
|
+
{
|
|
7936
|
+
id: "root",
|
|
7937
|
+
component: {
|
|
7938
|
+
type: "Row",
|
|
7939
|
+
id: "root",
|
|
7940
|
+
children: ["spinner-sm", "spinner-md", "spinner-lg"],
|
|
7941
|
+
distribution: "spaceAround",
|
|
7942
|
+
alignment: "center"
|
|
7943
|
+
}
|
|
7944
|
+
},
|
|
7945
|
+
{
|
|
7946
|
+
id: "spinner-sm",
|
|
7947
|
+
component: {
|
|
7948
|
+
type: "Spinner",
|
|
7949
|
+
id: "spinner-sm",
|
|
7950
|
+
size: "sm",
|
|
7951
|
+
label: "Loading small"
|
|
7952
|
+
}
|
|
7953
|
+
},
|
|
7954
|
+
{
|
|
7955
|
+
id: "spinner-md",
|
|
7956
|
+
component: {
|
|
7957
|
+
type: "Spinner",
|
|
7958
|
+
id: "spinner-md",
|
|
7959
|
+
size: "md",
|
|
7960
|
+
label: "Loading medium"
|
|
7961
|
+
}
|
|
7962
|
+
},
|
|
7963
|
+
{
|
|
7964
|
+
id: "spinner-lg",
|
|
7965
|
+
component: {
|
|
7966
|
+
type: "Spinner",
|
|
7967
|
+
id: "spinner-lg",
|
|
7968
|
+
size: "lg",
|
|
7969
|
+
label: "Loading large"
|
|
7970
|
+
}
|
|
7971
|
+
}
|
|
7972
|
+
]
|
|
7973
|
+
}
|
|
7974
|
+
}
|
|
7975
|
+
]
|
|
7976
|
+
}
|
|
7977
|
+
};
|
|
7558
7978
|
var TextRenderer = {
|
|
7559
7979
|
type: "Text",
|
|
7560
7980
|
render: ({ component, data }) => {
|
|
@@ -7668,6 +8088,122 @@ var TextRenderer = {
|
|
|
7668
8088
|
]
|
|
7669
8089
|
}
|
|
7670
8090
|
};
|
|
8091
|
+
var variantStyles2 = {
|
|
8092
|
+
default: "bg-background border-border",
|
|
8093
|
+
success: "bg-success border-success-border text-success-foreground",
|
|
8094
|
+
error: "bg-error border-error-border text-error-foreground",
|
|
8095
|
+
warning: "bg-warning border-warning-border text-warning-foreground",
|
|
8096
|
+
info: "bg-info border-info-border text-info-foreground"
|
|
8097
|
+
};
|
|
8098
|
+
var variantIcons2 = {
|
|
8099
|
+
default: null,
|
|
8100
|
+
success: lucideReact.CheckCircle,
|
|
8101
|
+
error: lucideReact.XCircle,
|
|
8102
|
+
warning: lucideReact.AlertCircle,
|
|
8103
|
+
info: lucideReact.Info
|
|
8104
|
+
};
|
|
8105
|
+
var ToastRenderer = {
|
|
8106
|
+
type: "Toast",
|
|
8107
|
+
render: ({ component, id, onAction }) => {
|
|
8108
|
+
const variant = component.variant || "default";
|
|
8109
|
+
const Icon2 = variantIcons2[variant];
|
|
8110
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8111
|
+
"div",
|
|
8112
|
+
{
|
|
8113
|
+
id,
|
|
8114
|
+
"data-a2ui-component": "Toast",
|
|
8115
|
+
role: "alert",
|
|
8116
|
+
"aria-live": "polite",
|
|
8117
|
+
className: cn(
|
|
8118
|
+
"pointer-events-auto relative flex w-full max-w-sm items-start gap-3 rounded-lg border p-4 shadow-lg",
|
|
8119
|
+
variantStyles2[variant]
|
|
8120
|
+
),
|
|
8121
|
+
children: [
|
|
8122
|
+
Icon2 && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "h-5 w-5 flex-shrink-0 mt-0.5", "aria-hidden": "true" }),
|
|
8123
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-1", children: [
|
|
8124
|
+
component.title && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-semibold text-foreground", children: component.title }),
|
|
8125
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground", children: component.message }),
|
|
8126
|
+
component.actionLabel && component.action && /* @__PURE__ */ jsxRuntime.jsx(
|
|
8127
|
+
"button",
|
|
8128
|
+
{
|
|
8129
|
+
type: "button",
|
|
8130
|
+
onClick: () => onAction?.({ type: component.action, payload: { id: component.id } }),
|
|
8131
|
+
className: "text-sm font-medium text-primary hover:underline mt-2",
|
|
8132
|
+
children: component.actionLabel
|
|
8133
|
+
}
|
|
8134
|
+
)
|
|
8135
|
+
] }),
|
|
8136
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8137
|
+
"button",
|
|
8138
|
+
{
|
|
8139
|
+
type: "button",
|
|
8140
|
+
onClick: () => onAction?.({ type: "toast.dismiss", payload: { id: component.id } }),
|
|
8141
|
+
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",
|
|
8142
|
+
"aria-label": "Dismiss",
|
|
8143
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" })
|
|
8144
|
+
}
|
|
8145
|
+
)
|
|
8146
|
+
]
|
|
8147
|
+
}
|
|
8148
|
+
);
|
|
8149
|
+
},
|
|
8150
|
+
example: {
|
|
8151
|
+
name: "Toast",
|
|
8152
|
+
description: "Notification toast with variants and optional action",
|
|
8153
|
+
category: "display",
|
|
8154
|
+
messages: [
|
|
8155
|
+
{ createSurface: { surfaceId: "toast-demo", root: "root" } },
|
|
8156
|
+
{
|
|
8157
|
+
updateComponents: {
|
|
8158
|
+
surfaceId: "toast-demo",
|
|
8159
|
+
components: [
|
|
8160
|
+
{
|
|
8161
|
+
id: "root",
|
|
8162
|
+
component: {
|
|
8163
|
+
type: "Column",
|
|
8164
|
+
id: "root",
|
|
8165
|
+
children: ["toast-success", "toast-error", "toast-info"]
|
|
8166
|
+
}
|
|
8167
|
+
},
|
|
8168
|
+
{
|
|
8169
|
+
id: "toast-success",
|
|
8170
|
+
component: {
|
|
8171
|
+
type: "Toast",
|
|
8172
|
+
id: "toast-success",
|
|
8173
|
+
variant: "success",
|
|
8174
|
+
title: "Success!",
|
|
8175
|
+
message: "Your changes have been saved."
|
|
8176
|
+
}
|
|
8177
|
+
},
|
|
8178
|
+
{
|
|
8179
|
+
id: "toast-error",
|
|
8180
|
+
component: {
|
|
8181
|
+
type: "Toast",
|
|
8182
|
+
id: "toast-error",
|
|
8183
|
+
variant: "error",
|
|
8184
|
+
title: "Error",
|
|
8185
|
+
message: "Something went wrong. Please try again.",
|
|
8186
|
+
actionLabel: "Retry",
|
|
8187
|
+
action: "retry"
|
|
8188
|
+
}
|
|
8189
|
+
},
|
|
8190
|
+
{
|
|
8191
|
+
id: "toast-info",
|
|
8192
|
+
component: {
|
|
8193
|
+
type: "Toast",
|
|
8194
|
+
id: "toast-info",
|
|
8195
|
+
variant: "info",
|
|
8196
|
+
message: "New version available!",
|
|
8197
|
+
actionLabel: "Update",
|
|
8198
|
+
action: "update"
|
|
8199
|
+
}
|
|
8200
|
+
}
|
|
8201
|
+
]
|
|
8202
|
+
}
|
|
8203
|
+
}
|
|
8204
|
+
]
|
|
8205
|
+
}
|
|
8206
|
+
};
|
|
7671
8207
|
var VideoRenderer = {
|
|
7672
8208
|
type: "Video",
|
|
7673
8209
|
render: ({ component }) => {
|
|
@@ -8948,6 +9484,12 @@ var shadcnRenderers = [
|
|
|
8948
9484
|
ColumnRenderer,
|
|
8949
9485
|
// Display
|
|
8950
9486
|
TextRenderer,
|
|
9487
|
+
MarkdownRenderer,
|
|
9488
|
+
SpinnerRenderer,
|
|
9489
|
+
SkeletonRenderer,
|
|
9490
|
+
ToastRenderer,
|
|
9491
|
+
AlertRenderer,
|
|
9492
|
+
ProgressRenderer,
|
|
8951
9493
|
ImageRenderer,
|
|
8952
9494
|
IconRenderer,
|
|
8953
9495
|
DividerRenderer,
|
|
@@ -8966,6 +9508,7 @@ var shadcnRenderers = [
|
|
|
8966
9508
|
CardRenderer,
|
|
8967
9509
|
ModalRenderer,
|
|
8968
9510
|
TabsRenderer,
|
|
9511
|
+
StepperRenderer,
|
|
8969
9512
|
ListRenderer,
|
|
8970
9513
|
// Charts
|
|
8971
9514
|
PieChartRenderer,
|
|
@@ -9121,11 +9664,13 @@ exports.AnimatedTooltipRenderer = AnimatedTooltipRenderer;
|
|
|
9121
9664
|
exports.AreaChartRenderer = AreaChartRenderer;
|
|
9122
9665
|
exports.ArticleRenderer = ArticleRenderer;
|
|
9123
9666
|
exports.AsideRenderer = AsideRenderer;
|
|
9667
|
+
exports.AudioPlayerRenderer = AudioPlayerRenderer;
|
|
9124
9668
|
exports.AuroraBackgroundRenderer = AuroraBackgroundRenderer;
|
|
9125
9669
|
exports.BarChartRenderer = BarChartRenderer;
|
|
9126
9670
|
exports.BlurRevealTextRenderer = BlurRevealTextRenderer;
|
|
9127
9671
|
exports.BubbleBackgroundRenderer = BubbleBackgroundRenderer;
|
|
9128
9672
|
exports.Button = Button;
|
|
9673
|
+
exports.CardRenderer = CardRenderer;
|
|
9129
9674
|
exports.Checkbox = Checkbox;
|
|
9130
9675
|
exports.ComponentRenderer = ComponentRenderer;
|
|
9131
9676
|
exports.CopyButtonRenderer = CopyButtonRenderer;
|
|
@@ -9142,6 +9687,7 @@ exports.DialogOverlay = DialogOverlay;
|
|
|
9142
9687
|
exports.DialogPortal = DialogPortal;
|
|
9143
9688
|
exports.DialogTitle = DialogTitle;
|
|
9144
9689
|
exports.DialogTrigger = DialogTrigger;
|
|
9690
|
+
exports.DividerRenderer = DividerRenderer;
|
|
9145
9691
|
exports.FireworksBackgroundRenderer = FireworksBackgroundRenderer;
|
|
9146
9692
|
exports.FlipButtonRenderer = FlipButtonRenderer;
|
|
9147
9693
|
exports.FlipCardRenderer = FlipCardRenderer;
|
|
@@ -9154,14 +9700,19 @@ exports.HeaderRenderer = HeaderRenderer;
|
|
|
9154
9700
|
exports.HexagonBackgroundRenderer = HexagonBackgroundRenderer;
|
|
9155
9701
|
exports.HoleBackgroundRenderer = HoleBackgroundRenderer;
|
|
9156
9702
|
exports.IconButtonRenderer = IconButtonRenderer;
|
|
9703
|
+
exports.IconRenderer = IconRenderer;
|
|
9704
|
+
exports.ImageRenderer = ImageRenderer;
|
|
9157
9705
|
exports.Input = Input;
|
|
9158
9706
|
exports.Label = Label;
|
|
9159
9707
|
exports.LineChartRenderer = LineChartRenderer;
|
|
9160
9708
|
exports.LiquidButtonRenderer = LiquidButtonRenderer;
|
|
9709
|
+
exports.ListRenderer = ListRenderer;
|
|
9161
9710
|
exports.LiveRegionRenderer = LiveRegionRenderer;
|
|
9162
9711
|
exports.MagneticButtonRenderer = MagneticButtonRenderer;
|
|
9163
9712
|
exports.MainRenderer = MainRenderer;
|
|
9713
|
+
exports.MarkdownRenderer = MarkdownRenderer;
|
|
9164
9714
|
exports.MessageParseError = MessageParseError;
|
|
9715
|
+
exports.ModalRenderer = ModalRenderer;
|
|
9165
9716
|
exports.MorphingIconRenderer = MorphingIconRenderer;
|
|
9166
9717
|
exports.NavRenderer = NavRenderer;
|
|
9167
9718
|
exports.ParticlesBackgroundRenderer = ParticlesBackgroundRenderer;
|
|
@@ -9170,17 +9721,24 @@ exports.ProgressRenderer = ProgressRenderer;
|
|
|
9170
9721
|
exports.RippleButtonRenderer = RippleButtonRenderer;
|
|
9171
9722
|
exports.SectionRenderer = SectionRenderer;
|
|
9172
9723
|
exports.ShimmerButtonRenderer = ShimmerButtonRenderer;
|
|
9724
|
+
exports.SkeletonRenderer = SkeletonRenderer;
|
|
9173
9725
|
exports.SkipLinkRenderer = SkipLinkRenderer;
|
|
9726
|
+
exports.SpinnerRenderer = SpinnerRenderer;
|
|
9174
9727
|
exports.SpotlightRenderer = SpotlightRenderer;
|
|
9175
9728
|
exports.StarsBackgroundRenderer = StarsBackgroundRenderer;
|
|
9729
|
+
exports.StepperRenderer = StepperRenderer;
|
|
9176
9730
|
exports.Tabs = Tabs;
|
|
9177
9731
|
exports.TabsContent = TabsContent;
|
|
9178
9732
|
exports.TabsList = TabsList;
|
|
9733
|
+
exports.TabsRenderer = TabsRenderer;
|
|
9179
9734
|
exports.TabsTrigger = TabsTrigger;
|
|
9735
|
+
exports.TextRenderer = TextRenderer;
|
|
9180
9736
|
exports.TextScrambleRenderer = TextScrambleRenderer;
|
|
9181
9737
|
exports.Textarea = Textarea;
|
|
9182
9738
|
exports.ThemeTogglerButtonRenderer = ThemeTogglerButtonRenderer;
|
|
9739
|
+
exports.ToastRenderer = ToastRenderer;
|
|
9183
9740
|
exports.TypewriterTextRenderer = TypewriterTextRenderer;
|
|
9741
|
+
exports.VideoRenderer = VideoRenderer;
|
|
9184
9742
|
exports.a11yRenderers = a11yRenderers;
|
|
9185
9743
|
exports.allAnimatedRenderers = allAnimatedRenderers;
|
|
9186
9744
|
exports.allRenderers = allRenderers;
|