Skip to content

Releases: noahsalvi/svelte-use-form

2.10.0 - New email validator that requires TLD

17 Sep 16:04
Compare
Choose a tag to compare

emailWithTLD can now be used as an extension of email which furthermore requires a valid TLD. (.com, .org, ...)

Thanks to @keehun

2.9.1 - Fix change method

31 Aug 14:35
Compare
Choose a tag to compare

Fixed a bug where the change method of a form control wouldn't update $form.

2.9.0 - Validators "control" parameter

10 Aug 13:57
Compare
Choose a tag to compare

Validators can now access the control / field that it was assigned to.

const newValidator: Validator = (value, form, control) => {
   // Access `field`
};

The syntax may change in the next major release version 3 to for example concatenate form and control into an object.
This would allow further changes later down the line without causing breaking changes.

2.8.0 - Dynamic Validators

19 Jul 13:17
Compare
Choose a tag to compare

When using the validators action, validators will now be "recreated" when the argument changes.

Example:
Iff you modify the parameter length the validator is automatically recreated and applied to the input.

<script>
let length = 5;
</script>

<input name="username" use:validators={[minLength(length)]} >

2.6.0

08 Jan 16:22
Compare
Choose a tag to compare
  • Multiple forms per component: Assign a name to a form by setting it in the constructor useForm({}, "user-form") and then assigning the form attribute on the HintGroup or Hint to it: <Hint form="user-form"…>
  • Hint class and id: Hint component now exposes class and id attributes.

Huge thanks to @moalamri! 🎉

⚠️ Update to 2.6.1 since 2.6.0 had some breaking changes.

2.5.0

20 Nov 22:33
Compare
Choose a tag to compare
  • Improve typings: Specifying controls in the constructor will lead to them being suggested when accessing $form #24
  • Ignore attribute: We can now use data-suf-ignore to ignore a form control from being detected by svelte-use-form. #38
  • New Regex pattern validator #41
  • Newer svelte version: Updated project to newer svelte library skeleton
  • Bug fixes and refactoring

2.4.0 - Reset Functions

18 Jul 19:17
Compare
Choose a tag to compare

$form.reset() to reset the whole form.
$form.email.reset() to reset for example the email field.
$form.email.reset({ value: "Set the value it should have after the reset }) You can also set the value manually, if omitted it will have the initial value of the field.

2.3.0

16 Mar 15:25
Compare
Choose a tag to compare
  • Added error function in FormControl:
    You can now set errors manually on a specific FormControl. e.g. $form.email.error({ login: "Password is incorrect" }).
    This comes in handy, when dealing with async errors for example when dealing with backend responses.

2.2.0

14 Mar 10:48
Compare
Choose a tag to compare
  • Addedtouched property on form object.
    You can now set all the fields to touched, resulting in hints being shown and the styling being triggered when e.g. :global(input.touched:inalid){}

2.1.0

10 Mar 19:41
Compare
Choose a tag to compare
  • Added errorMap. (Map the validationErrors to new value before they are assigned to the formControl object)
  • Added class on Hint component. (You can now use classes on it directly instead of wrapping it)
  • Added url validator