import { CardProps } from '@heroui/react'; import { ComponentType, ReactNode } from 'react'; import { SocialLayout } from '../../../components/auth/provider-buttons.js'; import { AdditionalField as AdditionalFieldConfig } from '../../../compat/better-auth/core.js'; import { AccountCardProps, AuthPlugin as AuthPluginPrimitive, AuthPluginComponents as BaseAuthPluginComponents, OrganizationCardProps, SecurityCardProps, UserMenuItemProps } from '../../../compat/better-auth/react.js'; import { AuthUiView } from './auth-view.js'; import { SettingsSectionContribution } from './extension.js'; import { AuthPluginRequiredCapability } from './plugin-capability.js'; import { AuthSurfaceVariant } from './resolve-auth-input-variant.js'; import { AthenaAuthUiOptions } from './ui-options.js'; /** Props for the heroui `` component and `field.render` callbacks. */ export interface AdditionalFieldProps { field: AdditionalFieldConfig; isPending?: boolean; name: string; /** * Suffix appended to the label of non-required fields (sign-up only). * Pass a suffix from the host form (e.g. ` (${localization.settings.optional})`). */ optionalLabel?: string; /** Shell variant; resolved to TextField primary/secondary via helper. */ variant?: AuthSurfaceVariant; } /** Props for heroui plugin-contributed auth buttons. */ export interface AuthButtonProps { children?: ReactNode; className?: string; ui?: AthenaAuthUiOptions; /** Current built-in or plugin auth view. */ view?: AuthUiView; } declare module "@better-auth-ui/core" { interface AuthPluginRegister { heroui: AuthPlugin; } interface AdditionalFieldRegister { label: ReactNode; renderProps: AdditionalFieldProps; renderResult: ReactNode; } } /** Heroui slot component shapes — inherits from the framework-agnostic defaults and narrows slots that receive a heroui variant from the host. */ export type AuthPluginComponents = Omit & { /** Rendered below the submit button in auth forms. */ authButtons?: ComponentType[]; /** Rendered as cards inside security settings */ securityCards?: ComponentType[]; /** Rendered as cards inside account settings */ accountCards?: ComponentType[]; /** Rendered as cards inside organization settings */ organizationCards?: ComponentType[]; /** Canonical content-only settings contributions. */ settingsSections?: readonly SettingsSectionContribution[]; /** Rendered as action items inside the `UserButton` `Dropdown.Menu` (e.g. account switcher). Theme is not a menu item. */ userMenuItems?: ComponentType[]; }; /** * Props the heroui `` router spreads onto built-in and plugin auth views. * * Single package SSOT — do not redefine a second `AuthViewProps` in `auth.tsx` * (root `export *` name collision drops package types). * * `variant` is {@link AuthSurfaceVariant}: card variants plus field-only * `primary`, so `` bleeds into TextFields. */ export type AuthViewProps = { socialLayout?: SocialLayout; socialPosition?: "top" | "bottom"; ui?: AthenaAuthUiOptions; /** * Shell variant forwarded `AuthPage` → `Auth` → `SignIn` / `SignUp`. * - `primary` / `transparent` → primary TextFields * - other card surfaces → secondary TextFields */ variant?: AuthSurfaceVariant; } & Omit; /** * Props the heroui `` router spreads onto plugin settings views * (including billing / workspace tabs). */ export type SettingsViewProps = Omit; /** Heroui plugin type. Plugin authors import this from `@xylex-group/athena-auth-ui`. */ export type AuthPlugin = AuthPluginPrimitive & { requiresCapability?: AuthPluginRequiredCapability; settingsSections?: readonly SettingsSectionContribution[]; };