use-mask-input 3.3.4 → 3.3.6

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/dist/index.js CHANGED
@@ -13,7 +13,7 @@ var inputmask$1 = {exports: {}};
13
13
  * https://github.com/RobinHerbots/Inputmask
14
14
  * Copyright (c) 2010 - 2023 Robin Herbots
15
15
  * Licensed under the MIT license
16
- * Version: 5.0.9-beta.30
16
+ * Version: 5.0.9-beta.32
17
17
  */
18
18
 
19
19
  (function (module, exports) {
@@ -720,7 +720,7 @@ var inputmask$1 = {exports: {}};
720
720
  },
721
721
  keypressEvent: function(e, t, n, i, a) {
722
722
  var l = this.inputmask || this, u = l.opts, f = l.dependencyLib, p = l.maskset, d = l.el, h = f(d), v = e.key;
723
- if (!0 === t || e.ctrlKey && e.altKey || !(e.ctrlKey || e.metaKey || l.ignorable)) {
723
+ if (!0 === t || e.ctrlKey && e.altKey && !l.ignorable || !(e.ctrlKey || e.metaKey || l.ignorable)) {
724
724
  if (v) {
725
725
  var m, g = t ? {
726
726
  begin: a,
@@ -3642,118 +3642,96 @@ function flow(...funcs) {
3642
3642
 
3643
3643
  const isServer = !(typeof window !== "undefined" && window.document && window.document.createElement);
3644
3644
 
3645
- var __defProp$2 = Object.defineProperty;
3646
- var __defProps$2 = Object.defineProperties;
3647
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
3648
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
3649
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
3650
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
3651
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3652
- var __spreadValues$2 = (a, b) => {
3653
- for (var prop in b || (b = {}))
3654
- if (__hasOwnProp$2.call(b, prop))
3655
- __defNormalProp$2(a, prop, b[prop]);
3656
- if (__getOwnPropSymbols$2)
3657
- for (var prop of __getOwnPropSymbols$2(b)) {
3658
- if (__propIsEnum$2.call(b, prop))
3659
- __defNormalProp$2(a, prop, b[prop]);
3660
- }
3661
- return a;
3662
- };
3663
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
3664
3645
  const getMaskOptions = (mask, _options) => {
3665
- const options = __spreadProps$2(__spreadValues$2({}, _options), {
3646
+ const options = {
3647
+ ..._options,
3666
3648
  jitMasking: false
3667
- });
3649
+ };
3668
3650
  if (!mask)
3669
3651
  return options;
3670
3652
  const masks = {
3671
- datetime: __spreadValues$2({
3672
- alias: "datetime"
3673
- }, options),
3674
- email: __spreadValues$2({
3653
+ datetime: {
3654
+ alias: "datetime",
3655
+ ...options
3656
+ },
3657
+ email: {
3675
3658
  alias: "email",
3676
- placeholder: ""
3677
- }, options),
3678
- numeric: __spreadValues$2({
3659
+ placeholder: "",
3660
+ ...options
3661
+ },
3662
+ numeric: {
3679
3663
  alias: "numeric",
3680
- placeholder: ""
3681
- }, options),
3682
- currency: __spreadValues$2({
3664
+ placeholder: "",
3665
+ ...options
3666
+ },
3667
+ currency: {
3683
3668
  alias: "currency",
3684
3669
  prefix: "$ ",
3685
- placeholder: ""
3686
- }, options),
3687
- decimal: __spreadValues$2({
3670
+ placeholder: "",
3671
+ ...options
3672
+ },
3673
+ decimal: {
3688
3674
  alias: "decimal",
3689
- placeholder: ""
3690
- }, options),
3691
- integer: __spreadValues$2({
3675
+ placeholder: "",
3676
+ ...options
3677
+ },
3678
+ integer: {
3692
3679
  alias: "integer",
3693
- placeholder: ""
3694
- }, options),
3695
- percentage: __spreadValues$2({
3680
+ placeholder: "",
3681
+ ...options
3682
+ },
3683
+ percentage: {
3696
3684
  alias: "percentage",
3697
3685
  placeholder: " %",
3698
- suffix: " %"
3699
- }, options),
3700
- url: __spreadValues$2({
3686
+ suffix: " %",
3687
+ ...options
3688
+ },
3689
+ url: {
3701
3690
  alias: "url",
3702
- placeholder: "https://"
3703
- }, options),
3704
- ip: __spreadValues$2({
3705
- alias: "ip"
3706
- }, options),
3707
- mac: __spreadValues$2({
3708
- alias: "mac"
3709
- }, options),
3710
- ssn: __spreadValues$2({
3711
- alias: "ssn"
3712
- }, options),
3691
+ placeholder: "https://",
3692
+ ...options
3693
+ },
3694
+ ip: {
3695
+ alias: "ip",
3696
+ ...options
3697
+ },
3698
+ mac: {
3699
+ alias: "mac",
3700
+ ...options
3701
+ },
3702
+ ssn: {
3703
+ alias: "ssn",
3704
+ ...options
3705
+ },
3713
3706
  // alias for brazilians <3
3714
- "brl-currency": __spreadValues$2({
3707
+ "brl-currency": {
3715
3708
  alias: "currency",
3716
3709
  prefix: "R$ ",
3717
3710
  placeholder: "0,00",
3718
3711
  displayFormat: "currency",
3719
3712
  radixPoint: ",",
3720
- autoUnmask: true
3721
- }, options),
3722
- cpf: __spreadValues$2({
3713
+ autoUnmask: true,
3714
+ ...options
3715
+ },
3716
+ cpf: {
3723
3717
  mask: "999.999.999-99",
3724
- placeholder: "___.___.___-__"
3725
- }, options),
3726
- cnpj: __spreadValues$2({
3718
+ placeholder: "___.___.___-__",
3719
+ ...options
3720
+ },
3721
+ cnpj: {
3727
3722
  mask: "99.999.999/9999-99",
3728
- placeholder: "__.___.___/____-__"
3729
- }, options)
3723
+ placeholder: "__.___.___/____-__",
3724
+ ...options
3725
+ }
3730
3726
  };
3731
3727
  if (typeof mask === "string" && masks[mask])
3732
3728
  return masks[mask];
3733
- return __spreadValues$2({
3734
- mask
3735
- }, options);
3729
+ return {
3730
+ mask,
3731
+ ...options
3732
+ };
3736
3733
  };
3737
3734
 
3738
- var __defProp$1 = Object.defineProperty;
3739
- var __defProps$1 = Object.defineProperties;
3740
- var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
3741
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
3742
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
3743
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
3744
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3745
- var __spreadValues$1 = (a, b) => {
3746
- for (var prop in b || (b = {}))
3747
- if (__hasOwnProp$1.call(b, prop))
3748
- __defNormalProp$1(a, prop, b[prop]);
3749
- if (__getOwnPropSymbols$1)
3750
- for (var prop of __getOwnPropSymbols$1(b)) {
3751
- if (__propIsEnum$1.call(b, prop))
3752
- __defNormalProp$1(a, prop, b[prop]);
3753
- }
3754
- return a;
3755
- };
3756
- var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
3757
3735
  const withHookFormMask = (register, mask, options) => {
3758
3736
  let newRef;
3759
3737
  if (register) {
@@ -3765,9 +3743,10 @@ const withHookFormMask = (register, mask, options) => {
3765
3743
  return _ref;
3766
3744
  }, ref);
3767
3745
  }
3768
- return __spreadProps$1(__spreadValues$1({}, register), {
3746
+ return {
3747
+ ...register,
3769
3748
  ref: newRef
3770
- });
3749
+ };
3771
3750
  };
3772
3751
 
3773
3752
  const withMask = (mask, options) => (input) => {
@@ -3782,51 +3761,21 @@ const withMask = (mask, options) => (input) => {
3782
3761
  return input;
3783
3762
  };
3784
3763
 
3785
- var __defProp = Object.defineProperty;
3786
- var __defProps = Object.defineProperties;
3787
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
3788
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3789
- var __hasOwnProp = Object.prototype.hasOwnProperty;
3790
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
3791
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3792
- var __spreadValues = (a, b) => {
3793
- for (var prop in b || (b = {}))
3794
- if (__hasOwnProp.call(b, prop))
3795
- __defNormalProp(a, prop, b[prop]);
3796
- if (__getOwnPropSymbols)
3797
- for (var prop of __getOwnPropSymbols(b)) {
3798
- if (__propIsEnum.call(b, prop))
3799
- __defNormalProp(a, prop, b[prop]);
3800
- }
3801
- return a;
3802
- };
3803
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
3804
- var __objRest = (source, exclude) => {
3805
- var target = {};
3806
- for (var prop in source)
3807
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
3808
- target[prop] = source[prop];
3809
- if (source != null && __getOwnPropSymbols)
3810
- for (var prop of __getOwnPropSymbols(source)) {
3811
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
3812
- target[prop] = source[prop];
3813
- }
3814
- return target;
3815
- };
3816
3764
  function useHookFormMask(registerFn) {
3817
3765
  return (fieldName, mask, options) => {
3818
3766
  if (!registerFn)
3819
3767
  throw new Error("registerFn is required");
3820
- const _a = registerFn(fieldName, options), { ref } = _a, restRegister = __objRest(_a, ["ref"]);
3768
+ const { ref, ...restRegister } = registerFn(fieldName, options);
3821
3769
  const maskInput = inputmask(getMaskOptions(mask, options));
3822
3770
  const newRef = flow((_ref) => {
3823
3771
  if (_ref)
3824
3772
  maskInput.mask(_ref);
3825
3773
  return _ref;
3826
3774
  }, ref);
3827
- return __spreadProps(__spreadValues({}, restRegister), {
3775
+ return {
3776
+ ...restRegister,
3828
3777
  ref: newRef
3829
- });
3778
+ };
3830
3779
  };
3831
3780
  }
3832
3781