@lanaco/lnc-react-ui 3.11.35 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/README.md +0 -3
  2. package/dist/Accordion.cjs +6 -0
  3. package/dist/Accordion.js +65 -0
  4. package/dist/AccordionDetails.cjs +7 -0
  5. package/dist/AccordionDetails.js +32 -0
  6. package/dist/AccordionSummary.cjs +12 -0
  7. package/dist/AccordionSummary.js +78 -0
  8. package/dist/ActionsToolbar.cjs +19 -0
  9. package/dist/ActionsToolbar.js +225 -0
  10. package/dist/Alert.cjs +40 -0
  11. package/dist/Alert.js +138 -0
  12. package/dist/Avatar.cjs +16 -0
  13. package/dist/Avatar.js +114 -0
  14. package/dist/Badge.cjs +17 -0
  15. package/dist/Badge.js +70 -0
  16. package/dist/Breadcrumbs.cjs +8 -0
  17. package/dist/Breadcrumbs.js +131 -0
  18. package/dist/Button.cjs +127 -0
  19. package/dist/Button.js +542 -0
  20. package/dist/ButtonGroup.cjs +44 -0
  21. package/dist/ButtonGroup.js +112 -0
  22. package/dist/CheckBoxInput.cjs +118 -0
  23. package/dist/CheckBoxInput.js +348 -0
  24. package/dist/Chip.cjs +27 -0
  25. package/dist/Chip.js +189 -0
  26. package/dist/ColorInput.cjs +60 -0
  27. package/dist/ColorInput.js +256 -0
  28. package/dist/ConfirmationForm.cjs +22 -0
  29. package/dist/ConfirmationForm.js +169 -0
  30. package/dist/Content.cjs +1 -0
  31. package/dist/Content.js +18 -0
  32. package/dist/CustomStyles-CqlCjTgU.cjs +8 -0
  33. package/dist/CustomStyles-nfD3J1mi.js +2881 -0
  34. package/dist/DataView.cjs +1 -0
  35. package/dist/DataView.js +62 -0
  36. package/dist/DateInput.cjs +296 -0
  37. package/dist/DateInput.js +7042 -0
  38. package/dist/DecimalInput.cjs +54 -0
  39. package/dist/DecimalInput.js +697 -0
  40. package/dist/DetailsView.cjs +18 -0
  41. package/dist/DetailsView.js +243 -0
  42. package/dist/DoubleRangeSlider.cjs +114 -0
  43. package/dist/DoubleRangeSlider.js +289 -0
  44. package/dist/DragAndDropFile.cjs +31 -0
  45. package/dist/DragAndDropFile.js +2331 -0
  46. package/dist/DragDropFiles.cjs +14 -0
  47. package/dist/DragDropFiles.js +175 -0
  48. package/dist/Drawer.cjs +6 -0
  49. package/dist/Drawer.js +206 -0
  50. package/dist/Dropdown.cjs +1 -0
  51. package/dist/Dropdown.js +266 -0
  52. package/dist/DropdownItem.cjs +36 -0
  53. package/dist/DropdownItem.js +241 -0
  54. package/dist/DropdownLookup.cjs +1 -0
  55. package/dist/DropdownLookup.js +325 -0
  56. package/dist/DropdownMenu-B6qr13ik.cjs +19 -0
  57. package/dist/DropdownMenu-DZi3TJ8Q.js +1547 -0
  58. package/dist/DropdownMenu.cjs +1 -0
  59. package/dist/DropdownMenu.js +12 -0
  60. package/dist/EditableTable.cjs +21 -0
  61. package/dist/EditableTable.js +462 -0
  62. package/dist/FileInput.cjs +47 -0
  63. package/dist/FileInput.js +206 -0
  64. package/dist/FlexBox.cjs +9 -0
  65. package/dist/FlexBox.js +97 -0
  66. package/dist/FlexGrid.cjs +1 -0
  67. package/dist/FlexGrid.js +78 -0
  68. package/dist/FlexGridItem.cjs +7 -0
  69. package/dist/FlexGridItem.js +97 -0
  70. package/dist/Footer.cjs +1 -0
  71. package/dist/Footer.js +18 -0
  72. package/dist/FormField.cjs +11 -0
  73. package/dist/FormField.js +65 -0
  74. package/dist/FormView.cjs +13 -0
  75. package/dist/FormView.js +354 -0
  76. package/dist/Grid.cjs +13 -0
  77. package/dist/Grid.js +62 -0
  78. package/dist/GridItem.cjs +15 -0
  79. package/dist/GridItem.js +72 -0
  80. package/dist/Header.cjs +1 -0
  81. package/dist/Header.js +18 -0
  82. package/dist/Icon.cjs +8 -0
  83. package/dist/Icon.js +59 -0
  84. package/dist/IconButton.cjs +122 -0
  85. package/dist/IconButton.js +481 -0
  86. package/dist/Kanban.cjs +85 -0
  87. package/dist/Kanban.js +4793 -0
  88. package/dist/KanbanActionsToolbar.cjs +19 -0
  89. package/dist/KanbanActionsToolbar.js +152 -0
  90. package/dist/KanbanCard-ConTmu3w.cjs +30 -0
  91. package/dist/KanbanCard-D9OhU8C6.js +175 -0
  92. package/dist/KanbanCard.cjs +1 -0
  93. package/dist/KanbanCard.js +12 -0
  94. package/dist/KanbanFooter.cjs +5 -0
  95. package/dist/KanbanFooter.js +84 -0
  96. package/dist/KanbanHeader.cjs +15 -0
  97. package/dist/KanbanHeader.js +127 -0
  98. package/dist/KanbanView.cjs +8 -0
  99. package/dist/KanbanView.js +255 -0
  100. package/dist/Link.cjs +15 -0
  101. package/dist/Link.js +62 -0
  102. package/dist/MenuItem.cjs +36 -0
  103. package/dist/MenuItem.js +230 -0
  104. package/dist/Modal.cjs +84 -0
  105. package/dist/Modal.js +372 -0
  106. package/dist/MultiSelectDropdown.cjs +1 -0
  107. package/dist/MultiSelectDropdown.js +261 -0
  108. package/dist/MultiSelectDropdownLookup.cjs +1 -0
  109. package/dist/MultiSelectDropdownLookup.js +274 -0
  110. package/dist/NestedDropdownItem.cjs +6 -0
  111. package/dist/NestedDropdownItem.js +102 -0
  112. package/dist/NestedMenuItem.cjs +6 -0
  113. package/dist/NestedMenuItem.js +115 -0
  114. package/dist/Notification.cjs +83 -0
  115. package/dist/Notification.js +1079 -0
  116. package/dist/NumberInput.cjs +45 -0
  117. package/dist/NumberInput.js +241 -0
  118. package/dist/PageLayout.cjs +26 -0
  119. package/dist/PageLayout.js +92 -0
  120. package/dist/PasswordInput.cjs +47 -0
  121. package/dist/PasswordInput.js +230 -0
  122. package/dist/ProgressBar.cjs +22 -0
  123. package/dist/ProgressBar.js +92 -0
  124. package/dist/RadioGroup.cjs +7 -0
  125. package/dist/RadioGroup.js +104 -0
  126. package/dist/RadioInput.cjs +117 -0
  127. package/dist/RadioInput.js +362 -0
  128. package/dist/RangeSlider.cjs +72 -0
  129. package/dist/RangeSlider.js +253 -0
  130. package/dist/SearchBar.cjs +100 -0
  131. package/dist/SearchBar.js +994 -0
  132. package/dist/Separator.cjs +6 -0
  133. package/dist/Separator.js +37 -0
  134. package/dist/Sidebar.cjs +39 -0
  135. package/dist/Sidebar.js +123 -0
  136. package/dist/Spinner.cjs +38 -0
  137. package/dist/Spinner.js +114 -0
  138. package/dist/Surface.cjs +7 -0
  139. package/dist/Surface.js +60 -0
  140. package/dist/SwipeableDrawer.cjs +33 -0
  141. package/dist/SwipeableDrawer.js +213 -0
  142. package/dist/Table.cjs +170 -0
  143. package/dist/Table.js +1408 -0
  144. package/dist/TableView-Cj5_fbSR.js +481 -0
  145. package/dist/TableView-D8ex512p.cjs +19 -0
  146. package/dist/TableView.cjs +1 -0
  147. package/dist/TableView.js +11 -0
  148. package/dist/Tabs.cjs +7 -0
  149. package/dist/Tabs.js +72 -0
  150. package/dist/TextAreaInput.cjs +33 -0
  151. package/dist/TextAreaInput.js +320 -0
  152. package/dist/TextInput.cjs +45 -0
  153. package/dist/TextInput.js +227 -0
  154. package/dist/ThemeProvider.cjs +113 -0
  155. package/dist/ThemeProvider.js +1340 -0
  156. package/dist/TimeInput.cjs +31 -0
  157. package/dist/TimeInput.js +133 -0
  158. package/dist/Toggle.cjs +151 -0
  159. package/dist/Toggle.js +421 -0
  160. package/dist/TreeMenu.cjs +15 -0
  161. package/dist/TreeMenu.js +108 -0
  162. package/dist/TreeMenuSeparator.cjs +6 -0
  163. package/dist/TreeMenuSeparator.js +40 -0
  164. package/dist/UploadedFile.cjs +39 -0
  165. package/dist/UploadedFile.js +192 -0
  166. package/dist/defineProperty-BHpTtkhC.js +110 -0
  167. package/dist/defineProperty-DHvxLH8G.cjs +1 -0
  168. package/dist/emotion-element-5486c51c.browser.esm-CSejtOeT.js +886 -0
  169. package/dist/emotion-element-5486c51c.browser.esm-QRQ5FSjv.cjs +1 -0
  170. package/dist/emotion-is-prop-valid.esm-BzFBwmJz.js +10 -0
  171. package/dist/emotion-is-prop-valid.esm-CMrshNb7.cjs +1 -0
  172. package/dist/emotion-react.browser.esm-DQBL7Wls.cjs +1 -0
  173. package/dist/emotion-react.browser.esm-OWM-uG8Q.js +94 -0
  174. package/dist/emotion-styled.browser.esm-BZSYYThs.js +210 -0
  175. package/dist/emotion-styled.browser.esm-Cbp_XsK4.cjs +1 -0
  176. package/dist/floating-ui.dom-1F2mTXOe.cjs +1 -0
  177. package/dist/floating-ui.dom-BdUovkEr.js +938 -0
  178. package/dist/hoist-non-react-statics.cjs-B8r9S_ak.cjs +15 -0
  179. package/dist/hoist-non-react-statics.cjs-Drf1aBlk.js +235 -0
  180. package/dist/index-BLQWNy78.js +109 -0
  181. package/dist/index-BP5r5zGN.cjs +1 -0
  182. package/dist/index-B_da1uvD.js +451 -0
  183. package/dist/index-BjdOz5Ok.cjs +1 -0
  184. package/dist/index-BklgDeu4.js +42 -0
  185. package/dist/index-C29T0m2a.cjs +174 -0
  186. package/dist/index-CZJEA84h.js +19069 -0
  187. package/dist/index-Cdkz-XH-.js +127 -0
  188. package/dist/index-D5vEbKUT.js +81 -0
  189. package/dist/index-DXnSjbfJ.cjs +20 -0
  190. package/dist/index-Ds9PUTwb.js +667 -0
  191. package/dist/index-Dzkd2i4n.cjs +1 -0
  192. package/dist/index-IO9v6o0I.cjs +5 -0
  193. package/dist/index-P-naJISQ.cjs +1 -0
  194. package/dist/index.cjs +26 -0
  195. package/dist/index.js +378 -0
  196. package/dist/motion-CtkUpWEn.js +3785 -0
  197. package/dist/motion-Oud-wpUz.cjs +1 -0
  198. package/dist/objectWithoutPropertiesLoose-Bz3hwpmU.cjs +1 -0
  199. package/dist/objectWithoutPropertiesLoose-DwEN6RBQ.js +12 -0
  200. package/dist/setPrototypeOf-4aSEnBDm.cjs +1 -0
  201. package/dist/setPrototypeOf-a891FLQJ.js +13 -0
  202. package/dist/style.css +5 -0
  203. package/dist/tslib.es6-ZNVz5r_T.js +90 -0
  204. package/dist/tslib.es6-fPwcSa2V.cjs +1 -0
  205. package/dist/use-isomorphic-layout-effect.browser.esm-CkGv31zs.cjs +1 -0
  206. package/dist/use-isomorphic-layout-effect.browser.esm-DERp5kr6.js +5 -0
  207. package/dist/useUpdateEffect-BtMgpgIV.cjs +1 -0
  208. package/dist/useUpdateEffect-CuYWz7EA.js +15 -0
  209. package/dist/utils-DEke8iwo.js +10196 -0
  210. package/dist/utils-hdRGTsQ7.cjs +13 -0
  211. package/eslint.config.js +38 -0
  212. package/package.json +137 -58
  213. package/vite.config.js +135 -0
  214. package/jest.config.js +0 -7
  215. package/lib/index.esm.js +0 -84028
  216. package/lib/index.js +0 -84165
  217. package/rc1 +0 -0
  218. package/test/jest/__mocks__/styleMock.js +0 -1
@@ -0,0 +1,697 @@
1
+ import { jsxs as ie, jsx as K } from "react/jsx-runtime";
2
+ import { P as S } from "./index-Ds9PUTwb.js";
3
+ import I, { useState as oe, useCallback as ne } from "react";
4
+ import { d as se } from "./index-D5vEbKUT.js";
5
+ import { n as G } from "./emotion-styled.browser.esm-BZSYYThs.js";
6
+ import { f as B, b as R, c as fe, h as le, g as W, a as ue } from "./utils-DEke8iwo.js";
7
+ import { u as ce } from "./emotion-element-5486c51c.browser.esm-CSejtOeT.js";
8
+ function O() {
9
+ }
10
+ function pe() {
11
+ return !0;
12
+ }
13
+ function V(a) {
14
+ return !!(a || "").match(/\d/);
15
+ }
16
+ function _(a) {
17
+ return a == null;
18
+ }
19
+ function Z(a) {
20
+ return a.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
21
+ }
22
+ function de(a) {
23
+ switch (a) {
24
+ case "lakh":
25
+ return /(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;
26
+ case "wan":
27
+ return /(\d)(?=(\d{4})+(?!\d))/g;
28
+ case "thousand":
29
+ default:
30
+ return /(\d)(?=(\d{3})+(?!\d))/g;
31
+ }
32
+ }
33
+ function me(a, f, u) {
34
+ var e = de(u), t = a.search(/[1-9]/);
35
+ return t = t === -1 ? a.length : t, a.substring(0, t) + a.substring(t, a.length).replace(e, "$1" + f);
36
+ }
37
+ function z(a, f) {
38
+ f === void 0 && (f = !0);
39
+ var u = a[0] === "-", e = u && f;
40
+ a = a.replace("-", "");
41
+ var t = a.split("."), r = t[0], o = t[1] || "";
42
+ return {
43
+ beforeDecimal: r,
44
+ afterDecimal: o,
45
+ hasNagation: u,
46
+ addNegation: e
47
+ };
48
+ }
49
+ function he(a) {
50
+ if (!a)
51
+ return a;
52
+ var f = a[0] === "-";
53
+ f && (a = a.substring(1, a.length));
54
+ var u = a.split("."), e = u[0].replace(/^0+/, "") || "0", t = u[1] || "";
55
+ return (f ? "-" : "") + e + (t ? "." + t : "");
56
+ }
57
+ function Q(a, f, u) {
58
+ for (var e = "", t = u ? "0" : "", r = 0; r <= f - 1; r++)
59
+ e += a[r] || t;
60
+ return e;
61
+ }
62
+ function q(a, f) {
63
+ return Array(f + 1).join(a);
64
+ }
65
+ function ve(a) {
66
+ a += "";
67
+ var f = a[0] === "-" ? "-" : "";
68
+ f && (a = a.substring(1));
69
+ var u = a.split(/[eE]/g), e = u[0], t = u[1];
70
+ if (t = Number(t), !t)
71
+ return f + e;
72
+ e = e.replace(".", "");
73
+ var r = 1 + t, o = e.length;
74
+ return r < 0 ? e = "0." + q("0", Math.abs(r)) + e : r >= o ? e = e + q("0", r - o) : e = (e.substring(0, r) || "0") + "." + e.substring(r), f + e;
75
+ }
76
+ function ge(a, f, u) {
77
+ if (["", "-"].indexOf(a) !== -1)
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;
81
+ }, l[0]), c = Q(
82
+ l[1] || "",
83
+ Math.min(f, o.length),
84
+ u
85
+ ), h = s ? "-" : "", m = e ? "." : "";
86
+ return "" + h + p + m + c;
87
+ }
88
+ function H(a, f) {
89
+ if (a.value = a.value, a !== null) {
90
+ if (a.createTextRange) {
91
+ var u = a.createTextRange();
92
+ return u.move("character", f), u.select(), !0;
93
+ }
94
+ return a.selectionStart || a.selectionStart === 0 ? (a.focus(), a.setSelectionRange(f, f), !0) : (a.focus(), !1);
95
+ }
96
+ }
97
+ function Se(a, f) {
98
+ for (var u = 0, e = 0, t = a.length, r = f.length; a[u] === f[u] && u < t; )
99
+ u++;
100
+ for (; a[t - 1 - e] === f[r - 1 - e] && r - e > u && t - e > u; )
101
+ e++;
102
+ return { start: u, end: t - e };
103
+ }
104
+ function L(a, f, u) {
105
+ return Math.min(Math.max(a, f), u);
106
+ }
107
+ function J(a) {
108
+ return Math.max(a.selectionStart, a.selectionEnd);
109
+ }
110
+ function ye(a) {
111
+ return a || typeof navigator < "u" && !(navigator.platform && /iPhone|iPod/.test(navigator.platform));
112
+ }
113
+ function xe(a, f) {
114
+ var u = {};
115
+ for (var e in a) Object.prototype.hasOwnProperty.call(a, e) && f.indexOf(e) === -1 && (u[e] = a[e]);
116
+ return u;
117
+ }
118
+ var be = {
119
+ displayType: "input",
120
+ decimalSeparator: ".",
121
+ thousandsGroupStyle: "thousand",
122
+ fixedDecimalScale: !1,
123
+ prefix: "",
124
+ suffix: "",
125
+ allowNegative: !0,
126
+ allowEmptyFormatting: !1,
127
+ allowLeadingZeros: !1,
128
+ isNumericString: !1,
129
+ type: "text",
130
+ onValueChange: O,
131
+ onChange: O,
132
+ onKeyDown: O,
133
+ onMouseUp: O,
134
+ onFocus: O,
135
+ onBlur: O,
136
+ isAllowed: pe
137
+ }, X = /* @__PURE__ */ function(a) {
138
+ function f(u) {
139
+ a.call(this, u);
140
+ var e = u.defaultValue;
141
+ this.validateProps();
142
+ var t = this.formatValueProp(e);
143
+ this.state = {
144
+ value: t,
145
+ numAsString: this.removeFormatting(t),
146
+ mounted: !1
147
+ }, this.selectionBeforeInput = {
148
+ selectionStart: 0,
149
+ selectionEnd: 0
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
+ }
152
+ return a && (f.__proto__ = a), f.prototype = Object.create(a && a.prototype), f.prototype.constructor = f, f.prototype.componentDidMount = function() {
153
+ this.setState({
154
+ mounted: !0
155
+ });
156
+ }, f.prototype.componentDidUpdate = function(e) {
157
+ this.updateValueIfRequired(e);
158
+ }, f.prototype.componentWillUnmount = function() {
159
+ clearTimeout(this.focusTimeout), clearTimeout(this.caretPositionTimeout);
160
+ }, f.prototype.updateValueIfRequired = function(e) {
161
+ var t = this, r = t.props, o = t.state, s = t.focusedElm, i = o.value, n = o.numAsString;
162
+ if (n === void 0 && (n = ""), e !== r) {
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);
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
167
+ l !== i || //set state always when not in focus and formatted value is changed
168
+ s === null && p !== i) && this.updateValue({
169
+ formattedValue: p,
170
+ numAsString: c,
171
+ input: s,
172
+ source: "prop",
173
+ event: null
174
+ });
175
+ }
176
+ }, f.prototype.getFloatString = function(e) {
177
+ e === void 0 && (e = "");
178
+ var t = this.props, r = t.decimalScale, o = this.getSeparators(), s = o.decimalSeparator, i = this.getNumberRegex(!0), n = e[0] === "-";
179
+ n && (e = e.replace("-", "")), s && r === 0 && (e = e.split(s)[0]), e = (e.match(i) || []).join("").replace(s, ".");
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;
182
+ }, f.prototype.getNumberRegex = function(e, t) {
183
+ var r = this.props, o = r.format, s = r.decimalScale, i = r.customNumerals, n = this.getSeparators(), l = n.decimalSeparator;
184
+ return new RegExp(
185
+ "[0-9" + (i ? i.join("") : "") + "]" + (l && s !== 0 && !t && !o ? "|" + Z(l) : ""),
186
+ e ? "g" : void 0
187
+ );
188
+ }, f.prototype.getSeparators = function() {
189
+ var e = this.props, t = e.decimalSeparator, r = this.props, o = r.thousandSeparator, s = r.allowedDecimalSeparators;
190
+ return o === !0 && (o = ","), s || (s = [t, "."]), {
191
+ decimalSeparator: t,
192
+ thousandSeparator: o,
193
+ allowedDecimalSeparators: s
194
+ };
195
+ }, f.prototype.getMaskAtIndex = function(e) {
196
+ var t = this.props, r = t.mask;
197
+ return r === void 0 && (r = " "), typeof r == "string" ? r : r[e] || " ";
198
+ }, f.prototype.getValueObject = function(e, t) {
199
+ var r = parseFloat(t);
200
+ return {
201
+ formattedValue: e,
202
+ value: t,
203
+ floatValue: isNaN(r) ? void 0 : r
204
+ };
205
+ }, f.prototype.validateProps = function() {
206
+ var e = this.props, t = e.mask, r = this.getSeparators(), o = r.decimalSeparator, s = r.thousandSeparator;
207
+ if (o === s)
208
+ throw new Error(`
209
+ Decimal separator can't be same as thousand separator.
210
+ thousandSeparator: ` + s + ` (thousandSeparator = {true} is same as thousandSeparator = ",")
211
+ decimalSeparator: ` + o + ` (default value for decimalSeparator is .)
212
+ `);
213
+ if (t) {
214
+ var i = t === "string" ? t : t.toString();
215
+ if (i.match(/\d/g))
216
+ throw new Error(`
217
+ Mask ` + t + ` should not contain numeric character;
218
+ `);
219
+ }
220
+ }, f.prototype.setPatchedCaretPosition = function(e, t, r) {
221
+ H(e, t), this.caretPositionTimeout = setTimeout(function() {
222
+ e.value === r && H(e, t);
223
+ }, 0);
224
+ }, f.prototype.correctCaretPosition = function(e, t, r) {
225
+ var o = this.props, s = o.prefix, i = o.suffix, n = o.format;
226
+ if (e === "")
227
+ return 0;
228
+ if (t = L(t, 0, e.length), !n) {
229
+ var l = e[0] === "-";
230
+ return L(t, s.length + (l ? 1 : 0), e.length - i.length);
231
+ }
232
+ if (typeof n == "function" || n[t] === "#" && V(e[t]) || n[t - 1] === "#" && V(e[t - 1]))
233
+ return t;
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;
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; )
246
+ c++;
247
+ c++;
248
+ }
249
+ }
250
+ return typeof s == "string" && !i && (c = t.length), c = this.correctCaretPosition(t, c), c;
251
+ }, f.prototype.removePrefixAndSuffix = function(e) {
252
+ var t = this.props, r = t.format, o = t.prefix, s = t.suffix;
253
+ if (!r && e) {
254
+ var i = e[0] === "-";
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(s);
257
+ e = s && n !== -1 && n === e.length - s.length ? e.substring(0, n) : e, i && (e = "-" + e);
258
+ }
259
+ return e;
260
+ }, f.prototype.removePatternFormatting = function(e) {
261
+ for (var t = this.props, r = t.format, o = r.split("#").filter(function(h) {
262
+ return h !== "";
263
+ }), s = 0, i = "", n = 0, l = o.length; n <= l; n++) {
264
+ var p = o[n] || "", c = n === l ? e.length : e.indexOf(p, s);
265
+ if (c === -1) {
266
+ i = e;
267
+ break;
268
+ } else
269
+ i += e.substring(s, c), s = c + p.length;
270
+ }
271
+ return (i.match(this.getNumberRegex(!0)) || []).join("");
272
+ }, f.prototype.removeFormatting = function(e) {
273
+ var t = this.props, r = t.format, o = t.removeFormatting;
274
+ return e && (r ? typeof r == "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
+ }, f.prototype.formatWithPattern = function(e) {
276
+ for (var t = this.props, r = t.format, o = 0, s = r.split(""), i = 0, n = r.length; i < n; i++)
277
+ r[i] === "#" && (s[i] = e[o] || this.getMaskAtIndex(o), o += 1);
278
+ return s.join("");
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 = me(g, c, l)), s && (g = s + g), i && (y = y + i), x && (g = "-" + g), e = g + (m && h || "") + y, e;
282
+ }, f.prototype.formatNumString = function(e) {
283
+ e === void 0 && (e = "");
284
+ var t = this.props, r = t.format, o = t.allowEmptyFormatting, s = t.customNumerals, i = e;
285
+ if (s && s.length === 10) {
286
+ var n = new RegExp("[" + s.join("") + "]", "g");
287
+ i = e.replace(
288
+ n,
289
+ function(l) {
290
+ return s.indexOf(l).toString();
291
+ }
292
+ );
293
+ }
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
+ }, f.prototype.formatValueProp = function(e) {
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;
298
+ var c = !l && l !== 0;
299
+ if (c && i && (l = ""), c && !i)
300
+ return "";
301
+ typeof l == "number" && (l = ve(l), p = !0), l === "Infinity" && p && (l = ""), p && !r && typeof o == "number" && (l = ge(l, o, s));
302
+ var h = p ? this.formatNumString(l) : this.formatInput(l);
303
+ return h;
304
+ }, f.prototype.formatNegation = function(e) {
305
+ e === void 0 && (e = "");
306
+ var t = this.props, r = t.allowNegative, o = new RegExp("(-)"), s = new RegExp("(-)(.)*(-)"), i = o.test(e), n = s.test(e);
307
+ return e = e.replace(/-/g, ""), i && !n && r && (e = "-" + e), e;
308
+ }, f.prototype.formatInput = function(e) {
309
+ e === void 0 && (e = "");
310
+ var t = this.props, r = t.format;
311
+ return r || (e = this.removePrefixAndSuffix(e), e = this.formatNegation(e)), e = this.removeFormatting(e), this.formatNumString(e);
312
+ }, f.prototype.isCharacterAFormat = function(e, t) {
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
+ return !!(typeof o == "string" && o[e] !== "#" || !o && (e < s.length || e >= t.length - i.length || n && l && t[e] === c));
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 = Se(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);
320
+ }
321
+ var E = i ? 0 : l.length, T = t.length - (i ? 0 : p.length);
322
+ if (
323
+ // don't do anything if something got added
324
+ r.length > t.length || // or if the new value is an empty string
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.
329
+ // For numeric inputs we apply the format so, prefix and suffix can be ignored
330
+ x === E && w === T
331
+ )
332
+ return r;
333
+ var j = t.substr(v, N - v), M = !![].concat(j).find(
334
+ function(C, $) {
335
+ return o.isCharacterAFormat($ + v, t);
336
+ }
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 : $ > j.length - 1 && b.push(C);
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("");
345
+ }
346
+ if (!i) {
347
+ var D = this.removeFormatting(r), U = z(
348
+ D,
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))
352
+ return re ? "-" : "";
353
+ }
354
+ return r;
355
+ }, f.prototype.updateValue = function(e) {
356
+ var t = e.formattedValue, r = e.input, o = e.setCaretPosition;
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;
359
+ if (r) {
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);
363
+ }
364
+ r.value = t, o && this.setPatchedCaretPosition(r, l, t);
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 }));
367
+ }, f.prototype.onChange = function(e) {
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
+ 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({
372
+ formattedValue: c,
373
+ numAsString: h,
374
+ inputValue: r,
375
+ input: t,
376
+ event: e,
377
+ source: "event"
378
+ }), d && i.onChange(e);
379
+ }, f.prototype.onBlur = function(e) {
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
+ if (this.focusedElm = null, clearTimeout(this.focusTimeout), clearTimeout(this.caretPositionTimeout), !s) {
382
+ isNaN(parseFloat(l)) && (l = ""), n || (l = he(l));
383
+ var c = this.formatNumString(l);
384
+ if (c !== p) {
385
+ this.updateValue({
386
+ formattedValue: c,
387
+ numAsString: l,
388
+ input: e.target,
389
+ setCaretPosition: !1,
390
+ event: e,
391
+ source: "event"
392
+ }), i(e);
393
+ return;
394
+ }
395
+ }
396
+ i(e);
397
+ }, f.prototype.onKeyDown = function(e) {
398
+ var t = e.target, r = e.key, o = t.selectionStart, s = t.selectionEnd, i = t.value;
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";
401
+ if (this.selectionBeforeInput = {
402
+ selectionStart: o,
403
+ selectionEnd: s
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);
406
+ return;
407
+ }
408
+ var v = n, N = P ? d.indexOf("#") : h.length, F = P ? d.lastIndexOf("#") + 1 : i.length - m.length;
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);
418
+ this.updateValue({
419
+ formattedValue: T,
420
+ caretPos: v,
421
+ input: t,
422
+ event: e,
423
+ source: "event"
424
+ });
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");
429
+ }
430
+ }
431
+ (v !== n || n < N || n > F) && (e.preventDefault(), this.setPatchedCaretPosition(t, v, i)), e.isUnitTestRun && this.setPatchedCaretPosition(t, v, i), g(e);
432
+ }, f.prototype.onMouseUp = function(e) {
433
+ var t = e.target, r = t.selectionStart, o = t.selectionEnd, s = t.value;
434
+ if (s === void 0 && (s = ""), r === o) {
435
+ var i = this.correctCaretPosition(s, r);
436
+ i !== r && this.setPatchedCaretPosition(t, i, s);
437
+ }
438
+ this.props.onMouseUp(e);
439
+ }, f.prototype.onFocus = function(e) {
440
+ var t = this;
441
+ e.persist(), this.focusedElm = e.target, this.focusTimeout = setTimeout(function() {
442
+ var r = e.target, o = r.selectionStart, s = r.selectionEnd, i = r.value;
443
+ i === void 0 && (i = "");
444
+ var n = t.correctCaretPosition(i, o);
445
+ n !== o && !(o === 0 && s === i.length) && t.setPatchedCaretPosition(r, n, i), t.props.onFocus(e);
446
+ }, 0);
447
+ }, f.prototype.render = function() {
448
+ var e = this.props, t = e.type, r = e.displayType, o = e.customInput, s = e.renderText, i = e.getInputRef, n = e.format;
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 = xe(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 && ye(n) ? "numeric" : void 0, g = Object.assign({ inputMode: d }, p, {
451
+ type: t,
452
+ value: h,
453
+ onChange: this.onChange,
454
+ onKeyDown: this.onKeyDown,
455
+ onMouseUp: this.onMouseUp,
456
+ onFocus: this.onFocus,
457
+ onBlur: this.onBlur
458
+ });
459
+ if (r === "text")
460
+ return s ? s(h, p) || null : I.createElement(
461
+ "span",
462
+ Object.assign({}, p, { ref: i }),
463
+ h
464
+ );
465
+ if (o) {
466
+ var y = o;
467
+ return I.createElement(y, Object.assign({}, g, { ref: i }));
468
+ }
469
+ return I.createElement("input", Object.assign({}, g, { ref: i }));
470
+ }, f;
471
+ }(I.Component);
472
+ X.defaultProps = be;
473
+ const Ne = G.div`
474
+ display: flex;
475
+ align-items: center;
476
+
477
+ min-height: ${(a) => B(a.theme, a.size)};
478
+ max-height: ${(a) => B(a.theme, a.size)};
479
+ background-color: ${(a) => R(
480
+ a.theme,
481
+ "Input",
482
+ a.color,
483
+ "enabled",
484
+ "background"
485
+ )};
486
+ border: 1px solid
487
+ ${(a) => R(
488
+ a.theme,
489
+ "Input",
490
+ a.focused === !0 ? "primary" : a.color,
491
+ "enabled",
492
+ "border"
493
+ )};
494
+ border-radius: ${(a) => fe(a.theme, "regular")};
495
+
496
+ ${(a) => a.focused === !0 && a.readOnly !== !0 ? le(a.theme) : ""}
497
+ ${(a) => a.isDisabled === !0 ? W(a.theme) : ""}
498
+ ${(a) => a.isDisabled === !0 ? "border: 1px solid " + R(
499
+ a.theme,
500
+ "Input",
501
+ a.color,
502
+ "disabled",
503
+ "border"
504
+ ) : ""}
505
+
506
+ & input {
507
+ background: none;
508
+ border: none;
509
+ outline: none;
510
+ padding-top: 0.625rem;
511
+ padding-bottom: 0.625rem;
512
+ width: 100%;
513
+
514
+ ${(a) => ue(a.theme, "Input", a.size, "enabled")}
515
+ min-height: ${(a) => B(a.theme, a.size)};
516
+ max-height: ${(a) => B(a.theme, a.size)};
517
+ color: ${(a) => R(
518
+ a.theme,
519
+ "Input",
520
+ a.focused === !0 ? "primary" : a.color,
521
+ "enabled",
522
+ "text"
523
+ )};
524
+ caret-color: ${(a) => R(a.theme, "Input", a.color, "enabled", "caret")};
525
+ padding-right: ${(a) => a.suffix ? "0" : "0.75rem"};
526
+ padding-left: ${(a) => a.prefix ? "0" : "0.75rem"};
527
+ }
528
+
529
+ & input:disabled {
530
+ ${(a) => W(a.theme)}
531
+ background: none;
532
+ }
533
+
534
+ & input:read-only {
535
+ cursor: default;
536
+ }
537
+
538
+ & input::placeholder {
539
+ color: ${(a) => R(
540
+ a.theme,
541
+ "Input",
542
+ a.color,
543
+ "enabled",
544
+ "placeholder"
545
+ )};
546
+ }
547
+ `, Y = G.span`
548
+ padding: 0 12px;
549
+ color: ${(a) => R(
550
+ a.theme,
551
+ "Input",
552
+ a.focused === !0 ? "primary" : a.color,
553
+ "enabled",
554
+ "prefix"
555
+ )};
556
+ `, we = G(Y)``, De = I.forwardRef((a, f) => {
557
+ const {
558
+ disabled: u,
559
+ readOnly: e,
560
+ debounceTime: t = 180,
561
+ prefix: r,
562
+ suffix: o,
563
+ thousandSeparator: s = ".",
564
+ decimalSeparator: i = ",",
565
+ decimalScale: n = 2,
566
+ fixedDecimalScale: l = !0,
567
+ allowNegative: p = !0,
568
+ //----------------
569
+ onChange: c,
570
+ onKeyDown: h,
571
+ onBlur: m,
572
+ onFocus: d,
573
+ //----------------
574
+ className: g = "",
575
+ style: y = {},
576
+ size: x = "small",
577
+ color: w = "primary",
578
+ ...P
579
+ } = a, v = ce(), [N, F] = oe(!1), E = ne(
580
+ se((b, D) => T(b, D), t),
581
+ [c]
582
+ ), T = (b, D) => {
583
+ c && (c == null || c(b, D));
584
+ }, j = (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);
590
+ };
591
+ return /* @__PURE__ */ ie(
592
+ Ne,
593
+ {
594
+ style: y,
595
+ className: g,
596
+ theme: v,
597
+ color: w,
598
+ size: x,
599
+ prefix: r,
600
+ suffix: o,
601
+ focused: N,
602
+ disabled: u,
603
+ readOnly: e,
604
+ children: [
605
+ r && /* @__PURE__ */ K(
606
+ Y,
607
+ {
608
+ theme: v,
609
+ color: w,
610
+ focused: N,
611
+ className: "lnc-input-prefix",
612
+ children: r
613
+ }
614
+ ),
615
+ /* @__PURE__ */ K(
616
+ X,
617
+ {
618
+ getInputRef: f,
619
+ className: "lnc-decimal-input",
620
+ disabled: u,
621
+ readOnly: e,
622
+ thousandSeparator: s,
623
+ decimalSeparator: i,
624
+ decimalScale: M(),
625
+ fixedDecimalScale: l,
626
+ allowNegative: p,
627
+ onFocus: k,
628
+ onBlur: A,
629
+ onValueChange: j,
630
+ ...P
631
+ }
632
+ ),
633
+ o && /* @__PURE__ */ K(
634
+ we,
635
+ {
636
+ theme: v,
637
+ color: w,
638
+ focused: N,
639
+ className: "lnc-input-suffix",
640
+ children: o
641
+ }
642
+ )
643
+ ]
644
+ }
645
+ );
646
+ });
647
+ De.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,
654
+ /**
655
+ * Reserved space before input. Intented to be used with plain text or `Icon` component.
656
+ */
657
+ prefix: S.oneOfType([S.string, S.element]),
658
+ /**
659
+ * Reserved space after input. Intented to be used with plain text or `Icon` component.
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,
667
+ //----------------
668
+ /**
669
+ * `(event, value) => void`
670
+ */
671
+ onChange: S.func,
672
+ /**
673
+ * `(event) => void`
674
+ */
675
+ onBlur: S.func,
676
+ /**
677
+ * `(event) => void`
678
+ */
679
+ onFocus: S.func,
680
+ //----------------
681
+ className: S.string,
682
+ style: S.object,
683
+ size: S.oneOf(["small", "medium", "large"]),
684
+ color: S.oneOf([
685
+ "primary",
686
+ "secondary",
687
+ "success",
688
+ "danger",
689
+ "warning",
690
+ "information",
691
+ "neutral",
692
+ "gray"
693
+ ])
694
+ };
695
+ export {
696
+ De as default
697
+ };