@spicenet-io/spiceflow-ui 1.9.34 → 1.9.35
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/Button-4ryz2e1P.js +2 -0
- package/dist/Button-Cn16gFtO.js +2 -0
- package/dist/auth-dynamic.cjs.js +3 -1019
- package/dist/auth-dynamic.js +3 -1017
- package/dist/auth-privy.cjs.js +2 -125
- package/dist/auth-privy.js +2 -123
- package/dist/index.cjs.js +16 -14242
- package/dist/index.js +16 -14215
- package/dist/types/authorization.d.ts +0 -1
- package/dist/utils/relayer/index.d.ts +9 -0
- package/package.json +10 -17
- package/dist/Button-CWjGZdAM.js +0 -228
- package/dist/Button-D2yFTia-.js +0 -232
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CreateActionRequest, CreateActionResponse, ExecuteStepRequest } from "../../types/unified";
|
|
2
2
|
import { SwapStep } from "../../types/status";
|
|
3
3
|
import { ChainBatch } from "../../types/authorization";
|
|
4
|
+
import { RelayerSubmitRequest, RelayerSubmitResponse } from "@/types/relayer";
|
|
4
5
|
export declare const RELAYER_API_URL: string;
|
|
5
6
|
export declare class RelayerService {
|
|
6
7
|
private baseUrl;
|
|
@@ -39,6 +40,14 @@ export declare class RelayerService {
|
|
|
39
40
|
amount?: string;
|
|
40
41
|
errorMessage?: string;
|
|
41
42
|
}>;
|
|
43
|
+
submitTransaction(request: RelayerSubmitRequest): Promise<RelayerSubmitResponse>;
|
|
44
|
+
checkStepStatusSubmitRoute(intentId: string, stepId: number): Promise<{
|
|
45
|
+
success: boolean;
|
|
46
|
+
data: {
|
|
47
|
+
status: "created" | "executing" | "success" | "reverted";
|
|
48
|
+
transactionHash?: string;
|
|
49
|
+
};
|
|
50
|
+
}>;
|
|
42
51
|
}
|
|
43
52
|
export declare const relayerService: RelayerService;
|
|
44
53
|
export declare const createInitialSteps: (chainBatches: ChainBatch[], customGetChainName?: (chainId: number) => string) => SwapStep[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spicenet-io/spiceflow-ui",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.35",
|
|
4
4
|
"description": "Spiceflow UI SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -38,21 +38,11 @@
|
|
|
38
38
|
".npmrc"
|
|
39
39
|
],
|
|
40
40
|
"scripts": {
|
|
41
|
-
"build
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"build:watch": "rollup -c rollup.config.mjs --watch",
|
|
41
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json --emitDeclarationOnly && rollup -c rollup.config.mjs",
|
|
42
|
+
"dev": "npm run build:watch",
|
|
43
|
+
"dev:link": "npm run build && npm link && echo '✅ SDK linked globally. Run: npm link @spicenet-io/spiceflow-ui in your project'",
|
|
45
44
|
"clean": "rm -rf dist",
|
|
46
|
-
"
|
|
47
|
-
"pack:local": "npm run build && npm pack",
|
|
48
|
-
"lint": "eslint src --ext .ts,.tsx",
|
|
49
|
-
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
50
|
-
"format": "prettier --write 'src/**/*.{ts,tsx,js,jsx,json,md}'",
|
|
51
|
-
"format:check": "prettier --check 'src/**/*.{ts,tsx,js,jsx,json,md}'",
|
|
52
|
-
"typecheck": "tsc --noEmit",
|
|
53
|
-
"prepublishOnly": "npm run build",
|
|
54
|
-
"prepare": "husky install",
|
|
55
|
-
"clean-install": "rm -rf node_modules package-lock.json && npm install"
|
|
45
|
+
"prepublishOnly": "npm run build"
|
|
56
46
|
},
|
|
57
47
|
"keywords": [
|
|
58
48
|
"react",
|
|
@@ -75,7 +65,7 @@
|
|
|
75
65
|
"@dynamic-labs/sdk-react-core": ">=3.9.13 <5.0.0",
|
|
76
66
|
"@dynamic-labs/wallet-connector-core": ">=3.9.13 <5.0.0",
|
|
77
67
|
"@privy-io/react-auth": ">=2.24.0 <4.0.0",
|
|
78
|
-
"@spicenet-io/spiceflow-core": "0.1.
|
|
68
|
+
"@spicenet-io/spiceflow-core": "0.1.3",
|
|
79
69
|
"@tanstack/react-query": ">=5.0.0",
|
|
80
70
|
"axios": ">=1.0.0",
|
|
81
71
|
"react": "^18.0.0",
|
|
@@ -108,7 +98,7 @@
|
|
|
108
98
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
109
99
|
"@rollup/plugin-replace": "^6.0.2",
|
|
110
100
|
"@rollup/plugin-typescript": "^12.1.4",
|
|
111
|
-
"@spicenet-io/spiceflow-core": "0.1.
|
|
101
|
+
"@spicenet-io/spiceflow-core": "0.1.3",
|
|
112
102
|
"@tanstack/react-query": "^5.90.5",
|
|
113
103
|
"@types/node": "^24.3.0",
|
|
114
104
|
"@types/react": "^18.3.3",
|
|
@@ -122,6 +112,7 @@
|
|
|
122
112
|
"eslint-plugin-react": "^7.33.0",
|
|
123
113
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
124
114
|
"husky": "^9.1.7",
|
|
115
|
+
"jest": "^29.6.0",
|
|
125
116
|
"lint-staged": "^16.2.5",
|
|
126
117
|
"lucide-react": "^0.562.0",
|
|
127
118
|
"postcss": "^8.5.6",
|
|
@@ -134,6 +125,8 @@
|
|
|
134
125
|
"rollup-plugin-esbuild": "^6.1.1",
|
|
135
126
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
136
127
|
"rollup-plugin-postcss": "^4.0.2",
|
|
128
|
+
"sharp": "^0.34.5",
|
|
129
|
+
"spiceflow-core-test": "^0.1.0",
|
|
137
130
|
"ts-node": "^10.9.2",
|
|
138
131
|
"typescript": "^5.9.2",
|
|
139
132
|
"viem": "2.33.1",
|
package/dist/Button-CWjGZdAM.js
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
|
|
4
|
-
const baseTheme = {
|
|
5
|
-
spacing: {
|
|
6
|
-
xs: "0.25rem",
|
|
7
|
-
sm: "0.5rem",
|
|
8
|
-
md: "1rem",
|
|
9
|
-
lg: "1.5rem",
|
|
10
|
-
xl: "2rem"
|
|
11
|
-
},
|
|
12
|
-
borderRadius: {
|
|
13
|
-
sm: "0.25rem",
|
|
14
|
-
md: "0.5rem",
|
|
15
|
-
lg: "0.75rem",
|
|
16
|
-
full: "9999px"
|
|
17
|
-
},
|
|
18
|
-
typography: {
|
|
19
|
-
fontFamily: '"Helvetica Neue", sans-serif',
|
|
20
|
-
fontSize: {
|
|
21
|
-
xs: "0.75rem",
|
|
22
|
-
sm: "0.875rem",
|
|
23
|
-
base: "1rem",
|
|
24
|
-
lg: "1.125rem",
|
|
25
|
-
xl: "1.25rem",
|
|
26
|
-
"2xl": "1.5rem",
|
|
27
|
-
"3xl": "1.75rem"
|
|
28
|
-
},
|
|
29
|
-
fontWeight: {
|
|
30
|
-
normal: 400,
|
|
31
|
-
medium: 500,
|
|
32
|
-
semibold: 600,
|
|
33
|
-
bold: 700
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
shadows: {
|
|
37
|
-
sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
38
|
-
md: "0 4px 6px -1px rgb(0 0 0 / 0.1)",
|
|
39
|
-
lg: "0 10px 15px -3px rgb(0 0 0 / 0.1)"
|
|
40
|
-
},
|
|
41
|
-
animation: {
|
|
42
|
-
fast: "150ms ease-in-out",
|
|
43
|
-
normal: "200ms ease-in-out",
|
|
44
|
-
slow: "300ms ease-in-out"
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const lightColors = {
|
|
48
|
-
primary: "#EA4B4B",
|
|
49
|
-
primaryHover: "#E43838",
|
|
50
|
-
secondary: "#f3f4f6",
|
|
51
|
-
background: "#ffffff",
|
|
52
|
-
surface: "#f9fafb",
|
|
53
|
-
surfaceHover: "#f3f4f6",
|
|
54
|
-
border: "#e5e7eb",
|
|
55
|
-
borderHover: "#d1d5db",
|
|
56
|
-
text: "#111827",
|
|
57
|
-
textSecondary: "#374151",
|
|
58
|
-
textMuted: "#6b7280",
|
|
59
|
-
success: "#10b981",
|
|
60
|
-
error: "#ef4444",
|
|
61
|
-
warning: "#f59e0b",
|
|
62
|
-
info: "#3b82f6"
|
|
63
|
-
};
|
|
64
|
-
const darkColors = {
|
|
65
|
-
primary: "#EA4B4B",
|
|
66
|
-
primaryHover: "#E43838",
|
|
67
|
-
secondary: "#1f2937",
|
|
68
|
-
background: "#111217",
|
|
69
|
-
surface: "#161a22",
|
|
70
|
-
surfaceHover: "#1f2937",
|
|
71
|
-
border: "#374151",
|
|
72
|
-
borderHover: "#4b5563",
|
|
73
|
-
text: "#ffffff",
|
|
74
|
-
textSecondary: "#d1d5db",
|
|
75
|
-
textMuted: "#9ca3af",
|
|
76
|
-
success: "#10b981",
|
|
77
|
-
error: "#ef4444",
|
|
78
|
-
warning: "#f59e0b",
|
|
79
|
-
info: "#3b82f6"
|
|
80
|
-
};
|
|
81
|
-
const createTheme = (mode = "light") => {
|
|
82
|
-
return {
|
|
83
|
-
mode,
|
|
84
|
-
...baseTheme,
|
|
85
|
-
colors: mode === "light" ? lightColors : darkColors
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
const defaultTheme = createTheme("light");
|
|
89
|
-
|
|
90
|
-
const Button = ({
|
|
91
|
-
variant = "primary",
|
|
92
|
-
size = "md",
|
|
93
|
-
loading = false,
|
|
94
|
-
fullWidth = false,
|
|
95
|
-
disabled,
|
|
96
|
-
children,
|
|
97
|
-
className = "",
|
|
98
|
-
style,
|
|
99
|
-
theme: providedTheme,
|
|
100
|
-
styles,
|
|
101
|
-
...props
|
|
102
|
-
}) => {
|
|
103
|
-
const theme = providedTheme || createTheme("light");
|
|
104
|
-
const getVariantStyles = () => {
|
|
105
|
-
switch (variant) {
|
|
106
|
-
case "primary":
|
|
107
|
-
return {
|
|
108
|
-
backgroundColor: styles?.button?.backgroundColor || theme.colors.primary,
|
|
109
|
-
color: styles?.button?.color || "#ffffff",
|
|
110
|
-
border: `1px solid ${styles?.button?.backgroundColor || theme.colors.primary}`,
|
|
111
|
-
":hover": {
|
|
112
|
-
backgroundColor: theme.colors.primaryHover
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
case "secondary":
|
|
116
|
-
return {
|
|
117
|
-
backgroundColor: theme.colors.secondary,
|
|
118
|
-
color: theme.colors.text,
|
|
119
|
-
border: `1px solid ${theme.colors.border}`,
|
|
120
|
-
":hover": {
|
|
121
|
-
backgroundColor: theme.colors.surfaceHover
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
case "success":
|
|
125
|
-
return {
|
|
126
|
-
backgroundColor: theme.colors.success,
|
|
127
|
-
color: theme.colors.text,
|
|
128
|
-
border: `1px solid ${theme.colors.success}`
|
|
129
|
-
};
|
|
130
|
-
case "error":
|
|
131
|
-
return {
|
|
132
|
-
backgroundColor: theme.colors.error,
|
|
133
|
-
color: theme.colors.text,
|
|
134
|
-
border: `1px solid ${theme.colors.error}`
|
|
135
|
-
};
|
|
136
|
-
case "ghost":
|
|
137
|
-
return {
|
|
138
|
-
backgroundColor: "transparent",
|
|
139
|
-
color: theme.colors.textSecondary,
|
|
140
|
-
border: `1px solid ${theme.colors.border}`,
|
|
141
|
-
":hover": {
|
|
142
|
-
backgroundColor: theme.colors.surface
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
case "outline":
|
|
146
|
-
return {
|
|
147
|
-
backgroundColor: theme.colors.primary,
|
|
148
|
-
color: "#000000",
|
|
149
|
-
border: "1px solid black",
|
|
150
|
-
boxShadow: "3px 3px 0px white, 4px 4px 0px black",
|
|
151
|
-
// layered for comic pop
|
|
152
|
-
transition: "transform 0.1s ease, box-shadow 0.1s ease",
|
|
153
|
-
":hover": {
|
|
154
|
-
transform: "translate(-2px, -2px)",
|
|
155
|
-
boxShadow: "6px 6px 0px #000000, 8px 8px 0px rgba(0, 0, 0, 0.2)"
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
default:
|
|
159
|
-
return {};
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
const getSizeStyles = () => {
|
|
163
|
-
switch (size) {
|
|
164
|
-
case "sm":
|
|
165
|
-
return {
|
|
166
|
-
padding: `${theme.spacing.sm} ${theme.spacing.md}`,
|
|
167
|
-
fontSize: theme.typography.fontSize.sm
|
|
168
|
-
};
|
|
169
|
-
case "md":
|
|
170
|
-
return {
|
|
171
|
-
padding: `${theme.spacing.md} ${theme.spacing.lg}`,
|
|
172
|
-
fontSize: theme.typography.fontSize.base
|
|
173
|
-
};
|
|
174
|
-
case "lg":
|
|
175
|
-
return {
|
|
176
|
-
padding: `${theme.spacing.lg} ${theme.spacing.xl}`,
|
|
177
|
-
fontSize: theme.typography.fontSize.lg
|
|
178
|
-
};
|
|
179
|
-
default:
|
|
180
|
-
return {};
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
const variantStyles = getVariantStyles();
|
|
184
|
-
const baseStyles = {
|
|
185
|
-
borderRadius: styles?.button?.borderRadius || theme.borderRadius.md,
|
|
186
|
-
fontWeight: styles?.button?.fontWeight || theme.typography.fontWeight.medium,
|
|
187
|
-
fontFamily: styles?.button?.fontFamily || theme.typography.fontFamily,
|
|
188
|
-
fontSize: styles?.button?.fontSize || void 0,
|
|
189
|
-
transition: `all ${theme.animation.normal}`,
|
|
190
|
-
cursor: disabled || loading ? "not-allowed" : "pointer",
|
|
191
|
-
opacity: disabled || loading ? 0.6 : 1,
|
|
192
|
-
width: fullWidth ? "100%" : "auto",
|
|
193
|
-
display: "flex",
|
|
194
|
-
alignItems: "center",
|
|
195
|
-
justifyContent: "center",
|
|
196
|
-
gap: theme.spacing.sm,
|
|
197
|
-
...variantStyles,
|
|
198
|
-
...getSizeStyles(),
|
|
199
|
-
...styles?.button?.fontSize && { fontSize: styles.button.fontSize }
|
|
200
|
-
};
|
|
201
|
-
return /* @__PURE__ */ jsxs(
|
|
202
|
-
"button",
|
|
203
|
-
{
|
|
204
|
-
style: { ...baseStyles, ...style },
|
|
205
|
-
className,
|
|
206
|
-
disabled: disabled || loading,
|
|
207
|
-
...props,
|
|
208
|
-
children: [
|
|
209
|
-
loading && /* @__PURE__ */ jsx(
|
|
210
|
-
"div",
|
|
211
|
-
{
|
|
212
|
-
style: {
|
|
213
|
-
width: "1rem",
|
|
214
|
-
height: "1rem",
|
|
215
|
-
border: "2px solid currentColor",
|
|
216
|
-
borderTop: "2px solid transparent",
|
|
217
|
-
borderRadius: "50%",
|
|
218
|
-
animation: "spin 1s linear infinite"
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
),
|
|
222
|
-
children
|
|
223
|
-
]
|
|
224
|
-
}
|
|
225
|
-
);
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
export { Button as B, createTheme as c, defaultTheme as d };
|
package/dist/Button-D2yFTia-.js
DELETED
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
const jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
|
|
6
|
-
const baseTheme = {
|
|
7
|
-
spacing: {
|
|
8
|
-
xs: "0.25rem",
|
|
9
|
-
sm: "0.5rem",
|
|
10
|
-
md: "1rem",
|
|
11
|
-
lg: "1.5rem",
|
|
12
|
-
xl: "2rem"
|
|
13
|
-
},
|
|
14
|
-
borderRadius: {
|
|
15
|
-
sm: "0.25rem",
|
|
16
|
-
md: "0.5rem",
|
|
17
|
-
lg: "0.75rem",
|
|
18
|
-
full: "9999px"
|
|
19
|
-
},
|
|
20
|
-
typography: {
|
|
21
|
-
fontFamily: '"Helvetica Neue", sans-serif',
|
|
22
|
-
fontSize: {
|
|
23
|
-
xs: "0.75rem",
|
|
24
|
-
sm: "0.875rem",
|
|
25
|
-
base: "1rem",
|
|
26
|
-
lg: "1.125rem",
|
|
27
|
-
xl: "1.25rem",
|
|
28
|
-
"2xl": "1.5rem",
|
|
29
|
-
"3xl": "1.75rem"
|
|
30
|
-
},
|
|
31
|
-
fontWeight: {
|
|
32
|
-
normal: 400,
|
|
33
|
-
medium: 500,
|
|
34
|
-
semibold: 600,
|
|
35
|
-
bold: 700
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
shadows: {
|
|
39
|
-
sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
40
|
-
md: "0 4px 6px -1px rgb(0 0 0 / 0.1)",
|
|
41
|
-
lg: "0 10px 15px -3px rgb(0 0 0 / 0.1)"
|
|
42
|
-
},
|
|
43
|
-
animation: {
|
|
44
|
-
fast: "150ms ease-in-out",
|
|
45
|
-
normal: "200ms ease-in-out",
|
|
46
|
-
slow: "300ms ease-in-out"
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
const lightColors = {
|
|
50
|
-
primary: "#EA4B4B",
|
|
51
|
-
primaryHover: "#E43838",
|
|
52
|
-
secondary: "#f3f4f6",
|
|
53
|
-
background: "#ffffff",
|
|
54
|
-
surface: "#f9fafb",
|
|
55
|
-
surfaceHover: "#f3f4f6",
|
|
56
|
-
border: "#e5e7eb",
|
|
57
|
-
borderHover: "#d1d5db",
|
|
58
|
-
text: "#111827",
|
|
59
|
-
textSecondary: "#374151",
|
|
60
|
-
textMuted: "#6b7280",
|
|
61
|
-
success: "#10b981",
|
|
62
|
-
error: "#ef4444",
|
|
63
|
-
warning: "#f59e0b",
|
|
64
|
-
info: "#3b82f6"
|
|
65
|
-
};
|
|
66
|
-
const darkColors = {
|
|
67
|
-
primary: "#EA4B4B",
|
|
68
|
-
primaryHover: "#E43838",
|
|
69
|
-
secondary: "#1f2937",
|
|
70
|
-
background: "#111217",
|
|
71
|
-
surface: "#161a22",
|
|
72
|
-
surfaceHover: "#1f2937",
|
|
73
|
-
border: "#374151",
|
|
74
|
-
borderHover: "#4b5563",
|
|
75
|
-
text: "#ffffff",
|
|
76
|
-
textSecondary: "#d1d5db",
|
|
77
|
-
textMuted: "#9ca3af",
|
|
78
|
-
success: "#10b981",
|
|
79
|
-
error: "#ef4444",
|
|
80
|
-
warning: "#f59e0b",
|
|
81
|
-
info: "#3b82f6"
|
|
82
|
-
};
|
|
83
|
-
const createTheme = (mode = "light") => {
|
|
84
|
-
return {
|
|
85
|
-
mode,
|
|
86
|
-
...baseTheme,
|
|
87
|
-
colors: mode === "light" ? lightColors : darkColors
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
const defaultTheme = createTheme("light");
|
|
91
|
-
|
|
92
|
-
const Button = ({
|
|
93
|
-
variant = "primary",
|
|
94
|
-
size = "md",
|
|
95
|
-
loading = false,
|
|
96
|
-
fullWidth = false,
|
|
97
|
-
disabled,
|
|
98
|
-
children,
|
|
99
|
-
className = "",
|
|
100
|
-
style,
|
|
101
|
-
theme: providedTheme,
|
|
102
|
-
styles,
|
|
103
|
-
...props
|
|
104
|
-
}) => {
|
|
105
|
-
const theme = providedTheme || createTheme("light");
|
|
106
|
-
const getVariantStyles = () => {
|
|
107
|
-
switch (variant) {
|
|
108
|
-
case "primary":
|
|
109
|
-
return {
|
|
110
|
-
backgroundColor: styles?.button?.backgroundColor || theme.colors.primary,
|
|
111
|
-
color: styles?.button?.color || "#ffffff",
|
|
112
|
-
border: `1px solid ${styles?.button?.backgroundColor || theme.colors.primary}`,
|
|
113
|
-
":hover": {
|
|
114
|
-
backgroundColor: theme.colors.primaryHover
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
case "secondary":
|
|
118
|
-
return {
|
|
119
|
-
backgroundColor: theme.colors.secondary,
|
|
120
|
-
color: theme.colors.text,
|
|
121
|
-
border: `1px solid ${theme.colors.border}`,
|
|
122
|
-
":hover": {
|
|
123
|
-
backgroundColor: theme.colors.surfaceHover
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
case "success":
|
|
127
|
-
return {
|
|
128
|
-
backgroundColor: theme.colors.success,
|
|
129
|
-
color: theme.colors.text,
|
|
130
|
-
border: `1px solid ${theme.colors.success}`
|
|
131
|
-
};
|
|
132
|
-
case "error":
|
|
133
|
-
return {
|
|
134
|
-
backgroundColor: theme.colors.error,
|
|
135
|
-
color: theme.colors.text,
|
|
136
|
-
border: `1px solid ${theme.colors.error}`
|
|
137
|
-
};
|
|
138
|
-
case "ghost":
|
|
139
|
-
return {
|
|
140
|
-
backgroundColor: "transparent",
|
|
141
|
-
color: theme.colors.textSecondary,
|
|
142
|
-
border: `1px solid ${theme.colors.border}`,
|
|
143
|
-
":hover": {
|
|
144
|
-
backgroundColor: theme.colors.surface
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
case "outline":
|
|
148
|
-
return {
|
|
149
|
-
backgroundColor: theme.colors.primary,
|
|
150
|
-
color: "#000000",
|
|
151
|
-
border: "1px solid black",
|
|
152
|
-
boxShadow: "3px 3px 0px white, 4px 4px 0px black",
|
|
153
|
-
// layered for comic pop
|
|
154
|
-
transition: "transform 0.1s ease, box-shadow 0.1s ease",
|
|
155
|
-
":hover": {
|
|
156
|
-
transform: "translate(-2px, -2px)",
|
|
157
|
-
boxShadow: "6px 6px 0px #000000, 8px 8px 0px rgba(0, 0, 0, 0.2)"
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
default:
|
|
161
|
-
return {};
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
const getSizeStyles = () => {
|
|
165
|
-
switch (size) {
|
|
166
|
-
case "sm":
|
|
167
|
-
return {
|
|
168
|
-
padding: `${theme.spacing.sm} ${theme.spacing.md}`,
|
|
169
|
-
fontSize: theme.typography.fontSize.sm
|
|
170
|
-
};
|
|
171
|
-
case "md":
|
|
172
|
-
return {
|
|
173
|
-
padding: `${theme.spacing.md} ${theme.spacing.lg}`,
|
|
174
|
-
fontSize: theme.typography.fontSize.base
|
|
175
|
-
};
|
|
176
|
-
case "lg":
|
|
177
|
-
return {
|
|
178
|
-
padding: `${theme.spacing.lg} ${theme.spacing.xl}`,
|
|
179
|
-
fontSize: theme.typography.fontSize.lg
|
|
180
|
-
};
|
|
181
|
-
default:
|
|
182
|
-
return {};
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
const variantStyles = getVariantStyles();
|
|
186
|
-
const baseStyles = {
|
|
187
|
-
borderRadius: styles?.button?.borderRadius || theme.borderRadius.md,
|
|
188
|
-
fontWeight: styles?.button?.fontWeight || theme.typography.fontWeight.medium,
|
|
189
|
-
fontFamily: styles?.button?.fontFamily || theme.typography.fontFamily,
|
|
190
|
-
fontSize: styles?.button?.fontSize || void 0,
|
|
191
|
-
transition: `all ${theme.animation.normal}`,
|
|
192
|
-
cursor: disabled || loading ? "not-allowed" : "pointer",
|
|
193
|
-
opacity: disabled || loading ? 0.6 : 1,
|
|
194
|
-
width: fullWidth ? "100%" : "auto",
|
|
195
|
-
display: "flex",
|
|
196
|
-
alignItems: "center",
|
|
197
|
-
justifyContent: "center",
|
|
198
|
-
gap: theme.spacing.sm,
|
|
199
|
-
...variantStyles,
|
|
200
|
-
...getSizeStyles(),
|
|
201
|
-
...styles?.button?.fontSize && { fontSize: styles.button.fontSize }
|
|
202
|
-
};
|
|
203
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
204
|
-
"button",
|
|
205
|
-
{
|
|
206
|
-
style: { ...baseStyles, ...style },
|
|
207
|
-
className,
|
|
208
|
-
disabled: disabled || loading,
|
|
209
|
-
...props,
|
|
210
|
-
children: [
|
|
211
|
-
loading && /* @__PURE__ */ jsxRuntime.jsx(
|
|
212
|
-
"div",
|
|
213
|
-
{
|
|
214
|
-
style: {
|
|
215
|
-
width: "1rem",
|
|
216
|
-
height: "1rem",
|
|
217
|
-
border: "2px solid currentColor",
|
|
218
|
-
borderTop: "2px solid transparent",
|
|
219
|
-
borderRadius: "50%",
|
|
220
|
-
animation: "spin 1s linear infinite"
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
),
|
|
224
|
-
children
|
|
225
|
-
]
|
|
226
|
-
}
|
|
227
|
-
);
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
exports.Button = Button;
|
|
231
|
-
exports.createTheme = createTheme;
|
|
232
|
-
exports.defaultTheme = defaultTheme;
|