use-mask-input 3.3.5 → 3.3.7

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