@lanaco/lnc-react-ui 4.0.105 → 4.0.106
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/Accordion.cjs +1 -1
- package/dist/Accordion.js +1 -1
- package/dist/AccordionSummary.cjs +1 -1
- package/dist/AccordionSummary.js +1 -1
- package/dist/ActionsToolbar.cjs +1 -1
- package/dist/ActionsToolbar.js +1 -1
- package/dist/Alert.cjs +1 -1
- package/dist/Alert.js +1 -1
- package/dist/Avatar.cjs +1 -1
- package/dist/Avatar.js +1 -1
- package/dist/Badge.cjs +1 -1
- package/dist/Badge.js +1 -1
- package/dist/BannerSectionCarousel.cjs +1 -1
- package/dist/BannerSectionCarousel.js +1 -1
- package/dist/BannerSectionWithList.cjs +1 -1
- package/dist/BannerSectionWithList.js +1 -1
- package/dist/BlogCardsSponsoredSection.cjs +1 -1
- package/dist/BlogCardsSponsoredSection.js +3 -3
- package/dist/BlogCategoryCardsSection.cjs +1 -1
- package/dist/BlogCategoryCardsSection.js +1 -1
- package/dist/BlogListSection.cjs +1 -1
- package/dist/BlogListSection.js +3 -3
- package/dist/BlogProductCardsSection.cjs +1 -1
- package/dist/BlogProductCardsSection.js +2 -2
- package/dist/BlogShopCardsSection.cjs +1 -1
- package/dist/BlogShopCardsSection.js +1 -1
- package/dist/BlogSingleSection.cjs +1 -1
- package/dist/BlogSingleSection.js +2 -2
- package/dist/BlogsSectionDetailed.cjs +1 -1
- package/dist/BlogsSectionDetailed.js +3 -3
- package/dist/BlogsSectionLarge.cjs +1 -1
- package/dist/BlogsSectionLarge.js +2 -2
- package/dist/BlogsSectionSimple.cjs +1 -1
- package/dist/BlogsSectionSimple.js +3 -3
- package/dist/BlogsSectionSimpleCentered.cjs +1 -1
- package/dist/BlogsSectionSimpleCentered.js +2 -2
- package/dist/BlogsSectionWithFilters.cjs +1 -1
- package/dist/BlogsSectionWithFilters.js +4 -4
- package/dist/BrandHitsSection.cjs +1 -1
- package/dist/BrandHitsSection.js +1 -1
- package/dist/Breadcrumbs.cjs +1 -1
- package/dist/Breadcrumbs.js +1 -1
- package/dist/Button.cjs +6 -4
- package/dist/Button.js +12 -3
- package/dist/ButtonGroup.cjs +1 -1
- package/dist/ButtonGroup.js +1 -1
- package/dist/CalorieCalculatorSection.cjs +1 -1
- package/dist/CalorieCalculatorSection.js +1 -1
- package/dist/CheckBoxInput.cjs +1 -1
- package/dist/CheckBoxInput.js +1 -1
- package/dist/Chip.cjs +1 -1
- package/dist/Chip.js +1 -1
- package/dist/ColorInput.cjs +10 -6
- package/dist/ColorInput.js +117 -87
- package/dist/ConfirmationForm.cjs +1 -1
- package/dist/ConfirmationForm.js +1 -1
- package/dist/CustomLoanMapSection.cjs +1 -1
- package/dist/CustomLoanMapSection.js +1 -1
- package/dist/{CustomStyles-DYULk9y7.js → CustomStyles-Dd8IsVV6.js} +1 -1
- package/dist/{CustomStyles-Uqkz9jDo.cjs → CustomStyles-DtKDPOdk.cjs} +1 -1
- package/dist/DateInput.cjs +1 -1
- package/dist/DateInput.js +1 -1
- package/dist/DecimalInput.cjs +28 -24
- package/dist/DecimalInput.js +315 -285
- package/dist/DecimalInputV2.cjs +23 -19
- package/dist/DecimalInputV2.js +124 -94
- package/dist/DetailedProductsSection.cjs +1 -1
- package/dist/DetailedProductsSection.js +4 -4
- package/dist/DetailsView.cjs +1 -1
- package/dist/DetailsView.js +1 -1
- package/dist/DoubleRangeSlider.cjs +1 -1
- package/dist/DoubleRangeSlider.js +1 -1
- package/dist/DragAndDropFile.cjs +1 -1
- package/dist/DragAndDropFile.js +1 -1
- package/dist/DragDropFiles.cjs +1 -1
- package/dist/DragDropFiles.js +1 -1
- package/dist/Drawer.cjs +1 -1
- package/dist/Drawer.js +1 -1
- package/dist/Dropdown.cjs +1 -1
- package/dist/Dropdown.js +2 -2
- package/dist/DropdownItem.cjs +1 -1
- package/dist/DropdownItem.js +1 -1
- package/dist/DropdownLookup.cjs +1 -1
- package/dist/DropdownLookup.js +1 -1
- package/dist/DropdownMenu.cjs +1 -1
- package/dist/DropdownMenu.js +1 -1
- package/dist/EditableTable.cjs +1 -1
- package/dist/EditableTable.js +1 -1
- package/dist/FeedbackSection.cjs +1 -1
- package/dist/FeedbackSection.js +1 -1
- package/dist/FieldOfInterestsMasonrySection.cjs +1 -1
- package/dist/FieldOfInterestsMasonrySection.js +1 -1
- package/dist/FieldOfInterestsWithAvatarsCardsSection.cjs +1 -1
- package/dist/FieldOfInterestsWithAvatarsCardsSection.js +2 -2
- package/dist/FieldOfInterestsWithTagsCardsSection.cjs +1 -1
- package/dist/FieldOfInterestsWithTagsCardsSection.js +1 -1
- package/dist/FileInput.cjs +25 -20
- package/dist/FileInput.js +86 -55
- package/dist/FlexGridItem.cjs +1 -1
- package/dist/FlexGridItem.js +1 -1
- package/dist/FormField.cjs +1 -1
- package/dist/FormField.js +1 -1
- package/dist/FormView.cjs +1 -1
- package/dist/FormView.js +1 -1
- package/dist/GeneralWithTagsCardsSection.cjs +1 -1
- package/dist/GeneralWithTagsCardsSection.js +1 -1
- package/dist/GiftCardsSection.cjs +1 -1
- package/dist/GiftCardsSection.js +2 -2
- package/dist/Icon.cjs +1 -1
- package/dist/Icon.js +1 -1
- package/dist/IconButton.cjs +1 -1
- package/dist/IconButton.js +1 -1
- package/dist/Kanban.cjs +1 -1
- package/dist/Kanban.js +1 -1
- package/dist/KanbanActionsToolbar.cjs +1 -1
- package/dist/KanbanActionsToolbar.js +1 -1
- package/dist/KanbanView.cjs +1 -1
- package/dist/KanbanView.js +1 -1
- package/dist/Link.cjs +1 -1
- package/dist/Link.js +1 -1
- package/dist/LoanCalculatorSection.cjs +1 -1
- package/dist/LoanCalculatorSection.js +1 -1
- package/dist/LocationFinderSection.cjs +1 -1
- package/dist/LocationFinderSection.js +1 -1
- package/dist/LocationSearchSection.cjs +1 -1
- package/dist/LocationSearchSection.js +1 -1
- package/dist/MasonryGeneralCardsSection.cjs +1 -1
- package/dist/MasonryGeneralCardsSection.js +1 -1
- package/dist/MenuItem.cjs +1 -1
- package/dist/MenuItem.js +1 -1
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.js +1 -1
- package/dist/MultiSelectDropdown.cjs +1 -1
- package/dist/MultiSelectDropdown.js +1 -1
- package/dist/MultiSelectDropdownLookup.cjs +1 -1
- package/dist/MultiSelectDropdownLookup.js +1 -1
- package/dist/NestedDropdownItem.cjs +1 -1
- package/dist/NestedDropdownItem.js +1 -1
- package/dist/NestedMenuItem.cjs +1 -1
- package/dist/NestedMenuItem.js +1 -1
- package/dist/NotificationContainer.cjs +1 -1
- package/dist/NotificationContainer.js +1 -1
- package/dist/NotificationMessage.cjs +1 -1
- package/dist/NotificationMessage.js +1 -1
- package/dist/NumberInput.cjs +23 -19
- package/dist/NumberInput.js +116 -86
- package/dist/OverlayGeneralCardsSection.cjs +1 -1
- package/dist/OverlayGeneralCardsSection.js +2 -2
- package/dist/PasswordInput.cjs +23 -19
- package/dist/PasswordInput.js +94 -64
- package/dist/PopoverContent.cjs +1 -1
- package/dist/PopoverContent.js +1 -1
- package/dist/ProductsWithBannerSection.cjs +1 -1
- package/dist/ProductsWithBannerSection.js +3 -3
- package/dist/ProgressBar.cjs +1 -1
- package/dist/ProgressBar.js +1 -1
- package/dist/QuattroCardsSection.cjs +1 -1
- package/dist/QuattroCardsSection.js +1 -1
- package/dist/QuizSection.cjs +1 -1
- package/dist/QuizSection.js +1 -1
- package/dist/RadioInput.cjs +1 -1
- package/dist/RadioInput.js +1 -1
- package/dist/RangeSlider.cjs +8 -8
- package/dist/RangeSlider.js +19 -17
- package/dist/ReviewsSection.cjs +1 -1
- package/dist/ReviewsSection.js +2 -2
- package/dist/SalesCampaignsSection.cjs +1 -1
- package/dist/SalesCampaignsSection.js +1 -1
- package/dist/Separator.cjs +1 -1
- package/dist/Separator.js +1 -1
- package/dist/ShopCardsSection.cjs +1 -1
- package/dist/ShopCardsSection.js +2 -2
- package/dist/Sidebar.cjs +1 -1
- package/dist/Sidebar.js +1 -1
- package/dist/SimpleCategoriesSection.cjs +1 -1
- package/dist/SimpleCategoriesSection.js +3 -3
- package/dist/SimpleProductsSection.cjs +1 -1
- package/dist/SimpleProductsSection.js +2 -2
- package/dist/Spinner.cjs +1 -1
- package/dist/Spinner.js +1 -1
- package/dist/Surface.cjs +1 -1
- package/dist/Surface.js +1 -1
- package/dist/SwipeableDrawer.cjs +1 -1
- package/dist/SwipeableDrawer.js +1 -1
- package/dist/TabItem.cjs +1 -1
- package/dist/TabItem.js +1 -1
- package/dist/Table.cjs +1 -1
- package/dist/Table.js +1 -1
- package/dist/TableView.cjs +1 -1
- package/dist/TableView.js +1 -1
- package/dist/TextAreaInput.cjs +15 -12
- package/dist/TextAreaInput.js +70 -54
- package/dist/TextInput.cjs +23 -19
- package/dist/TextInput.js +90 -60
- package/dist/ThemeProvider.cjs +1 -1
- package/dist/ThemeProvider.js +1 -1
- package/dist/TimeInput.cjs +7 -5
- package/dist/TimeInput.js +47 -32
- package/dist/Toggle.cjs +1 -1
- package/dist/Toggle.js +1 -1
- package/dist/TreeMenuSeparator.cjs +1 -1
- package/dist/TreeMenuSeparator.js +1 -1
- package/dist/UploadedFile.cjs +1 -1
- package/dist/UploadedFile.js +1 -1
- package/dist/UrgentSaleProductsSection.cjs +1 -1
- package/dist/UrgentSaleProductsSection.js +1 -1
- package/dist/{index-C4gGt12B.cjs → index-B30K8mkW.cjs} +1 -1
- package/dist/{index-Kx8irvHH.js → index-BBMleFo5.js} +1 -1
- package/dist/{index-BRgZcjpI.cjs → index-BvSNRLNa.cjs} +1 -1
- package/dist/{index-C_T-BQ5p.cjs → index-C1DkD2ug.cjs} +1 -1
- package/dist/{index-DMysapsB.cjs → index-C9GK00PM.cjs} +1 -1
- package/dist/{index-Dcw6ecHw.js → index-CEI_JOki.js} +2 -2
- package/dist/{index-BPgWhA1t.js → index-CQLF61YV.js} +1 -1
- package/dist/{index-Cru8Sd2q.js → index-CTJpJFtr.js} +2 -2
- package/dist/{index-DZDz9qZP.cjs → index-Cg4t3q_p.cjs} +1 -1
- package/dist/{index-D86vS9UF.js → index-YGcWbzeb.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{skeleton-BrUEdt6Z.js → skeleton-CkTNgaA3.js} +2 -2
- package/dist/{skeleton-BcaMeKFQ.cjs → skeleton-CoErfoMc.cjs} +1 -1
- package/dist/{skeleton-TrselJrj.js → skeleton-DWZNwK33.js} +1 -1
- package/dist/{skeleton-DwZzdFei.cjs → skeleton-DdlE-y3C.cjs} +1 -1
- package/dist/{style-LEmcTrN9.js → style-08foMKSd.js} +1 -1
- package/dist/{style-Bjk6yHcP.cjs → style-JqDQj4jh.cjs} +1 -1
- package/dist/{suspense-categories-card-simple-B2swGa6t.cjs → suspense-categories-card-simple-B5zd-nnm.cjs} +1 -1
- package/dist/{suspense-categories-card-simple-BCn3U1cz.js → suspense-categories-card-simple-Ds6hXZKt.js} +1 -1
- package/dist/{suspense-large-DgzTM-qh.js → suspense-large-BM9s_kZP.js} +1 -1
- package/dist/{suspense-large-DMhn-lIG.cjs → suspense-large-CtcwWswP.cjs} +1 -1
- package/dist/{suspense-product-card-detailed-BNOhu3Z4.cjs → suspense-product-card-detailed-DXwya4fQ.cjs} +1 -1
- package/dist/{suspense-product-card-detailed-BDkww9pS.js → suspense-product-card-detailed-bYBpLiXc.js} +2 -2
- package/dist/{suspense-product-card-simple-BxDjW7gR.cjs → suspense-product-card-simple-Ba1UPqgy.cjs} +1 -1
- package/dist/{suspense-product-card-simple-CQ1qPZOa.js → suspense-product-card-simple-ib6FLerL.js} +1 -1
- package/dist/{utils-BXCGNjIy.js → utils-BbgAIA9N.js} +51 -13
- package/dist/utils-CZynEOC_.cjs +51 -0
- package/package.json +1 -1
- package/dist/utils-BWzf4vLl.cjs +0 -51
package/dist/DecimalInput.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { jsxs as ie, jsx as L } from "react/jsx-runtime";
|
|
2
2
|
import { P as v } from "./index-S5Cd7WrG.js";
|
|
3
|
-
import
|
|
3
|
+
import k, { forwardRef as oe, useState as ne, useCallback as se } from "react";
|
|
4
4
|
import { d as fe } from "./index-CkWvbrVT.js";
|
|
5
5
|
import { s as G } from "./emotion-styled.browser.esm-BNN1dTl3.js";
|
|
6
|
-
import { d as
|
|
6
|
+
import { d as B, b as w, a as le, e as ue, h as W, c as ce } from "./utils-BbgAIA9N.js";
|
|
7
7
|
import { u as pe } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js";
|
|
8
|
-
function
|
|
8
|
+
function A() {
|
|
9
9
|
}
|
|
10
10
|
function de() {
|
|
11
11
|
return !0;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return !!(
|
|
13
|
+
function O(r) {
|
|
14
|
+
return !!(r || "").match(/\d/);
|
|
15
15
|
}
|
|
16
|
-
function Z(
|
|
17
|
-
return
|
|
16
|
+
function Z(r) {
|
|
17
|
+
return r == null;
|
|
18
18
|
}
|
|
19
|
-
function _(
|
|
20
|
-
return
|
|
19
|
+
function _(r) {
|
|
20
|
+
return r.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
|
|
21
21
|
}
|
|
22
|
-
function me(
|
|
23
|
-
switch (
|
|
22
|
+
function me(r) {
|
|
23
|
+
switch (r) {
|
|
24
24
|
case "lakh":
|
|
25
25
|
return /(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;
|
|
26
26
|
case "wan":
|
|
@@ -30,89 +30,89 @@ function me(a) {
|
|
|
30
30
|
return /(\d)(?=(\d{3})+(?!\d))/g;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
function he(
|
|
34
|
-
var e = me(u), t =
|
|
35
|
-
return t = t === -1 ?
|
|
33
|
+
function he(r, s, u) {
|
|
34
|
+
var e = me(u), t = r.search(/[1-9]/);
|
|
35
|
+
return t = t === -1 ? r.length : t, r.substring(0, t) + r.substring(t, r.length).replace(e, "$1" + s);
|
|
36
36
|
}
|
|
37
|
-
function z(
|
|
38
|
-
|
|
39
|
-
var u =
|
|
40
|
-
|
|
41
|
-
var t =
|
|
37
|
+
function z(r, s) {
|
|
38
|
+
s === void 0 && (s = !0);
|
|
39
|
+
var u = r[0] === "-", e = u && s;
|
|
40
|
+
r = r.replace("-", "");
|
|
41
|
+
var t = r.split("."), a = t[0], o = t[1] || "";
|
|
42
42
|
return {
|
|
43
|
-
beforeDecimal:
|
|
43
|
+
beforeDecimal: a,
|
|
44
44
|
afterDecimal: o,
|
|
45
45
|
hasNagation: u,
|
|
46
46
|
addNegation: e
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
function ge(
|
|
50
|
-
if (!
|
|
51
|
-
return
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
var u =
|
|
55
|
-
return (
|
|
49
|
+
function ge(r) {
|
|
50
|
+
if (!r)
|
|
51
|
+
return r;
|
|
52
|
+
var s = r[0] === "-";
|
|
53
|
+
s && (r = r.substring(1, r.length));
|
|
54
|
+
var u = r.split("."), e = u[0].replace(/^0+/, "") || "0", t = u[1] || "";
|
|
55
|
+
return (s ? "-" : "") + e + (t ? "." + t : "");
|
|
56
56
|
}
|
|
57
|
-
function Q(
|
|
58
|
-
for (var e = "", t = u ? "0" : "",
|
|
59
|
-
e += a
|
|
57
|
+
function Q(r, s, u) {
|
|
58
|
+
for (var e = "", t = u ? "0" : "", a = 0; a <= s - 1; a++)
|
|
59
|
+
e += r[a] || t;
|
|
60
60
|
return e;
|
|
61
61
|
}
|
|
62
|
-
function q(
|
|
63
|
-
return Array(
|
|
62
|
+
function q(r, s) {
|
|
63
|
+
return Array(s + 1).join(r);
|
|
64
64
|
}
|
|
65
|
-
function ve(
|
|
66
|
-
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
var u =
|
|
65
|
+
function ve(r) {
|
|
66
|
+
r += "";
|
|
67
|
+
var s = r[0] === "-" ? "-" : "";
|
|
68
|
+
s && (r = r.substring(1));
|
|
69
|
+
var u = r.split(/[eE]/g), e = u[0], t = u[1];
|
|
70
70
|
if (t = Number(t), !t)
|
|
71
|
-
return
|
|
71
|
+
return s + e;
|
|
72
72
|
e = e.replace(".", "");
|
|
73
|
-
var
|
|
74
|
-
return
|
|
73
|
+
var a = 1 + t, o = e.length;
|
|
74
|
+
return a < 0 ? e = "0." + q("0", Math.abs(a)) + e : a >= o ? e = e + q("0", a - o) : e = (e.substring(0, a) || "0") + "." + e.substring(a), s + e;
|
|
75
75
|
}
|
|
76
|
-
function Se(
|
|
77
|
-
if (["", "-"].indexOf(
|
|
78
|
-
return
|
|
79
|
-
var e =
|
|
76
|
+
function Se(r, s, u) {
|
|
77
|
+
if (["", "-"].indexOf(r) !== -1)
|
|
78
|
+
return r;
|
|
79
|
+
var e = r.indexOf(".") !== -1 && s, t = z(r), a = t.beforeDecimal, o = t.afterDecimal, f = t.hasNagation, i = parseFloat("0." + (o || "0")), n = o.length <= s ? "0." + o : i.toFixed(s), l = n.split("."), p = a.split("").reverse().reduce(function(m, S, x) {
|
|
80
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
|
-
Math.min(
|
|
83
|
+
Math.min(s, o.length),
|
|
84
84
|
u
|
|
85
|
-
), d =
|
|
85
|
+
), d = f ? "-" : "", h = e ? "." : "";
|
|
86
86
|
return "" + d + p + h + c;
|
|
87
87
|
}
|
|
88
|
-
function H(
|
|
89
|
-
if (
|
|
90
|
-
if (
|
|
91
|
-
var u =
|
|
92
|
-
return u.move("character",
|
|
88
|
+
function H(r, s) {
|
|
89
|
+
if (r.value = r.value, r !== null) {
|
|
90
|
+
if (r.createTextRange) {
|
|
91
|
+
var u = r.createTextRange();
|
|
92
|
+
return u.move("character", s), u.select(), !0;
|
|
93
93
|
}
|
|
94
|
-
return
|
|
94
|
+
return r.selectionStart || r.selectionStart === 0 ? (r.focus(), r.setSelectionRange(s, s), !0) : (r.focus(), !1);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
function ye(
|
|
98
|
-
for (var u = 0, e = 0, t =
|
|
97
|
+
function ye(r, s) {
|
|
98
|
+
for (var u = 0, e = 0, t = r.length, a = s.length; r[u] === s[u] && u < t; )
|
|
99
99
|
u++;
|
|
100
|
-
for (;
|
|
100
|
+
for (; r[t - 1 - e] === s[a - 1 - e] && a - e > u && t - e > u; )
|
|
101
101
|
e++;
|
|
102
102
|
return { start: u, end: t - e };
|
|
103
103
|
}
|
|
104
|
-
function K(
|
|
105
|
-
return Math.min(Math.max(
|
|
104
|
+
function K(r, s, u) {
|
|
105
|
+
return Math.min(Math.max(r, s), u);
|
|
106
106
|
}
|
|
107
|
-
function J(
|
|
108
|
-
return Math.max(
|
|
107
|
+
function J(r) {
|
|
108
|
+
return Math.max(r.selectionStart, r.selectionEnd);
|
|
109
109
|
}
|
|
110
|
-
function xe(
|
|
111
|
-
return
|
|
110
|
+
function xe(r) {
|
|
111
|
+
return r || typeof navigator < "u" && !(navigator.platform && /iPhone|iPod/.test(navigator.platform));
|
|
112
112
|
}
|
|
113
|
-
function be(
|
|
113
|
+
function be(r, s) {
|
|
114
114
|
var u = {};
|
|
115
|
-
for (var e in
|
|
115
|
+
for (var e in r) Object.prototype.hasOwnProperty.call(r, e) && s.indexOf(e) === -1 && (u[e] = r[e]);
|
|
116
116
|
return u;
|
|
117
117
|
}
|
|
118
118
|
var Ne = {
|
|
@@ -127,16 +127,16 @@ var Ne = {
|
|
|
127
127
|
allowLeadingZeros: !1,
|
|
128
128
|
isNumericString: !1,
|
|
129
129
|
type: "text",
|
|
130
|
-
onValueChange:
|
|
131
|
-
onChange:
|
|
132
|
-
onKeyDown:
|
|
133
|
-
onMouseUp:
|
|
134
|
-
onFocus:
|
|
135
|
-
onBlur:
|
|
130
|
+
onValueChange: A,
|
|
131
|
+
onChange: A,
|
|
132
|
+
onKeyDown: A,
|
|
133
|
+
onMouseUp: A,
|
|
134
|
+
onFocus: A,
|
|
135
|
+
onBlur: A,
|
|
136
136
|
isAllowed: de
|
|
137
|
-
}, X = /* @__PURE__ */ function(
|
|
138
|
-
function
|
|
139
|
-
|
|
137
|
+
}, X = /* @__PURE__ */ function(r) {
|
|
138
|
+
function s(u) {
|
|
139
|
+
r.call(this, u);
|
|
140
140
|
var e = u.defaultValue;
|
|
141
141
|
this.validateProps();
|
|
142
142
|
var t = this.formatValueProp(e);
|
|
@@ -149,65 +149,65 @@ var Ne = {
|
|
|
149
149
|
selectionEnd: 0
|
|
150
150
|
}, this.onChange = this.onChange.bind(this), this.onKeyDown = this.onKeyDown.bind(this), this.onMouseUp = this.onMouseUp.bind(this), this.onFocus = this.onFocus.bind(this), this.onBlur = this.onBlur.bind(this);
|
|
151
151
|
}
|
|
152
|
-
return
|
|
152
|
+
return r && (s.__proto__ = r), s.prototype = Object.create(r && r.prototype), s.prototype.constructor = s, s.prototype.componentDidMount = function() {
|
|
153
153
|
this.setState({
|
|
154
154
|
mounted: !0
|
|
155
155
|
});
|
|
156
|
-
},
|
|
156
|
+
}, s.prototype.componentDidUpdate = function(e) {
|
|
157
157
|
this.updateValueIfRequired(e);
|
|
158
|
-
},
|
|
158
|
+
}, s.prototype.componentWillUnmount = function() {
|
|
159
159
|
clearTimeout(this.focusTimeout), clearTimeout(this.caretPositionTimeout);
|
|
160
|
-
},
|
|
161
|
-
var t = this,
|
|
162
|
-
if (n === void 0 && (n = ""), e !==
|
|
160
|
+
}, s.prototype.updateValueIfRequired = function(e) {
|
|
161
|
+
var t = this, a = t.props, o = t.state, f = t.focusedElm, i = o.value, n = o.numAsString;
|
|
162
|
+
if (n === void 0 && (n = ""), e !== a) {
|
|
163
163
|
this.validateProps();
|
|
164
|
-
var l = this.formatNumString(n), p = Z(
|
|
164
|
+
var l = this.formatNumString(n), p = Z(a.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
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
|
+
f === null && p !== i) && this.updateValue({
|
|
169
169
|
formattedValue: p,
|
|
170
170
|
numAsString: c,
|
|
171
|
-
input:
|
|
171
|
+
input: f,
|
|
172
172
|
source: "prop",
|
|
173
173
|
event: null
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
|
-
},
|
|
176
|
+
}, s.prototype.getFloatString = function(e) {
|
|
177
177
|
e === void 0 && (e = "");
|
|
178
|
-
var t = this.props,
|
|
179
|
-
n && (e = e.replace("-", "")),
|
|
178
|
+
var t = this.props, a = t.decimalScale, o = this.getSeparators(), f = o.decimalSeparator, i = this.getNumberRegex(!0), n = e[0] === "-";
|
|
179
|
+
n && (e = e.replace("-", "")), f && a === 0 && (e = e.split(f)[0]), e = (e.match(i) || []).join("").replace(f, ".");
|
|
180
180
|
var l = e.indexOf(".");
|
|
181
|
-
return l !== -1 && (e = e.substring(0, l) + "." + e.substring(l + 1, e.length).replace(new RegExp(_(
|
|
182
|
-
},
|
|
183
|
-
var
|
|
181
|
+
return l !== -1 && (e = e.substring(0, l) + "." + e.substring(l + 1, e.length).replace(new RegExp(_(f), "g"), "")), n && (e = "-" + e), e;
|
|
182
|
+
}, s.prototype.getNumberRegex = function(e, t) {
|
|
183
|
+
var a = this.props, o = a.format, f = a.decimalScale, i = a.customNumerals, n = this.getSeparators(), l = n.decimalSeparator;
|
|
184
184
|
return new RegExp(
|
|
185
|
-
"[0-9" + (i ? i.join("") : "") + "]" + (l &&
|
|
185
|
+
"[0-9" + (i ? i.join("") : "") + "]" + (l && f !== 0 && !t && !o ? "|" + _(l) : ""),
|
|
186
186
|
e ? "g" : void 0
|
|
187
187
|
);
|
|
188
|
-
},
|
|
189
|
-
var e = this.props, t = e.decimalSeparator,
|
|
190
|
-
return o === !0 && (o = ","),
|
|
188
|
+
}, s.prototype.getSeparators = function() {
|
|
189
|
+
var e = this.props, t = e.decimalSeparator, a = this.props, o = a.thousandSeparator, f = a.allowedDecimalSeparators;
|
|
190
|
+
return o === !0 && (o = ","), f || (f = [t, "."]), {
|
|
191
191
|
decimalSeparator: t,
|
|
192
192
|
thousandSeparator: o,
|
|
193
|
-
allowedDecimalSeparators:
|
|
193
|
+
allowedDecimalSeparators: f
|
|
194
194
|
};
|
|
195
|
-
},
|
|
196
|
-
var t = this.props,
|
|
197
|
-
return
|
|
198
|
-
},
|
|
199
|
-
var
|
|
195
|
+
}, s.prototype.getMaskAtIndex = function(e) {
|
|
196
|
+
var t = this.props, a = t.mask;
|
|
197
|
+
return a === void 0 && (a = " "), typeof a == "string" ? a : a[e] || " ";
|
|
198
|
+
}, s.prototype.getValueObject = function(e, t) {
|
|
199
|
+
var a = parseFloat(t);
|
|
200
200
|
return {
|
|
201
201
|
formattedValue: e,
|
|
202
202
|
value: t,
|
|
203
|
-
floatValue: isNaN(
|
|
203
|
+
floatValue: isNaN(a) ? void 0 : a
|
|
204
204
|
};
|
|
205
|
-
},
|
|
206
|
-
var e = this.props, t = e.mask,
|
|
207
|
-
if (o ===
|
|
205
|
+
}, s.prototype.validateProps = function() {
|
|
206
|
+
var e = this.props, t = e.mask, a = this.getSeparators(), o = a.decimalSeparator, f = a.thousandSeparator;
|
|
207
|
+
if (o === f)
|
|
208
208
|
throw new Error(`
|
|
209
209
|
Decimal separator can't be same as thousand separator.
|
|
210
|
-
thousandSeparator: ` +
|
|
210
|
+
thousandSeparator: ` + f + ` (thousandSeparator = {true} is same as thousandSeparator = ",")
|
|
211
211
|
decimalSeparator: ` + o + ` (default value for decimalSeparator is .)
|
|
212
212
|
`);
|
|
213
213
|
if (t) {
|
|
@@ -217,29 +217,29 @@ var Ne = {
|
|
|
217
217
|
Mask ` + t + ` should not contain numeric character;
|
|
218
218
|
`);
|
|
219
219
|
}
|
|
220
|
-
},
|
|
220
|
+
}, s.prototype.setPatchedCaretPosition = function(e, t, a) {
|
|
221
221
|
H(e, t), this.caretPositionTimeout = setTimeout(function() {
|
|
222
|
-
e.value ===
|
|
222
|
+
e.value === a && H(e, t);
|
|
223
223
|
}, 0);
|
|
224
|
-
},
|
|
225
|
-
var o = this.props,
|
|
224
|
+
}, s.prototype.correctCaretPosition = function(e, t, a) {
|
|
225
|
+
var o = this.props, f = o.prefix, i = o.suffix, n = o.format;
|
|
226
226
|
if (e === "")
|
|
227
227
|
return 0;
|
|
228
228
|
if (t = K(t, 0, e.length), !n) {
|
|
229
229
|
var l = e[0] === "-";
|
|
230
|
-
return K(t,
|
|
230
|
+
return K(t, f.length + (l ? 1 : 0), e.length - i.length);
|
|
231
231
|
}
|
|
232
|
-
if (typeof n == "function" || n[t] === "#" &&
|
|
232
|
+
if (typeof n == "function" || n[t] === "#" && O(e[t]) || n[t - 1] === "#" && O(e[t - 1]))
|
|
233
233
|
return t;
|
|
234
234
|
var p = n.indexOf("#"), c = n.lastIndexOf("#");
|
|
235
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] !== "#" || !
|
|
236
|
+
for (var d = n.substring(t, n.length).indexOf("#"), h = t, m = t + (d === -1 ? 0 : d); h > p && (n[h] !== "#" || !O(e[h])); )
|
|
237
237
|
h -= 1;
|
|
238
|
-
var S = !
|
|
239
|
-
return S ?
|
|
240
|
-
},
|
|
241
|
-
var o = this.props,
|
|
242
|
-
for (c = 0, d = 0; d <
|
|
238
|
+
var S = !O(e[m]) || a === "left" && t !== p || t - h < m - t;
|
|
239
|
+
return S ? O(e[h]) ? h + 1 : h : m;
|
|
240
|
+
}, s.prototype.getCaretPosition = function(e, t, a) {
|
|
241
|
+
var o = this.props, f = 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 < a; d++) {
|
|
243
243
|
var h = e[d] || "", m = t[c] || "";
|
|
244
244
|
if (!(!h.match(n) && h !== m) && !(h === "0" && m.match(n) && m !== "0" && l.length !== p.length)) {
|
|
245
245
|
for (; h !== t[c] && c < t.length; )
|
|
@@ -247,138 +247,138 @@ var Ne = {
|
|
|
247
247
|
c++;
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
|
-
return typeof
|
|
251
|
-
},
|
|
252
|
-
var t = this.props,
|
|
253
|
-
if (!
|
|
250
|
+
return typeof f == "string" && !i && (c = t.length), c = this.correctCaretPosition(t, c), c;
|
|
251
|
+
}, s.prototype.removePrefixAndSuffix = function(e) {
|
|
252
|
+
var t = this.props, a = t.format, o = t.prefix, f = t.suffix;
|
|
253
|
+
if (!a && e) {
|
|
254
254
|
var i = e[0] === "-";
|
|
255
255
|
i && (e = e.substring(1, e.length)), e = o && e.indexOf(o) === 0 ? e.substring(o.length, e.length) : e;
|
|
256
|
-
var n = e.lastIndexOf(
|
|
257
|
-
e =
|
|
256
|
+
var n = e.lastIndexOf(f);
|
|
257
|
+
e = f && n !== -1 && n === e.length - f.length ? e.substring(0, n) : e, i && (e = "-" + e);
|
|
258
258
|
}
|
|
259
259
|
return e;
|
|
260
|
-
},
|
|
261
|
-
for (var t = this.props,
|
|
260
|
+
}, s.prototype.removePatternFormatting = function(e) {
|
|
261
|
+
for (var t = this.props, a = t.format, o = a.split("#").filter(function(d) {
|
|
262
262
|
return d !== "";
|
|
263
|
-
}),
|
|
264
|
-
var p = o[n] || "", c = n === l ? e.length : e.indexOf(p,
|
|
263
|
+
}), f = 0, i = "", n = 0, l = o.length; n <= l; n++) {
|
|
264
|
+
var p = o[n] || "", c = n === l ? e.length : e.indexOf(p, f);
|
|
265
265
|
if (c === -1) {
|
|
266
266
|
i = e;
|
|
267
267
|
break;
|
|
268
268
|
} else
|
|
269
|
-
i += e.substring(
|
|
269
|
+
i += e.substring(f, c), f = c + p.length;
|
|
270
270
|
}
|
|
271
271
|
return (i.match(this.getNumberRegex(!0)) || []).join("");
|
|
272
|
-
},
|
|
273
|
-
var t = this.props,
|
|
274
|
-
return e && (
|
|
275
|
-
},
|
|
276
|
-
for (var t = this.props,
|
|
277
|
-
|
|
278
|
-
return
|
|
279
|
-
},
|
|
280
|
-
var t = this.props,
|
|
281
|
-
return
|
|
282
|
-
},
|
|
272
|
+
}, s.prototype.removeFormatting = function(e) {
|
|
273
|
+
var t = this.props, a = t.format, o = t.removeFormatting;
|
|
274
|
+
return e && (a ? typeof a == "string" ? e = this.removePatternFormatting(e) : typeof o == "function" ? e = o(e) : e = (e.match(this.getNumberRegex(!0)) || []).join("") : (e = this.removePrefixAndSuffix(e), e = this.getFloatString(e)), e);
|
|
275
|
+
}, s.prototype.formatWithPattern = function(e) {
|
|
276
|
+
for (var t = this.props, a = t.format, o = 0, f = a.split(""), i = 0, n = a.length; i < n; i++)
|
|
277
|
+
a[i] === "#" && (f[i] = e[o] || this.getMaskAtIndex(o), o += 1);
|
|
278
|
+
return f.join("");
|
|
279
|
+
}, s.prototype.formatAsNumber = function(e) {
|
|
280
|
+
var t = this.props, a = t.decimalScale, o = t.fixedDecimalScale, f = t.prefix, i = t.suffix, n = t.allowNegative, l = t.thousandsGroupStyle, p = this.getSeparators(), c = p.thousandSeparator, d = p.decimalSeparator, h = e.indexOf(".") !== -1 || a && o, m = z(e, n), S = m.beforeDecimal, x = m.afterDecimal, b = m.addNegation;
|
|
281
|
+
return a !== void 0 && (x = Q(x, a, o)), c && (S = he(S, c, l)), f && (S = f + S), i && (x = x + i), b && (S = "-" + S), e = S + (h && d || "") + x, e;
|
|
282
|
+
}, s.prototype.formatNumString = function(e) {
|
|
283
283
|
e === void 0 && (e = "");
|
|
284
|
-
var t = this.props,
|
|
285
|
-
if (
|
|
286
|
-
var n = new RegExp("[" +
|
|
284
|
+
var t = this.props, a = t.format, o = t.allowEmptyFormatting, f = t.customNumerals, i = e;
|
|
285
|
+
if (f && f.length === 10) {
|
|
286
|
+
var n = new RegExp("[" + f.join("") + "]", "g");
|
|
287
287
|
i = e.replace(
|
|
288
288
|
n,
|
|
289
289
|
function(l) {
|
|
290
|
-
return
|
|
290
|
+
return f.indexOf(l).toString();
|
|
291
291
|
}
|
|
292
292
|
);
|
|
293
293
|
}
|
|
294
|
-
return e === "" && !o ? i = "" : e === "-" && !
|
|
295
|
-
},
|
|
296
|
-
var t = this.props,
|
|
294
|
+
return e === "" && !o ? i = "" : e === "-" && !a ? i = "-" : typeof a == "string" ? i = this.formatWithPattern(i) : typeof a == "function" ? i = a(i) : i = this.formatAsNumber(i), i;
|
|
295
|
+
}, s.prototype.formatValueProp = function(e) {
|
|
296
|
+
var t = this.props, a = t.format, o = t.decimalScale, f = t.fixedDecimalScale, i = t.allowEmptyFormatting, n = this.props, l = n.value, p = n.isNumericString;
|
|
297
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 = ve(l), p = !0), l === "Infinity" && p && (l = ""), p && !
|
|
301
|
+
typeof l == "number" && (l = ve(l), p = !0), l === "Infinity" && p && (l = ""), p && !a && typeof o == "number" && (l = Se(l, o, f));
|
|
302
302
|
var d = p ? this.formatNumString(l) : this.formatInput(l);
|
|
303
303
|
return d;
|
|
304
|
-
},
|
|
304
|
+
}, s.prototype.formatNegation = function(e) {
|
|
305
305
|
e === void 0 && (e = "");
|
|
306
|
-
var t = this.props,
|
|
307
|
-
return e = e.replace(/-/g, ""), i && !n &&
|
|
308
|
-
},
|
|
306
|
+
var t = this.props, a = t.allowNegative, o = new RegExp("(-)"), f = new RegExp("(-)(.)*(-)"), i = o.test(e), n = f.test(e);
|
|
307
|
+
return e = e.replace(/-/g, ""), i && !n && a && (e = "-" + e), e;
|
|
308
|
+
}, s.prototype.formatInput = function(e) {
|
|
309
309
|
e === void 0 && (e = "");
|
|
310
|
-
var t = this.props,
|
|
311
|
-
return
|
|
312
|
-
},
|
|
313
|
-
var
|
|
314
|
-
return !!(typeof o == "string" && o[e] !== "#" || !o && (e <
|
|
315
|
-
},
|
|
316
|
-
var o = this,
|
|
317
|
-
if (!i && g === N && h.indexOf(
|
|
318
|
-
var
|
|
319
|
-
return
|
|
310
|
+
var t = this.props, a = t.format;
|
|
311
|
+
return a || (e = this.removePrefixAndSuffix(e), e = this.formatNegation(e)), e = this.removeFormatting(e), this.formatNumString(e);
|
|
312
|
+
}, s.prototype.isCharacterAFormat = function(e, t) {
|
|
313
|
+
var a = this.props, o = a.format, f = a.prefix, i = a.suffix, n = a.decimalScale, l = a.fixedDecimalScale, p = this.getSeparators(), c = p.decimalSeparator;
|
|
314
|
+
return !!(typeof o == "string" && o[e] !== "#" || !o && (e < f.length || e >= t.length - i.length || n && l && t[e] === c));
|
|
315
|
+
}, s.prototype.correctInputValue = function(e, t, a) {
|
|
316
|
+
var o = this, f = this.props, i = f.format, n = f.allowNegative, l = f.prefix, p = f.suffix, c = f.decimalScale, d = this.getSeparators(), h = d.allowedDecimalSeparators, m = d.decimalSeparator, S = this.state.numAsString || "", x = this.selectionBeforeInput, b = x.selectionStart, D = x.selectionEnd, F = ye(t, a), g = F.start, N = F.end;
|
|
317
|
+
if (!i && g === N && h.indexOf(a[b]) !== -1) {
|
|
318
|
+
var $ = c === 0 ? "" : m;
|
|
319
|
+
return a.substr(0, b) + $ + a.substr(b + 1, a.length);
|
|
320
320
|
}
|
|
321
|
-
var
|
|
321
|
+
var E = i ? 0 : l.length, I = t.length - (i ? 0 : p.length);
|
|
322
322
|
if (
|
|
323
323
|
// don't do anything if something got added
|
|
324
|
-
|
|
325
|
-
!
|
|
324
|
+
a.length > t.length || // or if the new value is an empty string
|
|
325
|
+
!a.length || // or if nothing has changed, in which case start will be same as end
|
|
326
326
|
g === N || // or in case if whole input is selected and new value is typed
|
|
327
|
-
b === 0 &&
|
|
327
|
+
b === 0 && D === t.length || // or in case if the whole content is replaced by browser, example (autocomplete)
|
|
328
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
|
-
b ===
|
|
330
|
+
b === E && D === I
|
|
331
331
|
)
|
|
332
|
-
return
|
|
333
|
-
var
|
|
334
|
-
function(
|
|
335
|
-
return o.isCharacterAFormat(
|
|
332
|
+
return a;
|
|
333
|
+
var V = t.substr(g, N - g), M = !![].concat(V).find(
|
|
334
|
+
function(P, T) {
|
|
335
|
+
return o.isCharacterAFormat(T + g, t);
|
|
336
336
|
}
|
|
337
337
|
);
|
|
338
|
-
if (
|
|
339
|
-
var
|
|
340
|
-
[].concat(
|
|
341
|
-
o.isCharacterAFormat(
|
|
342
|
-
}), Object.keys(
|
|
343
|
-
y.length >
|
|
344
|
-
}),
|
|
338
|
+
if (M) {
|
|
339
|
+
var j = t.substr(g), R = {}, y = [];
|
|
340
|
+
[].concat(j).forEach(function(P, T) {
|
|
341
|
+
o.isCharacterAFormat(T + g, t) ? R[T] = P : T > V.length - 1 && y.push(P);
|
|
342
|
+
}), Object.keys(R).forEach(function(P) {
|
|
343
|
+
y.length > P ? y.splice(P, 0, R[P]) : y.push(R[P]);
|
|
344
|
+
}), a = t.substr(0, g) + y.join("");
|
|
345
345
|
}
|
|
346
346
|
if (!i) {
|
|
347
|
-
var
|
|
348
|
-
|
|
347
|
+
var C = this.removeFormatting(a), U = z(
|
|
348
|
+
C,
|
|
349
349
|
n
|
|
350
|
-
), ee = U.beforeDecimal, te = U.afterDecimal, re = U.addNegation, ae = e <
|
|
351
|
-
if (
|
|
350
|
+
), ee = U.beforeDecimal, te = U.afterDecimal, re = U.addNegation, ae = e < a.indexOf(m) + 1;
|
|
351
|
+
if (C.length < S.length && ae && ee === "" && !parseFloat(te))
|
|
352
352
|
return re ? "-" : "";
|
|
353
353
|
}
|
|
354
|
-
return
|
|
355
|
-
},
|
|
356
|
-
var t = e.formattedValue,
|
|
354
|
+
return a;
|
|
355
|
+
}, s.prototype.updateValue = function(e) {
|
|
356
|
+
var t = e.formattedValue, a = e.input, o = e.setCaretPosition;
|
|
357
357
|
o === void 0 && (o = !0);
|
|
358
|
-
var
|
|
359
|
-
if (
|
|
358
|
+
var f = e.source, i = e.event, n = e.numAsString, l = e.caretPos, p = this.props, c = p.onValueChange, d = this.state, h = d.value;
|
|
359
|
+
if (a) {
|
|
360
360
|
if (l === void 0 && o) {
|
|
361
|
-
var m = e.inputValue ||
|
|
362
|
-
|
|
361
|
+
var m = e.inputValue || a.value, S = J(a);
|
|
362
|
+
a.value = t, l = this.getCaretPosition(m, t, S);
|
|
363
363
|
}
|
|
364
|
-
|
|
364
|
+
a.value = t, o && this.setPatchedCaretPosition(a, l, t);
|
|
365
365
|
}
|
|
366
|
-
n === void 0 && (n = this.removeFormatting(t)), t !== h && (this.setState({ value: t, numAsString: n }), c(this.getValueObject(t, n), { event: i, source:
|
|
367
|
-
},
|
|
368
|
-
var t = e.target,
|
|
369
|
-
|
|
370
|
-
var c = this.formatInput(
|
|
366
|
+
n === void 0 && (n = this.removeFormatting(t)), t !== h && (this.setState({ value: t, numAsString: n }), c(this.getValueObject(t, n), { event: i, source: f }));
|
|
367
|
+
}, s.prototype.onChange = function(e) {
|
|
368
|
+
var t = e.target, a = t.value, o = this, f = o.state, i = o.props, n = i.isAllowed, l = f.value || "", p = J(t);
|
|
369
|
+
a = this.correctInputValue(p, l, a);
|
|
370
|
+
var c = this.formatInput(a) || "", d = this.removeFormatting(c), h = this.getValueObject(c, d), m = n(h);
|
|
371
371
|
m || (c = l), this.updateValue({
|
|
372
372
|
formattedValue: c,
|
|
373
373
|
numAsString: d,
|
|
374
|
-
inputValue:
|
|
374
|
+
inputValue: a,
|
|
375
375
|
input: t,
|
|
376
376
|
event: e,
|
|
377
377
|
source: "event"
|
|
378
378
|
}), m && i.onChange(e);
|
|
379
|
-
},
|
|
380
|
-
var t = this,
|
|
381
|
-
if (this.focusedElm = null, clearTimeout(this.focusTimeout), clearTimeout(this.caretPositionTimeout), !
|
|
379
|
+
}, s.prototype.onBlur = function(e) {
|
|
380
|
+
var t = this, a = t.props, o = t.state, f = a.format, i = a.onBlur, n = a.allowLeadingZeros, l = o.numAsString, p = o.value;
|
|
381
|
+
if (this.focusedElm = null, clearTimeout(this.focusTimeout), clearTimeout(this.caretPositionTimeout), !f) {
|
|
382
382
|
isNaN(parseFloat(l)) && (l = ""), n || (l = ge(l));
|
|
383
383
|
var c = this.formatNumString(l);
|
|
384
384
|
if (c !== p) {
|
|
@@ -394,58 +394,58 @@ var Ne = {
|
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
i(e);
|
|
397
|
-
},
|
|
398
|
-
var t = e.target,
|
|
397
|
+
}, s.prototype.onKeyDown = function(e) {
|
|
398
|
+
var t = e.target, a = e.key, o = t.selectionStart, f = t.selectionEnd, i = t.value;
|
|
399
399
|
i === void 0 && (i = "");
|
|
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),
|
|
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), D = new RegExp("-"), F = typeof m == "string";
|
|
401
401
|
if (this.selectionBeforeInput = {
|
|
402
402
|
selectionStart: o,
|
|
403
|
-
selectionEnd:
|
|
404
|
-
},
|
|
403
|
+
selectionEnd: f
|
|
404
|
+
}, a === "ArrowLeft" || a === "Backspace" ? n = o - 1 : a === "ArrowRight" ? n = o + 1 : a === "Delete" && (n = o), n === void 0 || o !== f) {
|
|
405
405
|
S(e);
|
|
406
406
|
return;
|
|
407
407
|
}
|
|
408
|
-
var g = n, N =
|
|
409
|
-
if (
|
|
410
|
-
var
|
|
411
|
-
g = this.correctCaretPosition(i, n,
|
|
412
|
-
} else if (
|
|
413
|
-
for (; !b.test(i[g]) && g <
|
|
408
|
+
var g = n, N = F ? m.indexOf("#") : d.length, $ = F ? m.lastIndexOf("#") + 1 : i.length - h.length;
|
|
409
|
+
if (a === "ArrowLeft" || a === "ArrowRight") {
|
|
410
|
+
var E = a === "ArrowLeft" ? "left" : "right";
|
|
411
|
+
g = this.correctCaretPosition(i, n, E);
|
|
412
|
+
} else if (a === "Delete" && !b.test(i[n]) && !D.test(i[n]))
|
|
413
|
+
for (; !b.test(i[g]) && g < $; )
|
|
414
414
|
g++;
|
|
415
|
-
else if (
|
|
415
|
+
else if (a === "Backspace" && !b.test(i[n])) {
|
|
416
416
|
if (o <= N + 1 && i[0] === "-" && typeof m > "u") {
|
|
417
|
-
var
|
|
417
|
+
var I = i.substring(1);
|
|
418
418
|
this.updateValue({
|
|
419
|
-
formattedValue:
|
|
419
|
+
formattedValue: I,
|
|
420
420
|
caretPos: g,
|
|
421
421
|
input: t,
|
|
422
422
|
event: e,
|
|
423
423
|
source: "event"
|
|
424
424
|
});
|
|
425
|
-
} else if (!
|
|
425
|
+
} else if (!D.test(i[n])) {
|
|
426
426
|
for (; !b.test(i[g - 1]) && g > N; )
|
|
427
427
|
g--;
|
|
428
428
|
g = this.correctCaretPosition(i, g, "left");
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
|
-
(g !== n || n < N || n >
|
|
432
|
-
},
|
|
433
|
-
var t = e.target,
|
|
434
|
-
if (
|
|
435
|
-
var i = this.correctCaretPosition(
|
|
436
|
-
i !==
|
|
431
|
+
(g !== n || n < N || n > $) && (e.preventDefault(), this.setPatchedCaretPosition(t, g, i)), e.isUnitTestRun && this.setPatchedCaretPosition(t, g, i), S(e);
|
|
432
|
+
}, s.prototype.onMouseUp = function(e) {
|
|
433
|
+
var t = e.target, a = t.selectionStart, o = t.selectionEnd, f = t.value;
|
|
434
|
+
if (f === void 0 && (f = ""), a === o) {
|
|
435
|
+
var i = this.correctCaretPosition(f, a);
|
|
436
|
+
i !== a && this.setPatchedCaretPosition(t, i, f);
|
|
437
437
|
}
|
|
438
438
|
this.props.onMouseUp(e);
|
|
439
|
-
},
|
|
439
|
+
}, s.prototype.onFocus = function(e) {
|
|
440
440
|
var t = this;
|
|
441
441
|
e.persist(), this.focusedElm = e.target, this.focusTimeout = setTimeout(function() {
|
|
442
|
-
var
|
|
442
|
+
var a = e.target, o = a.selectionStart, f = a.selectionEnd, i = a.value;
|
|
443
443
|
i === void 0 && (i = "");
|
|
444
444
|
var n = t.correctCaretPosition(i, o);
|
|
445
|
-
n !== o && !(o === 0 &&
|
|
445
|
+
n !== o && !(o === 0 && f === i.length) && t.setPatchedCaretPosition(a, n, i), t.props.onFocus(e);
|
|
446
446
|
}, 0);
|
|
447
|
-
},
|
|
448
|
-
var e = this.props, t = e.type,
|
|
447
|
+
}, s.prototype.render = function() {
|
|
448
|
+
var e = this.props, t = e.type, a = e.displayType, o = e.customInput, f = 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
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,
|
|
@@ -456,49 +456,64 @@ var Ne = {
|
|
|
456
456
|
onFocus: this.onFocus,
|
|
457
457
|
onBlur: this.onBlur
|
|
458
458
|
});
|
|
459
|
-
if (
|
|
460
|
-
return
|
|
459
|
+
if (a === "text")
|
|
460
|
+
return f ? f(d, p) || null : k.createElement(
|
|
461
461
|
"span",
|
|
462
462
|
Object.assign({}, p, { ref: i }),
|
|
463
463
|
d
|
|
464
464
|
);
|
|
465
465
|
if (o) {
|
|
466
466
|
var x = o;
|
|
467
|
-
return
|
|
467
|
+
return k.createElement(x, Object.assign({}, S, { ref: i }));
|
|
468
468
|
}
|
|
469
|
-
return
|
|
470
|
-
},
|
|
471
|
-
}(
|
|
469
|
+
return k.createElement("input", Object.assign({}, S, { ref: i }));
|
|
470
|
+
}, s;
|
|
471
|
+
}(k.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: ${(
|
|
478
|
-
max-height: ${(
|
|
479
|
-
background-color: ${(
|
|
480
|
-
|
|
477
|
+
min-height: ${(r) => B(r.theme, r.size)};
|
|
478
|
+
max-height: ${(r) => B(r.theme, r.size)};
|
|
479
|
+
background-color: ${(r) => w(
|
|
480
|
+
r.theme,
|
|
481
481
|
"Input",
|
|
482
|
-
|
|
482
|
+
r.color,
|
|
483
483
|
"enabled",
|
|
484
484
|
"background"
|
|
485
485
|
)};
|
|
486
486
|
border: 1px solid
|
|
487
|
-
${(
|
|
488
|
-
|
|
487
|
+
${(r) => w(
|
|
488
|
+
r.theme,
|
|
489
489
|
"Input",
|
|
490
|
-
|
|
490
|
+
r.focused === !0 ? "primary" : r.color,
|
|
491
491
|
"enabled",
|
|
492
492
|
"border"
|
|
493
493
|
)};
|
|
494
|
-
border-radius: ${(
|
|
494
|
+
border-radius: ${(r) => le(r.theme, "regular")};
|
|
495
495
|
|
|
496
|
-
${(
|
|
497
|
-
${(
|
|
498
|
-
${(
|
|
499
|
-
|
|
496
|
+
${(r) => r.focused === !0 && r.readOnly !== !0 ? ue(r.theme) : ""}
|
|
497
|
+
/* ${(r) => r.isDisabled === !0 ? W(r.theme) : ""} */
|
|
498
|
+
${(r) => r.isDisabled === !0 && `background-color: ${w(
|
|
499
|
+
r.theme,
|
|
500
|
+
"Input",
|
|
501
|
+
r.color,
|
|
502
|
+
"disabled",
|
|
503
|
+
"background",
|
|
504
|
+
"backgroundOpacity"
|
|
505
|
+
)};
|
|
506
|
+
color: ${(s) => w(
|
|
507
|
+
s.theme,
|
|
500
508
|
"Input",
|
|
501
|
-
|
|
509
|
+
s.color,
|
|
510
|
+
"disabled",
|
|
511
|
+
"text"
|
|
512
|
+
)};`}
|
|
513
|
+
${(r) => r.isDisabled === !0 ? "border: 1px solid " + w(
|
|
514
|
+
r.theme,
|
|
515
|
+
"Input",
|
|
516
|
+
r.color,
|
|
502
517
|
"disabled",
|
|
503
518
|
"border"
|
|
504
519
|
) : ""}
|
|
@@ -511,23 +526,38 @@ const we = G.div`
|
|
|
511
526
|
padding-bottom: 0.625rem;
|
|
512
527
|
width: 100%;
|
|
513
528
|
|
|
514
|
-
${(
|
|
515
|
-
min-height: ${(
|
|
516
|
-
max-height: ${(
|
|
517
|
-
color: ${(
|
|
518
|
-
|
|
529
|
+
${(r) => ce(r.theme, "Input", r.size, "enabled")}
|
|
530
|
+
min-height: ${(r) => B(r.theme, r.size)};
|
|
531
|
+
max-height: ${(r) => B(r.theme, r.size)};
|
|
532
|
+
color: ${(r) => w(
|
|
533
|
+
r.theme,
|
|
519
534
|
"Input",
|
|
520
|
-
|
|
535
|
+
r.focused === !0 ? "primary" : r.color,
|
|
521
536
|
"enabled",
|
|
522
537
|
"text"
|
|
523
538
|
)};
|
|
524
|
-
caret-color: ${(
|
|
525
|
-
padding-right: ${(
|
|
526
|
-
padding-left: ${(
|
|
539
|
+
caret-color: ${(r) => w(r.theme, "Input", r.color, "enabled", "caret")};
|
|
540
|
+
padding-right: ${(r) => r.suffix ? "0" : "0.75rem"};
|
|
541
|
+
padding-left: ${(r) => r.prefix ? "0" : "0.75rem"};
|
|
527
542
|
}
|
|
528
543
|
|
|
529
544
|
& input:disabled {
|
|
530
|
-
${(
|
|
545
|
+
/* ${(r) => W(r.theme)} */
|
|
546
|
+
${(r) => `background-color: ${w(
|
|
547
|
+
r.theme,
|
|
548
|
+
"Input",
|
|
549
|
+
r.color,
|
|
550
|
+
"disabled",
|
|
551
|
+
"background",
|
|
552
|
+
"backgroundOpacity"
|
|
553
|
+
)};
|
|
554
|
+
color: ${(s) => w(
|
|
555
|
+
s.theme,
|
|
556
|
+
"Input",
|
|
557
|
+
s.color,
|
|
558
|
+
"disabled",
|
|
559
|
+
"text"
|
|
560
|
+
)};`}
|
|
531
561
|
background: none;
|
|
532
562
|
}
|
|
533
563
|
|
|
@@ -536,31 +566,31 @@ const we = G.div`
|
|
|
536
566
|
}
|
|
537
567
|
|
|
538
568
|
& input::placeholder {
|
|
539
|
-
color: ${(
|
|
540
|
-
|
|
569
|
+
color: ${(r) => w(
|
|
570
|
+
r.theme,
|
|
541
571
|
"Input",
|
|
542
|
-
|
|
572
|
+
r.color,
|
|
543
573
|
"enabled",
|
|
544
574
|
"placeholder"
|
|
545
575
|
)};
|
|
546
576
|
}
|
|
547
577
|
`, Y = G.span`
|
|
548
578
|
padding: 0 12px;
|
|
549
|
-
color: ${(
|
|
550
|
-
|
|
579
|
+
color: ${(r) => w(
|
|
580
|
+
r.theme,
|
|
551
581
|
"Input",
|
|
552
|
-
|
|
582
|
+
r.focused === !0 ? "primary" : r.color,
|
|
553
583
|
"enabled",
|
|
554
584
|
"prefix"
|
|
555
585
|
)};
|
|
556
|
-
`, De = G(Y)``, Ce = oe((
|
|
586
|
+
`, De = G(Y)``, Ce = oe((r, s) => {
|
|
557
587
|
const {
|
|
558
588
|
disabled: u,
|
|
559
589
|
readOnly: e,
|
|
560
590
|
debounceTime: t = 0,
|
|
561
|
-
prefix:
|
|
591
|
+
prefix: a,
|
|
562
592
|
suffix: o,
|
|
563
|
-
thousandSeparator:
|
|
593
|
+
thousandSeparator: f = ".",
|
|
564
594
|
decimalSeparator: i = ",",
|
|
565
595
|
decimalScale: n = 2,
|
|
566
596
|
fixedDecimalScale: l = !0,
|
|
@@ -574,19 +604,19 @@ const we = G.div`
|
|
|
574
604
|
className: S = "",
|
|
575
605
|
style: x = {},
|
|
576
606
|
size: b = "small",
|
|
577
|
-
color:
|
|
578
|
-
...
|
|
579
|
-
} =
|
|
580
|
-
fe((y,
|
|
607
|
+
color: D = "primary",
|
|
608
|
+
...F
|
|
609
|
+
} = r, g = pe(), [N, $] = ne(!1), E = se(
|
|
610
|
+
fe((y, C) => I(y, C), t),
|
|
581
611
|
[c]
|
|
582
|
-
),
|
|
583
|
-
c && (c == null || c(y,
|
|
584
|
-
},
|
|
585
|
-
|
|
586
|
-
},
|
|
587
|
-
|
|
588
|
-
},
|
|
589
|
-
|
|
612
|
+
), I = (y, C) => {
|
|
613
|
+
c && (c == null || c(y, C)), m == null || m(y, C);
|
|
614
|
+
}, V = (y, C) => {
|
|
615
|
+
E(C.event, y == null ? void 0 : y.floatValue);
|
|
616
|
+
}, M = () => n < 0 ? 0 : n > 17 ? 17 : n, j = (y) => {
|
|
617
|
+
$(!0), h == null || h(y);
|
|
618
|
+
}, R = (y) => {
|
|
619
|
+
$(!1), d == null || d(y);
|
|
590
620
|
};
|
|
591
621
|
return /* @__PURE__ */ ie(
|
|
592
622
|
we,
|
|
@@ -594,47 +624,47 @@ const we = G.div`
|
|
|
594
624
|
style: x,
|
|
595
625
|
className: S,
|
|
596
626
|
theme: g,
|
|
597
|
-
color:
|
|
627
|
+
color: D,
|
|
598
628
|
size: b,
|
|
599
|
-
prefix:
|
|
629
|
+
prefix: a,
|
|
600
630
|
suffix: o,
|
|
601
631
|
focused: N,
|
|
602
632
|
disabled: u,
|
|
603
633
|
readOnly: e,
|
|
604
634
|
children: [
|
|
605
|
-
|
|
635
|
+
a && /* @__PURE__ */ L(
|
|
606
636
|
Y,
|
|
607
637
|
{
|
|
608
638
|
theme: g,
|
|
609
|
-
color:
|
|
639
|
+
color: D,
|
|
610
640
|
focused: N,
|
|
611
641
|
className: "lnc-input-prefix",
|
|
612
|
-
children:
|
|
642
|
+
children: a
|
|
613
643
|
}
|
|
614
644
|
),
|
|
615
645
|
/* @__PURE__ */ L(
|
|
616
646
|
X,
|
|
617
647
|
{
|
|
618
|
-
getInputRef:
|
|
648
|
+
getInputRef: s,
|
|
619
649
|
className: "lnc-decimal-input",
|
|
620
650
|
disabled: u,
|
|
621
651
|
readOnly: e,
|
|
622
|
-
thousandSeparator:
|
|
652
|
+
thousandSeparator: f,
|
|
623
653
|
decimalSeparator: i,
|
|
624
|
-
decimalScale:
|
|
654
|
+
decimalScale: M(),
|
|
625
655
|
fixedDecimalScale: l,
|
|
626
656
|
allowNegative: p,
|
|
627
|
-
onFocus:
|
|
628
|
-
onBlur:
|
|
629
|
-
onValueChange:
|
|
630
|
-
...
|
|
657
|
+
onFocus: j,
|
|
658
|
+
onBlur: R,
|
|
659
|
+
onValueChange: V,
|
|
660
|
+
...F
|
|
631
661
|
}
|
|
632
662
|
),
|
|
633
663
|
o && /* @__PURE__ */ L(
|
|
634
664
|
De,
|
|
635
665
|
{
|
|
636
666
|
theme: g,
|
|
637
|
-
color:
|
|
667
|
+
color: D,
|
|
638
668
|
focused: N,
|
|
639
669
|
className: "lnc-input-suffix",
|
|
640
670
|
children: o
|