@lanaco/lnc-react-ui 4.0.13 → 4.0.15

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.
@@ -1,22 +1,22 @@
1
- import { jsxs as ie, jsx as K } from "react/jsx-runtime";
2
- import { P as S } from "./index-BYnWp42a.js";
3
- import j, { forwardRef as oe, useState as ne, useCallback as se } from "react";
1
+ import { jsxs as ie, jsx as L } from "react/jsx-runtime";
2
+ import { P as v } from "./index-BYnWp42a.js";
3
+ import B, { forwardRef as oe, useState as ne, useCallback as se } from "react";
4
4
  import { d as fe } from "./index-CNBqQrtK.js";
5
5
  import { n as G } from "./emotion-styled.browser.esm-BiK8DcgW.js";
6
- import { d as B, a as R, b as le, e as ue, h as W, g as ce } from "./utils-C52T57HO.js";
6
+ import { d as M, a as R, b as le, e as ue, h as W, g as ce } from "./utils-C52T57HO.js";
7
7
  import { u as pe } from "./emotion-element-5486c51c.browser.esm-Bb4VkP8U.js";
8
- function O() {
8
+ function E() {
9
9
  }
10
10
  function de() {
11
11
  return !0;
12
12
  }
13
- function V(a) {
13
+ function I(a) {
14
14
  return !!(a || "").match(/\d/);
15
15
  }
16
- function _(a) {
16
+ function Z(a) {
17
17
  return a == null;
18
18
  }
19
- function Z(a) {
19
+ function _(a) {
20
20
  return a.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
21
21
  }
22
22
  function me(a) {
@@ -46,7 +46,7 @@ function z(a, f) {
46
46
  addNegation: e
47
47
  };
48
48
  }
49
- function ve(a) {
49
+ function ge(a) {
50
50
  if (!a)
51
51
  return a;
52
52
  var f = a[0] === "-";
@@ -62,7 +62,7 @@ function Q(a, f, u) {
62
62
  function q(a, f) {
63
63
  return Array(f + 1).join(a);
64
64
  }
65
- function ge(a) {
65
+ function ve(a) {
66
66
  a += "";
67
67
  var f = a[0] === "-" ? "-" : "";
68
68
  f && (a = a.substring(1));
@@ -76,14 +76,14 @@ function ge(a) {
76
76
  function Se(a, f, u) {
77
77
  if (["", "-"].indexOf(a) !== -1)
78
78
  return a;
79
- var e = a.indexOf(".") !== -1 && f, t = z(a), r = t.beforeDecimal, o = t.afterDecimal, s = t.hasNagation, i = parseFloat("0." + (o || "0")), n = o.length <= f ? "0." + o : i.toFixed(f), l = n.split("."), p = r.split("").reverse().reduce(function(d, g, y) {
80
- return d.length > y ? (Number(d[0]) + Number(g)).toString() + d.substring(1, d.length) : g + d;
79
+ var e = a.indexOf(".") !== -1 && f, t = z(a), r = t.beforeDecimal, o = t.afterDecimal, s = t.hasNagation, i = parseFloat("0." + (o || "0")), n = o.length <= f ? "0." + o : i.toFixed(f), l = n.split("."), p = r.split("").reverse().reduce(function(m, S, x) {
80
+ return m.length > x ? (Number(m[0]) + Number(S)).toString() + m.substring(1, m.length) : S + m;
81
81
  }, l[0]), c = Q(
82
82
  l[1] || "",
83
83
  Math.min(f, o.length),
84
84
  u
85
- ), h = s ? "-" : "", m = e ? "." : "";
86
- return "" + h + p + m + c;
85
+ ), d = s ? "-" : "", h = e ? "." : "";
86
+ return "" + d + p + h + c;
87
87
  }
88
88
  function H(a, f) {
89
89
  if (a.value = a.value, a !== null) {
@@ -101,7 +101,7 @@ function ye(a, f) {
101
101
  e++;
102
102
  return { start: u, end: t - e };
103
103
  }
104
- function L(a, f, u) {
104
+ function K(a, f, u) {
105
105
  return Math.min(Math.max(a, f), u);
106
106
  }
107
107
  function J(a) {
@@ -127,12 +127,12 @@ var Ne = {
127
127
  allowLeadingZeros: !1,
128
128
  isNumericString: !1,
129
129
  type: "text",
130
- onValueChange: O,
131
- onChange: O,
132
- onKeyDown: O,
133
- onMouseUp: O,
134
- onFocus: O,
135
- onBlur: O,
130
+ onValueChange: E,
131
+ onChange: E,
132
+ onKeyDown: E,
133
+ onMouseUp: E,
134
+ onFocus: E,
135
+ onBlur: E,
136
136
  isAllowed: de
137
137
  }, X = /* @__PURE__ */ function(a) {
138
138
  function f(u) {
@@ -161,9 +161,9 @@ var Ne = {
161
161
  var t = this, r = t.props, o = t.state, s = t.focusedElm, i = o.value, n = o.numAsString;
162
162
  if (n === void 0 && (n = ""), e !== r) {
163
163
  this.validateProps();
164
- var l = this.formatNumString(n), p = _(r.value) ? l : this.formatValueProp(), c = this.removeFormatting(p), h = parseFloat(c), m = parseFloat(n);
164
+ var l = this.formatNumString(n), p = Z(r.value) ? l : this.formatValueProp(), c = this.removeFormatting(p), d = parseFloat(c), h = parseFloat(n);
165
165
  //while typing set state only when float value changes
166
- ((!isNaN(h) || !isNaN(m)) && h !== m || //can also set state when float value is same and the format props changes
166
+ ((!isNaN(d) || !isNaN(h)) && d !== h || //can also set state when float value is same and the format props changes
167
167
  l !== i || //set state always when not in focus and formatted value is changed
168
168
  s === null && p !== i) && this.updateValue({
169
169
  formattedValue: p,
@@ -178,11 +178,11 @@ var Ne = {
178
178
  var t = this.props, r = t.decimalScale, o = this.getSeparators(), s = o.decimalSeparator, i = this.getNumberRegex(!0), n = e[0] === "-";
179
179
  n && (e = e.replace("-", "")), s && r === 0 && (e = e.split(s)[0]), e = (e.match(i) || []).join("").replace(s, ".");
180
180
  var l = e.indexOf(".");
181
- return l !== -1 && (e = e.substring(0, l) + "." + e.substring(l + 1, e.length).replace(new RegExp(Z(s), "g"), "")), n && (e = "-" + e), e;
181
+ return l !== -1 && (e = e.substring(0, l) + "." + e.substring(l + 1, e.length).replace(new RegExp(_(s), "g"), "")), n && (e = "-" + e), e;
182
182
  }, f.prototype.getNumberRegex = function(e, t) {
183
183
  var r = this.props, o = r.format, s = r.decimalScale, i = r.customNumerals, n = this.getSeparators(), l = n.decimalSeparator;
184
184
  return new RegExp(
185
- "[0-9" + (i ? i.join("") : "") + "]" + (l && s !== 0 && !t && !o ? "|" + Z(l) : ""),
185
+ "[0-9" + (i ? i.join("") : "") + "]" + (l && s !== 0 && !t && !o ? "|" + _(l) : ""),
186
186
  e ? "g" : void 0
187
187
  );
188
188
  }, f.prototype.getSeparators = function() {
@@ -225,24 +225,24 @@ var Ne = {
225
225
  var o = this.props, s = o.prefix, i = o.suffix, n = o.format;
226
226
  if (e === "")
227
227
  return 0;
228
- if (t = L(t, 0, e.length), !n) {
228
+ if (t = K(t, 0, e.length), !n) {
229
229
  var l = e[0] === "-";
230
- return L(t, s.length + (l ? 1 : 0), e.length - i.length);
230
+ return K(t, s.length + (l ? 1 : 0), e.length - i.length);
231
231
  }
232
- if (typeof n == "function" || n[t] === "#" && V(e[t]) || n[t - 1] === "#" && V(e[t - 1]))
232
+ if (typeof n == "function" || n[t] === "#" && I(e[t]) || n[t - 1] === "#" && I(e[t - 1]))
233
233
  return t;
234
234
  var p = n.indexOf("#"), c = n.lastIndexOf("#");
235
- t = L(t, p, c + 1);
236
- for (var h = n.substring(t, n.length).indexOf("#"), m = t, d = t + (h === -1 ? 0 : h); m > p && (n[m] !== "#" || !V(e[m])); )
237
- m -= 1;
238
- var g = !V(e[d]) || r === "left" && t !== p || t - m < d - t;
239
- return g ? V(e[m]) ? m + 1 : m : d;
235
+ t = K(t, p, c + 1);
236
+ for (var d = n.substring(t, n.length).indexOf("#"), h = t, m = t + (d === -1 ? 0 : d); h > p && (n[h] !== "#" || !I(e[h])); )
237
+ h -= 1;
238
+ var S = !I(e[m]) || r === "left" && t !== p || t - h < m - t;
239
+ return S ? I(e[h]) ? h + 1 : h : m;
240
240
  }, f.prototype.getCaretPosition = function(e, t, r) {
241
- var o = this.props, s = o.format, i = this.state.value, n = this.getNumberRegex(!0), l = (e.match(n) || []).join(""), p = (t.match(n) || []).join(""), c, h;
242
- for (c = 0, h = 0; h < r; h++) {
243
- var m = e[h] || "", d = t[c] || "";
244
- if (!(!m.match(n) && m !== d) && !(m === "0" && d.match(n) && d !== "0" && l.length !== p.length)) {
245
- for (; m !== t[c] && c < t.length; )
241
+ var o = this.props, s = o.format, i = this.state.value, n = this.getNumberRegex(!0), l = (e.match(n) || []).join(""), p = (t.match(n) || []).join(""), c, d;
242
+ for (c = 0, d = 0; d < r; d++) {
243
+ var h = e[d] || "", m = t[c] || "";
244
+ if (!(!h.match(n) && h !== m) && !(h === "0" && m.match(n) && m !== "0" && l.length !== p.length)) {
245
+ for (; h !== t[c] && c < t.length; )
246
246
  c++;
247
247
  c++;
248
248
  }
@@ -258,8 +258,8 @@ var Ne = {
258
258
  }
259
259
  return e;
260
260
  }, f.prototype.removePatternFormatting = function(e) {
261
- for (var t = this.props, r = t.format, o = r.split("#").filter(function(h) {
262
- return h !== "";
261
+ for (var t = this.props, r = t.format, o = r.split("#").filter(function(d) {
262
+ return d !== "";
263
263
  }), s = 0, i = "", n = 0, l = o.length; n <= l; n++) {
264
264
  var p = o[n] || "", c = n === l ? e.length : e.indexOf(p, s);
265
265
  if (c === -1) {
@@ -277,8 +277,8 @@ var Ne = {
277
277
  r[i] === "#" && (s[i] = e[o] || this.getMaskAtIndex(o), o += 1);
278
278
  return s.join("");
279
279
  }, f.prototype.formatAsNumber = function(e) {
280
- var t = this.props, r = t.decimalScale, o = t.fixedDecimalScale, s = t.prefix, i = t.suffix, n = t.allowNegative, l = t.thousandsGroupStyle, p = this.getSeparators(), c = p.thousandSeparator, h = p.decimalSeparator, m = e.indexOf(".") !== -1 || r && o, d = z(e, n), g = d.beforeDecimal, y = d.afterDecimal, x = d.addNegation;
281
- return r !== void 0 && (y = Q(y, r, o)), c && (g = he(g, c, l)), s && (g = s + g), i && (y = y + i), x && (g = "-" + g), e = g + (m && h || "") + y, e;
280
+ var t = this.props, r = t.decimalScale, o = t.fixedDecimalScale, s = t.prefix, i = t.suffix, n = t.allowNegative, l = t.thousandsGroupStyle, p = this.getSeparators(), c = p.thousandSeparator, d = p.decimalSeparator, h = e.indexOf(".") !== -1 || r && o, m = z(e, n), S = m.beforeDecimal, x = m.afterDecimal, b = m.addNegation;
281
+ return r !== void 0 && (x = Q(x, r, o)), c && (S = he(S, c, l)), s && (S = s + S), i && (x = x + i), b && (S = "-" + S), e = S + (h && d || "") + x, e;
282
282
  }, f.prototype.formatNumString = function(e) {
283
283
  e === void 0 && (e = "");
284
284
  var t = this.props, r = t.format, o = t.allowEmptyFormatting, s = t.customNumerals, i = e;
@@ -294,13 +294,13 @@ var Ne = {
294
294
  return e === "" && !o ? i = "" : e === "-" && !r ? i = "-" : typeof r == "string" ? i = this.formatWithPattern(i) : typeof r == "function" ? i = r(i) : i = this.formatAsNumber(i), i;
295
295
  }, f.prototype.formatValueProp = function(e) {
296
296
  var t = this.props, r = t.format, o = t.decimalScale, s = t.fixedDecimalScale, i = t.allowEmptyFormatting, n = this.props, l = n.value, p = n.isNumericString;
297
- l = _(l) ? e : l;
297
+ l = Z(l) ? e : l;
298
298
  var c = !l && l !== 0;
299
299
  if (c && i && (l = ""), c && !i)
300
300
  return "";
301
- typeof l == "number" && (l = ge(l), p = !0), l === "Infinity" && p && (l = ""), p && !r && typeof o == "number" && (l = Se(l, o, s));
302
- var h = p ? this.formatNumString(l) : this.formatInput(l);
303
- return h;
301
+ typeof l == "number" && (l = ve(l), p = !0), l === "Infinity" && p && (l = ""), p && !r && typeof o == "number" && (l = Se(l, o, s));
302
+ var d = p ? this.formatNumString(l) : this.formatInput(l);
303
+ return d;
304
304
  }, f.prototype.formatNegation = function(e) {
305
305
  e === void 0 && (e = "");
306
306
  var t = this.props, r = t.allowNegative, o = new RegExp("(-)"), s = new RegExp("(-)(.)*(-)"), i = o.test(e), n = s.test(e);
@@ -313,73 +313,73 @@ var Ne = {
313
313
  var r = this.props, o = r.format, s = r.prefix, i = r.suffix, n = r.decimalScale, l = r.fixedDecimalScale, p = this.getSeparators(), c = p.decimalSeparator;
314
314
  return !!(typeof o == "string" && o[e] !== "#" || !o && (e < s.length || e >= t.length - i.length || n && l && t[e] === c));
315
315
  }, f.prototype.correctInputValue = function(e, t, r) {
316
- var o = this, s = this.props, i = s.format, n = s.allowNegative, l = s.prefix, p = s.suffix, c = s.decimalScale, h = this.getSeparators(), m = h.allowedDecimalSeparators, d = h.decimalSeparator, g = this.state.numAsString || "", y = this.selectionBeforeInput, x = y.selectionStart, w = y.selectionEnd, P = ye(t, r), v = P.start, N = P.end;
317
- if (!i && v === N && m.indexOf(r[x]) !== -1) {
318
- var F = c === 0 ? "" : d;
319
- return r.substr(0, x) + F + r.substr(x + 1, r.length);
316
+ var o = this, s = this.props, i = s.format, n = s.allowNegative, l = s.prefix, p = s.suffix, c = s.decimalScale, d = this.getSeparators(), h = d.allowedDecimalSeparators, m = d.decimalSeparator, S = this.state.numAsString || "", x = this.selectionBeforeInput, b = x.selectionStart, w = x.selectionEnd, P = ye(t, r), g = P.start, N = P.end;
317
+ if (!i && g === N && h.indexOf(r[b]) !== -1) {
318
+ var F = c === 0 ? "" : m;
319
+ return r.substr(0, b) + F + r.substr(b + 1, r.length);
320
320
  }
321
- var E = i ? 0 : l.length, T = t.length - (i ? 0 : p.length);
321
+ var T = i ? 0 : l.length, $ = t.length - (i ? 0 : p.length);
322
322
  if (
323
323
  // don't do anything if something got added
324
324
  r.length > t.length || // or if the new value is an empty string
325
325
  !r.length || // or if nothing has changed, in which case start will be same as end
326
- v === N || // or in case if whole input is selected and new value is typed
327
- x === 0 && w === t.length || // or in case if the whole content is replaced by browser, example (autocomplete)
328
- v === 0 && N === t.length || // or if charcters between prefix and suffix is selected.
326
+ g === N || // or in case if whole input is selected and new value is typed
327
+ b === 0 && w === t.length || // or in case if the whole content is replaced by browser, example (autocomplete)
328
+ g === 0 && N === t.length || // or if charcters between prefix and suffix is selected.
329
329
  // For numeric inputs we apply the format so, prefix and suffix can be ignored
330
- x === E && w === T
330
+ b === T && w === $
331
331
  )
332
332
  return r;
333
- var I = t.substr(v, N - v), M = !![].concat(I).find(
334
- function(C, $) {
335
- return o.isCharacterAFormat($ + v, t);
333
+ var O = t.substr(g, N - g), j = !![].concat(O).find(
334
+ function(C, V) {
335
+ return o.isCharacterAFormat(V + g, t);
336
336
  }
337
337
  );
338
- if (M) {
339
- var k = t.substr(v), A = {}, b = [];
340
- [].concat(k).forEach(function(C, $) {
341
- o.isCharacterAFormat($ + v, t) ? A[$] = C : $ > I.length - 1 && b.push(C);
338
+ if (j) {
339
+ var k = t.substr(g), A = {}, y = [];
340
+ [].concat(k).forEach(function(C, V) {
341
+ o.isCharacterAFormat(V + g, t) ? A[V] = C : V > O.length - 1 && y.push(C);
342
342
  }), Object.keys(A).forEach(function(C) {
343
- b.length > C ? b.splice(C, 0, A[C]) : b.push(A[C]);
344
- }), r = t.substr(0, v) + b.join("");
343
+ y.length > C ? y.splice(C, 0, A[C]) : y.push(A[C]);
344
+ }), r = t.substr(0, g) + y.join("");
345
345
  }
346
346
  if (!i) {
347
347
  var D = this.removeFormatting(r), U = z(
348
348
  D,
349
349
  n
350
- ), ee = U.beforeDecimal, te = U.afterDecimal, re = U.addNegation, ae = e < r.indexOf(d) + 1;
351
- if (D.length < g.length && ae && ee === "" && !parseFloat(te))
350
+ ), ee = U.beforeDecimal, te = U.afterDecimal, re = U.addNegation, ae = e < r.indexOf(m) + 1;
351
+ if (D.length < S.length && ae && ee === "" && !parseFloat(te))
352
352
  return re ? "-" : "";
353
353
  }
354
354
  return r;
355
355
  }, f.prototype.updateValue = function(e) {
356
356
  var t = e.formattedValue, r = e.input, o = e.setCaretPosition;
357
357
  o === void 0 && (o = !0);
358
- var s = e.source, i = e.event, n = e.numAsString, l = e.caretPos, p = this.props, c = p.onValueChange, h = this.state, m = h.value;
358
+ var s = e.source, i = e.event, n = e.numAsString, l = e.caretPos, p = this.props, c = p.onValueChange, d = this.state, h = d.value;
359
359
  if (r) {
360
360
  if (l === void 0 && o) {
361
- var d = e.inputValue || r.value, g = J(r);
362
- r.value = t, l = this.getCaretPosition(d, t, g);
361
+ var m = e.inputValue || r.value, S = J(r);
362
+ r.value = t, l = this.getCaretPosition(m, t, S);
363
363
  }
364
364
  r.value = t, o && this.setPatchedCaretPosition(r, l, t);
365
365
  }
366
- n === void 0 && (n = this.removeFormatting(t)), t !== m && (this.setState({ value: t, numAsString: n }), c(this.getValueObject(t, n), { event: i, source: s }));
366
+ n === void 0 && (n = this.removeFormatting(t)), t !== h && (this.setState({ value: t, numAsString: n }), c(this.getValueObject(t, n), { event: i, source: s }));
367
367
  }, f.prototype.onChange = function(e) {
368
368
  var t = e.target, r = t.value, o = this, s = o.state, i = o.props, n = i.isAllowed, l = s.value || "", p = J(t);
369
369
  r = this.correctInputValue(p, l, r);
370
- var c = this.formatInput(r) || "", h = this.removeFormatting(c), m = this.getValueObject(c, h), d = n(m);
371
- d || (c = l), this.updateValue({
370
+ var c = this.formatInput(r) || "", d = this.removeFormatting(c), h = this.getValueObject(c, d), m = n(h);
371
+ m || (c = l), this.updateValue({
372
372
  formattedValue: c,
373
- numAsString: h,
373
+ numAsString: d,
374
374
  inputValue: r,
375
375
  input: t,
376
376
  event: e,
377
377
  source: "event"
378
- }), d && i.onChange(e);
378
+ }), m && i.onChange(e);
379
379
  }, f.prototype.onBlur = function(e) {
380
380
  var t = this, r = t.props, o = t.state, s = r.format, i = r.onBlur, n = r.allowLeadingZeros, l = o.numAsString, p = o.value;
381
381
  if (this.focusedElm = null, clearTimeout(this.focusTimeout), clearTimeout(this.caretPositionTimeout), !s) {
382
- isNaN(parseFloat(l)) && (l = ""), n || (l = ve(l));
382
+ isNaN(parseFloat(l)) && (l = ""), n || (l = ge(l));
383
383
  var c = this.formatNumString(l);
384
384
  if (c !== p) {
385
385
  this.updateValue({
@@ -397,38 +397,38 @@ var Ne = {
397
397
  }, f.prototype.onKeyDown = function(e) {
398
398
  var t = e.target, r = e.key, o = t.selectionStart, s = t.selectionEnd, i = t.value;
399
399
  i === void 0 && (i = "");
400
- var n, l = this.props, p = l.decimalScale, c = l.fixedDecimalScale, h = l.prefix, m = l.suffix, d = l.format, g = l.onKeyDown, y = p !== void 0 && c, x = this.getNumberRegex(!1, y), w = new RegExp("-"), P = typeof d == "string";
400
+ var n, l = this.props, p = l.decimalScale, c = l.fixedDecimalScale, d = l.prefix, h = l.suffix, m = l.format, S = l.onKeyDown, x = p !== void 0 && c, b = this.getNumberRegex(!1, x), w = new RegExp("-"), P = typeof m == "string";
401
401
  if (this.selectionBeforeInput = {
402
402
  selectionStart: o,
403
403
  selectionEnd: s
404
404
  }, r === "ArrowLeft" || r === "Backspace" ? n = o - 1 : r === "ArrowRight" ? n = o + 1 : r === "Delete" && (n = o), n === void 0 || o !== s) {
405
- g(e);
405
+ S(e);
406
406
  return;
407
407
  }
408
- var v = n, N = P ? d.indexOf("#") : h.length, F = P ? d.lastIndexOf("#") + 1 : i.length - m.length;
408
+ var g = n, N = P ? m.indexOf("#") : d.length, F = P ? m.lastIndexOf("#") + 1 : i.length - h.length;
409
409
  if (r === "ArrowLeft" || r === "ArrowRight") {
410
- var E = r === "ArrowLeft" ? "left" : "right";
411
- v = this.correctCaretPosition(i, n, E);
412
- } else if (r === "Delete" && !x.test(i[n]) && !w.test(i[n]))
413
- for (; !x.test(i[v]) && v < F; )
414
- v++;
415
- else if (r === "Backspace" && !x.test(i[n])) {
416
- if (o <= N + 1 && i[0] === "-" && typeof d > "u") {
417
- var T = i.substring(1);
410
+ var T = r === "ArrowLeft" ? "left" : "right";
411
+ g = this.correctCaretPosition(i, n, T);
412
+ } else if (r === "Delete" && !b.test(i[n]) && !w.test(i[n]))
413
+ for (; !b.test(i[g]) && g < F; )
414
+ g++;
415
+ else if (r === "Backspace" && !b.test(i[n])) {
416
+ if (o <= N + 1 && i[0] === "-" && typeof m > "u") {
417
+ var $ = i.substring(1);
418
418
  this.updateValue({
419
- formattedValue: T,
420
- caretPos: v,
419
+ formattedValue: $,
420
+ caretPos: g,
421
421
  input: t,
422
422
  event: e,
423
423
  source: "event"
424
424
  });
425
425
  } else if (!w.test(i[n])) {
426
- for (; !x.test(i[v - 1]) && v > N; )
427
- v--;
428
- v = this.correctCaretPosition(i, v, "left");
426
+ for (; !b.test(i[g - 1]) && g > N; )
427
+ g--;
428
+ g = this.correctCaretPosition(i, g, "left");
429
429
  }
430
430
  }
431
- (v !== n || n < N || n > F) && (e.preventDefault(), this.setPatchedCaretPosition(t, v, i)), e.isUnitTestRun && this.setPatchedCaretPosition(t, v, i), g(e);
431
+ (g !== n || n < N || n > F) && (e.preventDefault(), this.setPatchedCaretPosition(t, g, i)), e.isUnitTestRun && this.setPatchedCaretPosition(t, g, i), S(e);
432
432
  }, f.prototype.onMouseUp = function(e) {
433
433
  var t = e.target, r = t.selectionStart, o = t.selectionEnd, s = t.value;
434
434
  if (s === void 0 && (s = ""), r === o) {
@@ -447,9 +447,9 @@ var Ne = {
447
447
  }, f.prototype.render = function() {
448
448
  var e = this.props, t = e.type, r = e.displayType, o = e.customInput, s = e.renderText, i = e.getInputRef, n = e.format;
449
449
  e.thousandSeparator, e.decimalSeparator, e.allowedDecimalSeparators, e.thousandsGroupStyle, e.decimalScale, e.fixedDecimalScale, e.prefix, e.suffix, e.removeFormatting, e.mask, e.defaultValue, e.isNumericString, e.allowNegative, e.allowEmptyFormatting, e.allowLeadingZeros, e.onValueChange, e.isAllowed, e.customNumerals, e.onChange, e.onKeyDown, e.onMouseUp, e.onFocus, e.onBlur, e.value;
450
- var l = be(e, ["type", "displayType", "customInput", "renderText", "getInputRef", "format", "thousandSeparator", "decimalSeparator", "allowedDecimalSeparators", "thousandsGroupStyle", "decimalScale", "fixedDecimalScale", "prefix", "suffix", "removeFormatting", "mask", "defaultValue", "isNumericString", "allowNegative", "allowEmptyFormatting", "allowLeadingZeros", "onValueChange", "isAllowed", "customNumerals", "onChange", "onKeyDown", "onMouseUp", "onFocus", "onBlur", "value"]), p = l, c = this.state, h = c.value, m = c.mounted, d = m && xe(n) ? "numeric" : void 0, g = Object.assign({ inputMode: d }, p, {
450
+ var l = be(e, ["type", "displayType", "customInput", "renderText", "getInputRef", "format", "thousandSeparator", "decimalSeparator", "allowedDecimalSeparators", "thousandsGroupStyle", "decimalScale", "fixedDecimalScale", "prefix", "suffix", "removeFormatting", "mask", "defaultValue", "isNumericString", "allowNegative", "allowEmptyFormatting", "allowLeadingZeros", "onValueChange", "isAllowed", "customNumerals", "onChange", "onKeyDown", "onMouseUp", "onFocus", "onBlur", "value"]), p = l, c = this.state, d = c.value, h = c.mounted, m = h && xe(n) ? "numeric" : void 0, S = Object.assign({ inputMode: m }, p, {
451
451
  type: t,
452
- value: h,
452
+ value: d,
453
453
  onChange: this.onChange,
454
454
  onKeyDown: this.onKeyDown,
455
455
  onMouseUp: this.onMouseUp,
@@ -457,25 +457,25 @@ var Ne = {
457
457
  onBlur: this.onBlur
458
458
  });
459
459
  if (r === "text")
460
- return s ? s(h, p) || null : j.createElement(
460
+ return s ? s(d, p) || null : B.createElement(
461
461
  "span",
462
462
  Object.assign({}, p, { ref: i }),
463
- h
463
+ d
464
464
  );
465
465
  if (o) {
466
- var y = o;
467
- return j.createElement(y, Object.assign({}, g, { ref: i }));
466
+ var x = o;
467
+ return B.createElement(x, Object.assign({}, S, { ref: i }));
468
468
  }
469
- return j.createElement("input", Object.assign({}, g, { ref: i }));
469
+ return B.createElement("input", Object.assign({}, S, { ref: i }));
470
470
  }, f;
471
- }(j.Component);
471
+ }(B.Component);
472
472
  X.defaultProps = Ne;
473
473
  const we = G.div`
474
474
  display: flex;
475
475
  align-items: center;
476
476
 
477
- min-height: ${(a) => B(a.theme, a.size)};
478
- max-height: ${(a) => B(a.theme, a.size)};
477
+ min-height: ${(a) => M(a.theme, a.size)};
478
+ max-height: ${(a) => M(a.theme, a.size)};
479
479
  background-color: ${(a) => R(
480
480
  a.theme,
481
481
  "Input",
@@ -512,8 +512,8 @@ const we = G.div`
512
512
  width: 100%;
513
513
 
514
514
  ${(a) => ce(a.theme, "Input", a.size, "enabled")}
515
- min-height: ${(a) => B(a.theme, a.size)};
516
- max-height: ${(a) => B(a.theme, a.size)};
515
+ min-height: ${(a) => M(a.theme, a.size)};
516
+ max-height: ${(a) => M(a.theme, a.size)};
517
517
  color: ${(a) => R(
518
518
  a.theme,
519
519
  "Input",
@@ -557,7 +557,7 @@ const we = G.div`
557
557
  const {
558
558
  disabled: u,
559
559
  readOnly: e,
560
- debounceTime: t = 180,
560
+ debounceTime: t = 0,
561
561
  prefix: r,
562
562
  suffix: o,
563
563
  thousandSeparator: s = ".",
@@ -567,52 +567,52 @@ const we = G.div`
567
567
  allowNegative: p = !0,
568
568
  //----------------
569
569
  onChange: c,
570
- onKeyDown: h,
571
- onBlur: m,
572
- onFocus: d,
570
+ onBlur: d,
571
+ onFocus: h,
572
+ onInputChange: m,
573
573
  //----------------
574
- className: g = "",
575
- style: y = {},
576
- size: x = "small",
574
+ className: S = "",
575
+ style: x = {},
576
+ size: b = "small",
577
577
  color: w = "primary",
578
578
  ...P
579
- } = a, v = pe(), [N, F] = ne(!1), E = se(
580
- fe((b, D) => T(b, D), t),
579
+ } = a, g = pe(), [N, F] = ne(!1), T = se(
580
+ fe((y, D) => $(y, D), t),
581
581
  [c]
582
- ), T = (b, D) => {
583
- c && (c == null || c(b, D));
584
- }, I = (b, D) => {
585
- E(D.event, _value);
586
- }, M = () => n < 0 ? 0 : n > 17 ? 17 : n, k = (b) => {
587
- F(!0), d == null || d(b);
588
- }, A = (b) => {
589
- F(!1), m == null || m(b);
582
+ ), $ = (y, D) => {
583
+ c && (c == null || c(y, D)), m == null || m(y, D);
584
+ }, O = (y, D) => {
585
+ T(D.event, y == null ? void 0 : y.floatValue);
586
+ }, j = () => n < 0 ? 0 : n > 17 ? 17 : n, k = (y) => {
587
+ F(!0), h == null || h(y);
588
+ }, A = (y) => {
589
+ F(!1), d == null || d(y);
590
590
  };
591
591
  return /* @__PURE__ */ ie(
592
592
  we,
593
593
  {
594
- style: y,
595
- className: g,
596
- theme: v,
594
+ style: x,
595
+ className: S,
596
+ theme: g,
597
597
  color: w,
598
- size: x,
598
+ size: b,
599
599
  prefix: r,
600
600
  suffix: o,
601
601
  focused: N,
602
602
  disabled: u,
603
603
  readOnly: e,
604
604
  children: [
605
- r && /* @__PURE__ */ K(
605
+ r && /* @__PURE__ */ L(
606
606
  Y,
607
607
  {
608
- theme: v,
608
+ theme: g,
609
609
  color: w,
610
610
  focused: N,
611
611
  className: "lnc-input-prefix",
612
612
  children: r
613
613
  }
614
614
  ),
615
- /* @__PURE__ */ K(
615
+ /* @__PURE__ */ L(
616
616
  X,
617
617
  {
618
618
  getInputRef: f,
@@ -621,19 +621,19 @@ const we = G.div`
621
621
  readOnly: e,
622
622
  thousandSeparator: s,
623
623
  decimalSeparator: i,
624
- decimalScale: M(),
624
+ decimalScale: j(),
625
625
  fixedDecimalScale: l,
626
626
  allowNegative: p,
627
627
  onFocus: k,
628
628
  onBlur: A,
629
- onValueChange: I,
629
+ onValueChange: O,
630
630
  ...P
631
631
  }
632
632
  ),
633
- o && /* @__PURE__ */ K(
633
+ o && /* @__PURE__ */ L(
634
634
  De,
635
635
  {
636
- theme: v,
636
+ theme: g,
637
637
  color: w,
638
638
  focused: N,
639
639
  className: "lnc-input-suffix",
@@ -645,43 +645,47 @@ const we = G.div`
645
645
  );
646
646
  });
647
647
  Ce.propTypes = {
648
- id: S.string,
649
- value: S.any,
650
- defaultValue: S.any,
651
- disabled: S.bool,
652
- readOnly: S.bool,
653
- debounceTime: S.number,
648
+ id: v.string,
649
+ value: v.any,
650
+ defaultValue: v.any,
651
+ disabled: v.bool,
652
+ readOnly: v.bool,
653
+ debounceTime: v.number,
654
654
  /**
655
655
  * Reserved space before input. Intented to be used with plain text or `Icon` component.
656
656
  */
657
- prefix: S.oneOfType([S.string, S.element]),
657
+ prefix: v.oneOfType([v.string, v.element]),
658
658
  /**
659
659
  * Reserved space after input. Intented to be used with plain text or `Icon` component.
660
660
  */
661
- suffix: S.oneOfType([S.string, S.element]),
662
- thousandSeparator: S.oneOf([".", ",", " "]),
663
- decimalSeparator: S.oneOf([".", ","]),
664
- decimalScale: S.number,
665
- fixedDecimalScale: S.bool,
666
- allowNegative: S.bool,
661
+ suffix: v.oneOfType([v.string, v.element]),
662
+ thousandSeparator: v.oneOf([".", ",", " "]),
663
+ decimalSeparator: v.oneOf([".", ","]),
664
+ decimalScale: v.number,
665
+ fixedDecimalScale: v.bool,
666
+ allowNegative: v.bool,
667
667
  //----------------
668
668
  /**
669
669
  * `(event, value) => void`
670
670
  */
671
- onChange: S.func,
671
+ onChange: v.func,
672
+ /**
673
+ * `(event, value) => void`
674
+ */
675
+ onInputChange: v.func,
672
676
  /**
673
677
  * `(event) => void`
674
678
  */
675
- onBlur: S.func,
679
+ onBlur: v.func,
676
680
  /**
677
681
  * `(event) => void`
678
682
  */
679
- onFocus: S.func,
683
+ onFocus: v.func,
680
684
  //----------------
681
- className: S.string,
682
- style: S.object,
683
- size: S.oneOf(["small", "medium", "large"]),
684
- color: S.oneOf([
685
+ className: v.string,
686
+ style: v.object,
687
+ size: v.oneOf(["small", "medium", "large"]),
688
+ color: v.oneOf([
685
689
  "primary",
686
690
  "secondary",
687
691
  "success",
@@ -0,0 +1,48 @@
1
+ "use strict";const g=require("react/jsx-runtime"),o=require("./index-BIlhCoy2.cjs"),d=require("react"),C=require("./emotion-styled.browser.esm-Cbp_XsK4.cjs"),s=require("./utils-DTAPpJXU.cjs"),H=require("./emotion-element-5486c51c.browser.esm-QRQ5FSjv.cjs"),J=C.newStyled.div`
2
+ display: flex;
3
+ align-items: center;
4
+
5
+ min-height: ${e=>s.getSizeValueWithUnits(e.theme,e.size)};
6
+ max-height: ${e=>s.getSizeValueWithUnits(e.theme,e.size)};
7
+ background-color: ${e=>s.getColorRgbaValue(e.theme,"Input",e.color,"enabled","background")};
8
+ border: 1px solid
9
+ ${e=>s.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","border")};
10
+ border-radius: ${e=>s.getBorderRadiusValueWithUnits(e.theme,"regular")};
11
+
12
+ ${e=>e.focused===!0&&e.readOnly!==!0?s.getOutlineCss(e.theme):""}
13
+ ${e=>e.isDisabled===!0?s.getDisabledStateCss(e.theme):""}
14
+ ${e=>e.isDisabled===!0?"border: 1px solid "+s.getColorRgbaValue(e.theme,"Input",e.color,"disabled","border"):""}
15
+
16
+ & input {
17
+ background: none;
18
+ border: none;
19
+ outline: none;
20
+ padding-top: 0.625rem;
21
+ padding-bottom: 0.625rem;
22
+ width: 100%;
23
+
24
+ ${e=>s.getComponentTypographyCss(e.theme,"Input",e.size,"enabled")}
25
+ min-height: ${e=>s.getSizeValueWithUnits(e.theme,e.size)};
26
+ max-height: ${e=>s.getSizeValueWithUnits(e.theme,e.size)};
27
+ color: ${e=>s.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","text")};
28
+ caret-color: ${e=>s.getColorRgbaValue(e.theme,"Input",e.color,"enabled","caret")};
29
+ padding-right: ${e=>e.suffix?"0":"0.75rem"};
30
+ padding-left: ${e=>e.prefix?"0":"0.75rem"};
31
+ }
32
+
33
+ & input:disabled {
34
+ ${e=>s.getDisabledStateCss(e.theme)}
35
+ background: none;
36
+ }
37
+
38
+ & input:read-only {
39
+ cursor: default;
40
+ }
41
+
42
+ & input::placeholder {
43
+ color: ${e=>s.getColorRgbaValue(e.theme,"Input",e.color,"enabled","placeholder")};
44
+ }
45
+ `,R=C.newStyled.span`
46
+ padding: 0 12px;
47
+ color: ${e=>s.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","prefix")};
48
+ `,L=C.newStyled(R)``,k=d.forwardRef((e,O)=>{const{disabled:V,readOnly:j,prefix:h,suffix:y,decimalSeparator:c=",",decimalScale:a=2,allowNegative:D=!0,onKeyDown:S=()=>{},onBlur:m=()=>{},onFocus:f=()=>{},onChange:q=()=>{},value:b,className:W="",style:U={},size:v="small",color:T="primary",onInputChange:B=()=>{},...K}=e,x=H.useTheme(),[P,z]=d.useState(!1),I=r=>{var n,u;if(!isNaN(+r)){const i=(n=r==null?void 0:r.toString())==null?void 0:n.split(".");if(!(i!=null&&i.length)>0)return"0"+c+new Array(a+1).join("0");if((i==null?void 0:i.length)===1)return i.at(0)+c+new Array(a+1).join("0");if((i==null?void 0:i.length)>1){let t=(u=i==null?void 0:i.at(1))==null?void 0:u.toString();if((t==null?void 0:t.length)===a)return i.at(0)+c+t;if((t==null?void 0:t.length)<a)return i.at(0)+c+i.at(1)+new Array(a-t.length+1).join("0");if((t==null?void 0:t.length)>a)return i.at(0)+c+t.slice(0,a)}}return"0"+c+new Array(a+1).join("0")},N=I(b),[_,p]=d.useState(N),l=d.useRef(N);d.useEffect(()=>{const r=I(b);l.current=r,p(l.current)},[b]);const F=r=>{z(!0),f==null||f(r)},E=r=>{z(!1),m==null||m(r)},G=r=>{var u,i;let n=(u=l.current)==null?void 0:u.replace(c,"");if(r.key==="Delete"||r.key==="Backspace"){if(+n!=0){n=n.slice(0,(n==null?void 0:n.length)-1);let t=n.slice(0,(n==null?void 0:n.length)-a),w=n.slice((n==null?void 0:n.length)-a);(t==null?void 0:t.length)===0?t="0":t==="-"&&+n!=0?t="-0":t==="-"&&+n==0&&(t="0");let $=[t,c,w].join("");l.current=$,p(l.current)}}else if(r.key==="-"&&D===!0&&+n!=0)((i=l==null?void 0:l.current)==null?void 0:i.slice(1))==="-"?l.current=l.current.slice(1,l.current.length):l.current="-"+l.current,p(l.current);else if(!isNaN(r.key)){n=n+r.key;let t=n.slice(0,(n==null?void 0:n.length)-a),w=n.slice((n==null?void 0:n.length)-a);(t==null?void 0:t.length)>1&&(t=t.replace(/^0+/,""),(t==null?void 0:t.length)===0&&(t="0"));let $=[t,c,w].join("");l.current=$,p(l.current)}S(r)};return g.jsxs(J,{style:U,className:W,theme:x,color:T,size:v,prefix:h,suffix:y,focused:P,disabled:V,readOnly:j,children:[h&&g.jsx(R,{theme:x,color:T,focused:P,className:"lnc-input-prefix",children:h}),g.jsx("input",{ref:O,type:"text",...K,onKeyDown:G,onBlur:E,value:_,className:"lnc-ui-decimal-v2-input",onFocus:F,disabled:V||j,onChange:r=>{B(r),q(r)}}),y&&g.jsx(L,{theme:x,color:T,focused:P,className:"lnc-input-suffix",children:y})]})});k.propTypes={id:o.PropTypes.string,value:o.PropTypes.any,defaultValue:o.PropTypes.any,disabled:o.PropTypes.bool,readOnly:o.PropTypes.bool,debounceTime:o.PropTypes.number,prefix:o.PropTypes.oneOfType([o.PropTypes.string,o.PropTypes.element]),suffix:o.PropTypes.oneOfType([o.PropTypes.string,o.PropTypes.element]),thousandSeparator:o.PropTypes.oneOf([".",","," "]),decimalSeparator:o.PropTypes.oneOf([".",","]),decimalScale:o.PropTypes.number,fixedDecimalScale:o.PropTypes.bool,allowNegative:o.PropTypes.bool,onChange:o.PropTypes.func,onInputChange:o.PropTypes.func,onBlur:o.PropTypes.func,onFocus:o.PropTypes.func,onKeyDown:o.PropTypes.func,className:o.PropTypes.string,style:o.PropTypes.object,size:o.PropTypes.oneOf(["small","medium","large"]),color:o.PropTypes.oneOf(["primary","secondary","success","danger","warning","information","neutral","gray"])};module.exports=k;