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