Initial Commit

This commit is contained in:
2026-05-27 23:47:53 +01:00
parent fbc70f96e6
commit 9b28db724f
18103 changed files with 1600554 additions and 0 deletions

View File

@@ -0,0 +1,201 @@
// Side-effect: register every REACT_FORMS.* error code with the
// shared `@suaveplan/error` registry at module load.
import "./errors/error-codes.js";
// Side-effect: augment ContributedTranslationKeys with the recipe-
// default keys so consumer t() / TranslationKey props type-narrow
// correctly.
import "./locales/augmentation.js";
// Core — contexts, hooks, validation engine
export type {
ApiClient,
ApiClientProviderProps,
AsyncValidatorRegistration,
AuthContextValue,
AuthCredentials,
AuthProviderProps,
CrossFieldRule,
CrossFieldRuleOptions,
CrossFieldViolation,
EngineFieldErrors,
FieldValuesMap,
FormSchema,
ServerErrorEnvelope,
ServerErrorState,
ServerFieldError,
UseDomainFormOptions,
UseDomainFormReturn,
UseFormValidationOptions,
ValidationEngineConfig,
ValidationResult,
} from "./core/index.js";
export {
ApiClientContext,
ApiClientProvider,
AuthContext,
AuthProvider,
defineCrossFieldRule,
mapServerErrors,
throwServerErrorMapped,
unsafeAssertTranslationKey,
unwrapServerEnvelope,
useApiClient,
useAuth,
useDomainForm,
useFormValidation,
ValidationEngine,
violate,
} from "./core/index.js";
// Errors
export type { ReactFormsCode } from "./errors/index.js";
export { REACT_FORMS_CODES, ReactFormsError } from "./errors/index.js";
export type {
CheckboxFieldConfig,
CreateDomainFormConfig,
CurrencyFieldConfig,
CustomFieldConfig,
DomainFormChildren,
DomainFormComponent,
DomainFormLayout,
DomainFormProps,
DomainFormStatics,
EmailFieldConfig,
FieldConfig,
FieldConfigBase,
FieldConfigMap,
LayoutRenderFn,
NumberFieldConfig,
PasswordFieldConfig,
RadioFieldConfig,
RenderFieldProps,
SupportedFieldKind,
TextareaFieldConfig,
TextFieldConfig,
ToggleFieldConfig,
} from "./factory/index.js";
// Factory
export {
createDomainForm,
FieldConfigSchema,
isSupportedFieldKind,
RenderField,
SUPPORTED_FIELD_KINDS,
validateFieldConfig,
validateFieldConfigMap,
} from "./factory/index.js";
// Locales
export type {
FormsLocaleBundle,
SupportedFormsLocale,
} from "./locales/index.js";
export { REACT_FORMS_BUNDLE_KEYS, reactFormsBundles } from "./locales/index.js";
// Translation key union (for non-React consumers)
export type { ReactFormsTranslationKey } from "./locales/translation-keys.js";
// Observability
export type {
AsyncValidatorOutcome,
ReactFormsMetricSample,
ReactFormsMetricsState,
SubmitOutcome,
ValidationErrorKind,
} from "./observability/react-forms-metrics.js";
export {
getReactFormsMetrics,
getReactFormsMetricsState,
recordAsyncValidatorDuration,
recordAsyncValidatorOutcome,
recordSubmitDuration,
recordSubmitOutcome,
recordValidationDuration,
recordValidationError,
resetReactFormsMetricsCache,
resetReactFormsMetricsState,
} from "./observability/react-forms-metrics.js";
// Primitives
export type {
FieldDescriptionProps,
FieldErrorProps,
FieldGroupProps,
FieldLabelProps,
FieldLegendProps,
FieldProps,
FieldSetProps,
MoneyInputProps,
} from "./primitives/index.js";
export {
Field,
FieldDescription,
FieldError,
FieldGroup,
FieldLabel,
FieldLegend,
FieldSet,
MoneyInput,
} from "./primitives/index.js";
export type {
AsyncSearchFormComponent,
AsyncSearchFormProps,
AsyncSearchPhase,
ConditionalFieldProps,
CreateAsyncSearchFormConfig,
CreateRepeatingFieldsetConfig,
CreateWizardFormConfig,
RepeatingChildrenContext,
RepeatingFieldsetComponent,
RepeatingFieldsetProps,
RepeatingRowContext,
WizardChildrenContext,
WizardFormComponent,
WizardFormProps,
WizardState,
WizardStep,
} from "./recipes/index.js";
// Recipes
export {
ConditionalField,
createAsyncSearchForm,
createRepeatingFieldset,
createWizardForm,
} from "./recipes/index.js";
// Validation
export type {
AsyncEmailUniqueOptions,
AsyncUsernameAvailableOptions,
AsyncValidator,
CustomPredicate,
PasswordStrengthOptions,
PasswordStrengthScore,
PhoneValidatorOptions,
PostcodeValidatorOptions,
UrlValidatorOptions,
Validator,
ValidatorFailure,
ValidatorResult,
ValidatorSuccess,
ValidatorValue,
} from "./validation/index.js";
export {
asyncEmailUnique,
asyncUsernameAvailable,
bic,
compose,
creditCard,
custom,
email,
expandLettersToDigits,
iban,
luhnValid,
maxLength,
minLength,
mod97,
or,
passwordStrength,
pattern,
phone,
postcode,
required,
SUPPORTED_POSTCODE_COUNTRIES,
sequence,
url,
} from "./validation/index.js";