@lanaco/lnc-react-ui 4.0.16 → 4.0.18

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,17 +1,17 @@
1
- "use strict";const g=require("react/jsx-runtime"),o=require("./index-BIlhCoy2.cjs"),d=require("react"),$=require("./emotion-styled.browser.esm-Cbp_XsK4.cjs"),l=require("./utils-DTAPpJXU.cjs"),J=require("./emotion-element-5486c51c.browser.esm-QRQ5FSjv.cjs"),L=$.newStyled.div`
1
+ "use strict";const y=require("react/jsx-runtime"),i=require("./index-BIlhCoy2.cjs"),h=require("react"),$=require("./emotion-styled.browser.esm-Cbp_XsK4.cjs"),s=require("./utils-DTAPpJXU.cjs"),M=require("./emotion-element-5486c51c.browser.esm-QRQ5FSjv.cjs"),Q=$.newStyled.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
 
5
- min-height: ${e=>l.getSizeValueWithUnits(e.theme,e.size)};
6
- max-height: ${e=>l.getSizeValueWithUnits(e.theme,e.size)};
7
- background-color: ${e=>l.getColorRgbaValue(e.theme,"Input",e.color,"enabled","background")};
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
8
  border: 1px solid
9
- ${e=>l.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","border")};
10
- border-radius: ${e=>l.getBorderRadiusValueWithUnits(e.theme,"regular")};
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
11
 
12
- ${e=>e.focused===!0&&e.readOnly!==!0?l.getOutlineCss(e.theme):""}
13
- ${e=>e.isDisabled===!0?l.getDisabledStateCss(e.theme):""}
14
- ${e=>e.isDisabled===!0?"border: 1px solid "+l.getColorRgbaValue(e.theme,"Input",e.color,"disabled","border"):""}
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
15
 
16
16
  & input {
17
17
  background: none;
@@ -21,17 +21,17 @@
21
21
  padding-bottom: 0.625rem;
22
22
  width: 100%;
23
23
 
24
- ${e=>l.getComponentTypographyCss(e.theme,"Input",e.size,"enabled")}
25
- min-height: ${e=>l.getSizeValueWithUnits(e.theme,e.size)};
26
- max-height: ${e=>l.getSizeValueWithUnits(e.theme,e.size)};
27
- color: ${e=>l.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","text")};
28
- caret-color: ${e=>l.getColorRgbaValue(e.theme,"Input",e.color,"enabled","caret")};
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
29
  padding-right: ${e=>e.suffix?"0":"0.75rem"};
30
30
  padding-left: ${e=>e.prefix?"0":"0.75rem"};
31
31
  }
32
32
 
33
33
  & input:disabled {
34
- ${e=>l.getDisabledStateCss(e.theme)}
34
+ ${e=>s.getDisabledStateCss(e.theme)}
35
35
  background: none;
36
36
  }
37
37
 
@@ -40,9 +40,9 @@
40
40
  }
41
41
 
42
42
  & input::placeholder {
43
- color: ${e=>l.getColorRgbaValue(e.theme,"Input",e.color,"enabled","placeholder")};
43
+ color: ${e=>s.getColorRgbaValue(e.theme,"Input",e.color,"enabled","placeholder")};
44
44
  }
45
- `,k=$.newStyled.span`
45
+ `,q=$.newStyled.span`
46
46
  padding: 0 12px;
47
- color: ${e=>l.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","prefix")};
48
- `,M=$.newStyled(k)``,O=d.forwardRef((e,D)=>{const{disabled:V,readOnly:j,prefix:h,suffix:y,decimalSeparator:c=",",decimalScale:a=2,allowNegative:S=!0,onKeyDown:R=()=>{},onBlur:m=()=>{},onFocus:f=()=>{},onChange:q=()=>{},value:b,className:W="",style:U={},size:B="small",color:T="primary",onInputChange:K=()=>{},..._}=e,x=J.useTheme(),[P,z]=d.useState(!1),I=i=>{var n,u;if(!isNaN(+i)){const s=(n=i==null?void 0:i.toString())==null?void 0:n.split(".");if(!(s!=null&&s.length)>0)return"0"+c+new Array(a+1).join("0");if((s==null?void 0:s.length)===1)return s.at(0)+c+new Array(a+1).join("0");if((s==null?void 0:s.length)>1){let t=(u=s==null?void 0:s.at(1))==null?void 0:u.toString();if((t==null?void 0:t.length)===a)return s.at(0)+c+t;if((t==null?void 0:t.length)<a)return s.at(0)+c+s.at(1)+new Array(a-t.length+1).join("0");if((t==null?void 0:t.length)>a)return s.at(0)+c+t.slice(0,a)}}return"0"+c+new Array(a+1).join("0")},N=I(b),[F,p]=d.useState(N),r=d.useRef(N);d.useEffect(()=>{const i=I(b);r.current=i,p(r.current)},[b]);const E=i=>{z(!0),f==null||f(i)},v=i=>{z(!1),m==null||m(i)},G=i=>{var u,s;let n=(u=r.current)==null?void 0:u.replace(c,"");if(i.key==="Delete"||i.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 C=[t,c,w].join("");r.current=C,p(r.current)}}else if(i.key==="-"&&S===!0&&+n!=0)((s=r==null?void 0:r.current)==null?void 0:s.slice(1))==="-"?r.current=r.current.slice(1,r.current.length):r.current="-"+r.current,p(r.current);else if(!isNaN(i.key)){n=n+i.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 C=[t,c,w].join("");r.current=C,p(r.current)}R(i)},H=i=>{i.target.value=r.current,K(i,r==null?void 0:r.current),q(i,r==null?void 0:r.current)};return g.jsxs(L,{style:U,className:W,theme:x,color:T,size:B,prefix:h,suffix:y,focused:P,disabled:V,readOnly:j,children:[h&&g.jsx(k,{theme:x,color:T,focused:P,className:"lnc-input-prefix",children:h}),g.jsx("input",{ref:D,type:"text",..._,onKeyDown:G,onBlur:v,value:F,className:"lnc-ui-decimal-v2-input",onFocus:E,disabled:V||j,onChange:H}),y&&g.jsx(M,{theme:x,color:T,focused:P,className:"lnc-input-suffix",children:y})]})});O.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=O;
47
+ color: ${e=>s.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","prefix")};
48
+ `,X=$.newStyled(q)``,W=h.forwardRef((e,R)=>{const{disabled:V,readOnly:j,prefix:m,suffix:f,decimalSeparator:c=",",decimalScale:a=2,allowNegative:U=!0,onKeyDown:B=()=>{},onBlur:b=()=>{},onFocus:T=()=>{},onChange:N=()=>{},value:x,className:K="",style:_={},size:F="small",color:P="primary",onInputChange:k=()=>{},allowNull:z=!0,...E}=e,w=M.useTheme(),[C,I]=h.useState(!1),O=o=>{var t,u;if(isNaN(+o)){if(z===!0&&(o==null||o===""))return""}else{const l=(t=o==null?void 0:o.toString())==null?void 0:t.split(".");if(!(l!=null&&l.length)>0)return"0"+c+new Array(a+1).join("0");if((l==null?void 0:l.length)===1)return l.at(0)+c+new Array(a+1).join("0");if((l==null?void 0:l.length)>1){let n=(u=l==null?void 0:l.at(1))==null?void 0:u.toString();if((n==null?void 0:n.length)===a)return l.at(0)+c+n;if((n==null?void 0:n.length)<a)return l.at(0)+c+l.at(1)+new Array(a-n.length+1).join("0");if((n==null?void 0:n.length)>a)return l.at(0)+c+n.slice(0,a)}}return"0"+c+new Array(a+1).join("0")},D=O(x),[G,p]=h.useState(D),r=h.useRef(D);h.useEffect(()=>{const o=O(x);r.current=o,p(r.current)},[x]);const H=o=>{I(!0),T==null||T(o)},J=o=>{I(!1),b==null||b(o)},L=o=>{var u,l;let t=(u=r.current)==null?void 0:u.replace(c,"");if(o.key==="Delete"||o.key==="Backspace")if(+t!=0){t=t.slice(0,(t==null?void 0:t.length)-1);let n=t.slice(0,(t==null?void 0:t.length)-a),d=t.slice((t==null?void 0:t.length)-a);(n==null?void 0:n.length)===0?n="0":n==="-"&&+t!=0?n="-0":n==="-"&&+t==0&&(n="0");let g=[n,c,d].join("");r.current=g,p(r.current)}else+t==0&&z===!0&&(r==null?void 0:r.current)!==""&&(r.current="",p(r.current),S(o));else if(o.key==="-"&&U===!0&&+t!=0)((l=r==null?void 0:r.current)==null?void 0:l.slice(1))==="-"?r.current=r.current.slice(1,r.current.length):r.current="-"+r.current,p(r.current);else if(!isNaN(o.key)){(t==null?void 0:t.length)===0?t="0"+new Array(a).join("0")+o.key:t=t+o.key;let n=t.slice(0,(t==null?void 0:t.length)-a),d=t.slice((t==null?void 0:t.length)-a);(n==null?void 0:n.length)>1&&(n=n.replace(/^0+/,""),(n==null?void 0:n.length)===0&&(n="0"));let g=[n,c,d].join("");r.current=g,p(r.current)}B(o)},S=o=>{var d,g;if((r==null?void 0:r.current)===""){o.target.value="",k(o,null),N(o,null);return}let t=(d=r==null?void 0:r.current)==null?void 0:d.split(c),u=+(t==null?void 0:t.at(0)),l=((g=t==null?void 0:t.at(1))==null?void 0:g.length)>0?`0.${t==null?void 0:t.at(1)}`:0,n=u+ +l;o.target.value=n,k(o,n),N(o,n)};return y.jsxs(Q,{style:_,className:K,theme:w,color:P,size:F,prefix:m,suffix:f,focused:C,disabled:V,readOnly:j,children:[m&&y.jsx(q,{theme:w,color:P,focused:C,className:"lnc-input-prefix",children:m}),y.jsx("input",{ref:R,type:"text",...E,onKeyDown:L,onBlur:J,value:G,className:"lnc-ui-decimal-v2-input",onFocus:H,disabled:V||j,onChange:o=>{console.log("CHG",o),S(o)}}),f&&y.jsx(X,{theme:w,color:P,focused:C,className:"lnc-input-suffix",children:f})]})});W.propTypes={id:i.PropTypes.string,value:i.PropTypes.any,defaultValue:i.PropTypes.any,disabled:i.PropTypes.bool,readOnly:i.PropTypes.bool,debounceTime:i.PropTypes.number,prefix:i.PropTypes.oneOfType([i.PropTypes.string,i.PropTypes.element]),suffix:i.PropTypes.oneOfType([i.PropTypes.string,i.PropTypes.element]),thousandSeparator:i.PropTypes.oneOf([".",","," "]),decimalSeparator:i.PropTypes.oneOf([".",","]),decimalScale:i.PropTypes.number,fixedDecimalScale:i.PropTypes.bool,allowNegative:i.PropTypes.bool,onChange:i.PropTypes.func,onInputChange:i.PropTypes.func,onBlur:i.PropTypes.func,onFocus:i.PropTypes.func,onKeyDown:i.PropTypes.func,className:i.PropTypes.string,style:i.PropTypes.object,size:i.PropTypes.oneOf(["small","medium","large"]),color:i.PropTypes.oneOf(["primary","secondary","success","danger","warning","information","neutral","gray"])};module.exports=W;
@@ -1,16 +1,16 @@
1
- import { jsxs as H, jsx as I } from "react/jsx-runtime";
2
- import { P as o } from "./index-BYnWp42a.js";
3
- import { forwardRef as J, useState as T, useRef as L, useEffect as M } from "react";
4
- import { n as N } from "./emotion-styled.browser.esm-BiK8DcgW.js";
5
- import { d as h, a as s, b as Q, e as X, h as V, g as Y } from "./utils-C52T57HO.js";
6
- import { u as Z } from "./emotion-element-5486c51c.browser.esm-Bb4VkP8U.js";
7
- const _ = N.div`
1
+ import { jsxs as Y, jsx as N } from "react/jsx-runtime";
2
+ import { P as l } from "./index-BYnWp42a.js";
3
+ import { forwardRef as Z, useState as F, useRef as _, useEffect as v } from "react";
4
+ import { n as k } from "./emotion-styled.browser.esm-BiK8DcgW.js";
5
+ import { d as m, a as u, b as R, e as A, h as P, g as ee } from "./utils-C52T57HO.js";
6
+ import { u as te } from "./emotion-element-5486c51c.browser.esm-Bb4VkP8U.js";
7
+ const ne = k.div`
8
8
  display: flex;
9
9
  align-items: center;
10
10
 
11
- min-height: ${(e) => h(e.theme, e.size)};
12
- max-height: ${(e) => h(e.theme, e.size)};
13
- background-color: ${(e) => s(
11
+ min-height: ${(e) => m(e.theme, e.size)};
12
+ max-height: ${(e) => m(e.theme, e.size)};
13
+ background-color: ${(e) => u(
14
14
  e.theme,
15
15
  "Input",
16
16
  e.color,
@@ -18,18 +18,18 @@ const _ = N.div`
18
18
  "background"
19
19
  )};
20
20
  border: 1px solid
21
- ${(e) => s(
21
+ ${(e) => u(
22
22
  e.theme,
23
23
  "Input",
24
24
  e.focused === !0 ? "primary" : e.color,
25
25
  "enabled",
26
26
  "border"
27
27
  )};
28
- border-radius: ${(e) => Q(e.theme, "regular")};
28
+ border-radius: ${(e) => R(e.theme, "regular")};
29
29
 
30
- ${(e) => e.focused === !0 && e.readOnly !== !0 ? X(e.theme) : ""}
31
- ${(e) => e.isDisabled === !0 ? V(e.theme) : ""}
32
- ${(e) => e.isDisabled === !0 ? "border: 1px solid " + s(
30
+ ${(e) => e.focused === !0 && e.readOnly !== !0 ? A(e.theme) : ""}
31
+ ${(e) => e.isDisabled === !0 ? P(e.theme) : ""}
32
+ ${(e) => e.isDisabled === !0 ? "border: 1px solid " + u(
33
33
  e.theme,
34
34
  "Input",
35
35
  e.color,
@@ -45,23 +45,23 @@ const _ = N.div`
45
45
  padding-bottom: 0.625rem;
46
46
  width: 100%;
47
47
 
48
- ${(e) => Y(e.theme, "Input", e.size, "enabled")}
49
- min-height: ${(e) => h(e.theme, e.size)};
50
- max-height: ${(e) => h(e.theme, e.size)};
51
- color: ${(e) => s(
48
+ ${(e) => ee(e.theme, "Input", e.size, "enabled")}
49
+ min-height: ${(e) => m(e.theme, e.size)};
50
+ max-height: ${(e) => m(e.theme, e.size)};
51
+ color: ${(e) => u(
52
52
  e.theme,
53
53
  "Input",
54
54
  e.focused === !0 ? "primary" : e.color,
55
55
  "enabled",
56
56
  "text"
57
57
  )};
58
- caret-color: ${(e) => s(e.theme, "Input", e.color, "enabled", "caret")};
58
+ caret-color: ${(e) => u(e.theme, "Input", e.color, "enabled", "caret")};
59
59
  padding-right: ${(e) => e.suffix ? "0" : "0.75rem"};
60
60
  padding-left: ${(e) => e.prefix ? "0" : "0.75rem"};
61
61
  }
62
62
 
63
63
  & input:disabled {
64
- ${(e) => V(e.theme)}
64
+ ${(e) => P(e.theme)}
65
65
  background: none;
66
66
  }
67
67
 
@@ -70,7 +70,7 @@ const _ = N.div`
70
70
  }
71
71
 
72
72
  & input::placeholder {
73
- color: ${(e) => s(
73
+ color: ${(e) => u(
74
74
  e.theme,
75
75
  "Input",
76
76
  e.color,
@@ -78,203 +78,217 @@ const _ = N.div`
78
78
  "placeholder"
79
79
  )};
80
80
  }
81
- `, B = N.span`
81
+ `, W = k.span`
82
82
  padding: 0 12px;
83
- color: ${(e) => s(
83
+ color: ${(e) => u(
84
84
  e.theme,
85
85
  "Input",
86
86
  e.focused === !0 ? "primary" : e.color,
87
87
  "enabled",
88
88
  "prefix"
89
89
  )};
90
- `, R = N(B)``, A = J((e, K) => {
90
+ `, ie = k(W)``, oe = Z((e, U) => {
91
91
  const {
92
- disabled: k,
93
- readOnly: O,
92
+ disabled: I,
93
+ readOnly: j,
94
94
  // debounceTime = 0,
95
- prefix: g,
96
- suffix: m,
95
+ prefix: f,
96
+ suffix: p,
97
97
  decimalSeparator: c = ",",
98
98
  decimalScale: a = 2,
99
- allowNegative: F = !0,
99
+ allowNegative: E = !0,
100
100
  // //----------------
101
- onKeyDown: P = () => {
101
+ onKeyDown: G = () => {
102
102
  },
103
- onBlur: f = () => {
103
+ onBlur: y = () => {
104
104
  },
105
- onFocus: y = () => {
105
+ onFocus: b = () => {
106
106
  },
107
- onChange: W = () => {
107
+ onChange: O = () => {
108
108
  },
109
- value: p,
109
+ value: x,
110
110
  //----------------
111
- className: U = "",
112
- style: v = {},
113
- size: E = "small",
114
- color: b = "primary",
115
- onInputChange: S = () => {
111
+ className: H = "",
112
+ style: S = {},
113
+ size: q = "small",
114
+ color: $ = "primary",
115
+ onInputChange: V = () => {
116
116
  },
117
- ...q
118
- } = e, x = Z(), [$, j] = T(!1), D = (r) => {
119
- var t, d;
120
- if (!isNaN(+r)) {
121
- const l = (t = r == null ? void 0 : r.toString()) == null ? void 0 : t.split(".");
122
- if (!(l != null && l.length) > 0)
117
+ allowNull: z = !0,
118
+ ...J
119
+ } = e, w = te(), [C, D] = F(!1), T = (i) => {
120
+ var t, s;
121
+ if (isNaN(+i)) {
122
+ if (z === !0 && (i == null || i === ""))
123
+ return "";
124
+ } else {
125
+ const r = (t = i == null ? void 0 : i.toString()) == null ? void 0 : t.split(".");
126
+ if (!(r != null && r.length) > 0)
123
127
  return "0" + c + new Array(a + 1).join("0");
124
- if ((l == null ? void 0 : l.length) === 1)
125
- return l.at(0) + c + new Array(a + 1).join("0");
126
- if ((l == null ? void 0 : l.length) > 1) {
127
- let n = (d = l == null ? void 0 : l.at(1)) == null ? void 0 : d.toString();
128
+ if ((r == null ? void 0 : r.length) === 1)
129
+ return r.at(0) + c + new Array(a + 1).join("0");
130
+ if ((r == null ? void 0 : r.length) > 1) {
131
+ let n = (s = r == null ? void 0 : r.at(1)) == null ? void 0 : s.toString();
128
132
  if ((n == null ? void 0 : n.length) === a)
129
- return l.at(0) + c + n;
133
+ return r.at(0) + c + n;
130
134
  if ((n == null ? void 0 : n.length) < a)
131
- return l.at(0) + c + l.at(1) + new Array(a - n.length + 1).join("0");
135
+ return r.at(0) + c + r.at(1) + new Array(a - n.length + 1).join("0");
132
136
  if ((n == null ? void 0 : n.length) > a)
133
- return l.at(0) + c + n.slice(0, a);
137
+ return r.at(0) + c + n.slice(0, a);
134
138
  }
135
139
  }
136
140
  return "0" + c + new Array(a + 1).join("0");
137
- }, z = D(p), [G, u] = T(z), i = L(z);
138
- return M(() => {
139
- const r = D(p);
140
- i.current = r, u(i.current);
141
- }, [p]), /* @__PURE__ */ H(
142
- _,
141
+ }, B = T(x), [L, g] = F(B), o = _(B);
142
+ v(() => {
143
+ const i = T(x);
144
+ o.current = i, g(o.current);
145
+ }, [x]);
146
+ const M = (i) => {
147
+ D(!0), b == null || b(i);
148
+ }, Q = (i) => {
149
+ D(!1), y == null || y(i);
150
+ }, X = (i) => {
151
+ var s, r;
152
+ let t = (s = o.current) == null ? void 0 : s.replace(c, "");
153
+ if (i.key === "Delete" || i.key === "Backspace")
154
+ if (+t != 0) {
155
+ t = t.slice(0, (t == null ? void 0 : t.length) - 1);
156
+ let n = t.slice(
157
+ 0,
158
+ (t == null ? void 0 : t.length) - a
159
+ ), d = t.slice((t == null ? void 0 : t.length) - a);
160
+ (n == null ? void 0 : n.length) === 0 ? n = "0" : n === "-" && +t != 0 ? n = "-0" : n === "-" && +t == 0 && (n = "0");
161
+ let h = [
162
+ n,
163
+ c,
164
+ d
165
+ ].join("");
166
+ o.current = h, g(o.current);
167
+ } else +t == 0 && z === !0 && (o == null ? void 0 : o.current) !== "" && (o.current = "", g(o.current), K(i));
168
+ else if (i.key === "-" && E === !0 && +t != 0)
169
+ ((r = o == null ? void 0 : o.current) == null ? void 0 : r.slice(1)) === "-" ? o.current = o.current.slice(1, o.current.length) : o.current = "-" + o.current, g(o.current);
170
+ else if (!isNaN(i.key)) {
171
+ (t == null ? void 0 : t.length) === 0 ? t = "0" + new Array(a).join("0") + i.key : t = t + i.key;
172
+ let n = t.slice(0, (t == null ? void 0 : t.length) - a), d = t.slice((t == null ? void 0 : t.length) - a);
173
+ (n == null ? void 0 : n.length) > 1 && (n = n.replace(/^0+/, ""), (n == null ? void 0 : n.length) === 0 && (n = "0"));
174
+ let h = [
175
+ n,
176
+ c,
177
+ d
178
+ ].join("");
179
+ o.current = h, g(o.current);
180
+ }
181
+ G(i);
182
+ }, K = (i) => {
183
+ var d, h;
184
+ if ((o == null ? void 0 : o.current) === "") {
185
+ i.target.value = "", V(i, null), O(i, null);
186
+ return;
187
+ }
188
+ let t = (d = o == null ? void 0 : o.current) == null ? void 0 : d.split(c), s = +(t == null ? void 0 : t.at(0)), r = ((h = t == null ? void 0 : t.at(1)) == null ? void 0 : h.length) > 0 ? `0.${t == null ? void 0 : t.at(1)}` : 0, n = s + +r;
189
+ i.target.value = n, V(i, n), O(i, n);
190
+ };
191
+ return /* @__PURE__ */ Y(
192
+ ne,
143
193
  {
144
- style: v,
145
- className: U,
146
- theme: x,
147
- color: b,
148
- size: E,
149
- prefix: g,
150
- suffix: m,
151
- focused: $,
152
- disabled: k,
153
- readOnly: O,
194
+ style: S,
195
+ className: H,
196
+ theme: w,
197
+ color: $,
198
+ size: q,
199
+ prefix: f,
200
+ suffix: p,
201
+ focused: C,
202
+ disabled: I,
203
+ readOnly: j,
154
204
  children: [
155
- g && /* @__PURE__ */ I(
156
- B,
205
+ f && /* @__PURE__ */ N(
206
+ W,
157
207
  {
158
- theme: x,
159
- color: b,
160
- focused: $,
208
+ theme: w,
209
+ color: $,
210
+ focused: C,
161
211
  className: "lnc-input-prefix",
162
- children: g
212
+ children: f
163
213
  }
164
214
  ),
165
- /* @__PURE__ */ I(
215
+ /* @__PURE__ */ N(
166
216
  "input",
167
217
  {
168
- ref: K,
218
+ ref: U,
169
219
  type: "text",
170
- ...q,
171
- onKeyDown: (r) => {
172
- var d, l;
173
- let t = (d = i.current) == null ? void 0 : d.replace(c, "");
174
- if (r.key === "Delete" || r.key === "Backspace") {
175
- if (+t != 0) {
176
- t = t.slice(0, (t == null ? void 0 : t.length) - 1);
177
- let n = t.slice(
178
- 0,
179
- (t == null ? void 0 : t.length) - a
180
- ), w = t.slice((t == null ? void 0 : t.length) - a);
181
- (n == null ? void 0 : n.length) === 0 ? n = "0" : n === "-" && +t != 0 ? n = "-0" : n === "-" && +t == 0 && (n = "0");
182
- let C = [
183
- n,
184
- c,
185
- w
186
- ].join("");
187
- i.current = C, u(i.current);
188
- }
189
- } else if (r.key === "-" && F === !0 && +t != 0)
190
- ((l = i == null ? void 0 : i.current) == null ? void 0 : l.slice(1)) === "-" ? i.current = i.current.slice(1, i.current.length) : i.current = "-" + i.current, u(i.current);
191
- else if (!isNaN(r.key)) {
192
- t = t + r.key;
193
- let n = t.slice(0, (t == null ? void 0 : t.length) - a), w = t.slice((t == null ? void 0 : t.length) - a);
194
- (n == null ? void 0 : n.length) > 1 && (n = n.replace(/^0+/, ""), (n == null ? void 0 : n.length) === 0 && (n = "0"));
195
- let C = [
196
- n,
197
- c,
198
- w
199
- ].join("");
200
- i.current = C, u(i.current);
201
- }
202
- P(r);
203
- },
204
- onBlur: (r) => {
205
- j(!1), f == null || f(r);
206
- },
207
- value: G,
220
+ ...J,
221
+ onKeyDown: X,
222
+ onBlur: Q,
223
+ value: L,
208
224
  className: "lnc-ui-decimal-v2-input",
209
- onFocus: (r) => {
210
- j(!0), y == null || y(r);
211
- },
212
- disabled: k || O,
213
- onChange: (r) => {
214
- r.target.value = i.current, S(r, i == null ? void 0 : i.current), W(r, i == null ? void 0 : i.current);
225
+ onFocus: M,
226
+ disabled: I || j,
227
+ onChange: (i) => {
228
+ console.log("CHG", i), K(i);
215
229
  }
216
230
  }
217
231
  ),
218
- m && /* @__PURE__ */ I(
219
- R,
232
+ p && /* @__PURE__ */ N(
233
+ ie,
220
234
  {
221
- theme: x,
222
- color: b,
223
- focused: $,
235
+ theme: w,
236
+ color: $,
237
+ focused: C,
224
238
  className: "lnc-input-suffix",
225
- children: m
239
+ children: p
226
240
  }
227
241
  )
228
242
  ]
229
243
  }
230
244
  );
231
245
  });
232
- A.propTypes = {
233
- id: o.string,
234
- value: o.any,
235
- defaultValue: o.any,
236
- disabled: o.bool,
237
- readOnly: o.bool,
238
- debounceTime: o.number,
246
+ oe.propTypes = {
247
+ id: l.string,
248
+ value: l.any,
249
+ defaultValue: l.any,
250
+ disabled: l.bool,
251
+ readOnly: l.bool,
252
+ debounceTime: l.number,
239
253
  /**
240
254
  * Reserved space before input. Intented to be used with plain text or `Icon` component.
241
255
  */
242
- prefix: o.oneOfType([o.string, o.element]),
256
+ prefix: l.oneOfType([l.string, l.element]),
243
257
  /**
244
258
  * Reserved space after input. Intented to be used with plain text or `Icon` component.
245
259
  */
246
- suffix: o.oneOfType([o.string, o.element]),
247
- thousandSeparator: o.oneOf([".", ",", " "]),
248
- decimalSeparator: o.oneOf([".", ","]),
249
- decimalScale: o.number,
250
- fixedDecimalScale: o.bool,
251
- allowNegative: o.bool,
260
+ suffix: l.oneOfType([l.string, l.element]),
261
+ thousandSeparator: l.oneOf([".", ",", " "]),
262
+ decimalSeparator: l.oneOf([".", ","]),
263
+ decimalScale: l.number,
264
+ fixedDecimalScale: l.bool,
265
+ allowNegative: l.bool,
252
266
  //----------------
253
267
  /**
254
268
  * `(event, value) => void`
255
269
  */
256
- onChange: o.func,
270
+ onChange: l.func,
257
271
  /**
258
272
  * `(event, value) => void`
259
273
  */
260
- onInputChange: o.func,
274
+ onInputChange: l.func,
261
275
  /**
262
276
  * `(event) => void`
263
277
  */
264
- onBlur: o.func,
278
+ onBlur: l.func,
265
279
  /**
266
280
  * `(event) => void`
267
281
  */
268
- onFocus: o.func,
282
+ onFocus: l.func,
269
283
  /**
270
284
  * `(event) => void`
271
285
  */
272
- onKeyDown: o.func,
286
+ onKeyDown: l.func,
273
287
  //----------------
274
- className: o.string,
275
- style: o.object,
276
- size: o.oneOf(["small", "medium", "large"]),
277
- color: o.oneOf([
288
+ className: l.string,
289
+ style: l.object,
290
+ size: l.oneOf(["small", "medium", "large"]),
291
+ color: l.oneOf([
278
292
  "primary",
279
293
  "secondary",
280
294
  "success",
@@ -286,5 +300,5 @@ A.propTypes = {
286
300
  ])
287
301
  };
288
302
  export {
289
- A as default
303
+ oe as default
290
304
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lanaco/lnc-react-ui",
3
- "version": "4.0.16",
3
+ "version": "4.0.18",
4
4
  "description": "React component library",
5
5
  "type": "module",
6
6
  "keywords": [