use-mask-input 3.5.1 → 3.5.2
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.
- package/CHANGELOG.md +7 -0
- package/dist/index.cjs +2 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/types.ts +17 -17
- package/src/withMask.ts +3 -9
package/dist/index.d.cts
CHANGED
|
@@ -575,11 +575,11 @@ interface CommandObject {
|
|
|
575
575
|
|
|
576
576
|
type Mask = 'datetime' | 'email' | 'numeric' | 'currency' | 'decimal' | 'integer' | 'percentage' | 'url' | 'ip' | 'mac' | 'ssn' | 'brl-currency' | 'cpf' | 'cnpj' | (string & {}) | (string[] & {}) | null;
|
|
577
577
|
type Options = Options$1;
|
|
578
|
-
type Input = HTMLInputElement | HTMLTextAreaElement | HTMLElement
|
|
578
|
+
type Input = HTMLInputElement | HTMLTextAreaElement | HTMLElement;
|
|
579
579
|
|
|
580
580
|
declare function withHookFormMask(register: UseFormRegisterReturn, mask: Mask, options?: Options): UseFormRegisterReturn;
|
|
581
581
|
|
|
582
|
-
declare function withMask(mask: Mask, options?: Options): (input: Input) =>
|
|
582
|
+
declare function withMask(mask: Mask, options?: Options): (input: Input | null) => void;
|
|
583
583
|
|
|
584
584
|
declare function useHookFormMask<T extends FieldValues, D extends RegisterOptions>(registerFn: UseFormRegister<T>): (fieldName: Path<T>, mask: Mask, options?: (D & Options) | Options | D) => UseFormRegisterReturn<Path<T>>;
|
|
585
585
|
|
package/dist/index.d.ts
CHANGED
|
@@ -575,11 +575,11 @@ interface CommandObject {
|
|
|
575
575
|
|
|
576
576
|
type Mask = 'datetime' | 'email' | 'numeric' | 'currency' | 'decimal' | 'integer' | 'percentage' | 'url' | 'ip' | 'mac' | 'ssn' | 'brl-currency' | 'cpf' | 'cnpj' | (string & {}) | (string[] & {}) | null;
|
|
577
577
|
type Options = Options$1;
|
|
578
|
-
type Input = HTMLInputElement | HTMLTextAreaElement | HTMLElement
|
|
578
|
+
type Input = HTMLInputElement | HTMLTextAreaElement | HTMLElement;
|
|
579
579
|
|
|
580
580
|
declare function withHookFormMask(register: UseFormRegisterReturn, mask: Mask, options?: Options): UseFormRegisterReturn;
|
|
581
581
|
|
|
582
|
-
declare function withMask(mask: Mask, options?: Options): (input: Input) =>
|
|
582
|
+
declare function withMask(mask: Mask, options?: Options): (input: Input | null) => void;
|
|
583
583
|
|
|
584
584
|
declare function useHookFormMask<T extends FieldValues, D extends RegisterOptions>(registerFn: UseFormRegister<T>): (fieldName: Path<T>, mask: Mask, options?: (D & Options) | Options | D) => UseFormRegisterReturn<Path<T>>;
|
|
585
585
|
|
package/dist/index.js
CHANGED
|
@@ -3979,13 +3979,9 @@ function withHookFormMask(register, mask, options) {
|
|
|
3979
3979
|
var import_inputmask2 = __toESM(require_inputmask());
|
|
3980
3980
|
function withMask(mask, options) {
|
|
3981
3981
|
return (input) => {
|
|
3982
|
-
if (isServer_default) return
|
|
3983
|
-
if (mask === null) return input;
|
|
3982
|
+
if (isServer_default || mask === null || !input) return;
|
|
3984
3983
|
const maskInput = interopDefaultSync(import_inputmask2.default)(getMaskOptions(mask, options));
|
|
3985
|
-
|
|
3986
|
-
maskInput.mask(input);
|
|
3987
|
-
}
|
|
3988
|
-
return input;
|
|
3984
|
+
maskInput.mask(input);
|
|
3989
3985
|
};
|
|
3990
3986
|
}
|
|
3991
3987
|
|