UNPKG

@enclavemoney/enclave-wallet-sdk

Version:

A simple enclave wallet SDK for React applications

101 lines (100 loc) 3.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mapAppearanceToTheme = exports.mapCornerRadius = exports.borderRadiusStyles = exports.themeStyles = exports.getThemeStyles = void 0; // Helper function to darken a hex color for hover states var darkenColor = function (color, percent) { if (percent === void 0) { percent = 20; } var num = parseInt(color.replace("#", ""), 16); var amt = Math.round(2.55 * percent); var R = (num >> 16) - amt; var G = ((num >> 8) & 0x00ff) - amt; var B = (num & 0x0000ff) - amt; return ("#" + (0x1000000 + (R < 255 ? (R < 1 ? 0 : R) : 255) * 0x10000 + (G < 255 ? (G < 1 ? 0 : G) : 255) * 0x100 + (B < 255 ? (B < 1 ? 0 : B) : 255)) .toString(16) .slice(1)); }; // Function to generate theme styles with custom primary color var getThemeStyles = function (primaryColor) { if (primaryColor === void 0) { primaryColor = "#1657FF"; } return ({ dark: { background: "#0d0d0d", surface: "#1a1a1a", surfaceHover: "#222", surfaceActive: "#2a2a2a", border: "#333", text: "#fff", textSecondary: "rgb(255 255 255 / 50%)", primary: primaryColor, primaryHover: darkenColor(primaryColor), accent: "#5AC8FA", successBg: "#1E2D24", successText: "#12B76A", errorBg: "#382726", errorText: "#EA4335", warningBg: "#312D22", warningText: "#F7931A", }, light: { background: "#f5f5f5", surface: "#ffffff", surfaceHover: "#f0f0f0", surfaceActive: "#F4F6FF", border: "#e0e0e0", text: "#1a1a1a", textSecondary: "#666666", primary: primaryColor, primaryHover: darkenColor(primaryColor), accent: "#5AC8FA", successBg: "#ECFDF3", successText: "#12B76A", errorBg: "#FEF3F2", errorText: "#EA4335", warningBg: "#FFFAEB", warningText: "#F7931A", }, }); }; exports.getThemeStyles = getThemeStyles; // Default theme styles (for backward compatibility) exports.themeStyles = (0, exports.getThemeStyles)(); exports.borderRadiusStyles = { small: { innerRadius: 12, outerRadius: 16, level3Radius: 8, }, medium: { innerRadius: 20, outerRadius: 28, level3Radius: 12, }, large: { innerRadius: 32, outerRadius: 40, level3Radius: 24, }, }; // Helper function to map corner radius values var mapCornerRadius = function (cornerRadius) { switch (cornerRadius) { case "S": return "small"; case "M": return "medium"; case "L": return "large"; default: return "medium"; } }; exports.mapCornerRadius = mapCornerRadius; // Helper function to map appearance to theme var mapAppearanceToTheme = function (appearance) { return appearance === "dark" ? "dark" : "light"; }; exports.mapAppearanceToTheme = mapAppearanceToTheme;