import { D as Dict, C as CoreProps, a as CoreContext, F as Field, V as VariantKey, L as LabelPlacement, S as SublabelPlacement, b as DescriptionPlacement, H as HelpTextPlacement, E as ErrorTextPlacement, c as SlotPlacement, d as FieldSize, e as FieldDensity, f as ValidateResult, g as ChangeDetail, h as VariantValueFor, i as VariantPropsFor, j as VariantModule, P as PhoneCountry, k as PasswordDefinitionMap, l as CustomFileLoader, m as FileItem } from './core-DQr56obQ.mjs'; export { B as BaseProps, s as ButtonRef, z as EffectiveFieldLayout, y as FieldLayoutConfig, x as FieldOrdering, w as FieldRootId, u as FieldRoots, v as FieldSlotId, t as FieldSlots, p as FormProps, n as InferFromSchema, I as InputNumber, r as InputStore, A as LayoutResolveContext, G as LayoutResolver, R as RelativeRootsMap, o as SubmitEvent, T as Textarea, q as ValuesResult, J as VariantEntry, N as VariantLayoutDefaults, O as VariantModuleFor, M as VariantValidateFn, K as Variants } from './core-DQr56obQ.mjs'; import { A as AdapterKey } from './adapter-CvjXO9Gi.mjs'; export { a as AdapterCallbacks, c as AdapterConfig, h as AdapterError, d as AdapterFactory, g as AdapterOk, f as AdapterProps, b as AdapterResult, i as AdapterSubmit, e as Adapters, M as Method, N as NamedAdapterConfig, j as NamedAdapterFactory } from './adapter-CvjXO9Gi.mjs'; export { createAxiosAdapter, createInertiaAdapter, getAdapter, hasAdapter, localAdapter, registerAdapter, registerAllAdapters, registerAxiosAdapter, registerInertiaAdapter, registerKnownAdapter } from './adapters.mjs'; import * as react_jsx_runtime from 'react/jsx-runtime'; import * as React from 'react'; import { z } from 'zod'; import { $ZodError } from 'zod/v4/core'; import 'react-day-picker'; import 'class-variance-authority/types'; import 'class-variance-authority'; import '@radix-ui/react-switch'; import '@inertiajs/core'; import 'axios'; type Props = CoreProps & { children?: React.ReactNode; }; /** * CoreProvider: owns the form/core runtime state and implements CoreContext. * * - Tracks all inputs in a single store (inputsRef) * - Supports: * - named inputs via `name` * - bound inputs via `bindId` * - grouped inputs via `groupId` * - Manages errors and uncaught messages * - Builds values snapshots (including bucket values) * - Orchestrates submission via the adapter registry */ declare function CoreProvider(props: Props): react_jsx_runtime.JSX.Element; interface CoreRootProps extends React.FormHTMLAttributes { /** * If true, the global ErrorStrip will not be rendered automatically. */ noErrorStrip?: boolean; /** * Optional hook invoked after CoreRoot orchestrates the submit. * * - The native event is already `preventDefault()`-ed. * - The adapter flow is triggered via `form.go(...)`. * - Use this to tap into submit without breaking the core. */ onSubmitForm?(event: React.FormEvent, form: CoreContext): void | Promise; } /** * CoreRoot: actual
element wired to the core runtime. * * Responsibilities: * - Own the native submit event and prevent full-page navigation. * - Delegate submit orchestration to form.go(). * - Optionally render the global ErrorStrip at the top. */ declare function CoreRoot(props: CoreRootProps): react_jsx_runtime.JSX.Element; /** * Shared base props for CoreShell, independent of wrapping behaviour. */ type CoreShellBaseProps = CoreProps & { /** * Props passed directly to the underlying element via CoreRoot. */ formProps?: CoreRootProps; children?: React.ReactNode; }; /** * When `wrapped` is true, you can provide gap/contentClassName. */ type CoreShellWrappedProps = CoreShellBaseProps & { wrapped: true; /** * Gap for the inner wrapper. You can still control layout * (flex/grid/etc.) via `contentClassName`. */ gap?: React.CSSProperties["gap"]; /** * Class applied to the wrapper around children. */ contentClassName?: string; }; /** * When `wrapped` is not true (false/undefined), gap/contentClassName * are not allowed. */ type CoreShellUnwrappedProps = CoreShellBaseProps & { wrapped?: false | undefined; }; type CoreShellProps = CoreShellWrappedProps | CoreShellUnwrappedProps; /** * Combined provider + form-root wrapper. * * Usage: * * {...fields + buttons...} * * * * {...fields + buttons...} * */ declare function CoreShell(props: CoreShellProps): react_jsx_runtime.JSX.Element; interface UseButtonOptions { /** * Logical name of the button. * * Used by the core to: * - mark this as the "active" button before submit * - toggle loading/disabled specifically for this button */ name: string; /** * If true, clicking this button should trigger a submit: * * - form.setActiveButton(name) * - form.go() */ submit?: boolean; /** * Initial disabled state. */ disabled?: boolean; /** * Optional click handler. * * This runs *in addition to* the submit behavior (if `submit` is true). * You can call `event.preventDefault()` to prevent the auto-submit. */ onClick?(event: React.MouseEvent, form: CoreContext): void | Promise; } interface UseButtonReturn { /** * Current loading state, controlled by the core (via adapters) and * optionally by the host via setLoading. */ loading: boolean; setLoading(loading: boolean): void; /** * Current disabled state. */ disabled: boolean; setDisabled(disabled: boolean): void; /** * Ref for the underlying ; */ buttonProps: { ref: React.RefObject; disabled: boolean; "data-loading"?: "true" | "false"; onClick(event: React.MouseEvent): void; }; } /** * useButton * * - Registers a ButtonRef with the core. * - Cooperates with setActiveButton + adapter-based submit. * - Handles loading/disabled toggling via the core's callbacks. */ declare function useButton(options: UseButtonOptions): UseButtonReturn; /** * Convenience alias for useCoreContext. * * This mirrors the legacy useForm hook: you get the full CoreContext, * and can call core.values(), core.submit(), core.go(), etc. */ declare function useCore(): CoreContext; /** * Typed hook to access the current core/form context. * * Must be used inside a . If no provider is found, * this will throw to make misuse obvious. */ declare function useCoreContext(): CoreContext; type UseFieldValidate = (value: T, field?: Field, form?: CoreContext, report?: boolean) => boolean | string; interface UseFieldOptions { /** * Primary field name. * * This is the key that will show up in the values snapshot and * error bags (unless mapped via `shared` or `alias`). */ name?: string; variant: VariantKey; /** * Optional internal binding identifier. * * Used by the bound helpers (observeBoundField, waitForBoundField) * and the binder registry. */ bindId?: string; /** * Optional external binding key – a semantic identifier for this * field’s binding group. * * Example: * bind="shipping" */ bind?: string; /** * Shared key for nested grouping, e.g: * * shared="profile", name="first_name" * → values.profile.first_name */ shared?: string; /** * Optional grouping identifier used to group related controls * (e.g. radio groups, segmented inputs). */ groupId?: string; /** * Optional alias for error / mapping purposes. * * Example: * alias="email" but name="contact.email" */ alias?: string; /** * Marks this field as the "main" one in a group. */ main?: boolean; /** * If true, this field is ignored by snapshot / some validation * flows, but may still exist in the registry. */ ignore?: boolean; /** * Whether the field is required. */ required?: boolean; /** * Controlled value prop. */ value?: T; /** * Initial/default value for this field. */ defaultValue?: T; /** * Initial disabled flag. */ disabled?: boolean; /** * Initial readOnly flag. */ readOnly?: boolean; /** * Custom validation hook. * * Return: * - `true` → valid * - `false` → invalid (no message) * - `"message"` → invalid with explicit message */ validate?: UseFieldValidate; /** * Optional projector to derive an "original" value from the * initial default. */ getOriginalValue?(value: T | undefined): unknown; /** * Local change hook for the field. * * This is in addition to the form-level `onChange`. */ onValueChange?(next: T, prev: T, variant: string): void; onSubmit?(e: any): any; } interface UseFieldReturn { /** Ref to the underlying DOM element */ ref: React.RefObject; key: string; /** Current value */ value: T | undefined; setValue(next: T | undefined, variant?: string): void; /** Current error message */ error: string; setError(message: string): void; /** Async-loading flag (e.g. remote validation) */ loading: boolean; setLoading(loading: boolean): void; /** Required flag */ required: boolean; setRequired(required: boolean): void; /** Disabled flag */ disabled: boolean; setDisabled(disabled: boolean): void; /** Readonly flag */ readOnly: boolean; setReadOnly(readOnly: boolean): void; /** Metadata / wiring */ name: string; bindId: string; bind?: string; shared?: string; groupId?: string; alias?: string; main?: boolean; ignore?: boolean; /** Snapshots */ readonly defaultValue: T | undefined; readonly originalValue: unknown; /** Owning core context */ form: CoreContext; /** Run validation (optionally reporting errors) */ validate(report?: boolean): boolean | undefined; } /** * Strict field hook. * * - Registers the field with the core provider / registry. * - Exposes value/error/loading and lifecycle helpers. * - Wires into: * - core-level `onChange` * - `controlButton()` dirty logic */ declare function useField(options: UseFieldOptions): UseFieldReturn; /** * Optional variant of `useField`. * * - If there is a CoreProvider, behaves like `useField`. * - If not, it becomes a self-managed field (value/error/loading/etc). */ declare function useOptionalField(options: UseFieldOptions): UseFieldReturn; type ErrorBag = Record; type ErrorBagMapResult = { /** Field-specific errors keyed by field name. */ fieldErrors: Record; /** Errors that could not be mapped to a specific field. */ uncaught: string[]; }; /** * Map a generic "error bag" object into field errors + uncaught messages. * * Typical input: * { * name: "Name is required", * email: ["Email is invalid"], * message: "Something went wrong" // global * } * * Heuristics: * - Keys like "message", "error", "_", "global" → treated as global/uncaught. * - Everything else → treated as a field error. * - Array values are joined with "\n". */ declare function mapErrorBag(bag: ErrorBag): ErrorBagMapResult; type ZodErrorMapResult = { /** Field-specific errors keyed by field name. */ fieldErrors: Record; /** Errors that could not be mapped to a specific field. */ uncaught: string[]; }; /** * Map a ZodError into field-specific errors + uncaught messages. * * Heuristics: * - If issue.path[0] is a string → treated as a field name. * - Otherwise → message is pushed into `uncaught`. * * If a field has multiple issues, messages are joined with `\n`. */ declare function mapZodError(error: $ZodError): ZodErrorMapResult; interface ErrorStripProps extends React.HTMLAttributes { form?: CoreContext; messages?: readonly string[]; renderMessage?: (message: string, index: number) => React.ReactNode; as?: React.ElementType; listProps?: React.HTMLAttributes; dismissible?: boolean; onDismiss?: () => void; title?: string; } declare function ErrorStrip(props: ErrorStripProps): react_jsx_runtime.JSX.Element | null; /** * Core, variant-agnostic props for InputField. * * @template TValue Logical value type for this field. Will be refined by * variant typing (VariantValueFor). */ interface InputFieldBaseProps { name?: string; bind?: string; groupId?: string; shared?: string; ignore?: boolean; alias?: string; main?: boolean; tags?: FieldTag[]; contain?: boolean; autoOff?: boolean; /** * Controlled value prop. */ value?: TValue; /** * Handles the submission logic for a given form or process. * * @param {TValue} e - The value associated with the submission action. * @return {any} Value to be submitted. */ onSubmit?(e: TValue): any; onReset?(e: React.FormEvent): void; label?: React.ReactNode; sublabel?: React.ReactNode; description?: React.ReactNode; helpText?: React.ReactNode; /** * Optional explicit error text to display. * * This is *visual* error copy. The actual validation state still * lives in field.error / schema / onValidate. */ errorText?: React.ReactNode; /** * Placement hints for label / sublabel / description / helpText / errorText. * * These are purely layout hints; actual behaviour is implemented * by the preset / host component. */ labelPlacement?: LabelPlacement; sublabelPlacement?: SublabelPlacement; descriptionPlacement?: DescriptionPlacement; helpTextPlacement?: HelpTextPlacement; errorTextPlacement?: ErrorTextPlacement; tagPlacement?: SlotPlacement; required?: boolean; disabled?: boolean; readOnly?: boolean; size?: FieldSize; density?: FieldDensity; inline?: boolean; fullWidth?: boolean; onValidate?(value: TValue | undefined, field: Field, form: CoreContext): ValidateResult; /** * Per-field change hook at the InputField level. * * - `value` is what the variant is trying to set. * - `detail` comes from the variant (`ChangeDetail`). * - If you return `undefined`, the original value is used. * - If you return *anything else*, that is what will be stored * in the core (and emitted to the form). */ onChange?(e: { value: TValue | undefined; preventDefault(): void; event?: React.SyntheticEvent; readonly isDefaultPrevented?: boolean; readonly detail: ChangeDetail; }): void; } /** * Public props for . * * - `variant` selects the variant module. * - All variant-specific props are merged directly into the field props * via `VariantPropsFor`. * * NOTE: this is a type alias (not an interface) so we can safely intersect * unions coming from VariantPropsFor / VariantValueFor. */ type InputFieldProps = InputFieldBaseProps> & VariantPropsFor & InputFieldClassNameProps & Omit, "onChange" | "defaultValue" | 'value'> & { variant: K; /** * @deprecated Use the specific *ClassName props instead * (className, labelClassName, errorClassName, etc.). */ classes?: Partial; defaultValue?: any; }; interface InputFieldClassNameProps { /** Root comes from `className` on HTMLDivElement */ labelRowClassName?: string; inlineRowClassName?: string; labelClassName?: string; sublabelClassName?: string; descriptionClassName?: string; helpTextClassName?: string; errorClassName?: string; groupClassName?: string; contentClassName?: string; variantClassName?: string; inlineInputColumnClassName?: string; inlineLabelColumnClassName?: string; requiredClassName?: string; tagClassName?: string; } interface InputFieldClassNames { root?: string; labelRow?: string; inlineRow?: string; label?: string; sublabel?: string; description?: string; helpText?: string; error?: string; group?: string; content?: string; variant?: string; inlineInputColumn?: string; inlineLabelColumn?: string; required?: string; tag?: string; } interface FieldTag { label: React.ReactNode; icon?: React.ReactNode; className?: string; color?: string; bgColor?: string; onClick?: React.MouseEventHandler; } /** * Public InputField component. * * - Uses `useField` to register a Field and manage value/error/loading. * - Delegates rendering to the chosen variant's `Variant` component. * - Uses Shadcn's Field primitives for structure. * - Lets variants influence layout via defaults + optional resolveLayout(). * - Uses a layout graph (buildLayoutGraph) + getSlotsFor().render(...) to * position helpers (sublabel, description, helpText, error, tags) relative to * "label" vs "input" roots without empty wrapper divs. */ declare function InputField(props: InputFieldProps): react_jsx_runtime.JSX.Element | null; /** * Register (or overwrite) a variant module. * * Typically called from presets, e.g.: * * registerVariant(textVariant); * registerVariant(numberVariant); */ declare function registerVariant(module: VariantModule): void; /** * Look up a variant module by key. */ declare function getVariant(key: K): VariantModule | undefined; /** * List all registered variant modules. */ declare function listVariants(): VariantModule[]; /** * Register all core/built-in variants. * * Hosts can call this once at bootstrap: * * import { registerCoreVariants } from "@timeax/form-palette/variants"; * registerCoreVariants(); */ declare function registerCoreVariants(): void; interface InputMaskChangeEvent { originalEvent: React.SyntheticEvent | Event | undefined; value: string; stopPropagation(): void; preventDefault(): void; target: { name?: string; id?: string; value: string; }; } interface InputMaskCompleteEvent { originalEvent: React.SyntheticEvent | Event; value: string; } interface InputMaskRef { focus(): void; getElement(): HTMLInputElement | null; } interface InputMaskProps$1 extends Omit, "onChange" | "value" | "defaultValue"> { mask: string | null; autoClear?: boolean; autoFocus?: boolean; invalid?: boolean; unmask?: boolean; slotChar?: string; 'data-slot'?: string; value?: string | null; onChange?: (e: InputMaskChangeEvent) => void; onComplete?: (e: InputMaskCompleteEvent) => void; } declare const InputMask: React.MemoExoticComponent>>; type MaskMode = "raw" | "masked"; interface InputMaskProps { mask?: string; maskDefinitions?: Record; slotChar?: string; autoClear?: boolean; unmask?: MaskMode | boolean; maskInsertMode?: "stream" | "caret"; } interface InputAffixProps { prefix?: string; suffix?: string; /** * If true (default), we assume the model value does NOT contain the prefix * and we only add it visually at render time. */ stripPrefix?: boolean; /** * If true (default), we assume the model value does NOT contain the suffix * and we only add it visually at render time. */ stripSuffix?: boolean; } interface InputIconControlProps { leadingIcons?: React.ReactNode[]; trailingIcons?: React.ReactNode[]; icon?: React.ReactNode; iconGap?: number; leadingIconSpacing?: number; trailingIconSpacing?: number; leadingControl?: React.ReactNode; trailingControl?: React.ReactNode; leadingControlClassName?: string; trailingControlClassName?: string; joinControls?: boolean; extendBoxToControls?: boolean; px?: number; py?: number; ps?: number; pe?: number; pb?: number; inputClassName?: string; } interface InputSizeProps { size?: "sm" | "md" | "lg" | (string & {}); density?: "compact" | "normal" | "relaxed" | "dense" | "loose" | (string & {}); } type InputKeyFilter = string | RegExp | ((nextValue: string, ctx: { event: any; currentValue: string; input: HTMLInputElement; }) => boolean); interface InputKeyFilterProps { /** * Filter that constrains what can be typed / pasted. * * - string preset: "int" | "num" | "money" | "hex" | "alpha" | "alphanum" | "email" * - string pattern: converted to new RegExp(pattern) * - RegExp: used directly * - function: custom validator */ keyFilter?: InputKeyFilter; /** * Which keyboard event to hook for filtering: * - "keydown" * - "keypress" (closest to PrimeReact default) * - "beforeinput" * * Default: "keypress" */ keyFilterOn?: "keydown" | "keypress" | "beforeinput"; /** * Whether to apply keyFilter to paste events. * Default: true */ keyFilterOnPaste?: boolean; } interface InputProps extends Omit, "size">, InputMaskProps, InputAffixProps, InputIconControlProps, InputSizeProps, InputKeyFilterProps { } declare const Input: React.ForwardRefExoticComponent>; type IconGroup = { id: string; label: string; prefixes: string[]; }; interface PaletteRegistry { countries: PhoneCountry[]; ruleDefinition: PasswordDefinitionMap; customLoader: CustomFileLoader; getCountries: () => Promise; formatFileValue: (file: FileItem) => string | undefined; iconPicker: { groups?: IconGroup[]; url?: string; }; } declare global { interface Window { "form-palette"?: Partial; } } /** * Registers a value to the global window['form-palette'] object. * Safe to call in SSR environments (it will just no-op). */ declare function registerPaletteUtil(key: K, value: PaletteRegistry[K]): void; /** * Retrieves a value from the global window['form-palette'] object. * Returns the value if found, otherwise returns the optional defaultValue or undefined. */ declare function getPaletteUtil(key: K, defaultValue?: PaletteRegistry[K]): PaletteRegistry[K] | undefined; export { AdapterKey, CoreContext, CoreProps, CoreProvider, type CoreShellProps, DescriptionPlacement, Dict, type ErrorBag, type ErrorBagMapResult, ErrorStrip, type ErrorStripProps, ErrorTextPlacement, Field, CoreShell as Form, CoreRoot as FormRoot, HelpTextPlacement, Input, InputField, type InputFieldBaseProps, type InputFieldProps, InputMask, LabelPlacement, SlotPlacement, SublabelPlacement, type UseButtonOptions, type UseButtonReturn, type UseFieldOptions, type UseFieldReturn, type UseFieldValidate, ValidateResult, VariantKey, VariantModule, VariantPropsFor, VariantValueFor, type ZodErrorMapResult, getPaletteUtil, getVariant, listVariants, mapErrorBag, mapZodError, registerCoreVariants, registerPaletteUtil, registerVariant, useButton, useCore, useCoreContext, useField, useOptionalField };