@lanaco/lnc-react-ui 4.0.96 → 4.0.97

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,20 +1,20 @@
1
- "use strict";const d=require("react/jsx-runtime"),t=require("./index-BPVoEhTF.cjs"),s=require("react"),A=require("./index-DaiUAQVF.cjs"),c=require("./emotion-styled.browser.esm-BtEseadx.cjs"),r=require("./utils-BOtq2mcF.cjs"),B=require("./emotion-element-f0de968e.browser.esm-B7k6i6lC.cjs"),D=c.styled.div`
1
+ "use strict";const c=require("react/jsx-runtime"),t=require("./index-BPVoEhTF.cjs"),a=require("react"),M=require("./index-DaiUAQVF.cjs"),p=require("./emotion-styled.browser.esm-BtEseadx.cjs"),n=require("./utils-BOtq2mcF.cjs"),v=require("./emotion-element-f0de968e.browser.esm-B7k6i6lC.cjs"),K=p.styled.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
 
5
- min-height: ${e=>r.getSizeValueWithUnits(e.theme,e.size)};
6
- max-height: ${e=>r.getSizeValueWithUnits(e.theme,e.size)};
7
- background-color: ${e=>r.getColorRgbaValue(e.theme,"Input",e.color,"enabled","background")};
5
+ min-height: ${e=>n.getSizeValueWithUnits(e.theme,e.size)};
6
+ max-height: ${e=>n.getSizeValueWithUnits(e.theme,e.size)};
7
+ background-color: ${e=>n.getColorRgbaValue(e.theme,"Input",e.color,"enabled","background")};
8
8
  border: 1px solid
9
- ${e=>r.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,e.disabled===!0?"disabled":"enabled","border")};
10
- border-radius: ${e=>r.getBorderRadiusValueWithUnits(e.theme,"regular")};
9
+ ${e=>n.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,e.disabled===!0?"disabled":"enabled","border")};
10
+ border-radius: ${e=>n.getBorderRadiusValueWithUnits(e.theme,"regular")};
11
11
 
12
- ${e=>e.focused&&e.readOnly!==!0?r.getOutlineCss(e.theme):""}
13
- ${e=>e.disabled===!0?r.getDisabledStateCss(e.theme):""}
14
- `,C=c.styled.span`
12
+ ${e=>e.focused&&e.readOnly!==!0?n.getOutlineCss(e.theme):""}
13
+ ${e=>e.disabled===!0?n.getDisabledStateCss(e.theme):""}
14
+ `,I=p.styled.span`
15
15
  padding: 0 12px;
16
- color: ${e=>r.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","prefix")};
17
- `,G=c.styled(C)``,M=c.styled.input`
16
+ color: ${e=>n.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","prefix")};
17
+ `,X=p.styled(I)``,H=p.styled.input`
18
18
  background: none;
19
19
  border: none;
20
20
  outline: none;
@@ -22,16 +22,16 @@
22
22
  padding-bottom: 0.625rem;
23
23
  width: 100%;
24
24
 
25
- ${e=>r.getComponentTypographyCss(e.theme,"Input",e.size,"enabled")}
26
- min-height: ${e=>r.getSizeValueWithUnits(e.theme,e.size)};
27
- max-height: ${e=>r.getSizeValueWithUnits(e.theme,e.size)};
28
- color: ${e=>r.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","text")};
29
- caret-color: ${e=>r.getColorRgbaValue(e.theme,"Input",e.color,"enabled","caret")};
25
+ ${e=>n.getComponentTypographyCss(e.theme,"Input",e.size,"enabled")}
26
+ min-height: ${e=>n.getSizeValueWithUnits(e.theme,e.size)};
27
+ max-height: ${e=>n.getSizeValueWithUnits(e.theme,e.size)};
28
+ color: ${e=>n.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","text")};
29
+ caret-color: ${e=>n.getColorRgbaValue(e.theme,"Input",e.color,"enabled","caret")};
30
30
  padding-right: ${e=>e.suffix?"0":"0.75rem"};
31
31
  padding-left: ${e=>e.prefix?"0":"0.75rem"};
32
32
 
33
33
  &::placeholder {
34
- color: ${e=>r.getColorRgbaValue(e.theme,"Input",e.color,"enabled","placeholder")};
34
+ color: ${e=>n.getColorRgbaValue(e.theme,"Input",e.color,"enabled","placeholder")};
35
35
  }
36
36
 
37
37
  &:read-only {
@@ -39,7 +39,7 @@
39
39
  }
40
40
 
41
41
  &:disabled {
42
- ${e=>r.getDisabledStateCss(e.theme)}
42
+ ${e=>n.getDisabledStateCss(e.theme)}
43
43
  background: none;
44
44
  }
45
- `,S=s.forwardRef((e,I)=>{const{disabled:f,readOnly:T,debounceTime:R=0,step:z=1,min:N=Number.MIN_SAFE_INTEGER,max:O=Number.MAX_SAFE_INTEGER,prefix:m,suffix:p,placeholder:E,value:o,defaultValue:x,onChange:a,onBlur:y,onFocus:g,className:_="",style:q={},size:P="small",color:l="primary",...v}=e,u=B.useTheme(),i=s.useRef(o||x||""),[j,$]=s.useState(o||x||""),[b,V]=s.useState(!1);s.useEffect(()=>{o!=null&&(i.current=o,$(i.current))},[o]);const F=s.useCallback(A.debounce((n,h)=>W(n,h),R),[a]),W=(n,h)=>{a&&(a==null||a(n,h))},k=n=>{i.current=n.target.value,$(i.current),F(n,n.target.value)},w=n=>{V(!0),g==null||g(n)},U=n=>{V(!1),y==null||y(n)};return d.jsxs(D,{style:q,className:_,theme:u,color:l,size:P,focused:b,disabled:f,readOnly:T,children:[m&&d.jsx(C,{theme:u,color:l,focused:b,className:"lnc-input-prefix",children:m}),d.jsx(M,{ref:I,type:"number",theme:u,color:l,size:P,placeholder:E,prefix:m,suffix:p,disabled:f,readOnly:T,step:z,min:N,max:O,value:j,onFocus:w,onBlur:U,onChange:k,...v}),p&&d.jsx(G,{theme:u,color:l,focused:b,className:"lnc-input-suffix",children:p})]})});S.propTypes={id:t.PropTypes.any,value:t.PropTypes.any,defaultValue:t.PropTypes.any,disabled:t.PropTypes.bool,readOnly:t.PropTypes.bool,debounceTime:t.PropTypes.number,step:t.PropTypes.number,min:t.PropTypes.number,max:t.PropTypes.number,prefix:t.PropTypes.oneOfType([t.PropTypes.string,t.PropTypes.element]),suffix:t.PropTypes.oneOfType([t.PropTypes.string,t.PropTypes.element]),placeholder:t.PropTypes.string,tabIndex:t.PropTypes.number,onChange:t.PropTypes.func,onBlur:t.PropTypes.func,onFocus:t.PropTypes.func,className:t.PropTypes.string,style:t.PropTypes.object,size:t.PropTypes.oneOf(["small","medium","large"]),color:t.PropTypes.oneOf(["primary","secondary","success","danger","warning","information","neutral","gray"])};module.exports=S;
45
+ `,R=a.forwardRef((e,z)=>{const{disabled:T,readOnly:x,debounceTime:N=0,step:O=1,min:E=Number.MIN_SAFE_INTEGER,max:_=Number.MAX_SAFE_INTEGER,prefix:m,suffix:y,placeholder:k,value:o,defaultValue:P,onChange:l,onBlur:g,onFocus:b,onKeyDown:h,className:q="",style:j={},size:$="small",color:u="primary",...w}=e,i=v.useTheme(),d=a.useRef(o||P||""),[F,V]=a.useState(o||P||""),[f,C]=a.useState(!1);a.useEffect(()=>{o!=null&&(d.current=o,V(d.current))},[o]);const W=a.useCallback(M.debounce((r,s)=>U(r,s),N),[l]),U=(r,s)=>{l&&(l==null||l(r,s))},D=r=>{d.current=r.target.value,V(d.current),W(r,r.target.value)},A=r=>{C(!0),b==null||b(r)},B=r=>{C(!1),g==null||g(r)},G=r=>{var s,S;((S=(s=r==null?void 0:r.target)==null?void 0:s.value)==null?void 0:S.length)>0&&(r.key==="+"||r.key==="-")&&r.preventDefault(),h==null||h(r)};return c.jsxs(K,{style:j,className:q,theme:i,color:u,size:$,focused:f,disabled:T,readOnly:x,children:[m&&c.jsx(I,{theme:i,color:u,focused:f,className:"lnc-input-prefix",children:m}),c.jsx(H,{ref:z,type:"number",theme:i,color:u,size:$,placeholder:k,prefix:m,suffix:y,disabled:T,readOnly:x,step:O,min:E,max:_,value:F,onFocus:A,onBlur:B,onChange:D,onKeyDown:G,...w}),y&&c.jsx(X,{theme:i,color:u,focused:f,className:"lnc-input-suffix",children:y})]})});R.propTypes={id:t.PropTypes.any,value:t.PropTypes.any,defaultValue:t.PropTypes.any,disabled:t.PropTypes.bool,readOnly:t.PropTypes.bool,debounceTime:t.PropTypes.number,step:t.PropTypes.number,min:t.PropTypes.number,max:t.PropTypes.number,prefix:t.PropTypes.oneOfType([t.PropTypes.string,t.PropTypes.element]),suffix:t.PropTypes.oneOfType([t.PropTypes.string,t.PropTypes.element]),placeholder:t.PropTypes.string,tabIndex:t.PropTypes.number,onChange:t.PropTypes.func,onBlur:t.PropTypes.func,onFocus:t.PropTypes.func,className:t.PropTypes.string,style:t.PropTypes.object,size:t.PropTypes.oneOf(["small","medium","large"]),color:t.PropTypes.oneOf(["primary","secondary","success","danger","warning","information","neutral","gray"])};module.exports=R;
@@ -1,17 +1,17 @@
1
- import { jsxs as P, jsx as y } from "react/jsx-runtime";
1
+ import { jsxs as G, jsx as p } from "react/jsx-runtime";
2
2
  import { P as n } from "./index-S5Cd7WrG.js";
3
- import { forwardRef as W, useRef as G, useState as S, useEffect as M, useCallback as U } from "react";
4
- import { d as D } from "./index-CkWvbrVT.js";
5
- import { s as i } from "./emotion-styled.browser.esm-BNN1dTl3.js";
6
- import { d as s, b as r, a as X, e as q, h as T, c as H } from "./utils-WHYrEnYF.js";
7
- import { u as J } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js";
8
- const K = i.div`
3
+ import { forwardRef as K, useRef as M, useState as V, useEffect as U, useCallback as v } from "react";
4
+ import { d as X } from "./index-CkWvbrVT.js";
5
+ import { s as c } from "./emotion-styled.browser.esm-BNN1dTl3.js";
6
+ import { d as i, b as l, a as q, e as H, h as O, c as J } from "./utils-WHYrEnYF.js";
7
+ import { u as L } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js";
8
+ const Q = c.div`
9
9
  display: flex;
10
10
  align-items: center;
11
11
 
12
- min-height: ${(e) => s(e.theme, e.size)};
13
- max-height: ${(e) => s(e.theme, e.size)};
14
- background-color: ${(e) => r(
12
+ min-height: ${(e) => i(e.theme, e.size)};
13
+ max-height: ${(e) => i(e.theme, e.size)};
14
+ background-color: ${(e) => l(
15
15
  e.theme,
16
16
  "Input",
17
17
  e.color,
@@ -19,27 +19,27 @@ const K = i.div`
19
19
  "background"
20
20
  )};
21
21
  border: 1px solid
22
- ${(e) => r(
22
+ ${(e) => l(
23
23
  e.theme,
24
24
  "Input",
25
25
  e.focused === !0 ? "primary" : e.color,
26
26
  e.disabled === !0 ? "disabled" : "enabled",
27
27
  "border"
28
28
  )};
29
- border-radius: ${(e) => X(e.theme, "regular")};
29
+ border-radius: ${(e) => q(e.theme, "regular")};
30
30
 
31
- ${(e) => e.focused && e.readOnly !== !0 ? q(e.theme) : ""}
32
- ${(e) => e.disabled === !0 ? T(e.theme) : ""}
33
- `, V = i.span`
31
+ ${(e) => e.focused && e.readOnly !== !0 ? H(e.theme) : ""}
32
+ ${(e) => e.disabled === !0 ? O(e.theme) : ""}
33
+ `, z = c.span`
34
34
  padding: 0 12px;
35
- color: ${(e) => r(
35
+ color: ${(e) => l(
36
36
  e.theme,
37
37
  "Input",
38
38
  e.focused === !0 ? "primary" : e.color,
39
39
  "enabled",
40
40
  "prefix"
41
41
  )};
42
- `, L = i(V)``, Q = i.input`
42
+ `, Y = c(z)``, Z = c.input`
43
43
  background: none;
44
44
  border: none;
45
45
  outline: none;
@@ -47,22 +47,22 @@ const K = i.div`
47
47
  padding-bottom: 0.625rem;
48
48
  width: 100%;
49
49
 
50
- ${(e) => H(e.theme, "Input", e.size, "enabled")}
51
- min-height: ${(e) => s(e.theme, e.size)};
52
- max-height: ${(e) => s(e.theme, e.size)};
53
- color: ${(e) => r(
50
+ ${(e) => J(e.theme, "Input", e.size, "enabled")}
51
+ min-height: ${(e) => i(e.theme, e.size)};
52
+ max-height: ${(e) => i(e.theme, e.size)};
53
+ color: ${(e) => l(
54
54
  e.theme,
55
55
  "Input",
56
56
  e.focused === !0 ? "primary" : e.color,
57
57
  "enabled",
58
58
  "text"
59
59
  )};
60
- caret-color: ${(e) => r(e.theme, "Input", e.color, "enabled", "caret")};
60
+ caret-color: ${(e) => l(e.theme, "Input", e.color, "enabled", "caret")};
61
61
  padding-right: ${(e) => e.suffix ? "0" : "0.75rem"};
62
62
  padding-left: ${(e) => e.prefix ? "0" : "0.75rem"};
63
63
 
64
64
  &::placeholder {
65
- color: ${(e) => r(
65
+ color: ${(e) => l(
66
66
  e.theme,
67
67
  "Input",
68
68
  e.color,
@@ -76,108 +76,113 @@ const K = i.div`
76
76
  }
77
77
 
78
78
  &:disabled {
79
- ${(e) => T(e.theme)}
79
+ ${(e) => O(e.theme)}
80
80
  background: none;
81
81
  }
82
- `, Y = W((e, O) => {
82
+ `, ee = K((e, k) => {
83
83
  const {
84
- disabled: p,
85
- readOnly: x,
86
- debounceTime: z = 0,
87
- step: v = 1,
88
- min: E = Number.MIN_SAFE_INTEGER,
89
- max: R = Number.MAX_SAFE_INTEGER,
90
- prefix: c,
91
- suffix: m,
92
- placeholder: F,
84
+ disabled: x,
85
+ readOnly: $,
86
+ debounceTime: E = 0,
87
+ step: R = 1,
88
+ min: F = Number.MIN_SAFE_INTEGER,
89
+ max: w = Number.MAX_SAFE_INTEGER,
90
+ prefix: m,
91
+ suffix: f,
92
+ placeholder: B,
93
93
  value: a,
94
- defaultValue: $,
94
+ defaultValue: I,
95
95
  //----------------
96
- onChange: l,
97
- onBlur: f,
98
- onFocus: h,
96
+ onChange: o,
97
+ onBlur: h,
98
+ onFocus: b,
99
+ onKeyDown: g,
99
100
  //----------------
100
- className: k = "",
101
- style: B = {},
102
- size: I = "small",
103
- color: o = "primary",
104
- ..._
105
- } = e, u = J(), d = G(a || $ || ""), [j, C] = S(a || $ || ""), [b, N] = S(!1);
106
- M(() => {
107
- a != null && (d.current = a, C(d.current));
101
+ className: D = "",
102
+ style: _ = {},
103
+ size: C = "small",
104
+ color: u = "primary",
105
+ ...j
106
+ } = e, d = L(), s = M(a || I || ""), [A, N] = V(a || I || ""), [y, S] = V(!1);
107
+ U(() => {
108
+ a != null && (s.current = a, N(s.current));
108
109
  }, [a]);
109
- const w = U(
110
- D((t, g) => A(t, g), z),
111
- [l]
112
- ), A = (t, g) => {
113
- l && (l == null || l(t, g));
110
+ const P = v(
111
+ X((t, r) => W(t, r), E),
112
+ [o]
113
+ ), W = (t, r) => {
114
+ o && (o == null || o(t, r));
114
115
  };
115
- return /* @__PURE__ */ P(
116
- K,
116
+ return /* @__PURE__ */ G(
117
+ Q,
117
118
  {
118
- style: B,
119
- className: k,
120
- theme: u,
121
- color: o,
122
- size: I,
123
- focused: b,
124
- disabled: p,
125
- readOnly: x,
119
+ style: _,
120
+ className: D,
121
+ theme: d,
122
+ color: u,
123
+ size: C,
124
+ focused: y,
125
+ disabled: x,
126
+ readOnly: $,
126
127
  children: [
127
- c && /* @__PURE__ */ y(
128
- V,
128
+ m && /* @__PURE__ */ p(
129
+ z,
129
130
  {
130
- theme: u,
131
- color: o,
132
- focused: b,
131
+ theme: d,
132
+ color: u,
133
+ focused: y,
133
134
  className: "lnc-input-prefix",
134
- children: c
135
+ children: m
135
136
  }
136
137
  ),
137
- /* @__PURE__ */ y(
138
- Q,
138
+ /* @__PURE__ */ p(
139
+ Z,
139
140
  {
140
- ref: O,
141
+ ref: k,
141
142
  type: "number",
142
- theme: u,
143
- color: o,
144
- size: I,
145
- placeholder: F,
146
- prefix: c,
147
- suffix: m,
148
- disabled: p,
149
- readOnly: x,
150
- step: v,
151
- min: E,
152
- max: R,
153
- value: j,
143
+ theme: d,
144
+ color: u,
145
+ size: C,
146
+ placeholder: B,
147
+ prefix: m,
148
+ suffix: f,
149
+ disabled: x,
150
+ readOnly: $,
151
+ step: R,
152
+ min: F,
153
+ max: w,
154
+ value: A,
154
155
  onFocus: (t) => {
155
- N(!0), h == null || h(t);
156
+ S(!0), b == null || b(t);
156
157
  },
157
158
  onBlur: (t) => {
158
- N(!1), f == null || f(t);
159
+ S(!1), h == null || h(t);
159
160
  },
160
161
  onChange: (t) => {
161
- d.current = t.target.value, C(d.current), w(t, t.target.value);
162
+ s.current = t.target.value, N(s.current), P(t, t.target.value);
163
+ },
164
+ onKeyDown: (t) => {
165
+ var r, T;
166
+ ((T = (r = t == null ? void 0 : t.target) == null ? void 0 : r.value) == null ? void 0 : T.length) > 0 && (t.key === "+" || t.key === "-") && t.preventDefault(), g == null || g(t);
162
167
  },
163
- ..._
168
+ ...j
164
169
  }
165
170
  ),
166
- m && /* @__PURE__ */ y(
167
- L,
171
+ f && /* @__PURE__ */ p(
172
+ Y,
168
173
  {
169
- theme: u,
170
- color: o,
171
- focused: b,
174
+ theme: d,
175
+ color: u,
176
+ focused: y,
172
177
  className: "lnc-input-suffix",
173
- children: m
178
+ children: f
174
179
  }
175
180
  )
176
181
  ]
177
182
  }
178
183
  );
179
184
  });
180
- Y.propTypes = {
185
+ ee.propTypes = {
181
186
  id: n.any,
182
187
  value: n.any,
183
188
  defaultValue: n.any,
@@ -237,5 +242,5 @@ Y.propTypes = {
237
242
  ])
238
243
  };
239
244
  export {
240
- Y as default
245
+ ee as default
241
246
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lanaco/lnc-react-ui",
3
- "version": "4.0.96",
3
+ "version": "4.0.97",
4
4
  "description": "React component library",
5
5
  "type": "module",
6
6
  "keywords": [