@zemkogabor/vue-form-validator 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ import { Ref } from 'vue';
2
+ export declare function useValidator(inputRef: Ref<HTMLInputElement | null>): {
3
+ onInvalid: (event: Event) => void;
4
+ getInvalidMessage: () => string | null;
5
+ setCustomError: (data: string) => void;
6
+ };
@@ -0,0 +1,3 @@
1
+ export { useValidator } from './Validator';
2
+ export { VALIDATOR_CONFIG_KEY } from './validatorConfig';
3
+ export type { ValidatorConfig, ValidatorMessages } from './validatorConfig';
@@ -58,5 +58,6 @@ function g(s) {
58
58
  };
59
59
  }
60
60
  export {
61
+ v as VALIDATOR_CONFIG_KEY,
61
62
  g as useValidator
62
63
  };
@@ -0,0 +1,18 @@
1
+ import { InjectionKey } from 'vue';
2
+ export type ValidatorMessages = {
3
+ valueMissing: string;
4
+ tooShort(minLength: number): string;
5
+ tooLong(maxLength: number): string;
6
+ rangeUnderflow(min: string): string;
7
+ rangeOverflow(max: string): string;
8
+ typeMismatchEmail: string;
9
+ typeMismatchUrl: string;
10
+ badInputNumber: string;
11
+ badInputDate: string;
12
+ patternMismatch: string;
13
+ stepMismatch(nearestMin: number, nearestMax: number): string;
14
+ };
15
+ export interface ValidatorConfig {
16
+ messages: ValidatorMessages;
17
+ }
18
+ export declare const VALIDATOR_CONFIG_KEY: InjectionKey<ValidatorConfig>;
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@zemkogabor/vue-form-validator",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "A lightweight Vue.js library that implements the JavaScript Constraint Validation API, offering advanced form validation with custom error messages and internationalization support.",
5
- "module": "./dist/vue-form-validator.js",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
6
7
  "types": "./dist/index.d.ts",
7
8
  "type": "module",
8
9
  "exports": {
9
10
  ".": {
10
- "import": "./dist/vue-form-validator.js",
11
+ "import": "./dist/index.js",
11
12
  "types": "./dist/index.d.ts"
12
13
  }
13
14
  },