import type { ButtonIconSpec } from '@ankhorage/surface'; import type React from 'react'; import type { ButtonProps } from '../features/button/public'; import type { ZoraBaseProps } from './base'; import type { FormFieldConfig, FormValues } from './form'; export type AuthIdentifierKind = 'email' | 'phone' | 'username'; export interface AuthFormBaseProps extends ZoraBaseProps { loading?: boolean; disabled?: boolean; error?: React.ReactNode; submitLabel?: React.ReactNode; } export interface SignInFormValues { identifier: string; identifierKind: AuthIdentifierKind; secret: string; } export interface SignInFormProps extends AuthFormBaseProps { identifiers?: readonly AuthIdentifierKind[]; identifierLabel?: React.ReactNode; secretLabel?: React.ReactNode; forgotPasswordLabel?: React.ReactNode; signUpLabel?: React.ReactNode; onSubmit?: (values: SignInFormValues) => void | Promise; onForgotPassword?: () => void | Promise; onSignUp?: () => void | Promise; } export type SignUpFormValues = FormValues; export type SignUpFormField = FormFieldConfig; export interface SignUpFormProps extends AuthFormBaseProps { fields?: readonly SignUpFormField[]; signInLabel?: React.ReactNode; onSubmit?: (values: SignUpFormValues) => void | Promise; onSignIn?: () => void | Promise; } export interface ForgotPasswordFormValues { identifier: string; identifierKind: AuthIdentifierKind; } export interface ForgotPasswordFormProps extends AuthFormBaseProps { identifiers?: readonly AuthIdentifierKind[]; identifierLabel?: React.ReactNode; signInLabel?: React.ReactNode; onSubmit?: (values: ForgotPasswordFormValues) => void | Promise; onSignIn?: () => void | Promise; } export interface OtpFormValues { otp: string; } export interface OtpFormProps extends AuthFormBaseProps { length?: number; otpLabel?: React.ReactNode; resendLabel?: React.ReactNode; resendDisabled?: boolean; resendLoading?: boolean; onSubmit?: (values: OtpFormValues) => void | Promise; onResend?: () => void | Promise; } export type OAuthProviderIconSpec = ButtonIconSpec; export interface OAuthProviderItem { id: string; label?: React.ReactNode; icon?: OAuthProviderIconSpec; disabled?: boolean; loading?: boolean; } export interface OAuthProviderButtonProps extends ZoraBaseProps { providerId: string; label?: React.ReactNode; icon?: OAuthProviderIconSpec; disabled?: boolean; loading?: boolean; fullWidth?: boolean; size?: ButtonProps['size']; variant?: ButtonProps['variant']; color?: ButtonProps['color']; onPress?: (providerId: string) => void | Promise; } export type OAuthProviderListLayout = 'stack' | 'inline'; export interface OAuthProviderListProps extends ZoraBaseProps { providers: readonly OAuthProviderItem[]; disabled?: boolean; loading?: boolean; fullWidth?: boolean; layout?: OAuthProviderListLayout; size?: ButtonProps['size']; variant?: ButtonProps['variant']; color?: ButtonProps['color']; onProviderPress?: (providerId: string) => void | Promise; }