@ai4b-team/fsaos-gateway-sdk 1.0.1
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/CHANGELOG.md +56 -0
- package/README.md +157 -0
- package/dist/iife/gateway.js +12 -0
- package/dist/iife/gateway.js.map +7 -0
- package/dist/iife/ui.js +3 -0
- package/dist/iife/ui.js.map +7 -0
- package/dist/index.cjs +3220 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1806 -0
- package/dist/index.d.ts +1806 -0
- package/dist/index.js +3079 -0
- package/dist/index.js.map +1 -0
- package/dist/ui.cjs +201 -0
- package/dist/ui.cjs.map +1 -0
- package/dist/ui.d.cts +243 -0
- package/dist/ui.d.ts +243 -0
- package/dist/ui.js +180 -0
- package/dist/ui.js.map +1 -0
- package/package.json +92 -0
package/dist/ui.cjs
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
|
|
5
|
+
// src/ui.ts
|
|
6
|
+
function getEdgeBaseUrl() {
|
|
7
|
+
const config = typeof window !== "undefined" && window.__FSAOS_CONFIG__ || {};
|
|
8
|
+
return config.edgeBaseUrl || "";
|
|
9
|
+
}
|
|
10
|
+
function Page(props) {
|
|
11
|
+
return react.createElement("div", {
|
|
12
|
+
style: { minHeight: "100vh", display: "flex", flexDirection: "column" },
|
|
13
|
+
className: props.className || ""
|
|
14
|
+
}, props.children);
|
|
15
|
+
}
|
|
16
|
+
function Stack(props) {
|
|
17
|
+
const dir = props.direction || "vertical";
|
|
18
|
+
return react.createElement("div", {
|
|
19
|
+
style: {
|
|
20
|
+
display: "flex",
|
|
21
|
+
flexDirection: dir === "horizontal" ? "row" : "column",
|
|
22
|
+
gap: props.gap || "0.5rem",
|
|
23
|
+
padding: props.padding || "0",
|
|
24
|
+
alignItems: props.align || "stretch",
|
|
25
|
+
justifyContent: props.justify || "flex-start",
|
|
26
|
+
flex: props.flex || "initial"
|
|
27
|
+
},
|
|
28
|
+
className: props.className || ""
|
|
29
|
+
}, props.children);
|
|
30
|
+
}
|
|
31
|
+
function Grid(props) {
|
|
32
|
+
return react.createElement("div", {
|
|
33
|
+
style: {
|
|
34
|
+
display: "grid",
|
|
35
|
+
gridTemplateColumns: "repeat(" + (props.columns || 3) + ", 1fr)",
|
|
36
|
+
gap: props.gap || "1rem",
|
|
37
|
+
padding: props.padding || "0"
|
|
38
|
+
},
|
|
39
|
+
className: props.className || ""
|
|
40
|
+
}, props.children);
|
|
41
|
+
}
|
|
42
|
+
function Sidebar(props) {
|
|
43
|
+
return react.createElement("div", {
|
|
44
|
+
style: { display: "flex", flexDirection: "row", minHeight: "100vh" },
|
|
45
|
+
className: props.className || ""
|
|
46
|
+
}, props.children);
|
|
47
|
+
}
|
|
48
|
+
function Card(props) {
|
|
49
|
+
return react.createElement("div", {
|
|
50
|
+
style: {
|
|
51
|
+
border: "1px solid var(--color-border, #e5e7eb)",
|
|
52
|
+
borderRadius: "var(--border-radius, 0.5rem)",
|
|
53
|
+
padding: props.padding || "1rem",
|
|
54
|
+
background: "var(--color-surface, #fff)"
|
|
55
|
+
},
|
|
56
|
+
className: props.className || "",
|
|
57
|
+
onClick: props.onClick
|
|
58
|
+
}, props.children);
|
|
59
|
+
}
|
|
60
|
+
function Badge(props) {
|
|
61
|
+
return react.createElement("span", {
|
|
62
|
+
style: {
|
|
63
|
+
display: "inline-flex",
|
|
64
|
+
alignItems: "center",
|
|
65
|
+
padding: "0.125rem 0.5rem",
|
|
66
|
+
fontSize: "0.75rem",
|
|
67
|
+
fontWeight: "500",
|
|
68
|
+
borderRadius: "9999px",
|
|
69
|
+
background: props.color || "#e5e7eb",
|
|
70
|
+
color: props.textColor || "#374151"
|
|
71
|
+
},
|
|
72
|
+
className: props.className || ""
|
|
73
|
+
}, props.children || props.label);
|
|
74
|
+
}
|
|
75
|
+
function Spinner(props) {
|
|
76
|
+
const size = props.size || "1.5rem";
|
|
77
|
+
return react.createElement("div", {
|
|
78
|
+
style: {
|
|
79
|
+
width: size,
|
|
80
|
+
height: size,
|
|
81
|
+
border: "2px solid #e5e7eb",
|
|
82
|
+
borderTopColor: "var(--color-primary, #3b82f6)",
|
|
83
|
+
borderRadius: "50%",
|
|
84
|
+
animation: "fsaos-spin 0.6s linear infinite"
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function Button(props) {
|
|
89
|
+
return react.createElement("button", {
|
|
90
|
+
style: {
|
|
91
|
+
display: "inline-flex",
|
|
92
|
+
alignItems: "center",
|
|
93
|
+
justifyContent: "center",
|
|
94
|
+
padding: "0.5rem 1rem",
|
|
95
|
+
fontSize: "0.875rem",
|
|
96
|
+
fontWeight: "500",
|
|
97
|
+
borderRadius: "var(--border-radius, 0.375rem)",
|
|
98
|
+
border: props.variant === "outline" ? "1px solid var(--color-border, #d1d5db)" : "none",
|
|
99
|
+
background: props.variant === "outline" || props.variant === "ghost" ? "transparent" : "var(--color-primary, #3b82f6)",
|
|
100
|
+
color: props.variant === "outline" || props.variant === "ghost" ? "var(--color-text, #1a1a1a)" : "#fff",
|
|
101
|
+
cursor: props.disabled ? "not-allowed" : "pointer",
|
|
102
|
+
opacity: props.disabled ? "0.5" : "1",
|
|
103
|
+
gap: "0.5rem"
|
|
104
|
+
},
|
|
105
|
+
className: props.className || "",
|
|
106
|
+
onClick: props.onClick,
|
|
107
|
+
disabled: props.disabled
|
|
108
|
+
}, props.children || props.label);
|
|
109
|
+
}
|
|
110
|
+
function Empty(props) {
|
|
111
|
+
return react.createElement(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
style: {
|
|
115
|
+
display: "flex",
|
|
116
|
+
flexDirection: "column",
|
|
117
|
+
alignItems: "center",
|
|
118
|
+
justifyContent: "center",
|
|
119
|
+
padding: "3rem",
|
|
120
|
+
color: "var(--color-text-secondary, #6b7280)",
|
|
121
|
+
textAlign: "center"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
props.icon ? react.createElement("div", { style: { fontSize: "2rem", marginBottom: "0.5rem" } }, props.icon) : null,
|
|
125
|
+
react.createElement(
|
|
126
|
+
"div",
|
|
127
|
+
{ style: { fontWeight: 500, marginBottom: "0.25rem" } },
|
|
128
|
+
props.title || props.message || props.children || "No items"
|
|
129
|
+
),
|
|
130
|
+
props.description ? react.createElement("div", { style: { fontSize: "0.875rem", opacity: 0.7 } }, props.description) : null
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
function DataView(props) {
|
|
134
|
+
return react.createElement("div", { className: props.className || "" }, props.children);
|
|
135
|
+
}
|
|
136
|
+
function Table(props) {
|
|
137
|
+
return react.createElement("table", { className: props.className || "" }, props.children);
|
|
138
|
+
}
|
|
139
|
+
function Form(props) {
|
|
140
|
+
return react.createElement("form", { className: props.className || "", onSubmit: props.onSubmit }, props.children);
|
|
141
|
+
}
|
|
142
|
+
function Detail(props) {
|
|
143
|
+
return react.createElement("div", { className: props.className || "" }, props.children);
|
|
144
|
+
}
|
|
145
|
+
function Router(props) {
|
|
146
|
+
return react.createElement("div", null, props.children);
|
|
147
|
+
}
|
|
148
|
+
function Link(props) {
|
|
149
|
+
return react.createElement("a", {
|
|
150
|
+
href: props.href || props.to,
|
|
151
|
+
className: props.className || "",
|
|
152
|
+
onClick: props.onClick
|
|
153
|
+
}, props.children);
|
|
154
|
+
}
|
|
155
|
+
function Tabs(props) {
|
|
156
|
+
return react.createElement("div", { className: props.className || "" }, props.children);
|
|
157
|
+
}
|
|
158
|
+
function Breadcrumbs(props) {
|
|
159
|
+
return react.createElement("nav", { className: props.className || "" }, props.children);
|
|
160
|
+
}
|
|
161
|
+
function Image(props) {
|
|
162
|
+
return react.createElement("img", {
|
|
163
|
+
src: props.src || (props.path ? getEdgeBaseUrl() + props.path : ""),
|
|
164
|
+
alt: props.alt || "",
|
|
165
|
+
className: props.className || "",
|
|
166
|
+
style: props.style
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function Video(props) {
|
|
170
|
+
return react.createElement("video", {
|
|
171
|
+
src: props.src || (props.path ? getEdgeBaseUrl() + props.path : ""),
|
|
172
|
+
controls: true,
|
|
173
|
+
className: props.className || ""
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function FilePreview(props) {
|
|
177
|
+
return react.createElement("div", { className: props.className || "" }, props.children || "File preview");
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
exports.Badge = Badge;
|
|
181
|
+
exports.Breadcrumbs = Breadcrumbs;
|
|
182
|
+
exports.Button = Button;
|
|
183
|
+
exports.Card = Card;
|
|
184
|
+
exports.DataView = DataView;
|
|
185
|
+
exports.Detail = Detail;
|
|
186
|
+
exports.Empty = Empty;
|
|
187
|
+
exports.FilePreview = FilePreview;
|
|
188
|
+
exports.Form = Form;
|
|
189
|
+
exports.Grid = Grid;
|
|
190
|
+
exports.Image = Image;
|
|
191
|
+
exports.Link = Link;
|
|
192
|
+
exports.Page = Page;
|
|
193
|
+
exports.Router = Router;
|
|
194
|
+
exports.Sidebar = Sidebar;
|
|
195
|
+
exports.Spinner = Spinner;
|
|
196
|
+
exports.Stack = Stack;
|
|
197
|
+
exports.Table = Table;
|
|
198
|
+
exports.Tabs = Tabs;
|
|
199
|
+
exports.Video = Video;
|
|
200
|
+
//# sourceMappingURL=ui.cjs.map
|
|
201
|
+
//# sourceMappingURL=ui.cjs.map
|
package/dist/ui.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ui.ts"],"names":["createElement"],"mappings":";;;;;AAgBA,SAAS,cAAA,GAAyB;AAChC,EAAA,MAAM,SAAU,OAAO,MAAA,KAAW,WAAA,IAAgB,MAAA,CAAe,oBAAqB,EAAC;AACvF,EAAA,OAAO,OAAO,WAAA,IAAe,EAAA;AAC/B;AAIO,SAAS,KAAK,KAAA,EAA+C;AAClE,EAAA,OAAOA,oBAAc,KAAA,EAAO;AAAA,IAC1B,OAAO,EAA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,IAC5B,GAAA,EAAK,MAAM,GAAA,KAAQ,KAAA,CAAM,OAAO,cAAA,EAAe,GAAI,MAAM,IAAA,GAAO,EAAA,CAAA;AAAA,IAChE,QAAA,EAAU,IAAA;AAAA,IACV,SAAA,EAAW,MAAM,SAAA,IAAa;AAAA,GAC/B,CAAA;AACH;AAEO,SAAS,YAAY,KAAA,EAA+C;AACzE,EAAA,OAAOA,mBAAA,CAAc,KAAA,EAAO,EAAE,SAAA,EAAW,KAAA,CAAM,aAAa,EAAA,EAAG,EAAG,KAAA,CAAM,QAAA,IAAY,cAAc,CAAA;AACpG","file":"ui.cjs","sourcesContent":["/**\n * @fsaos/ui — UI Primitives\n *\n * Lightweight layout and display components for edge-served FSAOS components.\n * These render real HTML/CSS using CSS custom properties from the scope's theme.\n *\n * Built as a separate IIFE bundle → window.__FSAOS_UI__\n * Components: Page, Stack, Grid, Sidebar, Card, Badge, Spinner, Button,\n * Empty, DataView, Table, Form, Detail, Router, Link, Tabs,\n * Breadcrumbs, Image, Video, FilePreview\n */\n\nimport { createElement } from 'react';\n\n// ── Helpers ────────────────────────────────────────────────────────────────\n\nfunction getEdgeBaseUrl(): string {\n const config = (typeof window !== 'undefined' && (window as any).__FSAOS_CONFIG__) || {};\n return config.edgeBaseUrl || '';\n}\n\n// ── Layout Components ──────────────────────────────────────────────────────\n\nexport function Page(props: { className?: string; children?: any }) {\n return createElement('div', {\n style: { minHeight: '100vh', display: 'flex', flexDirection: 'column' },\n className: props.className || '',\n }, props.children);\n}\n\nexport function Stack(props: {\n direction?: 'vertical' | 'horizontal';\n gap?: string;\n padding?: string;\n align?: string;\n justify?: string;\n flex?: string;\n className?: string;\n children?: any;\n}) {\n const dir = props.direction || 'vertical';\n return createElement('div', {\n style: {\n display: 'flex',\n flexDirection: dir === 'horizontal' ? 'row' : 'column',\n gap: props.gap || '0.5rem',\n padding: props.padding || '0',\n alignItems: props.align || 'stretch',\n justifyContent: props.justify || 'flex-start',\n flex: props.flex || 'initial',\n },\n className: props.className || '',\n }, props.children);\n}\n\nexport function Grid(props: {\n columns?: number;\n gap?: string;\n padding?: string;\n className?: string;\n children?: any;\n}) {\n return createElement('div', {\n style: {\n display: 'grid',\n gridTemplateColumns: 'repeat(' + (props.columns || 3) + ', 1fr)',\n gap: props.gap || '1rem',\n padding: props.padding || '0',\n },\n className: props.className || '',\n }, props.children);\n}\n\nexport function Sidebar(props: { className?: string; children?: any }) {\n return createElement('div', {\n style: { display: 'flex', flexDirection: 'row', minHeight: '100vh' },\n className: props.className || '',\n }, props.children);\n}\n\n// ── Display Components ─────────────────────────────────────────────────────\n\nexport function Card(props: {\n padding?: string;\n className?: string;\n onClick?: () => void;\n children?: any;\n}) {\n return createElement('div', {\n style: {\n border: '1px solid var(--color-border, #e5e7eb)',\n borderRadius: 'var(--border-radius, 0.5rem)',\n padding: props.padding || '1rem',\n background: 'var(--color-surface, #fff)',\n },\n className: props.className || '',\n onClick: props.onClick,\n }, props.children);\n}\n\nexport function Badge(props: {\n color?: string;\n textColor?: string;\n label?: string;\n className?: string;\n children?: any;\n}) {\n return createElement('span', {\n style: {\n display: 'inline-flex',\n alignItems: 'center',\n padding: '0.125rem 0.5rem',\n fontSize: '0.75rem',\n fontWeight: '500',\n borderRadius: '9999px',\n background: props.color || '#e5e7eb',\n color: props.textColor || '#374151',\n },\n className: props.className || '',\n }, props.children || props.label);\n}\n\nexport function Spinner(props: { size?: string }) {\n const size = props.size || '1.5rem';\n return createElement('div', {\n style: {\n width: size,\n height: size,\n border: '2px solid #e5e7eb',\n borderTopColor: 'var(--color-primary, #3b82f6)',\n borderRadius: '50%',\n animation: 'fsaos-spin 0.6s linear infinite',\n },\n });\n}\n\nexport function Button(props: {\n variant?: 'default' | 'outline' | 'ghost';\n disabled?: boolean;\n label?: string;\n className?: string;\n onClick?: () => void;\n children?: any;\n}) {\n return createElement('button', {\n style: {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: '0.5rem 1rem',\n fontSize: '0.875rem',\n fontWeight: '500',\n borderRadius: 'var(--border-radius, 0.375rem)',\n border: props.variant === 'outline' ? '1px solid var(--color-border, #d1d5db)' : 'none',\n background: props.variant === 'outline' || props.variant === 'ghost'\n ? 'transparent'\n : 'var(--color-primary, #3b82f6)',\n color: props.variant === 'outline' || props.variant === 'ghost'\n ? 'var(--color-text, #1a1a1a)'\n : '#fff',\n cursor: props.disabled ? 'not-allowed' : 'pointer',\n opacity: props.disabled ? '0.5' : '1',\n gap: '0.5rem',\n },\n className: props.className || '',\n onClick: props.onClick,\n disabled: props.disabled,\n }, props.children || props.label);\n}\n\nexport function Empty(props: {\n icon?: string;\n title?: string;\n message?: string;\n description?: string;\n className?: string;\n children?: any;\n}) {\n return createElement('div', {\n style: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n padding: '3rem',\n color: 'var(--color-text-secondary, #6b7280)',\n textAlign: 'center',\n },\n },\n props.icon\n ? createElement('div', { style: { fontSize: '2rem', marginBottom: '0.5rem' } }, props.icon)\n : null,\n createElement('div', { style: { fontWeight: 500, marginBottom: '0.25rem' } },\n props.title || props.message || props.children || 'No items',\n ),\n props.description\n ? createElement('div', { style: { fontSize: '0.875rem', opacity: 0.7 } }, props.description)\n : null,\n );\n}\n\n// ── Passthrough Components ─────────────────────────────────────────────────\n// These render basic HTML elements. Components can style them via className.\n\nexport function DataView(props: { className?: string; children?: any }) {\n return createElement('div', { className: props.className || '' }, props.children);\n}\n\nexport function Table(props: { className?: string; children?: any }) {\n return createElement('table', { className: props.className || '' }, props.children);\n}\n\nexport function Form(props: { className?: string; onSubmit?: (e: any) => void; children?: any }) {\n return createElement('form', { className: props.className || '', onSubmit: props.onSubmit }, props.children);\n}\n\nexport function Detail(props: { className?: string; children?: any }) {\n return createElement('div', { className: props.className || '' }, props.children);\n}\n\nexport function Router(props: { children?: any }) {\n return createElement('div', null, props.children);\n}\n\nexport function Link(props: {\n href?: string;\n to?: string;\n className?: string;\n onClick?: (e: any) => void;\n children?: any;\n}) {\n return createElement('a', {\n href: props.href || props.to,\n className: props.className || '',\n onClick: props.onClick,\n }, props.children);\n}\n\nexport function Tabs(props: { className?: string; children?: any }) {\n return createElement('div', { className: props.className || '' }, props.children);\n}\n\nexport function Breadcrumbs(props: { className?: string; children?: any }) {\n return createElement('nav', { className: props.className || '' }, props.children);\n}\n\n// ── Media Components ───────────────────────────────────────────────────────\n\nexport function Image(props: {\n src?: string;\n path?: string;\n alt?: string;\n className?: string;\n style?: any;\n}) {\n return createElement('img', {\n src: props.src || (props.path ? getEdgeBaseUrl() + props.path : ''),\n alt: props.alt || '',\n className: props.className || '',\n style: props.style,\n });\n}\n\nexport function Video(props: {\n src?: string;\n path?: string;\n className?: string;\n}) {\n return createElement('video', {\n src: props.src || (props.path ? getEdgeBaseUrl() + props.path : ''),\n controls: true,\n className: props.className || '',\n });\n}\n\nexport function FilePreview(props: { className?: string; children?: any }) {\n return createElement('div', { className: props.className || '' }, props.children || 'File preview');\n}\n"]}
|
package/dist/ui.d.cts
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fsaos/ui — UI Primitives
|
|
5
|
+
*
|
|
6
|
+
* Lightweight layout and display components for edge-served FSAOS components.
|
|
7
|
+
* These render real HTML/CSS using CSS custom properties from the scope's theme.
|
|
8
|
+
*
|
|
9
|
+
* Built as a separate IIFE bundle → window.__FSAOS_UI__
|
|
10
|
+
* Components: Page, Stack, Grid, Sidebar, Card, Badge, Spinner, Button,
|
|
11
|
+
* Empty, DataView, Table, Form, Detail, Router, Link, Tabs,
|
|
12
|
+
* Breadcrumbs, Image, Video, FilePreview
|
|
13
|
+
*/
|
|
14
|
+
declare function Page(props: {
|
|
15
|
+
className?: string;
|
|
16
|
+
children?: any;
|
|
17
|
+
}): react.DetailedReactHTMLElement<{
|
|
18
|
+
style: {
|
|
19
|
+
minHeight: string;
|
|
20
|
+
display: "flex";
|
|
21
|
+
flexDirection: "column";
|
|
22
|
+
};
|
|
23
|
+
className: string;
|
|
24
|
+
}, HTMLElement>;
|
|
25
|
+
declare function Stack(props: {
|
|
26
|
+
direction?: 'vertical' | 'horizontal';
|
|
27
|
+
gap?: string;
|
|
28
|
+
padding?: string;
|
|
29
|
+
align?: string;
|
|
30
|
+
justify?: string;
|
|
31
|
+
flex?: string;
|
|
32
|
+
className?: string;
|
|
33
|
+
children?: any;
|
|
34
|
+
}): react.DetailedReactHTMLElement<{
|
|
35
|
+
style: {
|
|
36
|
+
display: "flex";
|
|
37
|
+
flexDirection: "column" | "row";
|
|
38
|
+
gap: string;
|
|
39
|
+
padding: string;
|
|
40
|
+
alignItems: string;
|
|
41
|
+
justifyContent: string;
|
|
42
|
+
flex: string;
|
|
43
|
+
};
|
|
44
|
+
className: string;
|
|
45
|
+
}, HTMLElement>;
|
|
46
|
+
declare function Grid(props: {
|
|
47
|
+
columns?: number;
|
|
48
|
+
gap?: string;
|
|
49
|
+
padding?: string;
|
|
50
|
+
className?: string;
|
|
51
|
+
children?: any;
|
|
52
|
+
}): react.DetailedReactHTMLElement<{
|
|
53
|
+
style: {
|
|
54
|
+
display: "grid";
|
|
55
|
+
gridTemplateColumns: string;
|
|
56
|
+
gap: string;
|
|
57
|
+
padding: string;
|
|
58
|
+
};
|
|
59
|
+
className: string;
|
|
60
|
+
}, HTMLElement>;
|
|
61
|
+
declare function Sidebar(props: {
|
|
62
|
+
className?: string;
|
|
63
|
+
children?: any;
|
|
64
|
+
}): react.DetailedReactHTMLElement<{
|
|
65
|
+
style: {
|
|
66
|
+
display: "flex";
|
|
67
|
+
flexDirection: "row";
|
|
68
|
+
minHeight: string;
|
|
69
|
+
};
|
|
70
|
+
className: string;
|
|
71
|
+
}, HTMLElement>;
|
|
72
|
+
declare function Card(props: {
|
|
73
|
+
padding?: string;
|
|
74
|
+
className?: string;
|
|
75
|
+
onClick?: () => void;
|
|
76
|
+
children?: any;
|
|
77
|
+
}): react.DetailedReactHTMLElement<{
|
|
78
|
+
style: {
|
|
79
|
+
border: string;
|
|
80
|
+
borderRadius: string;
|
|
81
|
+
padding: string;
|
|
82
|
+
background: string;
|
|
83
|
+
};
|
|
84
|
+
className: string;
|
|
85
|
+
onClick: (() => void) | undefined;
|
|
86
|
+
}, HTMLElement>;
|
|
87
|
+
declare function Badge(props: {
|
|
88
|
+
color?: string;
|
|
89
|
+
textColor?: string;
|
|
90
|
+
label?: string;
|
|
91
|
+
className?: string;
|
|
92
|
+
children?: any;
|
|
93
|
+
}): react.DetailedReactHTMLElement<{
|
|
94
|
+
style: {
|
|
95
|
+
display: "inline-flex";
|
|
96
|
+
alignItems: "center";
|
|
97
|
+
padding: string;
|
|
98
|
+
fontSize: string;
|
|
99
|
+
fontWeight: "500";
|
|
100
|
+
borderRadius: string;
|
|
101
|
+
background: string;
|
|
102
|
+
color: string;
|
|
103
|
+
};
|
|
104
|
+
className: string;
|
|
105
|
+
}, HTMLElement>;
|
|
106
|
+
declare function Spinner(props: {
|
|
107
|
+
size?: string;
|
|
108
|
+
}): react.DetailedReactHTMLElement<{
|
|
109
|
+
style: {
|
|
110
|
+
width: string;
|
|
111
|
+
height: string;
|
|
112
|
+
border: string;
|
|
113
|
+
borderTopColor: "var(--color-primary, #3b82f6)";
|
|
114
|
+
borderRadius: string;
|
|
115
|
+
animation: "fsaos-spin 0.6s linear infinite";
|
|
116
|
+
};
|
|
117
|
+
}, HTMLElement>;
|
|
118
|
+
declare function Button(props: {
|
|
119
|
+
variant?: 'default' | 'outline' | 'ghost';
|
|
120
|
+
disabled?: boolean;
|
|
121
|
+
label?: string;
|
|
122
|
+
className?: string;
|
|
123
|
+
onClick?: () => void;
|
|
124
|
+
children?: any;
|
|
125
|
+
}): react.DetailedReactHTMLElement<{
|
|
126
|
+
style: {
|
|
127
|
+
display: "inline-flex";
|
|
128
|
+
alignItems: "center";
|
|
129
|
+
justifyContent: "center";
|
|
130
|
+
padding: string;
|
|
131
|
+
fontSize: string;
|
|
132
|
+
fontWeight: "500";
|
|
133
|
+
borderRadius: string;
|
|
134
|
+
border: string;
|
|
135
|
+
background: string;
|
|
136
|
+
color: "var(--color-text, #1a1a1a)" | "#fff";
|
|
137
|
+
cursor: "not-allowed" | "pointer";
|
|
138
|
+
opacity: "0.5" | "1";
|
|
139
|
+
gap: string;
|
|
140
|
+
};
|
|
141
|
+
className: string;
|
|
142
|
+
onClick: (() => void) | undefined;
|
|
143
|
+
disabled: boolean | undefined;
|
|
144
|
+
}, HTMLElement>;
|
|
145
|
+
declare function Empty(props: {
|
|
146
|
+
icon?: string;
|
|
147
|
+
title?: string;
|
|
148
|
+
message?: string;
|
|
149
|
+
description?: string;
|
|
150
|
+
className?: string;
|
|
151
|
+
children?: any;
|
|
152
|
+
}): react.DetailedReactHTMLElement<{
|
|
153
|
+
style: {
|
|
154
|
+
display: "flex";
|
|
155
|
+
flexDirection: "column";
|
|
156
|
+
alignItems: "center";
|
|
157
|
+
justifyContent: "center";
|
|
158
|
+
padding: string;
|
|
159
|
+
color: "var(--color-text-secondary, #6b7280)";
|
|
160
|
+
textAlign: "center";
|
|
161
|
+
};
|
|
162
|
+
}, HTMLElement>;
|
|
163
|
+
declare function DataView(props: {
|
|
164
|
+
className?: string;
|
|
165
|
+
children?: any;
|
|
166
|
+
}): react.DetailedReactHTMLElement<{
|
|
167
|
+
className: string;
|
|
168
|
+
}, HTMLElement>;
|
|
169
|
+
declare function Table(props: {
|
|
170
|
+
className?: string;
|
|
171
|
+
children?: any;
|
|
172
|
+
}): react.DetailedReactHTMLElement<{
|
|
173
|
+
className: string;
|
|
174
|
+
}, HTMLElement>;
|
|
175
|
+
declare function Form(props: {
|
|
176
|
+
className?: string;
|
|
177
|
+
onSubmit?: (e: any) => void;
|
|
178
|
+
children?: any;
|
|
179
|
+
}): react.DetailedReactHTMLElement<{
|
|
180
|
+
className: string;
|
|
181
|
+
onSubmit: ((e: any) => void) | undefined;
|
|
182
|
+
}, HTMLElement>;
|
|
183
|
+
declare function Detail(props: {
|
|
184
|
+
className?: string;
|
|
185
|
+
children?: any;
|
|
186
|
+
}): react.DetailedReactHTMLElement<{
|
|
187
|
+
className: string;
|
|
188
|
+
}, HTMLElement>;
|
|
189
|
+
declare function Router(props: {
|
|
190
|
+
children?: any;
|
|
191
|
+
}): react.DetailedReactHTMLElement<react.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
192
|
+
declare function Link(props: {
|
|
193
|
+
href?: string;
|
|
194
|
+
to?: string;
|
|
195
|
+
className?: string;
|
|
196
|
+
onClick?: (e: any) => void;
|
|
197
|
+
children?: any;
|
|
198
|
+
}): react.DetailedReactHTMLElement<{
|
|
199
|
+
href: string | undefined;
|
|
200
|
+
className: string;
|
|
201
|
+
onClick: ((e: any) => void) | undefined;
|
|
202
|
+
}, HTMLElement>;
|
|
203
|
+
declare function Tabs(props: {
|
|
204
|
+
className?: string;
|
|
205
|
+
children?: any;
|
|
206
|
+
}): react.DetailedReactHTMLElement<{
|
|
207
|
+
className: string;
|
|
208
|
+
}, HTMLElement>;
|
|
209
|
+
declare function Breadcrumbs(props: {
|
|
210
|
+
className?: string;
|
|
211
|
+
children?: any;
|
|
212
|
+
}): react.DetailedReactHTMLElement<{
|
|
213
|
+
className: string;
|
|
214
|
+
}, HTMLElement>;
|
|
215
|
+
declare function Image(props: {
|
|
216
|
+
src?: string;
|
|
217
|
+
path?: string;
|
|
218
|
+
alt?: string;
|
|
219
|
+
className?: string;
|
|
220
|
+
style?: any;
|
|
221
|
+
}): react.DetailedReactHTMLElement<{
|
|
222
|
+
src: string;
|
|
223
|
+
alt: string;
|
|
224
|
+
className: string;
|
|
225
|
+
style: any;
|
|
226
|
+
}, HTMLElement>;
|
|
227
|
+
declare function Video(props: {
|
|
228
|
+
src?: string;
|
|
229
|
+
path?: string;
|
|
230
|
+
className?: string;
|
|
231
|
+
}): react.DetailedReactHTMLElement<{
|
|
232
|
+
src: string;
|
|
233
|
+
controls: boolean;
|
|
234
|
+
className: string;
|
|
235
|
+
}, HTMLElement>;
|
|
236
|
+
declare function FilePreview(props: {
|
|
237
|
+
className?: string;
|
|
238
|
+
children?: any;
|
|
239
|
+
}): react.DetailedReactHTMLElement<{
|
|
240
|
+
className: string;
|
|
241
|
+
}, HTMLElement>;
|
|
242
|
+
|
|
243
|
+
export { Badge, Breadcrumbs, Button, Card, DataView, Detail, Empty, FilePreview, Form, Grid, Image, Link, Page, Router, Sidebar, Spinner, Stack, Table, Tabs, Video };
|