use-mask-input 3.0.0 → 3.0.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/dist/index.js +1 -82
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +2 -0
- package/dist/index.modern.mjs.map +1 -0
- package/dist/index.module.js +2 -0
- package/dist/index.module.js.map +1 -0
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/withHookFormMask.d.ts +2 -2
- package/dist/withMask.d.ts +1 -1
- package/package.json +43 -39
- package/src/example/App.example.tsx +54 -0
- package/src/example/index.tsx +5 -0
- package/src/index.tsx +3 -0
- package/src/useMaskInput.ts +35 -0
- package/src/withHookFormMask.ts +36 -0
- package/src/withMask.ts +20 -0
- package/dist/index.modern.js +0 -80
- package/dist/index.modern.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,83 +1,2 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
var react = require('react');
|
|
4
|
-
var Inputmask = _interopDefault(require('inputmask'));
|
|
5
|
-
var flowright = _interopDefault(require('lodash.flowright'));
|
|
6
|
-
|
|
7
|
-
function _extends() {
|
|
8
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
9
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
10
|
-
var source = arguments[i];
|
|
11
|
-
|
|
12
|
-
for (var key in source) {
|
|
13
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
14
|
-
target[key] = source[key];
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return target;
|
|
20
|
-
};
|
|
21
|
-
return _extends.apply(this, arguments);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
var useInputMask = function useInputMask(props) {
|
|
25
|
-
var mask = props.mask,
|
|
26
|
-
register = props.register,
|
|
27
|
-
options = props.options;
|
|
28
|
-
var ref = react.useRef(null);
|
|
29
|
-
react.useEffect(function () {
|
|
30
|
-
if (!ref.current) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
var maskInput = Inputmask(_extends({
|
|
35
|
-
mask: mask
|
|
36
|
-
}, options));
|
|
37
|
-
maskInput.mask(ref.current);
|
|
38
|
-
|
|
39
|
-
if (register && ref.current) {
|
|
40
|
-
register(ref.current);
|
|
41
|
-
}
|
|
42
|
-
}, [mask, register, options]);
|
|
43
|
-
return ref;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
var withHookFormMask = function withHookFormMask(registerReturn, mask, options) {
|
|
47
|
-
var newRef;
|
|
48
|
-
|
|
49
|
-
if (registerReturn) {
|
|
50
|
-
var ref = registerReturn.ref;
|
|
51
|
-
var maskInput = Inputmask(_extends({
|
|
52
|
-
mask: mask,
|
|
53
|
-
jitMasking: true
|
|
54
|
-
}, options));
|
|
55
|
-
newRef = flowright(ref, function (_ref) {
|
|
56
|
-
maskInput.mask(_ref);
|
|
57
|
-
return _ref;
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return _extends({}, registerReturn, {
|
|
62
|
-
ref: newRef
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
var withFinalFormMask = function withFinalFormMask(mask, options) {
|
|
67
|
-
return function (input) {
|
|
68
|
-
var maskInput = Inputmask(_extends({
|
|
69
|
-
mask: mask
|
|
70
|
-
}, options));
|
|
71
|
-
|
|
72
|
-
if (input) {
|
|
73
|
-
maskInput.mask(input);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return input;
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
exports.default = useInputMask;
|
|
81
|
-
exports.withHookFormMask = withHookFormMask;
|
|
82
|
-
exports.withMask = withFinalFormMask;
|
|
1
|
+
var r=require("react"),t=require("inputmask"),e=require("lodash.flowright");function n(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var u=/*#__PURE__*/n(t),a=/*#__PURE__*/n(e);function i(){return i=Object.assign?Object.assign.bind():function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},i.apply(this,arguments)}exports.default=function(t){var e=t.mask,n=t.register,a=t.options,f=r.useRef(null);return r.useEffect(function(){f.current&&(u.default(i({mask:e},a)).mask(f.current),n&&f.current&&n(f.current))},[e,n,a]),f},exports.withHookFormMask=function(r,t,e){var n;if(r){var f=r.ref,o=u.default(i({mask:t,jitMasking:!0},e));n=a.default(f,function(r){return o.mask(r),r})}return i({},r,{ref:n})},exports.withMask=function(r,t){return function(e){var n=u.default(i({mask:r},t));return e&&n.mask(e),e}};
|
|
83
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/useMaskInput.ts","../src/withHookFormMask.ts","../src/withMask.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport Inputmask from 'inputmask';\n\ninterface UseInputMaskOptions {\n mask: Inputmask.Options['mask']\n register?(element: HTMLElement): void\n options?: Inputmask.Options\n}\n\nconst useInputMask = (props: UseInputMaskOptions) => {\n const { mask, register, options } = props;\n\n const ref = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (!ref.current) {\n return;\n }\n\n const maskInput = Inputmask({\n mask,\n ...options,\n });\n\n maskInput.mask(ref.current);\n\n if (register && ref.current) {\n register(ref.current);\n }\n }, [mask, register, options]);\n\n return ref;\n};\n\nexport default useInputMask;\n","/* eslint-disable @typescript-eslint/space-before-blocks */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport Inputmask from 'inputmask';\nimport { UseFormRegisterReturn } from 'react-hook-form';\nimport flowright from 'lodash.flowright';\n\nconst withHookFormMask = (\n registerReturn: UseFormRegisterReturn,\n mask: Inputmask.Options['mask'],\n options?: Inputmask.Options,\n) => {\n //\n let newRef;\n\n if (registerReturn){\n const { ref } = registerReturn;\n\n const maskInput = Inputmask({\n mask,\n jitMasking: true,\n ...options,\n });\n\n newRef = flowright(ref, (_ref) => {\n maskInput.mask(_ref);\n return _ref;\n });\n }\n\n return {\n ...registerReturn,\n ref: newRef,\n };\n};\n\nexport default withHookFormMask;\n","import Inputmask from 'inputmask';\n\nconst withFinalFormMask = (\n mask: Inputmask.Options['mask'],\n options?: Inputmask.Options,\n) => (input: HTMLElement | HTMLInputElement | null) => {\n //\n const maskInput = Inputmask({\n mask,\n ...options,\n });\n\n if (input) {\n maskInput.mask(input);\n }\n\n return input;\n};\n\nexport default withFinalFormMask;\n"],"names":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/useMaskInput.ts","../src/withHookFormMask.ts","../src/withMask.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport Inputmask from 'inputmask';\n\ninterface UseInputMaskOptions {\n mask: Inputmask.Options['mask']\n register?(element: HTMLElement): void\n options?: Inputmask.Options\n}\n\nconst useInputMask = (props: UseInputMaskOptions) => {\n const { mask, register, options } = props;\n\n const ref = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (!ref.current) {\n return;\n }\n\n const maskInput = Inputmask({\n mask,\n ...options,\n });\n\n maskInput.mask(ref.current);\n\n if (register && ref.current) {\n register(ref.current);\n }\n }, [mask, register, options]);\n\n return ref;\n};\n\nexport default useInputMask;\n","/* eslint-disable @typescript-eslint/space-before-blocks */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport Inputmask from 'inputmask';\nimport type { UseFormRegisterReturn } from 'react-hook-form';\nimport flowright from 'lodash.flowright';\n\nconst withHookFormMask = (\n registerReturn: UseFormRegisterReturn,\n mask: Inputmask.Options['mask'],\n options?: Inputmask.Options,\n) => {\n //\n let newRef;\n\n if (registerReturn){\n const { ref } = registerReturn;\n\n const maskInput = Inputmask({\n mask,\n jitMasking: true,\n ...options,\n });\n\n newRef = flowright(ref, (_ref) => {\n maskInput.mask(_ref);\n return _ref;\n });\n }\n\n return {\n ...registerReturn,\n ref: newRef,\n };\n};\n\nexport default withHookFormMask;\n","import Inputmask from 'inputmask';\n\nconst withFinalFormMask = (\n mask: Inputmask.Options['mask'],\n options?: Inputmask.Options,\n) => (input: HTMLElement | HTMLInputElement | null) => {\n //\n const maskInput = Inputmask({\n mask,\n ...options,\n });\n\n if (input) {\n maskInput.mask(input);\n }\n\n return input;\n};\n\nexport default withFinalFormMask;\n"],"names":["props","mask","register","options","ref","useRef","useEffect","current","Inputmask","registerReturn","newRef","maskInput","jitMasking","flowright","_ref","_extends","input"],"mappings":"obASqB,SAACA,GACpB,IAAYC,EAAwBD,EAA5BC,KAAMC,EAAsBF,EAAtBE,SAAUC,EAAYH,EAAZG,QAElBC,EAAMC,SAAyB,MAmBrC,OAjBAC,EAASA,UAAC,WACHF,EAAIG,UAISC,EAAS,QACzBP,EAAAA,CAAAA,KAAAA,GACGE,IAGKF,KAAKG,EAAIG,SAEfL,GAAYE,EAAIG,SAClBL,EAASE,EAAIG,SAEjB,EAAG,CAACN,EAAMC,EAAUC,IAGtBC,CAAA,2BC1ByB,SACvBK,EACAR,EACAE,GAGA,IAAUO,EAEV,GAAID,EAAe,CACjB,IAAQL,EAAQK,EAARL,IAEOO,EAAGH,EAAS,QACzBP,EAAAA,CAAAA,KAAAA,EACAW,YAAY,GACTT,IAGLO,EAASG,EAAAA,QAAUT,EAAK,SAACU,GAEvB,OADAH,EAAUV,KAAKa,GAEjBA,CAAA,EACD,CAED,OAAAC,EAAA,CAAA,EACKN,EAAc,CACjBL,IAAKM,GAET,mBC/B0B,SACxBT,EACAE,UACIa,SAAAA,GAEJ,IAAeL,EAAGH,EAAAA,QAASO,EAAA,CACzBd,KAAAA,GACGE,IAOL,OAJIa,GACFL,EAAUV,KAAKe,GAInBA,CAAA,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useRef as r,useEffect as t}from"react";import n from"inputmask";import s from"lodash.flowright";function a(){return a=Object.assign?Object.assign.bind():function(r){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},a.apply(this,arguments)}const e=s=>{const{mask:e,register:o,options:i}=s,c=r(null);return t(()=>{c.current&&(n(a({mask:e},i)).mask(c.current),o&&c.current&&o(c.current))},[e,o,i]),c},o=(r,t,e)=>{let o;if(r){const{ref:i}=r,c=n(a({mask:t,jitMasking:!0},e));o=s(i,r=>(c.mask(r),r))}return a({},r,{ref:o})},i=(r,t)=>s=>{const e=n(a({mask:r},t));return s&&e.mask(s),s};export{e as default,o as withHookFormMask,i as withMask};
|
|
2
|
+
//# sourceMappingURL=index.modern.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.modern.mjs","sources":["../src/useMaskInput.ts","../src/withHookFormMask.ts","../src/withMask.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport Inputmask from 'inputmask';\n\ninterface UseInputMaskOptions {\n mask: Inputmask.Options['mask']\n register?(element: HTMLElement): void\n options?: Inputmask.Options\n}\n\nconst useInputMask = (props: UseInputMaskOptions) => {\n const { mask, register, options } = props;\n\n const ref = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (!ref.current) {\n return;\n }\n\n const maskInput = Inputmask({\n mask,\n ...options,\n });\n\n maskInput.mask(ref.current);\n\n if (register && ref.current) {\n register(ref.current);\n }\n }, [mask, register, options]);\n\n return ref;\n};\n\nexport default useInputMask;\n","/* eslint-disable @typescript-eslint/space-before-blocks */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport Inputmask from 'inputmask';\nimport type { UseFormRegisterReturn } from 'react-hook-form';\nimport flowright from 'lodash.flowright';\n\nconst withHookFormMask = (\n registerReturn: UseFormRegisterReturn,\n mask: Inputmask.Options['mask'],\n options?: Inputmask.Options,\n) => {\n //\n let newRef;\n\n if (registerReturn){\n const { ref } = registerReturn;\n\n const maskInput = Inputmask({\n mask,\n jitMasking: true,\n ...options,\n });\n\n newRef = flowright(ref, (_ref) => {\n maskInput.mask(_ref);\n return _ref;\n });\n }\n\n return {\n ...registerReturn,\n ref: newRef,\n };\n};\n\nexport default withHookFormMask;\n","import Inputmask from 'inputmask';\n\nconst withFinalFormMask = (\n mask: Inputmask.Options['mask'],\n options?: Inputmask.Options,\n) => (input: HTMLElement | HTMLInputElement | null) => {\n //\n const maskInput = Inputmask({\n mask,\n ...options,\n });\n\n if (input) {\n maskInput.mask(input);\n }\n\n return input;\n};\n\nexport default withFinalFormMask;\n"],"names":["useInputMask","props","mask","register","options","useRef","useEffect","ref","current","Inputmask","registerReturn","newRef","maskInput","_extends","jitMasking","flowright","_ref","withFinalFormMask","input"],"mappings":"2UASMA,MAAAA,EAAgBC,IACpB,MAAMC,KAAEA,EAAIC,SAAEA,EAAQC,QAAEA,GAAYH,IAExBI,EAAyB,MAmBrC,OAjBAC,EAAU,KACHC,EAAIC,UAISC,EAChBP,EAAAA,CAAAA,QACGE,IAGKF,KAAKK,EAAIC,SAEfL,GAAYI,EAAIC,SAClBL,EAASI,EAAIC,SACd,EACA,CAACN,EAAMC,EAAUC,IAGtBG,KC1ByB,CACvBG,EACAR,EACAE,KAGA,IAAUO,EAEV,GAAID,EAAe,CACjB,MAAMH,IAAEA,GAAQG,EAEVE,EAAYH,EAASI,EAAA,CACzBX,OACAY,YAAY,GACTV,IAGLO,EAASI,EAAUR,EAAMS,IACvBJ,EAAUV,KAAKc,GAEjBA,GACD,CAED,OAAAH,EAAA,CAAA,EACKH,EAAc,CACjBH,IAAKI,KC7BHM,EAAoB,CACxBf,EACAE,IACIc,IAEJ,MAAMN,EAAYH,EAASI,EAAA,CACzBX,QACGE,IAOL,OAJIc,GACFN,EAAUV,KAAKgB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useRef as r,useEffect as t}from"react";import n from"inputmask";import a from"lodash.flowright";function e(){return e=Object.assign?Object.assign.bind():function(r){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])}return r},e.apply(this,arguments)}var i=function(a){var i=a.mask,o=a.register,u=a.options,s=r(null);return t(function(){s.current&&(n(e({mask:i},u)).mask(s.current),o&&s.current&&o(s.current))},[i,o,u]),s},o=function(r,t,i){var o;if(r){var u=r.ref,s=n(e({mask:t,jitMasking:!0},i));o=a(u,function(r){return s.mask(r),r})}return e({},r,{ref:o})},u=function(r,t){return function(a){var i=n(e({mask:r},t));return a&&i.mask(a),a}};export{i as default,o as withHookFormMask,u as withMask};
|
|
2
|
+
//# sourceMappingURL=index.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.module.js","sources":["../src/useMaskInput.ts","../src/withHookFormMask.ts","../src/withMask.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport Inputmask from 'inputmask';\n\ninterface UseInputMaskOptions {\n mask: Inputmask.Options['mask']\n register?(element: HTMLElement): void\n options?: Inputmask.Options\n}\n\nconst useInputMask = (props: UseInputMaskOptions) => {\n const { mask, register, options } = props;\n\n const ref = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (!ref.current) {\n return;\n }\n\n const maskInput = Inputmask({\n mask,\n ...options,\n });\n\n maskInput.mask(ref.current);\n\n if (register && ref.current) {\n register(ref.current);\n }\n }, [mask, register, options]);\n\n return ref;\n};\n\nexport default useInputMask;\n","/* eslint-disable @typescript-eslint/space-before-blocks */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport Inputmask from 'inputmask';\nimport type { UseFormRegisterReturn } from 'react-hook-form';\nimport flowright from 'lodash.flowright';\n\nconst withHookFormMask = (\n registerReturn: UseFormRegisterReturn,\n mask: Inputmask.Options['mask'],\n options?: Inputmask.Options,\n) => {\n //\n let newRef;\n\n if (registerReturn){\n const { ref } = registerReturn;\n\n const maskInput = Inputmask({\n mask,\n jitMasking: true,\n ...options,\n });\n\n newRef = flowright(ref, (_ref) => {\n maskInput.mask(_ref);\n return _ref;\n });\n }\n\n return {\n ...registerReturn,\n ref: newRef,\n };\n};\n\nexport default withHookFormMask;\n","import Inputmask from 'inputmask';\n\nconst withFinalFormMask = (\n mask: Inputmask.Options['mask'],\n options?: Inputmask.Options,\n) => (input: HTMLElement | HTMLInputElement | null) => {\n //\n const maskInput = Inputmask({\n mask,\n ...options,\n });\n\n if (input) {\n maskInput.mask(input);\n }\n\n return input;\n};\n\nexport default withFinalFormMask;\n"],"names":["useInputMask","props","mask","register","options","ref","useRef","useEffect","current","Inputmask","withHookFormMask","registerReturn","newRef","maskInput","jitMasking","flowright","_ref","_extends","withFinalFormMask","input"],"mappings":"2UASMA,MAAe,SAACC,GACpB,IAAYC,EAAwBD,EAA5BC,KAAMC,EAAsBF,EAAtBE,SAAUC,EAAYH,EAAZG,QAElBC,EAAMC,EAAyB,MAmBrC,OAjBAC,EAAU,WACHF,EAAIG,UAISC,EAChBP,EAAAA,CAAAA,KAAAA,GACGE,IAGKF,KAAKG,EAAIG,SAEfL,GAAYE,EAAIG,SAClBL,EAASE,EAAIG,SAEjB,EAAG,CAACN,EAAMC,EAAUC,IAGtBC,CAAA,EC1BMK,EAAmB,SACvBC,EACAT,EACAE,GAGA,IAAUQ,EAEV,GAAID,EAAe,CACjB,IAAQN,EAAQM,EAARN,IAEOQ,EAAGJ,EAChBP,EAAAA,CAAAA,KAAAA,EACAY,YAAY,GACTV,IAGLQ,EAASG,EAAUV,EAAK,SAACW,GAEvB,OADAH,EAAUX,KAAKc,GAEjBA,CAAA,EACD,CAED,OAAAC,EAAA,CAAA,EACKN,EAAc,CACjBN,IAAKO,GAET,EC/BuBM,EAAG,SACxBhB,EACAE,UACIe,SAAAA,GAEJ,IAAeN,EAAGJ,EAASQ,EAAA,CACzBf,KAAAA,GACGE,IAOL,OAJIe,GACFN,EAAUX,KAAKiB,GAInBA,CAAA,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("inputmask"),require("lodash.flowright")):"function"==typeof define&&define.amd?define(["exports","react","inputmask","lodash.flowright"],e):e((t||self).useMaskInput={},t.react,t.inputmask,t.flowright)}(this,function(t,e,n,r){function u(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var a=/*#__PURE__*/u(n),i=/*#__PURE__*/u(r);function f(){return f=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},f.apply(this,arguments)}t.default=function(t){var n=t.mask,r=t.register,u=t.options,i=e.useRef(null);return e.useEffect(function(){i.current&&(a.default(f({mask:n},u)).mask(i.current),r&&i.current&&r(i.current))},[n,r,u]),i},t.withHookFormMask=function(t,e,n){var r;if(t){var u=t.ref,o=a.default(f({mask:e,jitMasking:!0},n));r=i.default(u,function(t){return o.mask(t),t})}return f({},t,{ref:r})},t.withMask=function(t,e){return function(n){var r=a.default(f({mask:t},e));return n&&r.mask(n),n}}});
|
|
2
|
+
//# sourceMappingURL=index.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/useMaskInput.ts","../src/withHookFormMask.ts","../src/withMask.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport Inputmask from 'inputmask';\n\ninterface UseInputMaskOptions {\n mask: Inputmask.Options['mask']\n register?(element: HTMLElement): void\n options?: Inputmask.Options\n}\n\nconst useInputMask = (props: UseInputMaskOptions) => {\n const { mask, register, options } = props;\n\n const ref = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (!ref.current) {\n return;\n }\n\n const maskInput = Inputmask({\n mask,\n ...options,\n });\n\n maskInput.mask(ref.current);\n\n if (register && ref.current) {\n register(ref.current);\n }\n }, [mask, register, options]);\n\n return ref;\n};\n\nexport default useInputMask;\n","/* eslint-disable @typescript-eslint/space-before-blocks */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport Inputmask from 'inputmask';\nimport type { UseFormRegisterReturn } from 'react-hook-form';\nimport flowright from 'lodash.flowright';\n\nconst withHookFormMask = (\n registerReturn: UseFormRegisterReturn,\n mask: Inputmask.Options['mask'],\n options?: Inputmask.Options,\n) => {\n //\n let newRef;\n\n if (registerReturn){\n const { ref } = registerReturn;\n\n const maskInput = Inputmask({\n mask,\n jitMasking: true,\n ...options,\n });\n\n newRef = flowright(ref, (_ref) => {\n maskInput.mask(_ref);\n return _ref;\n });\n }\n\n return {\n ...registerReturn,\n ref: newRef,\n };\n};\n\nexport default withHookFormMask;\n","import Inputmask from 'inputmask';\n\nconst withFinalFormMask = (\n mask: Inputmask.Options['mask'],\n options?: Inputmask.Options,\n) => (input: HTMLElement | HTMLInputElement | null) => {\n //\n const maskInput = Inputmask({\n mask,\n ...options,\n });\n\n if (input) {\n maskInput.mask(input);\n }\n\n return input;\n};\n\nexport default withFinalFormMask;\n"],"names":["props","mask","register","options","ref","useRef","useEffect","current","Inputmask","registerReturn","newRef","maskInput","jitMasking","flowright","_ref","_extends","input"],"mappings":"utBASqB,SAACA,GACpB,IAAYC,EAAwBD,EAA5BC,KAAMC,EAAsBF,EAAtBE,SAAUC,EAAYH,EAAZG,QAElBC,EAAMC,SAAyB,MAmBrC,OAjBAC,EAASA,UAAC,WACHF,EAAIG,UAISC,EAAS,QACzBP,EAAAA,CAAAA,KAAAA,GACGE,IAGKF,KAAKG,EAAIG,SAEfL,GAAYE,EAAIG,SAClBL,EAASE,EAAIG,SAEjB,EAAG,CAACN,EAAMC,EAAUC,IAGtBC,CAAA,qBC1ByB,SACvBK,EACAR,EACAE,GAGA,IAAUO,EAEV,GAAID,EAAe,CACjB,IAAQL,EAAQK,EAARL,IAEOO,EAAGH,EAAS,QACzBP,EAAAA,CAAAA,KAAAA,EACAW,YAAY,GACTT,IAGLO,EAASG,EAAAA,QAAUT,EAAK,SAACU,GAEvB,OADAH,EAAUV,KAAKa,GAEjBA,CAAA,EACD,CAED,OAAAC,EAAA,CAAA,EACKN,EAAc,CACjBL,IAAKM,GAET,aC/B0B,SACxBT,EACAE,UACIa,SAAAA,GAEJ,IAAeL,EAAGH,EAAAA,QAASO,EAAA,CACzBd,KAAAA,GACGE,IAOL,OAJIa,GACFL,EAAUV,KAAKe,GAInBA,CAAA,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Inputmask from 'inputmask';
|
|
2
|
-
import { UseFormRegisterReturn } from 'react-hook-form';
|
|
3
|
-
declare const withHookFormMask: (registerReturn: UseFormRegisterReturn, mask: Inputmask.Options['mask'], options?: Inputmask.Options
|
|
2
|
+
import type { UseFormRegisterReturn } from 'react-hook-form';
|
|
3
|
+
declare const withHookFormMask: (registerReturn: UseFormRegisterReturn, mask: Inputmask.Options['mask'], options?: Inputmask.Options) => {
|
|
4
4
|
ref: ((_ref: any) => void) | undefined;
|
|
5
5
|
onChange: import("react-hook-form").ChangeHandler;
|
|
6
6
|
onBlur: import("react-hook-form").ChangeHandler;
|
package/dist/withMask.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import Inputmask from 'inputmask';
|
|
2
|
-
declare const withFinalFormMask: (mask: Inputmask.Options['mask'], options?: Inputmask.Options
|
|
2
|
+
declare const withFinalFormMask: (mask: Inputmask.Options['mask'], options?: Inputmask.Options) => (input: HTMLElement | HTMLInputElement | null) => HTMLElement | HTMLInputElement | null;
|
|
3
3
|
export default withFinalFormMask;
|
package/package.json
CHANGED
|
@@ -1,72 +1,76 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-mask-input",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "A react Hook for build elegant input masks. Compatible with React Hook Form",
|
|
5
5
|
"author": "eduardoborges",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "https://github.com/eduardoborges/use-mask-input",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
8
|
+
"source": "./src/index.tsx",
|
|
9
|
+
"exports": {
|
|
10
|
+
"require": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.modern.js"
|
|
12
|
+
},
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"module": "./dist/index.module.js",
|
|
15
|
+
"unpkg": "./dist/index.umd.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
11
17
|
"engines": {
|
|
12
|
-
"node": ">=
|
|
18
|
+
"node": ">=18"
|
|
13
19
|
},
|
|
14
20
|
"scripts": {
|
|
15
|
-
"build": "microbundle
|
|
21
|
+
"build": "microbundle",
|
|
16
22
|
"start": "vite",
|
|
17
23
|
"prepare": "npm run build",
|
|
18
|
-
"test": "concurrently
|
|
24
|
+
"test": "concurrently 'npm run test:*'",
|
|
19
25
|
"test:build": "npm run build",
|
|
20
|
-
"test:lint": "eslint
|
|
26
|
+
"test:lint": "eslint src",
|
|
21
27
|
"test:unit": "",
|
|
22
|
-
"test:watch": ""
|
|
23
|
-
"predeploy": "npm install && npm run build"
|
|
28
|
+
"test:watch": ""
|
|
24
29
|
},
|
|
25
30
|
"peerDependencies": {
|
|
26
|
-
"react": "
|
|
27
|
-
"react-dom": "
|
|
31
|
+
"react": ">=17",
|
|
32
|
+
"react-dom": ">=17"
|
|
28
33
|
},
|
|
29
34
|
"devDependencies": {
|
|
30
|
-
"@semantic-release/changelog": "6.0.
|
|
35
|
+
"@semantic-release/changelog": "6.0.2",
|
|
31
36
|
"@semantic-release/commit-analyzer": "9.0.2",
|
|
32
37
|
"@semantic-release/git": "10.0.1",
|
|
33
|
-
"@semantic-release/github": "8.0.
|
|
34
|
-
"@semantic-release/npm": "
|
|
38
|
+
"@semantic-release/github": "8.0.7",
|
|
39
|
+
"@semantic-release/npm": "9.0.2",
|
|
35
40
|
"@semantic-release/release-notes-generator": "10.0.3",
|
|
36
41
|
"@types/inputmask": "^5.0.3",
|
|
37
|
-
"@types/jest": "29.0
|
|
42
|
+
"@types/jest": "29.4.0",
|
|
38
43
|
"@types/lodash.flowright": "^3.5.7",
|
|
39
44
|
"@types/node": "18",
|
|
40
|
-
"@types/react": "
|
|
41
|
-
"@types/react-dom": "
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "
|
|
43
|
-
"@typescript-eslint/parser": "
|
|
44
|
-
"@vitejs/plugin-react": "
|
|
45
|
-
"concurrently": "
|
|
45
|
+
"@types/react": ">=17",
|
|
46
|
+
"@types/react-dom": ">=17",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "5.50.0",
|
|
48
|
+
"@typescript-eslint/parser": "5.50.0",
|
|
49
|
+
"@vitejs/plugin-react": "3.0.1",
|
|
50
|
+
"concurrently": "7.6.0",
|
|
46
51
|
"cross-env": "7.0.3",
|
|
47
|
-
"eslint": "
|
|
48
|
-
"eslint-config-airbnb": "
|
|
52
|
+
"eslint": "8.33.0",
|
|
53
|
+
"eslint-config-airbnb": "19.0.4",
|
|
49
54
|
"eslint-config-airbnb-typescript": "^17.0.0",
|
|
50
|
-
"eslint-plugin-import": "
|
|
51
|
-
"eslint-plugin-jsx-a11y": "
|
|
52
|
-
"eslint-plugin-react": "
|
|
55
|
+
"eslint-plugin-import": "2.27.5",
|
|
56
|
+
"eslint-plugin-jsx-a11y": "6.7.1",
|
|
57
|
+
"eslint-plugin-react": "7.32.1",
|
|
53
58
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
+
"microbundle": "0.15.1",
|
|
60
|
+
"semantic-release": "20.1.0",
|
|
61
|
+
"typescript": "4.9.5",
|
|
62
|
+
"vite": "4.1.1",
|
|
63
|
+
"react-final-form": "6.5.9",
|
|
64
|
+
"react-hook-form": "^7.42.1",
|
|
65
|
+
"final-form": "4.20.9"
|
|
59
66
|
},
|
|
60
67
|
"files": [
|
|
61
|
-
"dist"
|
|
68
|
+
"dist",
|
|
69
|
+
"src"
|
|
62
70
|
],
|
|
63
71
|
"dependencies": {
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"lodash.compose": "^2.4.1",
|
|
67
|
-
"lodash.flowright": "^3.5.0",
|
|
68
|
-
"react-final-form": "^6.5.9",
|
|
69
|
-
"react-hook-form": "^7.36.1"
|
|
72
|
+
"inputmask": "5.0.7",
|
|
73
|
+
"lodash.flowright": "3.5.0"
|
|
70
74
|
},
|
|
71
75
|
"bundleDependencies": [
|
|
72
76
|
"inputmask"
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
+
/* eslint-disable react/jsx-props-no-spreading */
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useForm } from 'react-hook-form';
|
|
6
|
+
import { Form, Field } from 'react-final-form';
|
|
7
|
+
import { withHookFormMask, withMask } from '../index';
|
|
8
|
+
|
|
9
|
+
function App() {
|
|
10
|
+
const { register, handleSubmit } = useForm();
|
|
11
|
+
|
|
12
|
+
const onSubmit = (data: any) => {
|
|
13
|
+
console.log(data);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<h3>Using simple ref</h3>
|
|
19
|
+
<input type="text" ref={withMask(['(99) 9999 9999', '(99) 9 9999 9999'])} />
|
|
20
|
+
<hr />
|
|
21
|
+
<h3>Using react-hook-form</h3>
|
|
22
|
+
<form onSubmit={handleSubmit(onSubmit)}>
|
|
23
|
+
<input
|
|
24
|
+
type="text"
|
|
25
|
+
{...withHookFormMask(register('phone'), ['(99) 9999 9999', '(99) 9 9999 9999'])}
|
|
26
|
+
/>
|
|
27
|
+
<button type="submit">Submit</button>
|
|
28
|
+
</form>
|
|
29
|
+
<hr />
|
|
30
|
+
|
|
31
|
+
<Form
|
|
32
|
+
onSubmit={onSubmit}
|
|
33
|
+
render={({ handleSubmit: _handleSubmit }) => (
|
|
34
|
+
<form onSubmit={_handleSubmit}>
|
|
35
|
+
<h3>working with example react-final-form </h3>
|
|
36
|
+
<Field
|
|
37
|
+
name="phone"
|
|
38
|
+
render={({ input, meta }) => (
|
|
39
|
+
<label htmlFor="phone">
|
|
40
|
+
Phone
|
|
41
|
+
<input ref={withMask('9999-9999')} {...input} placeholder="Phone" />
|
|
42
|
+
{meta.touched && meta.error && <span>{meta.error}</span>}
|
|
43
|
+
</label>
|
|
44
|
+
)}
|
|
45
|
+
/>
|
|
46
|
+
<button type="submit">Submit</button>
|
|
47
|
+
</form>
|
|
48
|
+
)}
|
|
49
|
+
/>
|
|
50
|
+
</>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default App;
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import Inputmask from 'inputmask';
|
|
3
|
+
|
|
4
|
+
interface UseInputMaskOptions {
|
|
5
|
+
mask: Inputmask.Options['mask']
|
|
6
|
+
register?(element: HTMLElement): void
|
|
7
|
+
options?: Inputmask.Options
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const useInputMask = (props: UseInputMaskOptions) => {
|
|
11
|
+
const { mask, register, options } = props;
|
|
12
|
+
|
|
13
|
+
const ref = useRef<HTMLInputElement>(null);
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!ref.current) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const maskInput = Inputmask({
|
|
21
|
+
mask,
|
|
22
|
+
...options,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
maskInput.mask(ref.current);
|
|
26
|
+
|
|
27
|
+
if (register && ref.current) {
|
|
28
|
+
register(ref.current);
|
|
29
|
+
}
|
|
30
|
+
}, [mask, register, options]);
|
|
31
|
+
|
|
32
|
+
return ref;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default useInputMask;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/space-before-blocks */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
+
import Inputmask from 'inputmask';
|
|
4
|
+
import type { UseFormRegisterReturn } from 'react-hook-form';
|
|
5
|
+
import flowright from 'lodash.flowright';
|
|
6
|
+
|
|
7
|
+
const withHookFormMask = (
|
|
8
|
+
registerReturn: UseFormRegisterReturn,
|
|
9
|
+
mask: Inputmask.Options['mask'],
|
|
10
|
+
options?: Inputmask.Options,
|
|
11
|
+
) => {
|
|
12
|
+
//
|
|
13
|
+
let newRef;
|
|
14
|
+
|
|
15
|
+
if (registerReturn){
|
|
16
|
+
const { ref } = registerReturn;
|
|
17
|
+
|
|
18
|
+
const maskInput = Inputmask({
|
|
19
|
+
mask,
|
|
20
|
+
jitMasking: true,
|
|
21
|
+
...options,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
newRef = flowright(ref, (_ref) => {
|
|
25
|
+
maskInput.mask(_ref);
|
|
26
|
+
return _ref;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
...registerReturn,
|
|
32
|
+
ref: newRef,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default withHookFormMask;
|
package/src/withMask.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Inputmask from 'inputmask';
|
|
2
|
+
|
|
3
|
+
const withFinalFormMask = (
|
|
4
|
+
mask: Inputmask.Options['mask'],
|
|
5
|
+
options?: Inputmask.Options,
|
|
6
|
+
) => (input: HTMLElement | HTMLInputElement | null) => {
|
|
7
|
+
//
|
|
8
|
+
const maskInput = Inputmask({
|
|
9
|
+
mask,
|
|
10
|
+
...options,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
if (input) {
|
|
14
|
+
maskInput.mask(input);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return input;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default withFinalFormMask;
|
package/dist/index.modern.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { useRef, useEffect } from 'react';
|
|
2
|
-
import Inputmask from 'inputmask';
|
|
3
|
-
import flowright from 'lodash.flowright';
|
|
4
|
-
|
|
5
|
-
function _extends() {
|
|
6
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
7
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
8
|
-
var source = arguments[i];
|
|
9
|
-
|
|
10
|
-
for (var key in source) {
|
|
11
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
12
|
-
target[key] = source[key];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return target;
|
|
18
|
-
};
|
|
19
|
-
return _extends.apply(this, arguments);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var useInputMask = function useInputMask(props) {
|
|
23
|
-
var mask = props.mask,
|
|
24
|
-
register = props.register,
|
|
25
|
-
options = props.options;
|
|
26
|
-
var ref = useRef(null);
|
|
27
|
-
useEffect(function () {
|
|
28
|
-
if (!ref.current) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
var maskInput = Inputmask(_extends({
|
|
33
|
-
mask: mask
|
|
34
|
-
}, options));
|
|
35
|
-
maskInput.mask(ref.current);
|
|
36
|
-
|
|
37
|
-
if (register && ref.current) {
|
|
38
|
-
register(ref.current);
|
|
39
|
-
}
|
|
40
|
-
}, [mask, register, options]);
|
|
41
|
-
return ref;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
var withHookFormMask = function withHookFormMask(registerReturn, mask, options) {
|
|
45
|
-
var newRef;
|
|
46
|
-
|
|
47
|
-
if (registerReturn) {
|
|
48
|
-
var ref = registerReturn.ref;
|
|
49
|
-
var maskInput = Inputmask(_extends({
|
|
50
|
-
mask: mask,
|
|
51
|
-
jitMasking: true
|
|
52
|
-
}, options));
|
|
53
|
-
newRef = flowright(ref, function (_ref) {
|
|
54
|
-
maskInput.mask(_ref);
|
|
55
|
-
return _ref;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return _extends({}, registerReturn, {
|
|
60
|
-
ref: newRef
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
var withFinalFormMask = function withFinalFormMask(mask, options) {
|
|
65
|
-
return function (input) {
|
|
66
|
-
var maskInput = Inputmask(_extends({
|
|
67
|
-
mask: mask
|
|
68
|
-
}, options));
|
|
69
|
-
|
|
70
|
-
if (input) {
|
|
71
|
-
maskInput.mask(input);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return input;
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export default useInputMask;
|
|
79
|
-
export { withHookFormMask, withFinalFormMask as withMask };
|
|
80
|
-
//# sourceMappingURL=index.modern.js.map
|
package/dist/index.modern.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.modern.js","sources":["../src/useMaskInput.ts","../src/withHookFormMask.ts","../src/withMask.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport Inputmask from 'inputmask';\n\ninterface UseInputMaskOptions {\n mask: Inputmask.Options['mask']\n register?(element: HTMLElement): void\n options?: Inputmask.Options\n}\n\nconst useInputMask = (props: UseInputMaskOptions) => {\n const { mask, register, options } = props;\n\n const ref = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (!ref.current) {\n return;\n }\n\n const maskInput = Inputmask({\n mask,\n ...options,\n });\n\n maskInput.mask(ref.current);\n\n if (register && ref.current) {\n register(ref.current);\n }\n }, [mask, register, options]);\n\n return ref;\n};\n\nexport default useInputMask;\n","/* eslint-disable @typescript-eslint/space-before-blocks */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport Inputmask from 'inputmask';\nimport { UseFormRegisterReturn } from 'react-hook-form';\nimport flowright from 'lodash.flowright';\n\nconst withHookFormMask = (\n registerReturn: UseFormRegisterReturn,\n mask: Inputmask.Options['mask'],\n options?: Inputmask.Options,\n) => {\n //\n let newRef;\n\n if (registerReturn){\n const { ref } = registerReturn;\n\n const maskInput = Inputmask({\n mask,\n jitMasking: true,\n ...options,\n });\n\n newRef = flowright(ref, (_ref) => {\n maskInput.mask(_ref);\n return _ref;\n });\n }\n\n return {\n ...registerReturn,\n ref: newRef,\n };\n};\n\nexport default withHookFormMask;\n","import Inputmask from 'inputmask';\n\nconst withFinalFormMask = (\n mask: Inputmask.Options['mask'],\n options?: Inputmask.Options,\n) => (input: HTMLElement | HTMLInputElement | null) => {\n //\n const maskInput = Inputmask({\n mask,\n ...options,\n });\n\n if (input) {\n maskInput.mask(input);\n }\n\n return input;\n};\n\nexport default withFinalFormMask;\n"],"names":["useInputMask","props","mask","register","options","ref","useRef","useEffect","current","maskInput","Inputmask","withHookFormMask","registerReturn","newRef","jitMasking","flowright","_ref","withFinalFormMask","input"],"mappings":";;;;;;;;;;;;;;;;;;;;;AASA,IAAMA,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD;EACnB,IAAQC,IAAR,GAAoCD,KAApC,CAAQC,IAAR;MAAcC,QAAd,GAAoCF,KAApC,CAAcE,QAAd;MAAwBC,OAAxB,GAAoCH,KAApC,CAAwBG,OAAxB;EAEA,IAAMC,GAAG,GAAGC,MAAM,CAAmB,IAAnB,CAAlB;EAEAC,SAAS,CAAC;IACR,IAAI,CAACF,GAAG,CAACG,OAAT,EAAkB;MAChB;;;IAGF,IAAMC,SAAS,GAAGC,SAAS;MACzBR,IAAI,EAAJA;OACGE,OAFsB,EAA3B;IAKAK,SAAS,CAACP,IAAV,CAAeG,GAAG,CAACG,OAAnB;;IAEA,IAAIL,QAAQ,IAAIE,GAAG,CAACG,OAApB,EAA6B;MAC3BL,QAAQ,CAACE,GAAG,CAACG,OAAL,CAAR;;GAbK,EAeN,CAACN,IAAD,EAAOC,QAAP,EAAiBC,OAAjB,CAfM,CAAT;EAiBA,OAAOC,GAAP;AACD,CAvBD;;ACHA,IAAMM,gBAAgB,GAAG,SAAnBA,gBAAmB,CACvBC,cADuB,EAEvBV,IAFuB,EAGvBE,OAHuB;EAMvB,IAAIS,MAAJ;;EAEA,IAAID,cAAJ,EAAmB;IACjB,IAAQP,GAAR,GAAgBO,cAAhB,CAAQP,GAAR;IAEA,IAAMI,SAAS,GAAGC,SAAS;MACzBR,IAAI,EAAJA,IADyB;MAEzBY,UAAU,EAAE;OACTV,OAHsB,EAA3B;IAMAS,MAAM,GAAGE,SAAS,CAACV,GAAD,EAAM,UAACW,IAAD;MACtBP,SAAS,CAACP,IAAV,CAAec,IAAf;MACA,OAAOA,IAAP;KAFgB,CAAlB;;;EAMF,oBACKJ,cADL;IAEEP,GAAG,EAAEQ;;AAER,CA3BD;;ACJA,IAAMI,iBAAiB,GAAG,SAApBA,iBAAoB,CACxBf,IADwB,EAExBE,OAFwB;EAAA,OAGrB,UAACc,KAAD;IAEH,IAAMT,SAAS,GAAGC,SAAS;MACzBR,IAAI,EAAJA;OACGE,OAFsB,EAA3B;;IAKA,IAAIc,KAAJ,EAAW;MACTT,SAAS,CAACP,IAAV,CAAegB,KAAf;;;IAGF,OAAOA,KAAP;GAdwB;AAAA,CAA1B;;;;;"}
|