@lanaco/lnc-react-ui 4.0.17 → 4.0.19

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