linear-react-components-ui 1.1.26-beta.23 → 1.1.26-beta.24
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/lib/assets/styles/datepicker2.css +1 -1
- package/lib/assets/styles/radiofield.css +1 -1
- package/lib/assets/styles/selectfield.css +1 -1
- package/lib/assets/styles/textfield.css +1 -1
- package/lib/buttons/DefaultButton.js +1 -1
- package/lib/calendar/base/index.js +2 -2
- package/lib/dialog/base/Content.d.ts +1 -1
- package/lib/dialog/base/Content.js +8 -7
- package/lib/dialog/base/Content.js.map +1 -1
- package/lib/dialog/form/index.js +23 -23
- package/lib/dialog/form/index.js.map +1 -1
- package/lib/dialog/types.d.ts +2 -1
- package/lib/dialog/wizard/index.js +4 -4
- package/lib/form/Field.js.map +1 -1
- package/lib/form/FieldArray.js +18 -18
- package/lib/form/FieldArray.js.map +1 -1
- package/lib/form/FieldNumber.js +42 -39
- package/lib/form/FieldNumber.js.map +1 -1
- package/lib/form/FieldPeriod.js +27 -27
- package/lib/form/FieldPeriod.js.map +1 -1
- package/lib/form/helpers.d.ts +5 -1
- package/lib/form/helpers.js.map +1 -1
- package/lib/form/withFormSecurity.js +3 -3
- package/lib/form2/useForm/index.js +95 -87
- package/lib/form2/useForm/index.js.map +1 -1
- package/lib/icons/index.js +1 -1
- package/lib/inputs/base/InputTextBase.js +1 -1
- package/lib/inputs/date/index.js +1 -1
- package/lib/inputs/number/Currency.d.ts +1 -1
- package/lib/inputs/number/Currency.js +79 -18
- package/lib/inputs/number/Currency.js.map +1 -1
- package/lib/inputs/number/Decimal.d.ts +2 -2
- package/lib/inputs/number/Decimal.js +78 -8
- package/lib/inputs/number/Decimal.js.map +1 -1
- package/lib/inputs/number/format_number.js +11 -5
- package/lib/inputs/number/format_number.js.map +1 -1
- package/lib/inputs/number/index.d.ts +1 -1
- package/lib/inputs/number/index.js +75 -31
- package/lib/inputs/number/index.js.map +1 -1
- package/lib/inputs/number/types.d.ts +9 -0
- package/lib/inputs/period/PeriodList.js +3 -3
- package/lib/inputs2/checkboxfield/base.js +1 -1
- package/lib/inputs2/date/datefield/base.js +1 -1
- package/lib/inputs2/date/datefield/types.d.ts +2 -2
- package/lib/inputs2/date/dateperiodfield/base.js +1 -1
- package/lib/inputs2/date/dateperiodfield/types.d.ts +2 -2
- package/lib/inputs2/filefield/index.js.map +1 -1
- package/lib/inputs2/index.d.ts +1 -1
- package/lib/inputs2/index.js +8 -8
- package/lib/inputs2/mask/Cnpj.d.ts +6 -3
- package/lib/inputs2/mask/Cnpj.js +107 -43
- package/lib/inputs2/mask/Cnpj.js.map +1 -1
- package/lib/inputs2/mask/Cpf.d.ts +6 -3
- package/lib/inputs2/mask/Cpf.js +87 -37
- package/lib/inputs2/mask/Cpf.js.map +1 -1
- package/lib/inputs2/mask/Phone.d.ts +5 -3
- package/lib/inputs2/mask/Phone.js +19 -18
- package/lib/inputs2/mask/Phone.js.map +1 -1
- package/lib/inputs2/mask/ZipCode.d.ts +6 -2
- package/lib/inputs2/mask/ZipCode.js +18 -16
- package/lib/inputs2/mask/ZipCode.js.map +1 -1
- package/lib/inputs2/mask/index.d.ts +6 -0
- package/lib/inputs2/mask/index.js +113 -0
- package/lib/inputs2/mask/index.js.map +1 -0
- package/lib/inputs2/mask/types.d.ts +16 -0
- package/lib/inputs2/numberfield/currency.d.ts +2 -1
- package/lib/inputs2/numberfield/currency.js +93 -75
- package/lib/inputs2/numberfield/currency.js.map +1 -1
- package/lib/inputs2/numberfield/decimal.d.ts +2 -1
- package/lib/inputs2/numberfield/decimal.js +86 -68
- package/lib/inputs2/numberfield/decimal.js.map +1 -1
- package/lib/inputs2/numberfield/helpers.js +10 -10
- package/lib/inputs2/numberfield/helpers.js.map +1 -1
- package/lib/inputs2/numberfield/index.d.ts +3 -2
- package/lib/inputs2/numberfield/index.js +26 -25
- package/lib/inputs2/numberfield/index.js.map +1 -1
- package/lib/inputs2/radiofield/base.js +76 -80
- package/lib/inputs2/radiofield/base.js.map +1 -1
- package/lib/inputs2/radiofield/index.js.map +1 -1
- package/lib/inputs2/selectfield/base.d.ts +1 -2
- package/lib/inputs2/selectfield/base.js +300 -300
- package/lib/inputs2/selectfield/base.js.map +1 -1
- package/lib/inputs2/selectfield/context.d.ts +1 -1
- package/lib/inputs2/selectfield/context.js.map +1 -1
- package/lib/inputs2/selectfield/index.d.ts +2 -1
- package/lib/inputs2/selectfield/index.js +20 -18
- package/lib/inputs2/selectfield/index.js.map +1 -1
- package/lib/inputs2/selectfield/listbox.d.ts +1 -0
- package/lib/inputs2/selectfield/listbox.js +34 -33
- package/lib/inputs2/selectfield/listbox.js.map +1 -1
- package/lib/inputs2/selectfield/selections.d.ts +1 -1
- package/lib/inputs2/selectfield/selections.js +11 -11
- package/lib/inputs2/selectfield/selections.js.map +1 -1
- package/lib/inputs2/selectfield/simple.d.ts +9 -0
- package/lib/inputs2/selectfield/simple.js +24 -0
- package/lib/inputs2/selectfield/simple.js.map +1 -0
- package/lib/inputs2/selectfield/triggers.js +15 -15
- package/lib/inputs2/selectfield/triggers.js.map +1 -1
- package/lib/inputs2/selectfield/types.d.ts +1 -0
- package/lib/inputs2/selectfield/types.js.map +1 -1
- package/lib/inputs2/textareafield/base.js +1 -1
- package/lib/inputs2/textfield/base.js +1 -1
- package/lib/labels/DefaultLabel.js +1 -1
- package/lib/list/Item.js +1 -1
- package/lib/menus/sidenav/MenuLink.js +1 -1
- package/lib/menus/sidenav/NavMenuItem.js +1 -1
- package/lib/permissionValidations.js +1 -2
- package/lib/textContent/index.js +1 -1
- package/package.json +1 -1
- package/lib/inputs/number/BaseNumber.d.ts +0 -3
- package/lib/inputs/number/BaseNumber.js +0 -60
- package/lib/inputs/number/BaseNumber.js.map +0 -1
- package/lib/inputs2/mask/BaseMask.d.ts +0 -13
- package/lib/inputs2/mask/BaseMask.js +0 -79
- package/lib/inputs2/mask/BaseMask.js.map +0 -1
package/lib/inputs2/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import * as DateField from './date/datefield';
|
|
|
6
6
|
import * as RadioField from './radiofield';
|
|
7
7
|
import * as SelectField from './selectfield';
|
|
8
8
|
import * as ColorField from './colorfield';
|
|
9
|
-
import * as MaskField from './mask/
|
|
9
|
+
import * as MaskField from './mask/index';
|
|
10
10
|
import * as CpfField from './mask/Cpf';
|
|
11
11
|
import * as CnpjField from './mask/Cnpj';
|
|
12
12
|
import * as PhoneField from './mask/Phone';
|
package/lib/inputs2/index.js
CHANGED
|
@@ -5,10 +5,10 @@ import * as t from "./date/datefield/index.js";
|
|
|
5
5
|
import * as r from "./radiofield/index.js";
|
|
6
6
|
import * as p from "./selectfield/index.js";
|
|
7
7
|
import * as d from "./colorfield/index.js";
|
|
8
|
-
import * as
|
|
9
|
-
import * as
|
|
10
|
-
import * as
|
|
11
|
-
import * as
|
|
8
|
+
import * as s from "./mask/index.js";
|
|
9
|
+
import * as a from "./mask/Cpf.js";
|
|
10
|
+
import * as m from "./mask/Cnpj.js";
|
|
11
|
+
import * as l from "./mask/Phone.js";
|
|
12
12
|
import * as x from "./mask/ZipCode.js";
|
|
13
13
|
import * as f from "./checkboxfield/index.js";
|
|
14
14
|
import * as n from "./date/dateperiodfield/index.js";
|
|
@@ -16,16 +16,16 @@ import * as _ from "./filefield/index.js";
|
|
|
16
16
|
import { LeftSlot as C, RightSlot as c } from "./slot/index.js";
|
|
17
17
|
export {
|
|
18
18
|
f as CheckboxField,
|
|
19
|
-
|
|
19
|
+
m as CnpjField,
|
|
20
20
|
d as ColorField,
|
|
21
|
-
|
|
21
|
+
a as CpfField,
|
|
22
22
|
t as DateField,
|
|
23
23
|
n as DatePeriodField,
|
|
24
24
|
_ as FileField,
|
|
25
25
|
C as LeftSlot,
|
|
26
|
-
|
|
26
|
+
s as MaskField,
|
|
27
27
|
o as NumberField,
|
|
28
|
-
|
|
28
|
+
l as PhoneField,
|
|
29
29
|
r as RadioField,
|
|
30
30
|
c as RightSlot,
|
|
31
31
|
p as SelectField,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MaskFieldProps } from './types';
|
|
3
|
+
interface CNPJFieldProps extends MaskFieldProps {
|
|
4
|
+
disabledValidation?: boolean;
|
|
3
5
|
onValidate?: (errors: string[]) => void;
|
|
4
6
|
}
|
|
5
|
-
declare const Input:
|
|
7
|
+
declare const Input: React.ForwardRefExoticComponent<CNPJFieldProps & React.RefAttributes<HTMLInputElement>>;
|
|
6
8
|
export { Input };
|
|
9
|
+
export type { CNPJFieldProps };
|
package/lib/inputs2/mask/Cnpj.js
CHANGED
|
@@ -1,48 +1,112 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const C = d.target.value.replace(/\D/g, "");
|
|
30
|
-
I(C), n?.(d);
|
|
31
|
-
}, e[12] = n, e[13] = I, e[14] = c) : c = e[14];
|
|
32
|
-
const x = c;
|
|
33
|
-
let p;
|
|
34
|
-
e[15] === Symbol.for("react.memo_cache_sentinel") ? (p = {
|
|
35
|
-
mask: "00.000.000/0000-00",
|
|
36
|
-
placeholderChar: "_",
|
|
37
|
-
lazy: !1
|
|
38
|
-
}, e[15] = p) : p = e[15];
|
|
39
|
-
let i;
|
|
40
|
-
e[16] !== g ? (i = y(g, R), e[16] = g, e[17] = i) : i = e[17];
|
|
1
|
+
import { jsx as O } from "react/jsx-runtime";
|
|
2
|
+
import { c as Q } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import { forwardRef as U, useState as $, useEffect as W } from "react";
|
|
4
|
+
import P from "../../_virtual/lodash.js";
|
|
5
|
+
import "../../node_modules/imask/esm/index.js";
|
|
6
|
+
import "../../node_modules/imask/esm/controls/input.js";
|
|
7
|
+
import "../../node_modules/imask/esm/masked/factory.js";
|
|
8
|
+
import "../../node_modules/imask/esm/controls/mask-element.js";
|
|
9
|
+
import "../../node_modules/imask/esm/controls/html-input-mask-element.js";
|
|
10
|
+
import "../../node_modules/imask/esm/controls/html-mask-element.js";
|
|
11
|
+
import "../../node_modules/imask/esm/controls/html-contenteditable-mask-element.js";
|
|
12
|
+
import "../../node_modules/imask/esm/controls/input-history.js";
|
|
13
|
+
import "../../node_modules/react-imask/esm/input.js";
|
|
14
|
+
import X from "../../node_modules/react-imask/esm/hook.js";
|
|
15
|
+
import "../../node_modules/react-imask/esm/mixin.js";
|
|
16
|
+
import { mergeRefs as Y } from "../../form2/helpers.js";
|
|
17
|
+
import { Input as Z } from "../textfield/index.js";
|
|
18
|
+
import { CNPJValidation as tt } from "./helpers.js";
|
|
19
|
+
const R = "CNPJ inválido", et = U((o, N) => {
|
|
20
|
+
const t = Q.c(30), {
|
|
21
|
+
mask: A,
|
|
22
|
+
unmask: z,
|
|
23
|
+
lazy: B,
|
|
24
|
+
placeholder: T,
|
|
25
|
+
disabledValidation: j,
|
|
26
|
+
autoCompleteMask: w,
|
|
27
|
+
...l
|
|
28
|
+
} = o, s = A === void 0 ? "00.000.000/0000-00" : A, F = z === void 0 ? !0 : z, y = B === void 0 ? !1 : B, G = T === void 0 ? "__.___.___/____-__" : T, I = j === void 0 ? !1 : j, c = w === void 0 ? void 0 : w, [m, b] = $(!1);
|
|
41
29
|
let u;
|
|
42
|
-
|
|
30
|
+
t[0] === Symbol.for("react.memo_cache_sentinel") ? (u = [], t[0] = u) : u = t[0];
|
|
31
|
+
const [d, f] = $(u), L = [...d, ...l?.errors || []];
|
|
32
|
+
let _;
|
|
33
|
+
t[1] !== I || t[2] !== o || t[3] !== f || t[4] !== d ? (_ = (n) => {
|
|
34
|
+
if (I)
|
|
35
|
+
return;
|
|
36
|
+
const a = d.includes(R), e = tt(n);
|
|
37
|
+
!e && !a && (o?.onValidate?.([R]), f([R])), e && a && (o?.onValidate?.([]), f([]));
|
|
38
|
+
}, t[1] = I, t[2] = o, t[3] = f, t[4] = d, t[5] = _) : _ = t[5];
|
|
39
|
+
const p = _, x = s;
|
|
40
|
+
let h;
|
|
41
|
+
t[6] === Symbol.for("react.memo_cache_sentinel") ? (h = [], t[6] = h) : h = t[6];
|
|
42
|
+
let v;
|
|
43
|
+
t[7] !== y || t[8] !== x ? (v = {
|
|
44
|
+
mask: x,
|
|
45
|
+
lazy: y,
|
|
46
|
+
scale: 0,
|
|
47
|
+
radix: "",
|
|
48
|
+
placeholderChar: "_",
|
|
49
|
+
mapToRadix: h
|
|
50
|
+
}, t[7] = y, t[8] = x, t[9] = v) : v = t[9];
|
|
51
|
+
let V;
|
|
52
|
+
t[10] !== l ? (V = (n, a, e) => {
|
|
53
|
+
l?.onComplete?.(n, e);
|
|
54
|
+
}, t[10] = l, t[11] = V) : V = t[11];
|
|
55
|
+
const {
|
|
56
|
+
ref: q,
|
|
57
|
+
value: r,
|
|
58
|
+
unmaskedValue: C,
|
|
59
|
+
setValue: H
|
|
60
|
+
} = X(v, {
|
|
61
|
+
onComplete: V,
|
|
62
|
+
onAccept: (n, a, e) => {
|
|
63
|
+
const D = F ? a.unmaskedValue : a.value;
|
|
64
|
+
l?.onAccept?.(D, e), i(n), o?.onChange?.({
|
|
65
|
+
...e,
|
|
66
|
+
target: {
|
|
67
|
+
...e?.target,
|
|
68
|
+
name: o?.name,
|
|
69
|
+
value: D
|
|
70
|
+
}
|
|
71
|
+
}), m && p(a.unmaskedValue);
|
|
72
|
+
}
|
|
73
|
+
}), i = H;
|
|
74
|
+
let g;
|
|
75
|
+
t[12] !== c || t[13] !== p || t[14] !== s || t[15] !== l || t[16] !== b || t[17] !== i || t[18] !== m || t[19] !== C || t[20] !== r ? (g = (n) => {
|
|
76
|
+
if (b(!0), !m && !P.isEmpty(r) && p(r), C.trim().length && c) {
|
|
77
|
+
const a = C, e = s?.toString().replace(/\D+/g, "").length;
|
|
78
|
+
if (e && e > a.length)
|
|
79
|
+
t: switch (c) {
|
|
80
|
+
case "left": {
|
|
81
|
+
i(a.padStart(e, "0"));
|
|
82
|
+
break t;
|
|
83
|
+
}
|
|
84
|
+
case "right": {
|
|
85
|
+
i(a.padEnd(e, "0"));
|
|
86
|
+
break t;
|
|
87
|
+
}
|
|
88
|
+
default:
|
|
89
|
+
i(a);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
l?.onBlur?.(n);
|
|
93
|
+
}, t[12] = c, t[13] = p, t[14] = s, t[15] = l, t[16] = b, t[17] = i, t[18] = m, t[19] = C, t[20] = r, t[21] = g) : g = t[21];
|
|
94
|
+
const K = g;
|
|
95
|
+
let k;
|
|
96
|
+
t[22] !== o.value || t[23] !== i ? (k = () => {
|
|
97
|
+
P.isNil(o?.value) || i(P.toString(o?.value));
|
|
98
|
+
}, t[22] = o.value, t[23] = i, t[24] = k) : k = t[24];
|
|
99
|
+
const J = o?.value;
|
|
100
|
+
let E;
|
|
101
|
+
t[25] !== J ? (E = [J], t[25] = J, t[26] = E) : E = t[26], W(k, E);
|
|
102
|
+
const M = q;
|
|
103
|
+
let S;
|
|
104
|
+
return t[27] !== N || t[28] !== M ? (S = Y(N, M), t[27] = N, t[28] = M, t[29] = S) : S = t[29], /* @__PURE__ */ O(Z, { ...l, type: "text", value: r, errors: L, placeholder: G, onBlur: K, onChange: ot, ref: S });
|
|
43
105
|
});
|
|
44
|
-
|
|
106
|
+
et.displayName = "CNPJInputField";
|
|
107
|
+
function ot() {
|
|
108
|
+
}
|
|
45
109
|
export {
|
|
46
|
-
|
|
110
|
+
et as Input
|
|
47
111
|
};
|
|
48
112
|
//# sourceMappingURL=Cnpj.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cnpj.js","sources":["../../../src/lib/inputs2/mask/Cnpj.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"Cnpj.js","sources":["../../../src/lib/inputs2/mask/Cnpj.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useState } from 'react';\nimport _ from 'lodash';\nimport { useIMask } from 'react-imask';\nimport { mergeRefs } from '../../form2/helpers';\nimport * as TextField from '../textfield';\nimport type { MaskFieldProps } from './types';\nimport { CNPJValidation } from './helpers';\n\ninterface CNPJFieldProps extends MaskFieldProps {\n disabledValidation?: boolean;\n onValidate?: (errors: string[]) => void;\n}\n\nconst CNPJ_INVALID_MESSAGE = 'CNPJ inválido';\nconst Input = forwardRef<HTMLInputElement, CNPJFieldProps>((props, ref) => {\n const { \n mask = '00.000.000/0000-00', unmask = true, lazy = false, placeholder = '__.___.___/____-__', \n disabledValidation = false, autoCompleteMask = undefined, ...rest\n } = props;\n const [touched, setTouched] = useState(false);\n const [validationError, setValidationError] = useState<string[]>([]);\n const fieldErrors = [...validationError, ...(rest?.errors || [])];\n\n const handleValidateCNPJ = (raw: string) => {\n if (disabledValidation) { return; }\n const hasCnpjError = validationError.includes(CNPJ_INVALID_MESSAGE);\n const isValid = CNPJValidation(raw);\n if (!isValid && !hasCnpjError) {\n props?.onValidate?.([CNPJ_INVALID_MESSAGE]);\n setValidationError([CNPJ_INVALID_MESSAGE]);\n }\n if (isValid && hasCnpjError) {\n props?.onValidate?.([]);\n setValidationError([]);\n }\n };\n\n const { ref: inputRef, value, unmaskedValue, setValue } = useIMask({\n mask: mask as string,\n lazy,\n scale: 0,\n radix: '',\n placeholderChar: '_',\n mapToRadix: [],\n }, {\n onComplete: (imaskValue, ___, event) => {\n rest?.onComplete?.(imaskValue, event);\n },\n onAccept: (acceptValue, imask, event) => {\n const valueToSet = unmask ? imask.unmaskedValue : imask.value;\n rest?.onAccept?.(valueToSet, event);\n setValue(acceptValue);\n props?.onChange?.({\n ...event,\n target: {\n ...event?.target,\n name: props?.name,\n value: valueToSet,\n },\n } as React.ChangeEvent<HTMLInputElement>);\n if (touched) { handleValidateCNPJ(imask.unmaskedValue); }\n },\n });\n\n const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n setTouched(true);\n if (!touched && !_.isEmpty(value)) { handleValidateCNPJ(value); }\n if (unmaskedValue.trim().length && autoCompleteMask) {\n const currentValue = unmaskedValue;\n const sizeMask = mask?.toString().replace(/\\D+/g, '').length;\n if (sizeMask && sizeMask > currentValue.length) {\n switch (autoCompleteMask) {\n case 'left':\n setValue(currentValue.padStart(sizeMask, '0'));\n break;\n case 'right':\n setValue(currentValue.padEnd(sizeMask, '0'));\n break;\n default:\n setValue(currentValue);\n break;\n }\n }\n }\n rest?.onBlur?.(event);\n };\n\n useEffect(() => {\n if (!_.isNil(props?.value)) { \n setValue(_.toString(props?.value)); \n }\n }, [props?.value]);\n\n return (\n <TextField.Input\n {...rest}\n type=\"text\"\n value={value}\n errors={fieldErrors}\n placeholder={placeholder}\n onBlur={handleBlur}\n onChange={() => { }}\n ref={mergeRefs(ref, inputRef as React.Ref<HTMLInputElement>)} />\n );\n});\n\nInput.displayName = 'CNPJInputField';\nexport { Input };\nexport type { CNPJFieldProps };\n"],"names":["CNPJ_INVALID_MESSAGE","Input","forwardRef","props","ref","$","_c","mask","t0","unmask","t1","lazy","t2","placeholder","t3","disabledValidation","t4","autoCompleteMask","t5","rest","undefined","touched","setTouched","useState","t6","Symbol","for","validationError","setValidationError","fieldErrors","errors","t7","raw","hasCnpjError","includes","isValid","CNPJValidation","onValidate","handleValidateCNPJ","t8","t9","t10","scale","radix","placeholderChar","mapToRadix","t11","imaskValue","___","event","onComplete","inputRef","value","unmaskedValue","setValue","t12","useIMask","onAccept","acceptValue","imask","event_0","valueToSet","onChange","target","name","t13","event_1","_","isEmpty","trim","length","currentValue","sizeMask","toString","replace","bb127","padStart","padEnd","onBlur","handleBlur","t14","isNil","t15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,GAAA/C,QAAA4D,KAAAA,IAAA5D,EAAA,EAAA;AArBD,QAAA0E,IAAmBd;AAqBjB,MAAAe;AAAA,EAAA3E,UAAAF,EAAAiD,SAAA/C,UAAAiD,KAEQ0B,IAAAA,MAAA;AACR,IAAKb,EAACc,MAAO9E,GAAKiD,KAAO,KACvBE,EAASa,EAACM,SAAUtE,GAAKiD,KAAO,CAAC;AAAA,EAClC,GACF/C,EAAA,EAAA,IAAAF,EAAAiD,OAAA/C,QAAAiD,GAAAjD,QAAA2E,KAAAA,IAAA3E,EAAA,EAAA;AAAG,QAAA6E,IAAA/E,GAAKiD;AAAO,MAAA+B;AAAA,EAAA9E,UAAA6E,KAAbC,IAAA,CAACD,CAAY,GAAC7E,QAAA6E,GAAA7E,QAAA8E,KAAAA,IAAA9E,EAAA,EAAA,GAJjB+E,EAAUJ,GAIPG,CAAc;AAWO,QAAAE,IAAAlC;AAAuC,MAAAmC;AAAA,SAAAjF,EAAA,EAAA,MAAAD,KAAAC,UAAAgF,KAAtDC,IAAAC,EAAUnF,GAAKiF,CAAuC,GAAChF,QAAAD,GAAAC,QAAAgF,GAAAhF,QAAAiF,KAAAA,IAAAjF,EAAA,EAAA,6BAPxDc,GACC,MAAA,QACEiC,OAAAA,GACCvB,QAAAA,GACKhB,aAAAA,GACLkE,QAAAA,GACE,UAAAS,IACL,KAAAF,GAAuD;AAAI,CAErE;AAEDrF,GAAMwF,cAAc;AA5FuC,SAAAD,KAAA;AAAA;"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MaskFieldProps } from './types';
|
|
3
|
+
interface CPFFieldProps extends MaskFieldProps {
|
|
4
|
+
disabledValidation?: boolean;
|
|
3
5
|
onValidate?: (errors: string[]) => void;
|
|
4
6
|
}
|
|
5
|
-
declare const Input:
|
|
7
|
+
declare const Input: React.ForwardRefExoticComponent<CPFFieldProps & React.RefAttributes<HTMLInputElement>>;
|
|
6
8
|
export { Input };
|
|
9
|
+
export type { CPFFieldProps };
|
package/lib/inputs2/mask/Cpf.js
CHANGED
|
@@ -1,44 +1,94 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsx as H } from "react/jsx-runtime";
|
|
2
|
+
import { c as J } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import { forwardRef as K, useState as M, useEffect as O } from "react";
|
|
4
|
+
import P from "../../_virtual/lodash.js";
|
|
5
|
+
import "../../node_modules/imask/esm/index.js";
|
|
6
|
+
import "../../node_modules/imask/esm/controls/input.js";
|
|
7
|
+
import "../../node_modules/imask/esm/masked/factory.js";
|
|
8
|
+
import "../../node_modules/imask/esm/controls/mask-element.js";
|
|
9
|
+
import "../../node_modules/imask/esm/controls/html-input-mask-element.js";
|
|
10
|
+
import "../../node_modules/imask/esm/controls/html-mask-element.js";
|
|
11
|
+
import "../../node_modules/imask/esm/controls/html-contenteditable-mask-element.js";
|
|
12
|
+
import "../../node_modules/imask/esm/controls/input-history.js";
|
|
13
|
+
import "../../node_modules/react-imask/esm/input.js";
|
|
14
|
+
import Q from "../../node_modules/react-imask/esm/hook.js";
|
|
15
|
+
import "../../node_modules/react-imask/esm/mixin.js";
|
|
16
|
+
import { mergeRefs as U } from "../../form2/helpers.js";
|
|
17
|
+
import { Input as W } from "../textfield/index.js";
|
|
18
|
+
import { CPFValidation as X } from "./helpers.js";
|
|
19
|
+
const R = "CPF inválido", Y = K((e, y) => {
|
|
20
|
+
const t = J.c(26), {
|
|
21
|
+
mask: b,
|
|
22
|
+
unmask: A,
|
|
23
|
+
lazy: B,
|
|
24
|
+
placeholder: N,
|
|
25
|
+
disabledValidation: T,
|
|
26
|
+
...o
|
|
27
|
+
} = e, $ = b === void 0 ? "000.000.000-00" : b, j = A === void 0 ? !0 : A, I = B === void 0 ? !1 : B, w = N === void 0 ? "___.___.___-__" : N, S = T === void 0 ? !1 : T, [r, g] = M(!1);
|
|
16
28
|
let s;
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
let i;
|
|
20
|
-
e[8] !== n || e[9] !== t ? (i = (p) => {
|
|
21
|
-
const d = n.includes(x), g = v(p);
|
|
22
|
-
!g && d && t?.([x]), g && !d && t?.([]);
|
|
23
|
-
}, e[8] = n, e[9] = t, e[10] = i) : i = e[10];
|
|
24
|
-
const h = i;
|
|
25
|
-
let c;
|
|
26
|
-
e[11] !== r || e[12] !== h ? (c = (p) => {
|
|
27
|
-
const d = p.target.value.replace(/\D/g, "");
|
|
28
|
-
h(d), r?.(p);
|
|
29
|
-
}, e[11] = r, e[12] = h, e[13] = c) : c = e[13];
|
|
30
|
-
const I = c;
|
|
29
|
+
t[0] === Symbol.for("react.memo_cache_sentinel") ? (s = [], t[0] = s) : s = t[0];
|
|
30
|
+
const [m, c] = M(s), D = [...m, ...o?.errors || []];
|
|
31
31
|
let f;
|
|
32
|
-
e[
|
|
33
|
-
|
|
32
|
+
t[1] !== S || t[2] !== e || t[3] !== c || t[4] !== m ? (f = (i) => {
|
|
33
|
+
if (S)
|
|
34
|
+
return;
|
|
35
|
+
const a = m.includes(R), l = X(i);
|
|
36
|
+
!l && !a && (e?.onValidate?.([R]), c([R])), l && a && (e?.onValidate?.([]), c([]));
|
|
37
|
+
}, t[1] = S, t[2] = e, t[3] = c, t[4] = m, t[5] = f) : f = t[5];
|
|
38
|
+
const u = f, k = $;
|
|
39
|
+
let d;
|
|
40
|
+
t[6] === Symbol.for("react.memo_cache_sentinel") ? (d = [], t[6] = d) : d = t[6];
|
|
41
|
+
let _;
|
|
42
|
+
t[7] !== I || t[8] !== k ? (_ = {
|
|
43
|
+
mask: k,
|
|
44
|
+
lazy: I,
|
|
45
|
+
scale: 0,
|
|
46
|
+
radix: "",
|
|
34
47
|
placeholderChar: "_",
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
let
|
|
38
|
-
|
|
48
|
+
mapToRadix: d
|
|
49
|
+
}, t[7] = I, t[8] = k, t[9] = _) : _ = t[9];
|
|
50
|
+
let p;
|
|
51
|
+
t[10] !== o ? (p = (i, a, l) => {
|
|
52
|
+
o?.onComplete?.(i, l);
|
|
53
|
+
}, t[10] = o, t[11] = p) : p = t[11];
|
|
54
|
+
const {
|
|
55
|
+
ref: G,
|
|
56
|
+
value: n,
|
|
57
|
+
setValue: L
|
|
58
|
+
} = Q(_, {
|
|
59
|
+
onComplete: p,
|
|
60
|
+
onAccept: (i, a, l) => {
|
|
61
|
+
const z = j ? a.unmaskedValue : a.value;
|
|
62
|
+
o?.onAccept?.(z, l), v(i), e?.onChange?.({
|
|
63
|
+
...l,
|
|
64
|
+
target: {
|
|
65
|
+
...l?.target,
|
|
66
|
+
name: e?.name,
|
|
67
|
+
value: z
|
|
68
|
+
}
|
|
69
|
+
}), r && u(a.unmaskedValue);
|
|
70
|
+
}
|
|
71
|
+
}), v = L;
|
|
72
|
+
let h;
|
|
73
|
+
t[12] !== u || t[13] !== o || t[14] !== g || t[15] !== r || t[16] !== n ? (h = (i) => {
|
|
74
|
+
g(!0), !r && !P.isEmpty(n) && u(n), o?.onBlur?.(i);
|
|
75
|
+
}, t[12] = u, t[13] = o, t[14] = g, t[15] = r, t[16] = n, t[17] = h) : h = t[17];
|
|
76
|
+
const q = h;
|
|
77
|
+
let V;
|
|
78
|
+
t[18] !== e.value || t[19] !== v ? (V = () => {
|
|
79
|
+
P.isNil(e?.value) || v(P.toString(e?.value));
|
|
80
|
+
}, t[18] = e.value, t[19] = v, t[20] = V) : V = t[20];
|
|
81
|
+
const x = e?.value;
|
|
82
|
+
let C;
|
|
83
|
+
t[21] !== x ? (C = [x], t[21] = x, t[22] = C) : C = t[22], O(V, C);
|
|
84
|
+
const F = G;
|
|
85
|
+
let E;
|
|
86
|
+
return t[23] !== y || t[24] !== F ? (E = U(y, F), t[23] = y, t[24] = F, t[25] = E) : E = t[25], /* @__PURE__ */ H(W, { ...o, type: "text", value: n, errors: D, placeholder: w, onBlur: q, onChange: Z, ref: E });
|
|
39
87
|
});
|
|
40
|
-
|
|
88
|
+
Y.displayName = "CPFInputField";
|
|
89
|
+
function Z() {
|
|
90
|
+
}
|
|
41
91
|
export {
|
|
42
|
-
|
|
92
|
+
Y as Input
|
|
43
93
|
};
|
|
44
94
|
//# sourceMappingURL=Cpf.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cpf.js","sources":["../../../src/lib/inputs2/mask/Cpf.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"Cpf.js","sources":["../../../src/lib/inputs2/mask/Cpf.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useState } from 'react';\nimport _ from 'lodash';\nimport { useIMask } from 'react-imask';\nimport { mergeRefs } from '../../form2/helpers';\nimport * as TextField from '../textfield';\nimport type { MaskFieldProps } from './types';\nimport { CPFValidation } from './helpers';\n\ninterface CPFFieldProps extends MaskFieldProps {\n disabledValidation?: boolean;\n onValidate?: (errors: string[]) => void;\n}\n\nconst CPF_INVALID_MESSAGE = 'CPF inválido';\nconst Input = forwardRef<HTMLInputElement, CPFFieldProps>((props, ref) => {\n const { \n mask = '000.000.000-00', unmask = true, lazy = false, \n placeholder = '___.___.___-__', disabledValidation = false, ...rest\n } = props;\n const [touched, setTouched] = useState(false);\n const [validationError, setValidationError] = useState<string[]>([]);\n const fieldErrors = [...validationError, ...(rest?.errors || [])];\n\n const handleValidateCPF = (raw: string) => {\n if (disabledValidation) { return; }\n const hasCpfError = validationError.includes(CPF_INVALID_MESSAGE);\n const isValid = CPFValidation(raw);\n if (!isValid && !hasCpfError) {\n props?.onValidate?.([CPF_INVALID_MESSAGE]);\n setValidationError([CPF_INVALID_MESSAGE]);\n }\n if (isValid && hasCpfError) {\n props?.onValidate?.([]);\n setValidationError([]);\n }\n };\n\n const { ref: inputRef, value, setValue } = useIMask({\n mask: mask as string,\n lazy,\n scale: 0,\n radix: '',\n placeholderChar: '_',\n mapToRadix: [],\n }, {\n onComplete: (imaskValue, ___, event) => {\n rest?.onComplete?.(imaskValue, event);\n },\n onAccept: (acceptValue, imask, event) => {\n const valueToSet = unmask ? imask.unmaskedValue : imask.value;\n rest?.onAccept?.(valueToSet, event);\n setValue(acceptValue);\n props?.onChange?.({\n ...event,\n target: {\n ...event?.target,\n name: props?.name,\n value: valueToSet,\n },\n } as React.ChangeEvent<HTMLInputElement>);\n if (touched) { handleValidateCPF(imask.unmaskedValue); }\n },\n });\n\n const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n setTouched(true);\n if (!touched && !_.isEmpty(value)) { handleValidateCPF(value); }\n rest?.onBlur?.(event);\n };\n\n useEffect(() => {\n if (!_.isNil(props?.value)) { \n setValue(_.toString(props?.value)); \n }\n }, [props?.value]);\n\n return (\n <TextField.Input\n {...rest}\n type=\"text\"\n value={value}\n errors={fieldErrors}\n placeholder={placeholder}\n onBlur={handleBlur}\n onChange={() => { }}\n ref={mergeRefs(ref, inputRef as React.Ref<HTMLInputElement>)} />\n );\n});\n\nInput.displayName = 'CPFInputField';\nexport { Input };\nexport type { CPFFieldProps };\n"],"names":["CPF_INVALID_MESSAGE","Input","forwardRef","props","ref","$","_c","mask","t0","unmask","t1","lazy","t2","placeholder","t3","disabledValidation","t4","rest","undefined","touched","setTouched","useState","t5","Symbol","for","validationError","setValidationError","fieldErrors","errors","t6","raw","hasCpfError","includes","isValid","CPFValidation","onValidate","handleValidateCPF","t7","t8","t9","scale","radix","placeholderChar","mapToRadix","t10","imaskValue","___","event","onComplete","inputRef","value","setValue","t11","useIMask","onAccept","acceptValue","imask","event_0","valueToSet","unmaskedValue","onChange","target","name","t12","event_1","_","isEmpty","onBlur","handleBlur","t13","isNil","toString","t14","t15","useEffect","t16","t17","mergeRefs","_tem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,QAAAA,GACKd,aAAAA,GACLuD,QAAAA,GACE,UAAAU,GACL,KAAAF,GAAuD;AAAI,CAErE;AAED3E,EAAM8E,cAAc;AA3EsC,SAAAD,IAAA;AAAA;"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MaskFieldProps } from './types';
|
|
3
|
+
interface PhoneFieldProps extends MaskFieldProps {
|
|
3
4
|
isCellphone?: boolean;
|
|
4
5
|
}
|
|
5
|
-
declare const Input:
|
|
6
|
+
declare const Input: React.ForwardRefExoticComponent<PhoneFieldProps & React.RefAttributes<HTMLInputElement>>;
|
|
6
7
|
export { Input };
|
|
8
|
+
export type { PhoneFieldProps };
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { Input as
|
|
5
|
-
const
|
|
6
|
-
const t =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}, t[0] =
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { c as f } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import { forwardRef as k } from "react";
|
|
4
|
+
import { Input as v } from "./index.js";
|
|
5
|
+
const x = k((r, a) => {
|
|
6
|
+
const t = f.c(12);
|
|
7
|
+
let e, o, l, s, n;
|
|
8
|
+
t[0] !== r ? ({
|
|
9
|
+
mask: o,
|
|
10
|
+
unmask: l,
|
|
11
|
+
placeholder: s,
|
|
12
|
+
isCellphone: n,
|
|
13
|
+
...e
|
|
14
|
+
} = r, t[0] = r, t[1] = e, t[2] = o, t[3] = l, t[4] = s, t[5] = n) : (e = t[1], o = t[2], l = t[3], s = t[4], n = t[5]);
|
|
15
|
+
const d = o === void 0 ? "(00) 0000-0000" : o, i = l === void 0 ? !0 : l, h = s === void 0 ? "(__) ____-____" : s, c = n === void 0 ? !1 : n, m = c ? "(00) 00000-0000" : d, p = c ? "(__) _____-____" : h;
|
|
16
|
+
let _;
|
|
17
|
+
return t[6] !== m || t[7] !== p || t[8] !== a || t[9] !== e || t[10] !== i ? (_ = /* @__PURE__ */ u(v, { ...e, ref: a, type: "text", mask: m, unmask: i, placeholder: p }), t[6] = m, t[7] = p, t[8] = a, t[9] = e, t[10] = i, t[11] = _) : _ = t[11], _;
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
+
x.displayName = "PhoneInputField";
|
|
19
20
|
export {
|
|
20
|
-
|
|
21
|
+
x as Input
|
|
21
22
|
};
|
|
22
23
|
//# sourceMappingURL=Phone.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Phone.js","sources":["../../../src/lib/inputs2/mask/Phone.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport
|
|
1
|
+
{"version":3,"file":"Phone.js","sources":["../../../src/lib/inputs2/mask/Phone.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport * as MaskField from './index';\nimport type { MaskFieldProps } from './types';\n\ninterface PhoneFieldProps extends MaskFieldProps {\n isCellphone?: boolean;\n}\n\nconst Input = forwardRef<HTMLInputElement, PhoneFieldProps>((props, ref) => {\n const { \n mask = '(00) 0000-0000', unmask = true, placeholder = '(__) ____-____', \n isCellphone = false, ...rest\n } = props;\n const phoneMask = isCellphone ? '(00) 00000-0000' : mask;\n const phonePlaceholder = isCellphone ? '(__) _____-____' : placeholder;\n\n return (\n <MaskField.Input\n {...rest}\n ref={ref}\n type=\"text\"\n mask={phoneMask}\n unmask={unmask}\n placeholder={phonePlaceholder} />\n );\n});\n\nInput.displayName = 'PhoneInputField';\nexport { Input };\nexport type { PhoneFieldProps };\n"],"names":["Input","forwardRef","props","ref","$","_c","rest","t0","t1","t2","t3","mask","unmask","placeholder","isCellphone","undefined","phoneMask","phonePlaceholder","t4","js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{
|
|
2
|
-
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MaskFieldProps } from './types';
|
|
3
|
+
interface ZipCodeFieldProps extends MaskFieldProps {
|
|
4
|
+
}
|
|
5
|
+
declare const Input: React.ForwardRefExoticComponent<ZipCodeFieldProps & React.RefAttributes<HTMLInputElement>>;
|
|
3
6
|
export { Input };
|
|
7
|
+
export type { ZipCodeFieldProps };
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { Input as
|
|
5
|
-
const
|
|
6
|
-
const t =
|
|
7
|
-
let e;
|
|
8
|
-
t[0]
|
|
9
|
-
mask:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { c as d } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import { forwardRef as u } from "react";
|
|
4
|
+
import { Input as _ } from "./index.js";
|
|
5
|
+
const f = u((i, l) => {
|
|
6
|
+
const t = d.c(11);
|
|
7
|
+
let e, o, m, r;
|
|
8
|
+
t[0] !== i ? ({
|
|
9
|
+
mask: o,
|
|
10
|
+
unmask: m,
|
|
11
|
+
placeholder: r,
|
|
12
|
+
...e
|
|
13
|
+
} = i, t[0] = i, t[1] = e, t[2] = o, t[3] = m, t[4] = r) : (e = t[1], o = t[2], m = t[3], r = t[4]);
|
|
14
|
+
const n = o === void 0 ? "00000-000" : o, p = m === void 0 ? !0 : m, a = r === void 0 ? "_____-___" : r;
|
|
15
|
+
let s;
|
|
16
|
+
return t[5] !== n || t[6] !== a || t[7] !== l || t[8] !== e || t[9] !== p ? (s = /* @__PURE__ */ c(_, { ...e, ref: l, type: "text", mask: n, unmask: p, placeholder: a }), t[5] = n, t[6] = a, t[7] = l, t[8] = e, t[9] = p, t[10] = s) : s = t[10], s;
|
|
15
17
|
});
|
|
16
|
-
|
|
18
|
+
f.displayName = "ZipCodeInputField";
|
|
17
19
|
export {
|
|
18
|
-
|
|
20
|
+
f as Input
|
|
19
21
|
};
|
|
20
22
|
//# sourceMappingURL=ZipCode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZipCode.js","sources":["../../../src/lib/inputs2/mask/ZipCode.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport
|
|
1
|
+
{"version":3,"file":"ZipCode.js","sources":["../../../src/lib/inputs2/mask/ZipCode.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport * as MaskField from './index';\nimport type { MaskFieldProps } from './types';\n\ninterface ZipCodeFieldProps extends MaskFieldProps { }\n\nconst Input = forwardRef<HTMLInputElement, ZipCodeFieldProps>((props, ref) => {\n const { \n mask = '00000-000', unmask = true, placeholder = '_____-___', ...rest\n } = props;\n\n return (\n <MaskField.Input\n {...rest}\n ref={ref}\n type=\"text\"\n mask={mask}\n unmask={unmask}\n placeholder={placeholder} />\n );\n});\n\nInput.displayName = 'ZipCodeInputField';\nexport { Input };\nexport type { ZipCodeFieldProps };\n"],"names":["Input","forwardRef","props","ref","$","_c","rest","t0","t1","t2","mask","unmask","placeholder","undefined","t3","jsx","MaskField.Input","displayName"],"mappings":";;;;AAMA,MAAMA,IAAQC,EAAgD,CAAAC,GAAAC,MAAA;AAAA,QAAAC,IAAAC,EAAAA,EAAA,EAAA;AAAA,MAAAC,GAAAC,GAAAC,GAAAC;AAAA,EAAAL,SAAAF,KAC5D;AAAA,IAAAQ,MAAAH;AAAAA,IAAAI,QAAAH;AAAAA,IAAAI,aAAAH;AAAAA,IAAA,GAAAH;AAAAA,EAAAA,IAEIJ,GAAME,OAAAF,GAAAE,OAAAE,GAAAF,OAAAG,GAAAH,OAAAI,GAAAJ,OAAAK,MAAAH,IAAAF,EAAA,CAAA,GAAAG,IAAAH,EAAA,CAAA,GAAAI,IAAAJ,EAAA,CAAA,GAAAK,IAAAL,EAAA,CAAA;AADR,QAAAM,IAAAH,MAAAM,SAAA,cAAAN,GAAoBI,IAAAH,MAAAK,SAAA,KAAAL,GAAeI,IAAAH,MAAAI,SAAA,cAAAJ;AAAyB,MAAAK;AAAA,SAAAV,EAAA,CAAA,MAAAM,KAAAN,EAAA,CAAA,MAAAQ,KAAAR,EAAA,CAAA,MAAAD,KAAAC,EAAA,CAAA,MAAAE,KAAAF,SAAAO,KAI5DG,IAAA,gBAAAC,EAAAC,GAAA,EAAA,GACMV,GACCH,KAAAA,GACA,MAAA,QACCO,MAAAA,GACEC,QAAAA,GACKC,aAAAA,EAAAA,CAAW,GAAIR,OAAAM,GAAAN,OAAAQ,GAAAR,OAAAD,GAAAC,OAAAE,GAAAF,OAAAO,GAAAP,QAAAU,KAAAA,IAAAV,EAAA,EAAA,GAN9BU;AAM8B,CAEjC;AAEDd,EAAMiB,cAAc;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MaskFieldProps } from './types';
|
|
3
|
+
import * as TextField from '../textfield';
|
|
4
|
+
declare const Input: React.ForwardRefExoticComponent<TextField.TextFieldInputProps & import('./types').IMaskOptions & React.RefAttributes<HTMLInputElement>>;
|
|
5
|
+
export { Input };
|
|
6
|
+
export type { MaskFieldProps };
|