Skip to content

v1.6.0

Choose a tag to compare

@ndlabdev ndlabdev released this 06 Apr 07:30
· 262 commits to main since this release

πŸ†• New Components

Form

Centralized form validation and submission β€” full parity with Nuxt UI v4's Form component.

  • Schema validation β€” Zod 3.24+, Valibot 1.0+, Yup 1.7+ (via Standard Schema) and Joi 17+ (dedicated adapter). Pass any schema directly to the schema prop β€” zero adapters needed
  • Custom validate β€” Sync or async function, runs alongside schema if both provided
  • Field-level validation β€” Triggers on blur / input / change / focus with configurable debounce (validateOnInputDelay) and eager-after-first-blur semantics
  • Dirty / touched / blurred tracking β€” Reactive SvelteSet-based field tracking with dirty, dirtyFields, touchedFields, blurredFields getters
  • Loading auto-disable β€” loadingAuto (default true) flips loading during async submit; double-submit guard via #submitting flag works even with loadingAuto: false
  • Nested forms β€” <Form nested name="address"> attaches to parent; submit() cascades validation, setErrors() / clear() / reset() cascade too. Errors prefixed with child path
  • Schema transform output β€” Zod .transform(), Valibot pipe transforms etc. applied on submit when transform: true
  • Full programmatic API via bind:api β€” submit(), validate(), clear(), reset(), setErrors(), getErrors() + reactive errors, loading, disabled, dirty, submitCount
  • Error summary β€” Read form.errors reactively to render error lists
  • 9 interactive demo examples β€” Basic Zod login, schema lib comparison (Zod/Valibot/Yup/Joi tabs), async submit, programmatic API, async username check, array repeater with nested forms per row, dependent fields (Zod refine), nested address form, error summary + reset

πŸ› οΈ New Utilities

  • useFormFieldEmit() β€” Helper hook for custom input components to emit form events (blur, input, change, focus) to the parent Form
  • wireFormEvents() β€” Convenience wrapper that merges emit calls with user-supplied event handlers for custom input wrappers
  • FORM_FIELD_CONTEXT_KEY β€” Exported Symbol for the FormField context (replaces string key)
  • getFormContext() β€” Access the parent Form context from custom components
  • InputValue type + InputProps<T extends InputValue> β€” Generic type for type-safe bind:value inference (string | number | bigint | boolean | null | undefined)

⚑ Changed

  • 10 input components (Input, Textarea, Select, SelectMenu, Checkbox, CheckboxGroup, RadioGroup, Switch, PinInput, Slider) β€” wired up form event emission via useFormFieldEmit. CheckboxGroup and RadioGroup fire focus/blur on the fieldset wrapper. Backward-compatible: no-op when used outside a Form
  • FormField β€” Context key migrated from string 'formField' to exported Symbol FORM_FIELD_CONTEXT_KEY

πŸ“¦ Dependencies

  • Added @standard-schema/spec (runtime dependency, types-only, zero bundle cost)
  • Added optional peer dependencies: zod ^3.24.0 || ^4.0.0, valibot ^1.0.0, yup ^1.7.0, joi ^17.0.0 || ^18.0.0 (all optional β€” user installs whichever they prefer)
  • Added zod, valibot, yup, joi as devDependencies (for integration tests + demo)

πŸ“Š Stats

  • 2112 tests passing across 53 test files
  • 92 new tests for Form component (44 context unit, 24 validate-schema, 13 real-library integration with Zod/Valibot/Yup/Joi, 11 browser component)
  • 0 type errors, 0 lint errors