UNPKG

@frank-auth/react

Version:

Flexible and customizable React UI components for Frank Authentication

369 lines (368 loc) 7.94 kB
import { ThemeUtils as a } from "../utils/theme.js"; import { getLocale as r, AVAILABLE_LOCALES as t, DEFAULT_LOCALE as e } from "../locales/index.js"; const A = a.generateColorPalette("#3b82f6"), s = { fontFamily: { sans: ["Inter", "ui-sans-serif", "system-ui", "sans-serif"], mono: ["JetBrains Mono", "ui-monospace", "monospace"], serif: ["JetBrains Mono", "ui-monospace", "monospace"] }, fontSize: { xs: ["0.75rem", { lineHeight: "1rem" }], sm: ["0.875rem", { lineHeight: "1.25rem" }], base: ["1rem", { lineHeight: "1.5rem" }], lg: ["1.125rem", { lineHeight: "1.75rem" }], xl: ["1.25rem", { lineHeight: "1.75rem" }], "2xl": ["1.5rem", { lineHeight: "2rem" }], "3xl": ["1.875rem", { lineHeight: "2.25rem" }], "4xl": ["2.25rem", { lineHeight: "2.5rem" }], "5xl": ["3rem", { lineHeight: "1" }], "6xl": ["4rem", { lineHeight: "1" }], "7xl": ["5rem", { lineHeight: "1" }], "8xl": ["6rem", { lineHeight: "1" }], "9xl": ["7rem", { lineHeight: "1" }] }, fontWeight: { light: "300", normal: "400", medium: "500", semibold: "600", bold: "700", thin: "", extralight: "", extrabold: "", black: "" }, lineHeight: { none: "", tight: "", snug: "", normal: "", relaxed: "", loose: "" }, letterSpacing: { tighter: "", tight: "", normal: "", wide: "", wider: "", widest: "" } }, i = { xs: "0.5rem", sm: "0.75rem", md: "1rem", lg: "1.5rem", xl: "2rem", "2xl": "2.5rem", "3xl": "3rem", "4xl": "4rem", "5xl": "5rem" }, n = { none: "0px", sm: "0.125rem", md: "0.375rem", lg: "0.5rem", xl: "0.75rem", "2xl": "1rem", "3xl": "1.5rem", full: "9999px", base: "" }, o = { sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)", md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)", lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)", xl: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)", "2xl": "0 25px 50px -12px rgb(0 0 0 / 0.25)", inner: "inset 0 2px 4px 0 rgb(0 0 0 / 0.05)", none: "0 0 #0000", base: "" }, l = { duration: { fast: "150ms", normal: "200ms", slow: "300ms" }, easing: { linear: "linear", ease: "ease", "ease-in": "ease-in", "ease-out": "ease-out", "ease-in-out": "ease-in-out" } }, m = { ...a.generateTheme({ animations: "enhanced", mode: "light", borderRadius: "medium", colorHarmony: "complementary", contrastRatio: "AAA", shadows: "none", secondaryColor: "#64748b", primaryColor: "#3b82f6" }), typography: s, spacing: i, borderRadius: n, shadows: o, animations: l }, u = { containerMaxWidth: "1200px", sidebarWidth: "280px", headerHeight: "64px", footerHeight: "80px", contentPadding: "24px" }, p = { input: { variant: "bordered", size: "md", radius: "md", color: "default", labelPlacement: "inside" }, button: { variant: "solid", size: "md", radius: "md", color: "primary", disableAnimation: !1, disableRipple: !1 }, card: { variant: "shadow", radius: "lg", shadow: "md", isBlurred: !1 }, modal: { size: "md", radius: "lg", shadow: "lg", backdrop: "opaque", placement: "auto" }, navbar: { variant: "sticky", maxWidth: "1200px", height: "64px", isBlurred: !0 }, table: { variant: "striped", size: "md", radius: "lg", shadow: "sm", isCompact: !1 } }, d = { logo: { alt: "Frank Auth", width: 120, height: 32 }, favicon: { type: "image/svg+xml" }, colors: { primary: "#3b82f6", secondary: "#64748b" }, fonts: { primary: "Inter, ui-sans-serif, system-ui, sans-serif" } }, g = { mode: "system", layout: u, components: p, branding: d }, c = r(e), f = { defaultLocale: e, fallbackLocale: e, supportedLocales: t, dateFormat: "MMM d, yyyy", timeFormat: "h:mm a", numberFormat: { style: "decimal", minimumFractionDigits: 0, maximumFractionDigits: 2 }, direction: "ltr", messages: c }, b = { settings: { allowPublicSignup: !0, requireEmailVerification: !0, requirePhoneVerification: !1, mfaRequired: !1, allowedMfaMethods: ["totp", "sms", "email"], passwordPolicy: { minLength: 8, requireUppercase: !0, requireLowercase: !0, requireNumbers: !0, requireSymbols: !1 }, sessionSettings: { maxDuration: 86400, // 24 hours inactivityTimeout: 1800, // 30 minutes multipleSessionsAllowed: !0 }, branding: { primaryColor: "#3b82f6", secondaryColor: "#64748b" } }, features: { sso: !1, mfa: !0, auditLogs: !1, customBranding: !1, apiAccess: !0 }, limits: { maxUsers: 100, maxSessions: 10, apiRequestLimit: 1e3 } }, L = { apiUrl: "https://api.frankauth.com", userType: "external", theme: m, appearance: g, localization: f, features: { signUp: !0, signIn: !0, passwordReset: !0, mfa: !0, sso: !1, organizationManagement: !0, userProfile: !0, sessionManagement: !0 }, debug: !1, telemetry: !0 }, E = { // Minimal configuration for simple auth minimal: { features: { signUp: !0, signIn: !0, passwordReset: !0, mfa: !1, sso: !1, organizationManagement: !1, userProfile: !1, sessionManagement: !1 }, appearance: { components: { input: { variant: "flat" }, button: { variant: "flat" }, card: { variant: "flat" } } } }, // Enterprise configuration with all features enterprise: { features: { signUp: !0, signIn: !0, passwordReset: !0, mfa: !0, sso: !0, organizationManagement: !0, userProfile: !0, sessionManagement: !0 }, organization: { settings: { mfaRequired: !0, allowedMfaMethods: ["totp", "webauthn"], passwordPolicy: { minLength: 12, requireUppercase: !0, requireLowercase: !0, requireNumbers: !0, requireSymbols: !0 } }, features: { sso: !0, mfa: !0, auditLogs: !0, customBranding: !0, apiAccess: !0 } } }, // B2B SaaS configuration b2b: { userType: "external", features: { signUp: !1, // Invitation-only signIn: !0, passwordReset: !0, mfa: !0, sso: !0, organizationManagement: !0, userProfile: !0, sessionManagement: !0 }, organization: { settings: { allowPublicSignup: !1, requireEmailVerification: !0, mfaRequired: !0 } } }, // Consumer app configuration consumer: { userType: "end_user", features: { signUp: !0, signIn: !0, passwordReset: !0, mfa: !1, sso: !0, organizationManagement: !1, userProfile: !0, sessionManagement: !1 }, appearance: { components: { input: { variant: "bordered" }, button: { variant: "shadow" }, card: { variant: "shadow" } } } } }; export { E as CONFIG_PRESETS, l as DEFAULT_ANIMATIONS, g as DEFAULT_APPEARANCE_CONFIG, n as DEFAULT_BORDER_RADIUS, d as DEFAULT_BRANDING_CONFIG, A as DEFAULT_COLOR_PALETTE, p as DEFAULT_COMPONENT_APPEARANCE, L as DEFAULT_FRANK_AUTH_CONFIG, u as DEFAULT_LAYOUT_CONFIG, c as DEFAULT_LOCALE_MESSAGES, f as DEFAULT_LOCALIZATION_CONFIG, b as DEFAULT_ORGANIZATION_CONFIG, o as DEFAULT_SHADOWS, i as DEFAULT_SPACING, m as DEFAULT_THEME_CONFIG, s as DEFAULT_TYPOGRAPHY, g as defaultAppearance, L as defaultConfig, f as defaultLocalization, b as defaultOrganization, m as defaultTheme }; //# sourceMappingURL=defaults.js.map