use-mask-input 3.0.5 → 3.1.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.
Files changed (67) hide show
  1. package/dist/index.cjs +177 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.ts +34 -3
  4. package/dist/index.js +172 -0
  5. package/dist/index.js.map +1 -0
  6. package/package.json +43 -51
  7. package/src/index.tsx +3 -2
  8. package/src/types.ts +6 -0
  9. package/src/useMaskInput.ts +12 -9
  10. package/src/utils.spec.ts +13 -0
  11. package/src/utils.ts +27 -0
  12. package/src/withHookFormMask.ts +9 -16
  13. package/src/withMask.ts +5 -6
  14. package/dist/example/App.example.d.ts +0 -3
  15. package/dist/example/index.d.ts +0 -1
  16. package/dist/index.modern.js +0 -2
  17. package/dist/index.modern.js.map +0 -1
  18. package/dist/index.module.js +0 -2
  19. package/dist/index.module.js.map +0 -1
  20. package/dist/index.umd.js +0 -2
  21. package/dist/index.umd.js.map +0 -1
  22. package/dist/useMaskInput.d.ts +0 -9
  23. package/dist/withHookFormMask.d.ts +0 -16
  24. package/dist/withMask.d.ts +0 -3
  25. package/node_modules/inputmask/LICENSE.txt +0 -7
  26. package/node_modules/inputmask/README.md +0 -1279
  27. package/node_modules/inputmask/bundle.js +0 -6
  28. package/node_modules/inputmask/dist/bindings/inputmask.binding.js +0 -26
  29. package/node_modules/inputmask/dist/inputmask.es6.js +0 -5
  30. package/node_modules/inputmask/dist/inputmask.js +0 -3031
  31. package/node_modules/inputmask/dist/inputmask.min.js +0 -8
  32. package/node_modules/inputmask/dist/jquery.inputmask.js +0 -2985
  33. package/node_modules/inputmask/dist/jquery.inputmask.min.js +0 -8
  34. package/node_modules/inputmask/lib/bindings/inputmask.binding.js +0 -26
  35. package/node_modules/inputmask/lib/bindings/inputmask.es6.js +0 -5
  36. package/node_modules/inputmask/lib/canUseDOM.js +0 -7
  37. package/node_modules/inputmask/lib/defaults.js +0 -101
  38. package/node_modules/inputmask/lib/definitions.js +0 -13
  39. package/node_modules/inputmask/lib/dependencyLibs/data.js +0 -8
  40. package/node_modules/inputmask/lib/dependencyLibs/events.js +0 -199
  41. package/node_modules/inputmask/lib/dependencyLibs/extend.js +0 -58
  42. package/node_modules/inputmask/lib/dependencyLibs/inputmask.dependencyLib.jquery.js +0 -13
  43. package/node_modules/inputmask/lib/dependencyLibs/inputmask.dependencyLib.js +0 -41
  44. package/node_modules/inputmask/lib/environment.js +0 -9
  45. package/node_modules/inputmask/lib/escapeRegex.js +0 -4
  46. package/node_modules/inputmask/lib/eventhandlers.js +0 -513
  47. package/node_modules/inputmask/lib/eventruler.js +0 -124
  48. package/node_modules/inputmask/lib/extensions/inputmask.date.extensions.js +0 -588
  49. package/node_modules/inputmask/lib/extensions/inputmask.extensions.js +0 -133
  50. package/node_modules/inputmask/lib/extensions/inputmask.numeric.extensions.js +0 -631
  51. package/node_modules/inputmask/lib/global/window.js +0 -3
  52. package/node_modules/inputmask/lib/inputHandling.js +0 -252
  53. package/node_modules/inputmask/lib/inputmask.js +0 -355
  54. package/node_modules/inputmask/lib/inputmaskElement.js +0 -33
  55. package/node_modules/inputmask/lib/jquery.inputmask.js +0 -81
  56. package/node_modules/inputmask/lib/keycode.json +0 -25
  57. package/node_modules/inputmask/lib/mask-lexer.js +0 -467
  58. package/node_modules/inputmask/lib/mask.js +0 -244
  59. package/node_modules/inputmask/lib/masktoken.js +0 -13
  60. package/node_modules/inputmask/lib/polyfills/Array.includes.js +0 -48
  61. package/node_modules/inputmask/lib/polyfills/Object.getPrototypeOf.js +0 -7
  62. package/node_modules/inputmask/lib/positioning.js +0 -348
  63. package/node_modules/inputmask/lib/validation-tests.js +0 -597
  64. package/node_modules/inputmask/lib/validation.js +0 -664
  65. package/node_modules/inputmask/package.json +0 -60
  66. package/src/example/App.example.tsx +0 -68
  67. package/src/example/index.tsx +0 -5
@@ -1,133 +0,0 @@
1
- /*
2
- Input Mask plugin extensions
3
- http://github.com/RobinHerbots/jquery.inputmask
4
- Copyright (c) Robin Herbots
5
- Licensed under the MIT license
6
- */
7
- import Inputmask from "../inputmask";
8
- import {getLastValidPosition} from "../positioning";
9
- import {getMaskTemplate} from "../validation-tests";
10
- //extra definitions
11
- Inputmask.extendDefinitions({
12
- "A": {
13
- validator: "[A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
14
- casing: "upper" //auto uppercasing
15
- },
16
- "&": { //alfanumeric uppercasing
17
- validator: "[0-9A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
18
- casing: "upper"
19
- },
20
- "#": { //hexadecimal
21
- validator: "[0-9A-Fa-f]",
22
- casing: "upper"
23
- }
24
- });
25
-
26
- var ipValidatorRegex = new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]");
27
-
28
- function ipValidator(chrs, maskset, pos, strict, opts) {
29
- if (pos - 1 > -1 && maskset.buffer[pos - 1] !== ".") {
30
- chrs = maskset.buffer[pos - 1] + chrs;
31
- if (pos - 2 > -1 && maskset.buffer[pos - 2] !== ".") {
32
- chrs = maskset.buffer[pos - 2] + chrs;
33
- } else chrs = "0" + chrs;
34
- } else chrs = "00" + chrs;
35
- return ipValidatorRegex.test(chrs);
36
- }
37
-
38
-
39
- Inputmask.extendAliases({
40
- "cssunit": {
41
- regex: "[+-]?[0-9]+\\.?([0-9]+)?(px|em|rem|ex|%|in|cm|mm|pt|pc)"
42
- },
43
- "url": { //needs update => https://en.wikipedia.org/wiki/URL
44
- regex: "(https?|ftp)://.*",
45
- autoUnmask: false,
46
- keepStatic: false,
47
- tabThrough: true
48
- },
49
- "ip": { //ip-address mask
50
- mask: "i{1,3}.j{1,3}.k{1,3}.l{1,3}",
51
- definitions: {
52
- "i": {
53
- validator: ipValidator
54
- },
55
- "j": {
56
- validator: ipValidator
57
- },
58
- "k": {
59
- validator: ipValidator
60
- },
61
- "l": {
62
- validator: ipValidator
63
- }
64
- },
65
- onUnMask: function (maskedValue, unmaskedValue, opts) {
66
- return maskedValue;
67
- },
68
- inputmode: "decimal",
69
- substitutes: {",": "."}
70
- },
71
- "email": {
72
- //https://en.wikipedia.org/wiki/Domain_name#Domain_name_space
73
- //https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names
74
- //should be extended with the toplevel domains at the end
75
- mask: function (opts) {
76
- var emailMask = "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]";
77
- var mask = emailMask;
78
- if (opts.separator) {
79
- for (let i = 0; i < opts.quantifier; i++) {
80
- mask += `[${opts.separator}${emailMask}]`;
81
- }
82
- }
83
- return mask;
84
- return opts.separator ? `${emailMask}(${opts.separator}${emailMask}){*}` : emailMask;
85
- },
86
- greedy: false,
87
- casing: "lower",
88
- separator: null,
89
- quantifier: 5,
90
- skipOptionalPartCharacter: "",
91
- onBeforePaste: function (pastedValue, opts) {
92
- pastedValue = pastedValue.toLowerCase();
93
- return pastedValue.replace("mailto:", "");
94
- },
95
- definitions: {
96
- "*": {
97
- validator: "[0-9\uFF11-\uFF19A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5!#$%&'*+/=?^_`{|}~-]"
98
- },
99
- "-": {
100
- validator: "[0-9A-Za-z-]"
101
- }
102
- },
103
- onUnMask: function (maskedValue, unmaskedValue, opts) {
104
- return maskedValue;
105
- },
106
- inputmode: "email"
107
- },
108
- "mac": {
109
- mask: "##:##:##:##:##:##"
110
- },
111
- //https://en.wikipedia.org/wiki/Vehicle_identification_number
112
- // see issue #1199
113
- "vin": {
114
- mask: "V{13}9{4}",
115
- definitions: {
116
- "V": {
117
- validator: "[A-HJ-NPR-Za-hj-npr-z\\d]",
118
- casing: "upper"
119
- }
120
- },
121
- clearIncomplete: true,
122
- autoUnmask: true
123
- },
124
- //http://rion.io/2013/09/10/validating-social-security-numbers-through-regular-expressions-2/
125
- //https://en.wikipedia.org/wiki/Social_Security_number
126
- "ssn": {
127
- mask: "999-99-9999",
128
- postValidation: function (buffer, pos, c, currentResult, opts, maskset, strict) {
129
- var bffr = getMaskTemplate.call(this, true, getLastValidPosition.call(this), true, true);
130
- return /^(?!219-09-9999|078-05-1120)(?!666|000|9.{2}).{3}-(?!00).{2}-(?!0{4}).{4}$/.test(bffr.join(""));
131
- }
132
- },
133
- });