@arthurzakharov/ui-kit 1.2.0 → 1.2.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/assets/not-found-Cmq6iPJq.css +1 -0
- package/dist/assets/tag-create-DlOCx7nc.css +1 -0
- package/dist/components/accordion-table/accordion-table.component.js +1 -1
- package/dist/components/animation/fade-scale/fade-scale.component.js +1 -1
- package/dist/components/animation/fade-slide/fade-slide.component.js +1 -1
- package/dist/components/bottom-bar/bottom-bar.component.js +1 -1
- package/dist/components/control/components/button-card/button-card.component.js +1 -1
- package/dist/components/control/components/button-radio/button-radio.component.js +1 -1
- package/dist/components/control/components/card-image/card-image.component.js +1 -1
- package/dist/components/control/components/card-text/card-text.component.js +1 -1
- package/dist/components/control/components/checkbox/checkbox.component.js +1 -1
- package/dist/components/control/components/dropdown/dropdown.component.js +1 -1
- package/dist/components/control/components/input/input.component.js +1 -1
- package/dist/components/control/components/radio/radio.component.js +1 -1
- package/dist/components/control/components/text/text.component.js +1 -1
- package/dist/components/control/components/textarea/textarea.component.js +1 -1
- package/dist/components/control/control.component.js +2 -2
- package/dist/components/dialog/dialog.component.js +2 -2
- package/dist/components/dialog-article/dialog-article.component.js +1 -1
- package/dist/components/not-found/not-found.component.cy.d.ts +1 -0
- package/dist/components/not-found/not-found.component.cy.js +30 -0
- package/dist/components/not-found/not-found.component.js +26 -20
- package/dist/components/payment/components/glass/glass.component.js +2 -2
- package/dist/components/sidebar/components/step/step.component.js +1 -1
- package/dist/components/signature/signature.component.js +835 -896
- package/dist/components/tag/block.component.d.ts +25 -0
- package/dist/components/tag/block.component.js +5 -0
- package/dist/components/tag/flex.component.d.ts +99 -0
- package/dist/components/tag/flex.component.js +10 -0
- package/dist/components/tag/inline-block.component.d.ts +25 -0
- package/dist/components/tag/inline-block.component.js +5 -0
- package/dist/components/tag/inline-flex.component.d.ts +99 -0
- package/dist/components/tag/inline-flex.component.js +10 -0
- package/dist/components/tag/inline.component.d.ts +25 -0
- package/dist/components/tag/inline.component.js +5 -0
- package/dist/components/tag/table.component.d.ts +147 -0
- package/dist/components/tag/table.component.js +12 -0
- package/dist/components/tag/tag-create.d.ts +25 -0
- package/dist/components/tag/tag-create.js +67 -0
- package/dist/components/tag/tag.types.d.ts +60 -0
- package/dist/components/tag/use-mq.hook.d.ts +6 -0
- package/dist/components/tag/use-mq.hook.js +9 -0
- package/dist/{control.component-CyNcrfGj.js → control.component-Cq46ev8T.js} +1 -1
- package/dist/index-PfP8s0Qf.js +148 -0
- package/dist/input.component-C5xcmnfu.js +999 -0
- package/dist/main.js +1 -1
- package/dist/{proxy-Di2RXnf-.js → proxy-Cx6n7mT2.js} +1980 -1865
- package/package.json +5 -3
- package/dist/assets/not-found-ZbA42G36.css +0 -1
- package/dist/index-BFkuhcb7.js +0 -148
- package/dist/input.component-DMLs5SZ0.js +0 -974
- /package/dist/{utils/types.js → components/tag/tag.types.js} +0 -0
|
@@ -1,974 +0,0 @@
|
|
|
1
|
-
import { jsx as ve } from "react/jsx-runtime";
|
|
2
|
-
import Me, { useRef as De } from "react";
|
|
3
|
-
import { r as Ie } from "./index-D3EuHLHH.js";
|
|
4
|
-
import { findEndIndex as be } from "./components/control/utils/functions/functions.util.js";
|
|
5
|
-
import './assets/input-Cckwgcro.css';function Ee(M) {
|
|
6
|
-
return M && M.__esModule && Object.prototype.hasOwnProperty.call(M, "default") ? M.default : M;
|
|
7
|
-
}
|
|
8
|
-
var te = { exports: {} }, ce, ge;
|
|
9
|
-
function Oe() {
|
|
10
|
-
if (ge) return ce;
|
|
11
|
-
ge = 1;
|
|
12
|
-
function M(n) {
|
|
13
|
-
return n && typeof n == "object" && "default" in n ? n.default : n;
|
|
14
|
-
}
|
|
15
|
-
var E = M(Me), T = Ie();
|
|
16
|
-
function A(n, r) {
|
|
17
|
-
for (var a = Object.getOwnPropertyNames(r), t = 0; t < a.length; t++) {
|
|
18
|
-
var e = a[t], o = Object.getOwnPropertyDescriptor(r, e);
|
|
19
|
-
o && o.configurable && n[e] === void 0 && Object.defineProperty(n, e, o);
|
|
20
|
-
}
|
|
21
|
-
return n;
|
|
22
|
-
}
|
|
23
|
-
function L() {
|
|
24
|
-
return (L = Object.assign || function(n) {
|
|
25
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
26
|
-
var a = arguments[r];
|
|
27
|
-
for (var t in a) Object.prototype.hasOwnProperty.call(a, t) && (n[t] = a[t]);
|
|
28
|
-
}
|
|
29
|
-
return n;
|
|
30
|
-
}).apply(this, arguments);
|
|
31
|
-
}
|
|
32
|
-
function x(n, r) {
|
|
33
|
-
n.prototype = Object.create(r.prototype), A(n.prototype.constructor = n, r);
|
|
34
|
-
}
|
|
35
|
-
function V(n, r) {
|
|
36
|
-
if (n == null) return {};
|
|
37
|
-
var a, t, e = {}, o = Object.keys(n);
|
|
38
|
-
for (t = 0; t < o.length; t++) a = o[t], 0 <= r.indexOf(a) || (e[a] = n[a]);
|
|
39
|
-
return e;
|
|
40
|
-
}
|
|
41
|
-
function O(n) {
|
|
42
|
-
if (n === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
43
|
-
return n;
|
|
44
|
-
}
|
|
45
|
-
var z = function(n, r, a, t, e, o, d, k) {
|
|
46
|
-
if (!n) {
|
|
47
|
-
var i;
|
|
48
|
-
if (r === void 0) i = new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");
|
|
49
|
-
else {
|
|
50
|
-
var c = [a, t, e, o, d, k], p = 0;
|
|
51
|
-
(i = new Error(r.replace(/%s/g, function() {
|
|
52
|
-
return c[p++];
|
|
53
|
-
}))).name = "Invariant Violation";
|
|
54
|
-
}
|
|
55
|
-
throw i.framesToPop = 1, i;
|
|
56
|
-
}
|
|
57
|
-
}, y = z;
|
|
58
|
-
function q(n, r, a) {
|
|
59
|
-
if ("selectionStart" in n && "selectionEnd" in n) n.selectionStart = r, n.selectionEnd = a;
|
|
60
|
-
else {
|
|
61
|
-
var t = n.createTextRange();
|
|
62
|
-
t.collapse(!0), t.moveStart("character", r), t.moveEnd("character", a - r), t.select();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function P(n) {
|
|
66
|
-
var r = 0, a = 0;
|
|
67
|
-
if ("selectionStart" in n && "selectionEnd" in n) r = n.selectionStart, a = n.selectionEnd;
|
|
68
|
-
else {
|
|
69
|
-
var t = document.selection.createRange();
|
|
70
|
-
t.parentElement() === n && (r = -t.moveStart("character", -n.value.length), a = -t.moveEnd("character", -n.value.length));
|
|
71
|
-
}
|
|
72
|
-
return { start: r, end: a, length: a - r };
|
|
73
|
-
}
|
|
74
|
-
var G = { 9: "[0-9]", a: "[A-Za-z]", "*": "[A-Za-z0-9]" }, J = "_";
|
|
75
|
-
function I(n, r, a) {
|
|
76
|
-
var t = "", e = "", o = null, d = [];
|
|
77
|
-
if (r === void 0 && (r = J), a == null && (a = G), !n || typeof n != "string") return { maskChar: r, formatChars: a, mask: null, prefix: null, lastEditablePosition: null, permanents: [] };
|
|
78
|
-
var k = !1;
|
|
79
|
-
return n.split("").forEach(function(i) {
|
|
80
|
-
k = !k && i === "\\" || (k || !a[i] ? (d.push(t.length), t.length === d.length - 1 && (e += i)) : o = t.length + 1, t += i, !1);
|
|
81
|
-
}), { maskChar: r, formatChars: a, prefix: e, mask: t, lastEditablePosition: o, permanents: d };
|
|
82
|
-
}
|
|
83
|
-
function g(n, r) {
|
|
84
|
-
return n.permanents.indexOf(r) !== -1;
|
|
85
|
-
}
|
|
86
|
-
function B(n, r, a) {
|
|
87
|
-
var t = n.mask, e = n.formatChars;
|
|
88
|
-
if (!a) return !1;
|
|
89
|
-
if (g(n, r)) return t[r] === a;
|
|
90
|
-
var o = e[t[r]];
|
|
91
|
-
return new RegExp(o).test(a);
|
|
92
|
-
}
|
|
93
|
-
function j(n, r) {
|
|
94
|
-
return r.split("").every(function(a, t) {
|
|
95
|
-
return g(n, t) || !B(n, t, a);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
function U(n, r) {
|
|
99
|
-
var a = n.maskChar, t = n.prefix;
|
|
100
|
-
if (!a) {
|
|
101
|
-
for (; r.length > t.length && g(n, r.length - 1); ) r = r.slice(0, r.length - 1);
|
|
102
|
-
return r.length;
|
|
103
|
-
}
|
|
104
|
-
for (var e = t.length, o = r.length; o >= t.length; o--) {
|
|
105
|
-
var d = r[o];
|
|
106
|
-
if (!g(n, o) && B(n, o, d)) {
|
|
107
|
-
e = o + 1;
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return e;
|
|
112
|
-
}
|
|
113
|
-
function Q(n, r) {
|
|
114
|
-
return U(n, r) === n.mask.length;
|
|
115
|
-
}
|
|
116
|
-
function _(n, r) {
|
|
117
|
-
var a = n.maskChar, t = n.mask, e = n.prefix;
|
|
118
|
-
if (!a) {
|
|
119
|
-
for ((r = $(n, "", r, 0)).length < e.length && (r = e); r.length < t.length && g(n, r.length); ) r += t[r.length];
|
|
120
|
-
return r;
|
|
121
|
-
}
|
|
122
|
-
if (r) return $(n, _(n, ""), r, 0);
|
|
123
|
-
for (var o = 0; o < t.length; o++) g(n, o) ? r += t[o] : r += a;
|
|
124
|
-
return r;
|
|
125
|
-
}
|
|
126
|
-
function re(n, r, a, t) {
|
|
127
|
-
var e = a + t, o = n.maskChar, d = n.mask, k = n.prefix, i = r.split("");
|
|
128
|
-
if (o) return i.map(function(p, h) {
|
|
129
|
-
return h < a || e <= h ? p : g(n, h) ? d[h] : o;
|
|
130
|
-
}).join("");
|
|
131
|
-
for (var c = e; c < i.length; c++) g(n, c) && (i[c] = "");
|
|
132
|
-
return a = Math.max(k.length, a), i.splice(a, e - a), r = i.join(""), _(n, r);
|
|
133
|
-
}
|
|
134
|
-
function $(n, r, a, t) {
|
|
135
|
-
var e = n.mask, o = n.maskChar, d = n.prefix, k = a.split(""), i = Q(n, r);
|
|
136
|
-
return !o && t > r.length && (r += e.slice(r.length, t)), k.every(function(c) {
|
|
137
|
-
for (; S = c, g(n, u = t) && S !== e[u]; ) {
|
|
138
|
-
if (t >= r.length && (r += e[t]), p = c, h = t, o && g(n, h) && p === o) return !0;
|
|
139
|
-
if (++t >= e.length) return !1;
|
|
140
|
-
}
|
|
141
|
-
var p, h, u, S;
|
|
142
|
-
return !B(n, t, c) && c !== o || (t < r.length ? r = o || i || t < d.length ? r.slice(0, t) + c + r.slice(t + 1) : (r = r.slice(0, t) + c + r.slice(t), _(n, r)) : o || (r += c), ++t < e.length);
|
|
143
|
-
}), r;
|
|
144
|
-
}
|
|
145
|
-
function ae(n, r, a, t) {
|
|
146
|
-
var e = n.mask, o = n.maskChar, d = a.split(""), k = t;
|
|
147
|
-
return d.every(function(i) {
|
|
148
|
-
for (; p = i, g(n, c = t) && p !== e[c]; ) if (++t >= e.length) return !1;
|
|
149
|
-
var c, p;
|
|
150
|
-
return (B(n, t, i) || i === o) && t++, t < e.length;
|
|
151
|
-
}), t - k;
|
|
152
|
-
}
|
|
153
|
-
function oe(n, r) {
|
|
154
|
-
for (var a = r; 0 <= a; --a) if (!g(n, a)) return a;
|
|
155
|
-
return null;
|
|
156
|
-
}
|
|
157
|
-
function W(n, r) {
|
|
158
|
-
for (var a = n.mask, t = r; t < a.length; ++t) if (!g(n, t)) return t;
|
|
159
|
-
return null;
|
|
160
|
-
}
|
|
161
|
-
function Z(n) {
|
|
162
|
-
return n || n === 0 ? n + "" : "";
|
|
163
|
-
}
|
|
164
|
-
function se(n, r, a, t, e) {
|
|
165
|
-
var o = n.mask, d = n.prefix, k = n.lastEditablePosition, i = r, c = "", p = 0, h = 0, u = Math.min(e.start, a.start);
|
|
166
|
-
return a.end > e.start ? h = (p = ae(n, t, c = i.slice(e.start, a.end), u)) ? e.length : 0 : i.length < t.length && (h = t.length - i.length), i = t, h && (h === 1 && !e.length && (u = e.start === a.start ? W(n, a.start) : oe(n, a.start)), i = re(n, i, u, h)), i = $(n, i, c, u), (u += p) >= o.length ? u = o.length : u < d.length && !p ? u = d.length : u >= d.length && u < k && p && (u = W(n, u)), c || (c = null), { value: i = _(n, i), enteredString: c, selection: { start: u, end: u } };
|
|
167
|
-
}
|
|
168
|
-
function ie() {
|
|
169
|
-
var n = new RegExp("windows", "i"), r = new RegExp("phone", "i"), a = navigator.userAgent;
|
|
170
|
-
return n.test(a) && r.test(a);
|
|
171
|
-
}
|
|
172
|
-
function D(n) {
|
|
173
|
-
return typeof n == "function";
|
|
174
|
-
}
|
|
175
|
-
function le() {
|
|
176
|
-
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
|
|
177
|
-
}
|
|
178
|
-
function ee() {
|
|
179
|
-
return window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame;
|
|
180
|
-
}
|
|
181
|
-
function ne(n) {
|
|
182
|
-
return (ee() ? le() : function() {
|
|
183
|
-
return setTimeout(n, 1e3 / 60);
|
|
184
|
-
})(n);
|
|
185
|
-
}
|
|
186
|
-
function K(n) {
|
|
187
|
-
(ee() || clearTimeout)(n);
|
|
188
|
-
}
|
|
189
|
-
var ue = (function(n) {
|
|
190
|
-
function r(t) {
|
|
191
|
-
var e = n.call(this, t) || this;
|
|
192
|
-
e.focused = !1, e.mounted = !1, e.previousSelection = null, e.selectionDeferId = null, e.saveSelectionLoopDeferId = null, e.saveSelectionLoop = function() {
|
|
193
|
-
e.previousSelection = e.getSelection(), e.saveSelectionLoopDeferId = ne(e.saveSelectionLoop);
|
|
194
|
-
}, e.runSaveSelectionLoop = function() {
|
|
195
|
-
e.saveSelectionLoopDeferId === null && e.saveSelectionLoop();
|
|
196
|
-
}, e.stopSaveSelectionLoop = function() {
|
|
197
|
-
e.saveSelectionLoopDeferId !== null && (K(e.saveSelectionLoopDeferId), e.saveSelectionLoopDeferId = null, e.previousSelection = null);
|
|
198
|
-
}, e.getInputDOMNode = function() {
|
|
199
|
-
if (!e.mounted) return null;
|
|
200
|
-
var l = T.findDOMNode(O(O(e))), s = typeof window < "u" && l instanceof window.Element;
|
|
201
|
-
if (l && !s) return null;
|
|
202
|
-
if (l.nodeName !== "INPUT" && (l = l.querySelector("input")), !l) throw new Error("react-input-mask: inputComponent doesn't contain input node");
|
|
203
|
-
return l;
|
|
204
|
-
}, e.getInputValue = function() {
|
|
205
|
-
var l = e.getInputDOMNode();
|
|
206
|
-
return l ? l.value : null;
|
|
207
|
-
}, e.setInputValue = function(l) {
|
|
208
|
-
var s = e.getInputDOMNode();
|
|
209
|
-
s && (e.value = l, s.value = l);
|
|
210
|
-
}, e.setCursorToEnd = function() {
|
|
211
|
-
var l = U(e.maskOptions, e.value), s = W(e.maskOptions, l);
|
|
212
|
-
s !== null && e.setCursorPosition(s);
|
|
213
|
-
}, e.setSelection = function(l, s, f) {
|
|
214
|
-
f === void 0 && (f = {});
|
|
215
|
-
var m = e.getInputDOMNode(), v = e.isFocused();
|
|
216
|
-
m && v && (f.deferred || q(m, l, s), e.selectionDeferId !== null && K(e.selectionDeferId), e.selectionDeferId = ne(function() {
|
|
217
|
-
e.selectionDeferId = null, q(m, l, s);
|
|
218
|
-
}), e.previousSelection = { start: l, end: s, length: Math.abs(s - l) });
|
|
219
|
-
}, e.getSelection = function() {
|
|
220
|
-
return P(e.getInputDOMNode());
|
|
221
|
-
}, e.getCursorPosition = function() {
|
|
222
|
-
return e.getSelection().start;
|
|
223
|
-
}, e.setCursorPosition = function(l) {
|
|
224
|
-
e.setSelection(l, l);
|
|
225
|
-
}, e.isFocused = function() {
|
|
226
|
-
return e.focused;
|
|
227
|
-
}, e.getBeforeMaskedValueChangeConfig = function() {
|
|
228
|
-
var l = e.maskOptions, s = l.mask, f = l.maskChar, m = l.permanents, v = l.formatChars;
|
|
229
|
-
return { mask: s, maskChar: f, permanents: m, alwaysShowMask: !!e.props.alwaysShowMask, formatChars: v };
|
|
230
|
-
}, e.isInputAutofilled = function(l, s, f, m) {
|
|
231
|
-
var v = e.getInputDOMNode();
|
|
232
|
-
try {
|
|
233
|
-
if (v.matches(":-webkit-autofill")) return !0;
|
|
234
|
-
} catch {
|
|
235
|
-
}
|
|
236
|
-
return !e.focused || m.end < f.length && s.end === l.length;
|
|
237
|
-
}, e.onChange = function(l) {
|
|
238
|
-
var s = O(O(e)).beforePasteState, f = O(O(e)).previousSelection, m = e.props.beforeMaskedValueChange, v = e.getInputValue(), w = e.value, C = e.getSelection();
|
|
239
|
-
e.isInputAutofilled(v, C, w, f) && (w = _(e.maskOptions, ""), f = { start: 0, end: 0, length: 0 }), s && (f = s.selection, w = s.value, C = { start: f.start + v.length, end: f.start + v.length, length: 0 }, v = w.slice(0, f.start) + v + w.slice(f.end), e.beforePasteState = null);
|
|
240
|
-
var b = se(e.maskOptions, v, C, w, f), F = b.enteredString, R = b.selection, N = b.value;
|
|
241
|
-
if (D(m)) {
|
|
242
|
-
var X = m({ value: N, selection: R }, { value: w, selection: f }, F, e.getBeforeMaskedValueChangeConfig());
|
|
243
|
-
N = X.value, R = X.selection;
|
|
244
|
-
}
|
|
245
|
-
e.setInputValue(N), D(e.props.onChange) && e.props.onChange(l), e.isWindowsPhoneBrowser ? e.setSelection(R.start, R.end, { deferred: !0 }) : e.setSelection(R.start, R.end);
|
|
246
|
-
}, e.onFocus = function(l) {
|
|
247
|
-
var s = e.props.beforeMaskedValueChange, f = e.maskOptions, m = f.mask, v = f.prefix;
|
|
248
|
-
if (e.focused = !0, e.mounted = !0, m) {
|
|
249
|
-
if (e.value) U(e.maskOptions, e.value) < e.maskOptions.mask.length && e.setCursorToEnd();
|
|
250
|
-
else {
|
|
251
|
-
var w = _(e.maskOptions, v), C = _(e.maskOptions, w), b = U(e.maskOptions, C), F = W(e.maskOptions, b), R = { start: F, end: F };
|
|
252
|
-
if (D(s)) {
|
|
253
|
-
var N = s({ value: C, selection: R }, { value: e.value, selection: null }, null, e.getBeforeMaskedValueChangeConfig());
|
|
254
|
-
C = N.value, R = N.selection;
|
|
255
|
-
}
|
|
256
|
-
var X = C !== e.getInputValue();
|
|
257
|
-
X && e.setInputValue(C), X && D(e.props.onChange) && e.props.onChange(l), e.setSelection(R.start, R.end);
|
|
258
|
-
}
|
|
259
|
-
e.runSaveSelectionLoop();
|
|
260
|
-
}
|
|
261
|
-
D(e.props.onFocus) && e.props.onFocus(l);
|
|
262
|
-
}, e.onBlur = function(l) {
|
|
263
|
-
var s = e.props.beforeMaskedValueChange, f = e.maskOptions.mask;
|
|
264
|
-
if (e.stopSaveSelectionLoop(), e.focused = !1, f && !e.props.alwaysShowMask && j(e.maskOptions, e.value)) {
|
|
265
|
-
var m = "";
|
|
266
|
-
D(s) && (m = s({ value: m, selection: null }, { value: e.value, selection: e.previousSelection }, null, e.getBeforeMaskedValueChangeConfig()).value);
|
|
267
|
-
var v = m !== e.getInputValue();
|
|
268
|
-
v && e.setInputValue(m), v && D(e.props.onChange) && e.props.onChange(l);
|
|
269
|
-
}
|
|
270
|
-
D(e.props.onBlur) && e.props.onBlur(l);
|
|
271
|
-
}, e.onMouseDown = function(l) {
|
|
272
|
-
if (!e.focused && document.addEventListener) {
|
|
273
|
-
e.mouseDownX = l.clientX, e.mouseDownY = l.clientY, e.mouseDownTime = (/* @__PURE__ */ new Date()).getTime();
|
|
274
|
-
var s = function f(m) {
|
|
275
|
-
if (document.removeEventListener("mouseup", f), e.focused) {
|
|
276
|
-
var v = Math.abs(m.clientX - e.mouseDownX), w = Math.abs(m.clientY - e.mouseDownY), C = Math.max(v, w), b = (/* @__PURE__ */ new Date()).getTime() - e.mouseDownTime;
|
|
277
|
-
(C <= 10 && b <= 200 || C <= 5 && b <= 300) && e.setCursorToEnd();
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
document.addEventListener("mouseup", s);
|
|
281
|
-
}
|
|
282
|
-
D(e.props.onMouseDown) && e.props.onMouseDown(l);
|
|
283
|
-
}, e.onPaste = function(l) {
|
|
284
|
-
D(e.props.onPaste) && e.props.onPaste(l), l.defaultPrevented || (e.beforePasteState = { value: e.getInputValue(), selection: e.getSelection() }, e.setInputValue(""));
|
|
285
|
-
}, e.handleRef = function(l) {
|
|
286
|
-
e.props.children == null && D(e.props.inputRef) && e.props.inputRef(l);
|
|
287
|
-
};
|
|
288
|
-
var o = t.mask, d = t.maskChar, k = t.formatChars, i = t.alwaysShowMask, c = t.beforeMaskedValueChange, p = t.defaultValue, h = t.value;
|
|
289
|
-
e.maskOptions = I(o, d, k), p == null && (p = ""), h == null && (h = p);
|
|
290
|
-
var u = Z(h);
|
|
291
|
-
if (e.maskOptions.mask && (i || u) && (u = _(e.maskOptions, u), D(c))) {
|
|
292
|
-
var S = t.value;
|
|
293
|
-
t.value == null && (S = p), u = c({ value: u, selection: null }, { value: S = Z(S), selection: null }, null, e.getBeforeMaskedValueChangeConfig()).value;
|
|
294
|
-
}
|
|
295
|
-
return e.value = u, e;
|
|
296
|
-
}
|
|
297
|
-
x(r, n);
|
|
298
|
-
var a = r.prototype;
|
|
299
|
-
return a.componentDidMount = function() {
|
|
300
|
-
this.mounted = !0, this.getInputDOMNode() && (this.isWindowsPhoneBrowser = ie(), this.maskOptions.mask && this.getInputValue() !== this.value && this.setInputValue(this.value));
|
|
301
|
-
}, a.componentDidUpdate = function() {
|
|
302
|
-
var t = this.previousSelection, e = this.props, o = e.beforeMaskedValueChange, d = e.alwaysShowMask, k = e.mask, i = e.maskChar, c = e.formatChars, p = this.maskOptions, h = d || this.isFocused(), u = this.props.value != null, S = u ? Z(this.props.value) : this.value, l = t ? t.start : null;
|
|
303
|
-
if (this.maskOptions = I(k, i, c), this.maskOptions.mask) {
|
|
304
|
-
!p.mask && this.isFocused() && this.runSaveSelectionLoop();
|
|
305
|
-
var s = this.maskOptions.mask && this.maskOptions.mask !== p.mask;
|
|
306
|
-
if (p.mask || u || (S = this.getInputValue()), (s || this.maskOptions.mask && (S || h)) && (S = _(this.maskOptions, S)), s) {
|
|
307
|
-
var f = U(this.maskOptions, S);
|
|
308
|
-
(l === null || f < l) && (l = Q(this.maskOptions, S) ? f : W(this.maskOptions, f));
|
|
309
|
-
}
|
|
310
|
-
!this.maskOptions.mask || !j(this.maskOptions, S) || h || u && this.props.value || (S = "");
|
|
311
|
-
var m = { start: l, end: l };
|
|
312
|
-
if (D(o)) {
|
|
313
|
-
var v = o({ value: S, selection: m }, { value: this.value, selection: this.previousSelection }, null, this.getBeforeMaskedValueChangeConfig());
|
|
314
|
-
S = v.value, m = v.selection;
|
|
315
|
-
}
|
|
316
|
-
this.value = S;
|
|
317
|
-
var w = this.getInputValue() !== this.value;
|
|
318
|
-
w ? (this.setInputValue(this.value), this.forceUpdate()) : s && this.forceUpdate();
|
|
319
|
-
var C = !1;
|
|
320
|
-
m.start != null && m.end != null && (C = !t || t.start !== m.start || t.end !== m.end), (C || w) && this.setSelection(m.start, m.end);
|
|
321
|
-
} else p.mask && (this.stopSaveSelectionLoop(), this.forceUpdate());
|
|
322
|
-
}, a.componentWillUnmount = function() {
|
|
323
|
-
this.mounted = !1, this.selectionDeferId !== null && K(this.selectionDeferId), this.stopSaveSelectionLoop();
|
|
324
|
-
}, a.render = function() {
|
|
325
|
-
var t, e = this.props, o = (e.mask, e.alwaysShowMask, e.maskChar, e.formatChars, e.inputRef, e.beforeMaskedValueChange, e.children), d = V(e, ["mask", "alwaysShowMask", "maskChar", "formatChars", "inputRef", "beforeMaskedValueChange", "children"]);
|
|
326
|
-
if (o) {
|
|
327
|
-
D(o) || y(!1);
|
|
328
|
-
var k = ["onChange", "onPaste", "onMouseDown", "onFocus", "onBlur", "value", "disabled", "readOnly"], i = L({}, d);
|
|
329
|
-
k.forEach(function(p) {
|
|
330
|
-
return delete i[p];
|
|
331
|
-
}), t = o(i), k.filter(function(p) {
|
|
332
|
-
return t.props[p] != null && t.props[p] !== d[p];
|
|
333
|
-
}).length && y(!1);
|
|
334
|
-
} else t = E.createElement("input", L({ ref: this.handleRef }, d));
|
|
335
|
-
var c = { onFocus: this.onFocus, onBlur: this.onBlur };
|
|
336
|
-
return this.maskOptions.mask && (d.disabled || d.readOnly || (c.onChange = this.onChange, c.onPaste = this.onPaste, c.onMouseDown = this.onMouseDown), d.value != null && (c.value = this.value)), t = E.cloneElement(t, c);
|
|
337
|
-
}, r;
|
|
338
|
-
})(E.Component);
|
|
339
|
-
return ce = ue, ce;
|
|
340
|
-
}
|
|
341
|
-
var he, ke;
|
|
342
|
-
function ye() {
|
|
343
|
-
if (ke) return he;
|
|
344
|
-
ke = 1;
|
|
345
|
-
var M = function(E, T, A, L, x, V, O, z) {
|
|
346
|
-
if (process.env.NODE_ENV !== "production" && T === void 0)
|
|
347
|
-
throw new Error("invariant requires an error message argument");
|
|
348
|
-
if (!E) {
|
|
349
|
-
var y;
|
|
350
|
-
if (T === void 0)
|
|
351
|
-
y = new Error(
|
|
352
|
-
"Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings."
|
|
353
|
-
);
|
|
354
|
-
else {
|
|
355
|
-
var q = [A, L, x, V, O, z], P = 0;
|
|
356
|
-
y = new Error(
|
|
357
|
-
T.replace(/%s/g, function() {
|
|
358
|
-
return q[P++];
|
|
359
|
-
})
|
|
360
|
-
), y.name = "Invariant Violation";
|
|
361
|
-
}
|
|
362
|
-
throw y.framesToPop = 1, y;
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
return he = M, he;
|
|
366
|
-
}
|
|
367
|
-
var pe, we;
|
|
368
|
-
function Ve() {
|
|
369
|
-
if (we) return pe;
|
|
370
|
-
we = 1;
|
|
371
|
-
var M = process.env.NODE_ENV !== "production", E = function() {
|
|
372
|
-
};
|
|
373
|
-
if (M) {
|
|
374
|
-
var T = function(L, x) {
|
|
375
|
-
var V = arguments.length;
|
|
376
|
-
x = new Array(V > 1 ? V - 1 : 0);
|
|
377
|
-
for (var O = 1; O < V; O++)
|
|
378
|
-
x[O - 1] = arguments[O];
|
|
379
|
-
var z = 0, y = "Warning: " + L.replace(/%s/g, function() {
|
|
380
|
-
return x[z++];
|
|
381
|
-
});
|
|
382
|
-
typeof console < "u" && console.error(y);
|
|
383
|
-
try {
|
|
384
|
-
throw new Error(y);
|
|
385
|
-
} catch {
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
E = function(A, L, x) {
|
|
389
|
-
var V = arguments.length;
|
|
390
|
-
x = new Array(V > 2 ? V - 2 : 0);
|
|
391
|
-
for (var O = 2; O < V; O++)
|
|
392
|
-
x[O - 2] = arguments[O];
|
|
393
|
-
if (L === void 0)
|
|
394
|
-
throw new Error(
|
|
395
|
-
"`warning(condition, format, ...args)` requires a warning message argument"
|
|
396
|
-
);
|
|
397
|
-
A || T.apply(null, [L].concat(x));
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
return pe = E, pe;
|
|
401
|
-
}
|
|
402
|
-
var de, Se;
|
|
403
|
-
function _e() {
|
|
404
|
-
if (Se) return de;
|
|
405
|
-
Se = 1;
|
|
406
|
-
function M(n) {
|
|
407
|
-
return n && typeof n == "object" && "default" in n ? n.default : n;
|
|
408
|
-
}
|
|
409
|
-
var E = M(Me), T = Ie(), A = M(ye()), L = M(Ve());
|
|
410
|
-
function x(n, r) {
|
|
411
|
-
for (var a = Object.getOwnPropertyNames(r), t = 0; t < a.length; t++) {
|
|
412
|
-
var e = a[t], o = Object.getOwnPropertyDescriptor(r, e);
|
|
413
|
-
o && o.configurable && n[e] === void 0 && Object.defineProperty(n, e, o);
|
|
414
|
-
}
|
|
415
|
-
return n;
|
|
416
|
-
}
|
|
417
|
-
function V() {
|
|
418
|
-
return V = Object.assign || function(n) {
|
|
419
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
420
|
-
var a = arguments[r];
|
|
421
|
-
for (var t in a)
|
|
422
|
-
Object.prototype.hasOwnProperty.call(a, t) && (n[t] = a[t]);
|
|
423
|
-
}
|
|
424
|
-
return n;
|
|
425
|
-
}, V.apply(this, arguments);
|
|
426
|
-
}
|
|
427
|
-
function O(n, r) {
|
|
428
|
-
n.prototype = Object.create(r.prototype), n.prototype.constructor = n, x(n, r);
|
|
429
|
-
}
|
|
430
|
-
function z(n, r) {
|
|
431
|
-
if (n == null) return {};
|
|
432
|
-
var a = {}, t = Object.keys(n), e, o;
|
|
433
|
-
for (o = 0; o < t.length; o++)
|
|
434
|
-
e = t[o], !(r.indexOf(e) >= 0) && (a[e] = n[e]);
|
|
435
|
-
return a;
|
|
436
|
-
}
|
|
437
|
-
function y(n) {
|
|
438
|
-
if (n === void 0)
|
|
439
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
440
|
-
return n;
|
|
441
|
-
}
|
|
442
|
-
function q(n, r, a) {
|
|
443
|
-
if ("selectionStart" in n && "selectionEnd" in n)
|
|
444
|
-
n.selectionStart = r, n.selectionEnd = a;
|
|
445
|
-
else {
|
|
446
|
-
var t = n.createTextRange();
|
|
447
|
-
t.collapse(!0), t.moveStart("character", r), t.moveEnd("character", a - r), t.select();
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
function P(n) {
|
|
451
|
-
var r = 0, a = 0;
|
|
452
|
-
if ("selectionStart" in n && "selectionEnd" in n)
|
|
453
|
-
r = n.selectionStart, a = n.selectionEnd;
|
|
454
|
-
else {
|
|
455
|
-
var t = document.selection.createRange();
|
|
456
|
-
t.parentElement() === n && (r = -t.moveStart("character", -n.value.length), a = -t.moveEnd("character", -n.value.length));
|
|
457
|
-
}
|
|
458
|
-
return {
|
|
459
|
-
start: r,
|
|
460
|
-
end: a,
|
|
461
|
-
length: a - r
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
|
-
var G = {
|
|
465
|
-
9: "[0-9]",
|
|
466
|
-
a: "[A-Za-z]",
|
|
467
|
-
"*": "[A-Za-z0-9]"
|
|
468
|
-
}, J = "_";
|
|
469
|
-
function I(n, r, a) {
|
|
470
|
-
var t = "", e = "", o = null, d = [];
|
|
471
|
-
if (r === void 0 && (r = J), a == null && (a = G), !n || typeof n != "string")
|
|
472
|
-
return {
|
|
473
|
-
maskChar: r,
|
|
474
|
-
formatChars: a,
|
|
475
|
-
mask: null,
|
|
476
|
-
prefix: null,
|
|
477
|
-
lastEditablePosition: null,
|
|
478
|
-
permanents: []
|
|
479
|
-
};
|
|
480
|
-
var k = !1;
|
|
481
|
-
return n.split("").forEach(function(i) {
|
|
482
|
-
!k && i === "\\" ? k = !0 : (k || !a[i] ? (d.push(t.length), t.length === d.length - 1 && (e += i)) : o = t.length + 1, t += i, k = !1);
|
|
483
|
-
}), {
|
|
484
|
-
maskChar: r,
|
|
485
|
-
formatChars: a,
|
|
486
|
-
prefix: e,
|
|
487
|
-
mask: t,
|
|
488
|
-
lastEditablePosition: o,
|
|
489
|
-
permanents: d
|
|
490
|
-
};
|
|
491
|
-
}
|
|
492
|
-
function g(n, r) {
|
|
493
|
-
return n.permanents.indexOf(r) !== -1;
|
|
494
|
-
}
|
|
495
|
-
function B(n, r, a) {
|
|
496
|
-
var t = n.mask, e = n.formatChars;
|
|
497
|
-
if (!a)
|
|
498
|
-
return !1;
|
|
499
|
-
if (g(n, r))
|
|
500
|
-
return t[r] === a;
|
|
501
|
-
var o = t[r], d = e[o];
|
|
502
|
-
return new RegExp(d).test(a);
|
|
503
|
-
}
|
|
504
|
-
function j(n, r) {
|
|
505
|
-
return r.split("").every(function(a, t) {
|
|
506
|
-
return g(n, t) || !B(n, t, a);
|
|
507
|
-
});
|
|
508
|
-
}
|
|
509
|
-
function U(n, r) {
|
|
510
|
-
var a = n.maskChar, t = n.prefix;
|
|
511
|
-
if (!a) {
|
|
512
|
-
for (; r.length > t.length && g(n, r.length - 1); )
|
|
513
|
-
r = r.slice(0, r.length - 1);
|
|
514
|
-
return r.length;
|
|
515
|
-
}
|
|
516
|
-
for (var e = t.length, o = r.length; o >= t.length; o--) {
|
|
517
|
-
var d = r[o], k = !g(n, o) && B(n, o, d);
|
|
518
|
-
if (k) {
|
|
519
|
-
e = o + 1;
|
|
520
|
-
break;
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
return e;
|
|
524
|
-
}
|
|
525
|
-
function Q(n, r) {
|
|
526
|
-
return U(n, r) === n.mask.length;
|
|
527
|
-
}
|
|
528
|
-
function _(n, r) {
|
|
529
|
-
var a = n.maskChar, t = n.mask, e = n.prefix;
|
|
530
|
-
if (!a) {
|
|
531
|
-
for (r = $(n, "", r, 0), r.length < e.length && (r = e); r.length < t.length && g(n, r.length); )
|
|
532
|
-
r += t[r.length];
|
|
533
|
-
return r;
|
|
534
|
-
}
|
|
535
|
-
if (r) {
|
|
536
|
-
var o = _(n, "");
|
|
537
|
-
return $(n, o, r, 0);
|
|
538
|
-
}
|
|
539
|
-
for (var d = 0; d < t.length; d++)
|
|
540
|
-
g(n, d) ? r += t[d] : r += a;
|
|
541
|
-
return r;
|
|
542
|
-
}
|
|
543
|
-
function re(n, r, a, t) {
|
|
544
|
-
var e = a + t, o = n.maskChar, d = n.mask, k = n.prefix, i = r.split("");
|
|
545
|
-
if (!o) {
|
|
546
|
-
for (var c = e; c < i.length; c++)
|
|
547
|
-
g(n, c) && (i[c] = "");
|
|
548
|
-
return a = Math.max(k.length, a), i.splice(a, e - a), r = i.join(""), _(n, r);
|
|
549
|
-
}
|
|
550
|
-
return i.map(function(p, h) {
|
|
551
|
-
return h < a || h >= e ? p : g(n, h) ? d[h] : o;
|
|
552
|
-
}).join("");
|
|
553
|
-
}
|
|
554
|
-
function $(n, r, a, t) {
|
|
555
|
-
var e = n.mask, o = n.maskChar, d = n.prefix, k = a.split(""), i = Q(n, r), c = function(u, S) {
|
|
556
|
-
return !g(n, u) || S === e[u];
|
|
557
|
-
}, p = function(u, S) {
|
|
558
|
-
return !o || !g(n, S) || u !== o;
|
|
559
|
-
};
|
|
560
|
-
return !o && t > r.length && (r += e.slice(r.length, t)), k.every(function(h) {
|
|
561
|
-
for (; !c(t, h); ) {
|
|
562
|
-
if (t >= r.length && (r += e[t]), !p(h, t))
|
|
563
|
-
return !0;
|
|
564
|
-
if (t++, t >= e.length)
|
|
565
|
-
return !1;
|
|
566
|
-
}
|
|
567
|
-
var u = B(n, t, h) || h === o;
|
|
568
|
-
return u ? (t < r.length ? o || i || t < d.length ? r = r.slice(0, t) + h + r.slice(t + 1) : (r = r.slice(0, t) + h + r.slice(t), r = _(n, r)) : o || (r += h), t++, t < e.length) : !0;
|
|
569
|
-
}), r;
|
|
570
|
-
}
|
|
571
|
-
function ae(n, r, a, t) {
|
|
572
|
-
var e = n.mask, o = n.maskChar, d = a.split(""), k = t, i = function(p, h) {
|
|
573
|
-
return !g(n, p) || h === e[p];
|
|
574
|
-
};
|
|
575
|
-
return d.every(function(c) {
|
|
576
|
-
for (; !i(t, c); )
|
|
577
|
-
if (t++, t >= e.length)
|
|
578
|
-
return !1;
|
|
579
|
-
var p = B(n, t, c) || c === o;
|
|
580
|
-
return p && t++, t < e.length;
|
|
581
|
-
}), t - k;
|
|
582
|
-
}
|
|
583
|
-
function oe(n, r) {
|
|
584
|
-
for (var a = r; a >= 0; --a)
|
|
585
|
-
if (!g(n, a))
|
|
586
|
-
return a;
|
|
587
|
-
return null;
|
|
588
|
-
}
|
|
589
|
-
function W(n, r) {
|
|
590
|
-
for (var a = n.mask, t = r; t < a.length; ++t)
|
|
591
|
-
if (!g(n, t))
|
|
592
|
-
return t;
|
|
593
|
-
return null;
|
|
594
|
-
}
|
|
595
|
-
function Z(n) {
|
|
596
|
-
return !n && n !== 0 ? "" : n + "";
|
|
597
|
-
}
|
|
598
|
-
function se(n, r, a, t, e) {
|
|
599
|
-
var o = n.mask, d = n.prefix, k = n.lastEditablePosition, i = r, c = "", p = 0, h = 0, u = Math.min(e.start, a.start);
|
|
600
|
-
if (a.end > e.start ? (c = i.slice(e.start, a.end), p = ae(n, t, c, u), p ? h = e.length : h = 0) : i.length < t.length && (h = t.length - i.length), i = t, h) {
|
|
601
|
-
if (h === 1 && !e.length) {
|
|
602
|
-
var S = e.start === a.start;
|
|
603
|
-
u = S ? W(n, a.start) : oe(n, a.start);
|
|
604
|
-
}
|
|
605
|
-
i = re(n, i, u, h);
|
|
606
|
-
}
|
|
607
|
-
return i = $(n, i, c, u), u = u + p, u >= o.length ? u = o.length : u < d.length && !p ? u = d.length : u >= d.length && u < k && p && (u = W(n, u)), i = _(n, i), c || (c = null), {
|
|
608
|
-
value: i,
|
|
609
|
-
enteredString: c,
|
|
610
|
-
selection: {
|
|
611
|
-
start: u,
|
|
612
|
-
end: u
|
|
613
|
-
}
|
|
614
|
-
};
|
|
615
|
-
}
|
|
616
|
-
function ie() {
|
|
617
|
-
var n = new RegExp("windows", "i"), r = new RegExp("phone", "i"), a = navigator.userAgent;
|
|
618
|
-
return n.test(a) && r.test(a);
|
|
619
|
-
}
|
|
620
|
-
function D(n) {
|
|
621
|
-
return typeof n == "function";
|
|
622
|
-
}
|
|
623
|
-
function le() {
|
|
624
|
-
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
|
|
625
|
-
}
|
|
626
|
-
function ee() {
|
|
627
|
-
return window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame;
|
|
628
|
-
}
|
|
629
|
-
function ne(n) {
|
|
630
|
-
var r = !!ee(), a;
|
|
631
|
-
return r ? a = le() : a = function() {
|
|
632
|
-
return setTimeout(n, 1e3 / 60);
|
|
633
|
-
}, a(n);
|
|
634
|
-
}
|
|
635
|
-
function K(n) {
|
|
636
|
-
var r = ee() || clearTimeout;
|
|
637
|
-
r(n);
|
|
638
|
-
}
|
|
639
|
-
var ue = /* @__PURE__ */ (function(n) {
|
|
640
|
-
O(r, n);
|
|
641
|
-
function r(t) {
|
|
642
|
-
var e;
|
|
643
|
-
e = n.call(this, t) || this, e.focused = !1, e.mounted = !1, e.previousSelection = null, e.selectionDeferId = null, e.saveSelectionLoopDeferId = null, e.saveSelectionLoop = function() {
|
|
644
|
-
e.previousSelection = e.getSelection(), e.saveSelectionLoopDeferId = ne(e.saveSelectionLoop);
|
|
645
|
-
}, e.runSaveSelectionLoop = function() {
|
|
646
|
-
e.saveSelectionLoopDeferId === null && e.saveSelectionLoop();
|
|
647
|
-
}, e.stopSaveSelectionLoop = function() {
|
|
648
|
-
e.saveSelectionLoopDeferId !== null && (K(e.saveSelectionLoopDeferId), e.saveSelectionLoopDeferId = null, e.previousSelection = null);
|
|
649
|
-
}, e.getInputDOMNode = function() {
|
|
650
|
-
if (!e.mounted)
|
|
651
|
-
return null;
|
|
652
|
-
var s = T.findDOMNode(y(y(e))), f = typeof window < "u" && s instanceof window.Element;
|
|
653
|
-
if (s && !f)
|
|
654
|
-
return null;
|
|
655
|
-
if (s.nodeName !== "INPUT" && (s = s.querySelector("input")), !s)
|
|
656
|
-
throw new Error("react-input-mask: inputComponent doesn't contain input node");
|
|
657
|
-
return s;
|
|
658
|
-
}, e.getInputValue = function() {
|
|
659
|
-
var s = e.getInputDOMNode();
|
|
660
|
-
return s ? s.value : null;
|
|
661
|
-
}, e.setInputValue = function(s) {
|
|
662
|
-
var f = e.getInputDOMNode();
|
|
663
|
-
f && (e.value = s, f.value = s);
|
|
664
|
-
}, e.setCursorToEnd = function() {
|
|
665
|
-
var s = U(e.maskOptions, e.value), f = W(e.maskOptions, s);
|
|
666
|
-
f !== null && e.setCursorPosition(f);
|
|
667
|
-
}, e.setSelection = function(s, f, m) {
|
|
668
|
-
m === void 0 && (m = {});
|
|
669
|
-
var v = e.getInputDOMNode(), w = e.isFocused();
|
|
670
|
-
if (!(!v || !w)) {
|
|
671
|
-
var C = m, b = C.deferred;
|
|
672
|
-
b || q(v, s, f), e.selectionDeferId !== null && K(e.selectionDeferId), e.selectionDeferId = ne(function() {
|
|
673
|
-
e.selectionDeferId = null, q(v, s, f);
|
|
674
|
-
}), e.previousSelection = {
|
|
675
|
-
start: s,
|
|
676
|
-
end: f,
|
|
677
|
-
length: Math.abs(f - s)
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
}, e.getSelection = function() {
|
|
681
|
-
var s = e.getInputDOMNode();
|
|
682
|
-
return P(s);
|
|
683
|
-
}, e.getCursorPosition = function() {
|
|
684
|
-
return e.getSelection().start;
|
|
685
|
-
}, e.setCursorPosition = function(s) {
|
|
686
|
-
e.setSelection(s, s);
|
|
687
|
-
}, e.isFocused = function() {
|
|
688
|
-
return e.focused;
|
|
689
|
-
}, e.getBeforeMaskedValueChangeConfig = function() {
|
|
690
|
-
var s = e.maskOptions, f = s.mask, m = s.maskChar, v = s.permanents, w = s.formatChars, C = e.props.alwaysShowMask;
|
|
691
|
-
return {
|
|
692
|
-
mask: f,
|
|
693
|
-
maskChar: m,
|
|
694
|
-
permanents: v,
|
|
695
|
-
alwaysShowMask: !!C,
|
|
696
|
-
formatChars: w
|
|
697
|
-
};
|
|
698
|
-
}, e.isInputAutofilled = function(s, f, m, v) {
|
|
699
|
-
var w = e.getInputDOMNode();
|
|
700
|
-
try {
|
|
701
|
-
if (w.matches(":-webkit-autofill"))
|
|
702
|
-
return !0;
|
|
703
|
-
} catch {
|
|
704
|
-
}
|
|
705
|
-
return e.focused ? v.end < m.length && f.end === s.length : !0;
|
|
706
|
-
}, e.onChange = function(s) {
|
|
707
|
-
var f = y(y(e)), m = f.beforePasteState, v = y(y(e)), w = v.previousSelection, C = e.props.beforeMaskedValueChange, b = e.getInputValue(), F = e.value, R = e.getSelection();
|
|
708
|
-
e.isInputAutofilled(b, R, F, w) && (F = _(e.maskOptions, ""), w = {
|
|
709
|
-
start: 0,
|
|
710
|
-
end: 0,
|
|
711
|
-
length: 0
|
|
712
|
-
}), m && (w = m.selection, F = m.value, R = {
|
|
713
|
-
start: w.start + b.length,
|
|
714
|
-
end: w.start + b.length,
|
|
715
|
-
length: 0
|
|
716
|
-
}, b = F.slice(0, w.start) + b + F.slice(w.end), e.beforePasteState = null);
|
|
717
|
-
var N = se(e.maskOptions, b, R, F, w), X = N.enteredString, Y = N.selection, fe = N.value;
|
|
718
|
-
if (D(C)) {
|
|
719
|
-
var me = C({
|
|
720
|
-
value: fe,
|
|
721
|
-
selection: Y
|
|
722
|
-
}, {
|
|
723
|
-
value: F,
|
|
724
|
-
selection: w
|
|
725
|
-
}, X, e.getBeforeMaskedValueChangeConfig());
|
|
726
|
-
fe = me.value, Y = me.selection;
|
|
727
|
-
}
|
|
728
|
-
e.setInputValue(fe), D(e.props.onChange) && e.props.onChange(s), e.isWindowsPhoneBrowser ? e.setSelection(Y.start, Y.end, {
|
|
729
|
-
deferred: !0
|
|
730
|
-
}) : e.setSelection(Y.start, Y.end);
|
|
731
|
-
}, e.onFocus = function(s) {
|
|
732
|
-
var f = e.props.beforeMaskedValueChange, m = e.maskOptions, v = m.mask, w = m.prefix;
|
|
733
|
-
if (e.focused = !0, e.mounted = !0, v) {
|
|
734
|
-
if (e.value)
|
|
735
|
-
U(e.maskOptions, e.value) < e.maskOptions.mask.length && e.setCursorToEnd();
|
|
736
|
-
else {
|
|
737
|
-
var C = _(e.maskOptions, w), b = _(e.maskOptions, C), F = U(e.maskOptions, b), R = W(e.maskOptions, F), N = {
|
|
738
|
-
start: R,
|
|
739
|
-
end: R
|
|
740
|
-
};
|
|
741
|
-
if (D(f)) {
|
|
742
|
-
var X = f({
|
|
743
|
-
value: b,
|
|
744
|
-
selection: N
|
|
745
|
-
}, {
|
|
746
|
-
value: e.value,
|
|
747
|
-
selection: null
|
|
748
|
-
}, null, e.getBeforeMaskedValueChangeConfig());
|
|
749
|
-
b = X.value, N = X.selection;
|
|
750
|
-
}
|
|
751
|
-
var Y = b !== e.getInputValue();
|
|
752
|
-
Y && e.setInputValue(b), Y && D(e.props.onChange) && e.props.onChange(s), e.setSelection(N.start, N.end);
|
|
753
|
-
}
|
|
754
|
-
e.runSaveSelectionLoop();
|
|
755
|
-
}
|
|
756
|
-
D(e.props.onFocus) && e.props.onFocus(s);
|
|
757
|
-
}, e.onBlur = function(s) {
|
|
758
|
-
var f = e.props.beforeMaskedValueChange, m = e.maskOptions.mask;
|
|
759
|
-
if (e.stopSaveSelectionLoop(), e.focused = !1, m && !e.props.alwaysShowMask && j(e.maskOptions, e.value)) {
|
|
760
|
-
var v = "";
|
|
761
|
-
if (D(f)) {
|
|
762
|
-
var w = f({
|
|
763
|
-
value: v,
|
|
764
|
-
selection: null
|
|
765
|
-
}, {
|
|
766
|
-
value: e.value,
|
|
767
|
-
selection: e.previousSelection
|
|
768
|
-
}, null, e.getBeforeMaskedValueChangeConfig());
|
|
769
|
-
v = w.value;
|
|
770
|
-
}
|
|
771
|
-
var C = v !== e.getInputValue();
|
|
772
|
-
C && e.setInputValue(v), C && D(e.props.onChange) && e.props.onChange(s);
|
|
773
|
-
}
|
|
774
|
-
D(e.props.onBlur) && e.props.onBlur(s);
|
|
775
|
-
}, e.onMouseDown = function(s) {
|
|
776
|
-
if (!e.focused && document.addEventListener) {
|
|
777
|
-
e.mouseDownX = s.clientX, e.mouseDownY = s.clientY, e.mouseDownTime = (/* @__PURE__ */ new Date()).getTime();
|
|
778
|
-
var f = function m(v) {
|
|
779
|
-
if (document.removeEventListener("mouseup", m), !!e.focused) {
|
|
780
|
-
var w = Math.abs(v.clientX - e.mouseDownX), C = Math.abs(v.clientY - e.mouseDownY), b = Math.max(w, C), F = (/* @__PURE__ */ new Date()).getTime() - e.mouseDownTime;
|
|
781
|
-
(b <= 10 && F <= 200 || b <= 5 && F <= 300) && e.setCursorToEnd();
|
|
782
|
-
}
|
|
783
|
-
};
|
|
784
|
-
document.addEventListener("mouseup", f);
|
|
785
|
-
}
|
|
786
|
-
D(e.props.onMouseDown) && e.props.onMouseDown(s);
|
|
787
|
-
}, e.onPaste = function(s) {
|
|
788
|
-
D(e.props.onPaste) && e.props.onPaste(s), s.defaultPrevented || (e.beforePasteState = {
|
|
789
|
-
value: e.getInputValue(),
|
|
790
|
-
selection: e.getSelection()
|
|
791
|
-
}, e.setInputValue(""));
|
|
792
|
-
}, e.handleRef = function(s) {
|
|
793
|
-
e.props.children == null && D(e.props.inputRef) && e.props.inputRef(s);
|
|
794
|
-
};
|
|
795
|
-
var o = t.mask, d = t.maskChar, k = t.formatChars, i = t.alwaysShowMask, c = t.beforeMaskedValueChange, p = t.defaultValue, h = t.value;
|
|
796
|
-
e.maskOptions = I(o, d, k), p == null && (p = ""), h == null && (h = p);
|
|
797
|
-
var u = Z(h);
|
|
798
|
-
if (e.maskOptions.mask && (i || u) && (u = _(e.maskOptions, u), D(c))) {
|
|
799
|
-
var S = t.value;
|
|
800
|
-
t.value == null && (S = p), S = Z(S);
|
|
801
|
-
var l = c({
|
|
802
|
-
value: u,
|
|
803
|
-
selection: null
|
|
804
|
-
}, {
|
|
805
|
-
value: S,
|
|
806
|
-
selection: null
|
|
807
|
-
}, null, e.getBeforeMaskedValueChangeConfig());
|
|
808
|
-
u = l.value;
|
|
809
|
-
}
|
|
810
|
-
return e.value = u, e;
|
|
811
|
-
}
|
|
812
|
-
var a = r.prototype;
|
|
813
|
-
return a.componentDidMount = function() {
|
|
814
|
-
this.mounted = !0, this.getInputDOMNode() && (this.isWindowsPhoneBrowser = ie(), this.maskOptions.mask && this.getInputValue() !== this.value && this.setInputValue(this.value));
|
|
815
|
-
}, a.componentDidUpdate = function() {
|
|
816
|
-
var e = this.previousSelection, o = this.props, d = o.beforeMaskedValueChange, k = o.alwaysShowMask, i = o.mask, c = o.maskChar, p = o.formatChars, h = this.maskOptions, u = k || this.isFocused(), S = this.props.value != null, l = S ? Z(this.props.value) : this.value, s = e ? e.start : null;
|
|
817
|
-
if (this.maskOptions = I(i, c, p), this.maskOptions.mask)
|
|
818
|
-
!h.mask && this.isFocused() && this.runSaveSelectionLoop();
|
|
819
|
-
else {
|
|
820
|
-
h.mask && (this.stopSaveSelectionLoop(), this.forceUpdate());
|
|
821
|
-
return;
|
|
822
|
-
}
|
|
823
|
-
var f = this.maskOptions.mask && this.maskOptions.mask !== h.mask;
|
|
824
|
-
if (!h.mask && !S && (l = this.getInputValue()), (f || this.maskOptions.mask && (l || u)) && (l = _(this.maskOptions, l)), f) {
|
|
825
|
-
var m = U(this.maskOptions, l);
|
|
826
|
-
(s === null || m < s) && (Q(this.maskOptions, l) ? s = m : s = W(this.maskOptions, m));
|
|
827
|
-
}
|
|
828
|
-
this.maskOptions.mask && j(this.maskOptions, l) && !u && (!S || !this.props.value) && (l = "");
|
|
829
|
-
var v = {
|
|
830
|
-
start: s,
|
|
831
|
-
end: s
|
|
832
|
-
};
|
|
833
|
-
if (D(d)) {
|
|
834
|
-
var w = d({
|
|
835
|
-
value: l,
|
|
836
|
-
selection: v
|
|
837
|
-
}, {
|
|
838
|
-
value: this.value,
|
|
839
|
-
selection: this.previousSelection
|
|
840
|
-
}, null, this.getBeforeMaskedValueChangeConfig());
|
|
841
|
-
l = w.value, v = w.selection;
|
|
842
|
-
}
|
|
843
|
-
this.value = l;
|
|
844
|
-
var C = this.getInputValue() !== this.value;
|
|
845
|
-
C ? (this.setInputValue(this.value), this.forceUpdate()) : f && this.forceUpdate();
|
|
846
|
-
var b = !1;
|
|
847
|
-
v.start != null && v.end != null && (b = !e || e.start !== v.start || e.end !== v.end), (b || C) && this.setSelection(v.start, v.end);
|
|
848
|
-
}, a.componentWillUnmount = function() {
|
|
849
|
-
this.mounted = !1, this.selectionDeferId !== null && K(this.selectionDeferId), this.stopSaveSelectionLoop();
|
|
850
|
-
}, a.render = function() {
|
|
851
|
-
var e = this.props, o = e.mask;
|
|
852
|
-
e.alwaysShowMask;
|
|
853
|
-
var d = e.maskChar, k = e.formatChars, i = e.inputRef;
|
|
854
|
-
e.beforeMaskedValueChange;
|
|
855
|
-
var c = e.children, p = z(e, ["mask", "alwaysShowMask", "maskChar", "formatChars", "inputRef", "beforeMaskedValueChange", "children"]), h;
|
|
856
|
-
if (process.env.NODE_ENV !== "production" && L(
|
|
857
|
-
// parse mask to test against actual mask prop as this.maskOptions
|
|
858
|
-
// will be updated later in componentDidUpdate
|
|
859
|
-
!p.maxLength || !I(o, d, k).mask,
|
|
860
|
-
"react-input-mask: maxLength property shouldn't be passed to the masked input. It breaks masking and unnecessary because length is limited by the mask length."
|
|
861
|
-
), c) {
|
|
862
|
-
D(c) || (process.env.NODE_ENV !== "production" ? A(!1, "react-input-mask: children must be a function") : A(!1));
|
|
863
|
-
var u = ["onChange", "onPaste", "onMouseDown", "onFocus", "onBlur", "value", "disabled", "readOnly"], S = V({}, p);
|
|
864
|
-
u.forEach(function(f) {
|
|
865
|
-
return delete S[f];
|
|
866
|
-
}), h = c(S);
|
|
867
|
-
var l = u.filter(function(f) {
|
|
868
|
-
return h.props[f] != null && h.props[f] !== p[f];
|
|
869
|
-
});
|
|
870
|
-
l.length && (process.env.NODE_ENV !== "production" ? A(!1, "react-input-mask: the following props should be passed to the react-input-mask's component and should not be altered in children's function: " + l.join(", ")) : A(!1)), process.env.NODE_ENV !== "production" && L(!i, "react-input-mask: inputRef is ignored when children is passed, attach ref to the children instead");
|
|
871
|
-
} else
|
|
872
|
-
h = E.createElement("input", V({
|
|
873
|
-
ref: this.handleRef
|
|
874
|
-
}, p));
|
|
875
|
-
var s = {
|
|
876
|
-
onFocus: this.onFocus,
|
|
877
|
-
onBlur: this.onBlur
|
|
878
|
-
};
|
|
879
|
-
return this.maskOptions.mask && (!p.disabled && !p.readOnly && (s.onChange = this.onChange, s.onPaste = this.onPaste, s.onMouseDown = this.onMouseDown), p.value != null && (s.value = this.value)), h = E.cloneElement(h, s), h;
|
|
880
|
-
}, r;
|
|
881
|
-
})(E.Component);
|
|
882
|
-
return de = ue, de;
|
|
883
|
-
}
|
|
884
|
-
var Ce;
|
|
885
|
-
function Re() {
|
|
886
|
-
return Ce || (Ce = 1, process.env.NODE_ENV === "production" ? te.exports = Oe() : te.exports = _e()), te.exports;
|
|
887
|
-
}
|
|
888
|
-
var Fe = Re();
|
|
889
|
-
const Le = /* @__PURE__ */ Ee(Fe), xe = "_Input_1df40_1", H = {
|
|
890
|
-
Input: xe,
|
|
891
|
-
"autofill-start": "_autofill-start_1df40_1",
|
|
892
|
-
"autofill-cancel": "_autofill-cancel_1df40_1"
|
|
893
|
-
}, Te = ({
|
|
894
|
-
id: M,
|
|
895
|
-
value: E,
|
|
896
|
-
disabled: T = !1,
|
|
897
|
-
dateMask: A = !1,
|
|
898
|
-
maxLength: L,
|
|
899
|
-
type: x = "text",
|
|
900
|
-
onAutofill: V,
|
|
901
|
-
onAutofillCancel: O,
|
|
902
|
-
onChange: z,
|
|
903
|
-
onFocus: y,
|
|
904
|
-
onBlur: q
|
|
905
|
-
}) => {
|
|
906
|
-
const P = De(null), G = (I) => {
|
|
907
|
-
const g = be(E);
|
|
908
|
-
g < E.length - 1 && P.current && (I.preventDefault(), P.current.setSelectionRange(g + 1, g + 1, "none"));
|
|
909
|
-
}, J = (I) => {
|
|
910
|
-
if ((I.code === "ArrowUp" || I.code === "ArrowDown") && I.preventDefault(), I.code === "ArrowRight" && P.current) {
|
|
911
|
-
const g = P.current.selectionStart || 0, B = E[g + 1] === "/" ? E[g + 2] : E[g + 1];
|
|
912
|
-
if (!/^\d+$/.test(B))
|
|
913
|
-
I.preventDefault();
|
|
914
|
-
else {
|
|
915
|
-
const j = E[g + 1] === "/" ? 1 : 0;
|
|
916
|
-
P.current.setSelectionRange(g + j, g + j, "none");
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
if (I.code === "ArrowLeft" && P.current) {
|
|
920
|
-
I.preventDefault();
|
|
921
|
-
const g = P.current.selectionStart || 0, B = E[g - 1] === "/" ? E[g - 2] : E[g - 1];
|
|
922
|
-
if (!/^\d+$/.test(B))
|
|
923
|
-
I.preventDefault();
|
|
924
|
-
else {
|
|
925
|
-
const j = E[g - 1] === "/" ? 2 : 1;
|
|
926
|
-
P.current.setSelectionRange(g - j, g - j, "none");
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
};
|
|
930
|
-
return A ? /* @__PURE__ */ ve(
|
|
931
|
-
Le,
|
|
932
|
-
{
|
|
933
|
-
"data-testid": "input-masked",
|
|
934
|
-
ref: P,
|
|
935
|
-
value: E,
|
|
936
|
-
id: M,
|
|
937
|
-
className: H.Input,
|
|
938
|
-
disabled: T,
|
|
939
|
-
mask: "99/99/9999",
|
|
940
|
-
maskChar: "_",
|
|
941
|
-
alwaysShowMask: !1,
|
|
942
|
-
onClick: G,
|
|
943
|
-
onKeyDown: J,
|
|
944
|
-
onChange: (I) => z(I.target.value, M, "keyboard"),
|
|
945
|
-
onAnimationStart: (I) => {
|
|
946
|
-
I.animationName === H["autofill-start"] && V?.call(null, M), I.animationName === H["autofill-cancel"] && (I.currentTarget.blur(), O?.call(null, M));
|
|
947
|
-
},
|
|
948
|
-
onFocus: () => y?.call(null, M),
|
|
949
|
-
onBlur: () => q?.call(null, M)
|
|
950
|
-
}
|
|
951
|
-
) : /* @__PURE__ */ ve(
|
|
952
|
-
"input",
|
|
953
|
-
{
|
|
954
|
-
"data-testid": "input",
|
|
955
|
-
disabled: T,
|
|
956
|
-
maxLength: L,
|
|
957
|
-
type: x,
|
|
958
|
-
id: M,
|
|
959
|
-
name: M,
|
|
960
|
-
value: E,
|
|
961
|
-
className: H.Input,
|
|
962
|
-
onChange: (I) => z(I.target.value, M, "keyboard"),
|
|
963
|
-
onAnimationStart: (I) => {
|
|
964
|
-
I.animationName === H["autofill-start"] && V?.call(null, M), I.animationName === H["autofill-cancel"] && (I.currentTarget.blur(), O?.call(null, M));
|
|
965
|
-
},
|
|
966
|
-
onFocus: () => y?.call(null, M),
|
|
967
|
-
onBlur: () => q?.call(null, M)
|
|
968
|
-
}
|
|
969
|
-
);
|
|
970
|
-
};
|
|
971
|
-
export {
|
|
972
|
-
Te as I,
|
|
973
|
-
Ee as g
|
|
974
|
-
};
|