@lanaco/lnc-react-ui 4.0.96 → 4.0.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NumberInput.cjs +19 -19
- package/dist/NumberInput.js +121 -116
- package/package.json +1 -1
package/dist/NumberInput.cjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),r=require("./index-BPVoEhTF.cjs"),l=require("react"),K=require("./index-DaiUAQVF.cjs"),p=require("./emotion-styled.browser.esm-BtEseadx.cjs"),o=require("./utils-BOtq2mcF.cjs"),X=require("./emotion-element-f0de968e.browser.esm-B7k6i6lC.cjs"),H=p.styled.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
|
|
5
|
-
min-height: ${e=>
|
|
6
|
-
max-height: ${e=>
|
|
7
|
-
background-color: ${e=>
|
|
5
|
+
min-height: ${e=>o.getSizeValueWithUnits(e.theme,e.size)};
|
|
6
|
+
max-height: ${e=>o.getSizeValueWithUnits(e.theme,e.size)};
|
|
7
|
+
background-color: ${e=>o.getColorRgbaValue(e.theme,"Input",e.color,"enabled","background")};
|
|
8
8
|
border: 1px solid
|
|
9
|
-
${e=>
|
|
10
|
-
border-radius: ${e=>
|
|
9
|
+
${e=>o.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,e.disabled===!0?"disabled":"enabled","border")};
|
|
10
|
+
border-radius: ${e=>o.getBorderRadiusValueWithUnits(e.theme,"regular")};
|
|
11
11
|
|
|
12
|
-
${e=>e.focused&&e.readOnly!==!0?
|
|
13
|
-
${e=>e.disabled===!0?
|
|
14
|
-
`,
|
|
12
|
+
${e=>e.focused&&e.readOnly!==!0?o.getOutlineCss(e.theme):""}
|
|
13
|
+
${e=>e.disabled===!0?o.getDisabledStateCss(e.theme):""}
|
|
14
|
+
`,R=p.styled.span`
|
|
15
15
|
padding: 0 12px;
|
|
16
|
-
color: ${e=>
|
|
17
|
-
`,
|
|
16
|
+
color: ${e=>o.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","prefix")};
|
|
17
|
+
`,J=p.styled(R)``,L=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=>
|
|
26
|
-
min-height: ${e=>
|
|
27
|
-
max-height: ${e=>
|
|
28
|
-
color: ${e=>
|
|
29
|
-
caret-color: ${e=>
|
|
25
|
+
${e=>o.getComponentTypographyCss(e.theme,"Input",e.size,"enabled")}
|
|
26
|
+
min-height: ${e=>o.getSizeValueWithUnits(e.theme,e.size)};
|
|
27
|
+
max-height: ${e=>o.getSizeValueWithUnits(e.theme,e.size)};
|
|
28
|
+
color: ${e=>o.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","text")};
|
|
29
|
+
caret-color: ${e=>o.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=>
|
|
34
|
+
color: ${e=>o.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=>
|
|
42
|
+
${e=>o.getDisabledStateCss(e.theme)}
|
|
43
43
|
background: none;
|
|
44
44
|
}
|
|
45
|
-
`,
|
|
45
|
+
`,z=l.forwardRef((e,k)=>{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:q,value:n,defaultValue:P,onChange:s,onBlur:g,onFocus:b,onKeyDown:h,className:j="",style:w={},size:$="small",color:u="primary",...F}=e,i=X.useTheme(),d=l.useRef(n||P||""),[W,V]=l.useState(n||P||""),[f,C]=l.useState(!1);l.useEffect(()=>{n!=null&&(d.current=n,V(d.current))},[n]);const U=l.useCallback(K.debounce((t,a)=>D(t,a),N),[s]),D=(t,a)=>{s&&(s==null||s(t,a))},A=t=>{d.current=t.target.value,V(d.current),U(t,t.target.value)},B=t=>{C(!0),b==null||b(t)},G=t=>{C(!1),g==null||g(t)},M=t=>{var a,S,I;((S=(a=t==null?void 0:t.target)==null?void 0:a.value)==null?void 0:S.length)>0&&(t.key==="+"||t.key==="-")&&t.preventDefault(),((I=t==null?void 0:t.target)==null?void 0:I.value)===""&&(t.key==="+"||t.key==="-")&&(t.target.value=t.key),h==null||h(t)};return c.jsxs(H,{style:w,className:j,theme:i,color:u,size:$,focused:f,disabled:T,readOnly:x,children:[m&&c.jsx(R,{theme:i,color:u,focused:f,className:"lnc-input-prefix",children:m}),c.jsx(L,{ref:k,type:"number",theme:i,color:u,size:$,placeholder:q,prefix:m,suffix:y,disabled:T,readOnly:x,step:O,min:E,max:_,value:W,onFocus:B,onBlur:G,onChange:A,onKeyDown:M,...F}),y&&c.jsx(J,{theme:i,color:u,focused:f,className:"lnc-input-suffix",children:y})]})});z.propTypes={id:r.PropTypes.any,value:r.PropTypes.any,defaultValue:r.PropTypes.any,disabled:r.PropTypes.bool,readOnly:r.PropTypes.bool,debounceTime:r.PropTypes.number,step:r.PropTypes.number,min:r.PropTypes.number,max:r.PropTypes.number,prefix:r.PropTypes.oneOfType([r.PropTypes.string,r.PropTypes.element]),suffix:r.PropTypes.oneOfType([r.PropTypes.string,r.PropTypes.element]),placeholder:r.PropTypes.string,tabIndex:r.PropTypes.number,onChange:r.PropTypes.func,onBlur:r.PropTypes.func,onFocus: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","information","neutral","gray"])};module.exports=z;
|
package/dist/NumberInput.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { P as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { d as
|
|
5
|
-
import { s as
|
|
6
|
-
import { d as s, b as
|
|
7
|
-
import { u as
|
|
8
|
-
const
|
|
1
|
+
import { jsxs as K, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { P as t } from "./index-S5Cd7WrG.js";
|
|
3
|
+
import { forwardRef as M, useRef as U, useState as V, useEffect as X, useCallback as q } from "react";
|
|
4
|
+
import { d as H } from "./index-CkWvbrVT.js";
|
|
5
|
+
import { s as c } from "./emotion-styled.browser.esm-BNN1dTl3.js";
|
|
6
|
+
import { d as s, b as l, a as J, e as L, h as O, c as Q } from "./utils-WHYrEnYF.js";
|
|
7
|
+
import { u as Y } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js";
|
|
8
|
+
const Z = c.div`
|
|
9
9
|
display: flex;
|
|
10
10
|
align-items: center;
|
|
11
11
|
|
|
12
12
|
min-height: ${(e) => s(e.theme, e.size)};
|
|
13
13
|
max-height: ${(e) => s(e.theme, e.size)};
|
|
14
|
-
background-color: ${(e) =>
|
|
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) =>
|
|
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) =>
|
|
29
|
+
border-radius: ${(e) => J(e.theme, "regular")};
|
|
30
30
|
|
|
31
|
-
${(e) => e.focused && e.readOnly !== !0 ?
|
|
32
|
-
${(e) => e.disabled === !0 ?
|
|
33
|
-
`,
|
|
31
|
+
${(e) => e.focused && e.readOnly !== !0 ? L(e.theme) : ""}
|
|
32
|
+
${(e) => e.disabled === !0 ? O(e.theme) : ""}
|
|
33
|
+
`, z = c.span`
|
|
34
34
|
padding: 0 12px;
|
|
35
|
-
color: ${(e) =>
|
|
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
|
-
`,
|
|
42
|
+
`, v = c(z)``, ee = 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) =>
|
|
50
|
+
${(e) => Q(e.theme, "Input", e.size, "enabled")}
|
|
51
51
|
min-height: ${(e) => s(e.theme, e.size)};
|
|
52
52
|
max-height: ${(e) => s(e.theme, e.size)};
|
|
53
|
-
color: ${(e) =>
|
|
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) =>
|
|
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) =>
|
|
65
|
+
color: ${(e) => l(
|
|
66
66
|
e.theme,
|
|
67
67
|
"Input",
|
|
68
68
|
e.color,
|
|
@@ -76,156 +76,161 @@ const K = i.div`
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
&:disabled {
|
|
79
|
-
${(e) =>
|
|
79
|
+
${(e) => O(e.theme)}
|
|
80
80
|
background: none;
|
|
81
81
|
}
|
|
82
|
-
`,
|
|
82
|
+
`, ae = M((e, E) => {
|
|
83
83
|
const {
|
|
84
|
-
disabled:
|
|
85
|
-
readOnly:
|
|
86
|
-
debounceTime:
|
|
87
|
-
step:
|
|
88
|
-
min:
|
|
89
|
-
max:
|
|
90
|
-
prefix:
|
|
91
|
-
suffix:
|
|
92
|
-
placeholder:
|
|
93
|
-
value:
|
|
94
|
-
defaultValue:
|
|
84
|
+
disabled: x,
|
|
85
|
+
readOnly: $,
|
|
86
|
+
debounceTime: R = 0,
|
|
87
|
+
step: F = 1,
|
|
88
|
+
min: w = Number.MIN_SAFE_INTEGER,
|
|
89
|
+
max: B = Number.MAX_SAFE_INTEGER,
|
|
90
|
+
prefix: m,
|
|
91
|
+
suffix: f,
|
|
92
|
+
placeholder: D,
|
|
93
|
+
value: n,
|
|
94
|
+
defaultValue: I,
|
|
95
95
|
//----------------
|
|
96
|
-
onChange:
|
|
97
|
-
onBlur:
|
|
98
|
-
onFocus:
|
|
96
|
+
onChange: o,
|
|
97
|
+
onBlur: h,
|
|
98
|
+
onFocus: b,
|
|
99
|
+
onKeyDown: g,
|
|
99
100
|
//----------------
|
|
100
|
-
className:
|
|
101
|
-
style:
|
|
102
|
-
size:
|
|
103
|
-
color:
|
|
104
|
-
...
|
|
105
|
-
} = e,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}, [
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
[
|
|
112
|
-
),
|
|
113
|
-
|
|
101
|
+
className: _ = "",
|
|
102
|
+
style: j = {},
|
|
103
|
+
size: C = "small",
|
|
104
|
+
color: u = "primary",
|
|
105
|
+
...A
|
|
106
|
+
} = e, d = Y(), i = U(n || I || ""), [P, k] = V(n || I || ""), [y, N] = V(!1);
|
|
107
|
+
X(() => {
|
|
108
|
+
n != null && (i.current = n, k(i.current));
|
|
109
|
+
}, [n]);
|
|
110
|
+
const W = q(
|
|
111
|
+
H((a, r) => G(a, r), R),
|
|
112
|
+
[o]
|
|
113
|
+
), G = (a, r) => {
|
|
114
|
+
o && (o == null || o(a, r));
|
|
114
115
|
};
|
|
115
|
-
return /* @__PURE__ */
|
|
116
|
-
|
|
116
|
+
return /* @__PURE__ */ K(
|
|
117
|
+
Z,
|
|
117
118
|
{
|
|
118
|
-
style:
|
|
119
|
-
className:
|
|
120
|
-
theme:
|
|
121
|
-
color:
|
|
122
|
-
size:
|
|
123
|
-
focused:
|
|
124
|
-
disabled:
|
|
125
|
-
readOnly:
|
|
119
|
+
style: j,
|
|
120
|
+
className: _,
|
|
121
|
+
theme: d,
|
|
122
|
+
color: u,
|
|
123
|
+
size: C,
|
|
124
|
+
focused: y,
|
|
125
|
+
disabled: x,
|
|
126
|
+
readOnly: $,
|
|
126
127
|
children: [
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
m && /* @__PURE__ */ p(
|
|
129
|
+
z,
|
|
129
130
|
{
|
|
130
|
-
theme:
|
|
131
|
-
color:
|
|
132
|
-
focused:
|
|
131
|
+
theme: d,
|
|
132
|
+
color: u,
|
|
133
|
+
focused: y,
|
|
133
134
|
className: "lnc-input-prefix",
|
|
134
|
-
children:
|
|
135
|
+
children: m
|
|
135
136
|
}
|
|
136
137
|
),
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
|
|
138
|
+
/* @__PURE__ */ p(
|
|
139
|
+
ee,
|
|
139
140
|
{
|
|
140
|
-
ref:
|
|
141
|
+
ref: E,
|
|
141
142
|
type: "number",
|
|
142
|
-
theme:
|
|
143
|
-
color:
|
|
144
|
-
size:
|
|
145
|
-
placeholder:
|
|
146
|
-
prefix:
|
|
147
|
-
suffix:
|
|
148
|
-
disabled:
|
|
149
|
-
readOnly:
|
|
150
|
-
step:
|
|
151
|
-
min:
|
|
152
|
-
max:
|
|
153
|
-
value:
|
|
154
|
-
onFocus: (
|
|
155
|
-
N(!0),
|
|
143
|
+
theme: d,
|
|
144
|
+
color: u,
|
|
145
|
+
size: C,
|
|
146
|
+
placeholder: D,
|
|
147
|
+
prefix: m,
|
|
148
|
+
suffix: f,
|
|
149
|
+
disabled: x,
|
|
150
|
+
readOnly: $,
|
|
151
|
+
step: F,
|
|
152
|
+
min: w,
|
|
153
|
+
max: B,
|
|
154
|
+
value: P,
|
|
155
|
+
onFocus: (a) => {
|
|
156
|
+
N(!0), b == null || b(a);
|
|
157
|
+
},
|
|
158
|
+
onBlur: (a) => {
|
|
159
|
+
N(!1), h == null || h(a);
|
|
156
160
|
},
|
|
157
|
-
|
|
158
|
-
|
|
161
|
+
onChange: (a) => {
|
|
162
|
+
i.current = a.target.value, k(i.current), W(a, a.target.value);
|
|
159
163
|
},
|
|
160
|
-
|
|
161
|
-
|
|
164
|
+
onKeyDown: (a) => {
|
|
165
|
+
var r, S, T;
|
|
166
|
+
((S = (r = a == null ? void 0 : a.target) == null ? void 0 : r.value) == null ? void 0 : S.length) > 0 && (a.key === "+" || a.key === "-") && a.preventDefault(), ((T = a == null ? void 0 : a.target) == null ? void 0 : T.value) === "" && (a.key === "+" || a.key === "-") && (a.target.value = a.key), g == null || g(a);
|
|
162
167
|
},
|
|
163
|
-
...
|
|
168
|
+
...A
|
|
164
169
|
}
|
|
165
170
|
),
|
|
166
|
-
|
|
167
|
-
|
|
171
|
+
f && /* @__PURE__ */ p(
|
|
172
|
+
v,
|
|
168
173
|
{
|
|
169
|
-
theme:
|
|
170
|
-
color:
|
|
171
|
-
focused:
|
|
174
|
+
theme: d,
|
|
175
|
+
color: u,
|
|
176
|
+
focused: y,
|
|
172
177
|
className: "lnc-input-suffix",
|
|
173
|
-
children:
|
|
178
|
+
children: f
|
|
174
179
|
}
|
|
175
180
|
)
|
|
176
181
|
]
|
|
177
182
|
}
|
|
178
183
|
);
|
|
179
184
|
});
|
|
180
|
-
|
|
181
|
-
id:
|
|
182
|
-
value:
|
|
183
|
-
defaultValue:
|
|
184
|
-
disabled:
|
|
185
|
-
readOnly:
|
|
185
|
+
ae.propTypes = {
|
|
186
|
+
id: t.any,
|
|
187
|
+
value: t.any,
|
|
188
|
+
defaultValue: t.any,
|
|
189
|
+
disabled: t.bool,
|
|
190
|
+
readOnly: t.bool,
|
|
186
191
|
/**
|
|
187
192
|
* Time in miliseconds before onChange event fires after it has been triggered.
|
|
188
193
|
*/
|
|
189
|
-
debounceTime:
|
|
194
|
+
debounceTime: t.number,
|
|
190
195
|
/**
|
|
191
196
|
* The amount that is added to the current value in the input if its incremented using the arrows/spinners.
|
|
192
197
|
*/
|
|
193
|
-
step:
|
|
198
|
+
step: t.number,
|
|
194
199
|
/**
|
|
195
200
|
* Minimum number value user can input.
|
|
196
201
|
*/
|
|
197
|
-
min:
|
|
202
|
+
min: t.number,
|
|
198
203
|
/**
|
|
199
204
|
* Maximum number value user can input.
|
|
200
205
|
*/
|
|
201
|
-
max:
|
|
206
|
+
max: t.number,
|
|
202
207
|
/**
|
|
203
208
|
* Reserved space before input. Intented to be used with plain text or `Icon` component.
|
|
204
209
|
*/
|
|
205
|
-
prefix:
|
|
210
|
+
prefix: t.oneOfType([t.string, t.element]),
|
|
206
211
|
/**
|
|
207
212
|
* Reserved space after input. Intented to be used with plain text or `Icon` component.
|
|
208
213
|
*/
|
|
209
|
-
suffix:
|
|
210
|
-
placeholder:
|
|
211
|
-
tabIndex:
|
|
214
|
+
suffix: t.oneOfType([t.string, t.element]),
|
|
215
|
+
placeholder: t.string,
|
|
216
|
+
tabIndex: t.number,
|
|
212
217
|
/**
|
|
213
218
|
* `(event, value) => void`
|
|
214
219
|
*/
|
|
215
|
-
onChange:
|
|
220
|
+
onChange: t.func,
|
|
216
221
|
/**
|
|
217
222
|
* `(event) => void`
|
|
218
223
|
*/
|
|
219
|
-
onBlur:
|
|
224
|
+
onBlur: t.func,
|
|
220
225
|
/**
|
|
221
226
|
* `(event) => void`
|
|
222
227
|
*/
|
|
223
|
-
onFocus:
|
|
228
|
+
onFocus: t.func,
|
|
224
229
|
//----------------
|
|
225
|
-
className:
|
|
226
|
-
style:
|
|
227
|
-
size:
|
|
228
|
-
color:
|
|
230
|
+
className: t.string,
|
|
231
|
+
style: t.object,
|
|
232
|
+
size: t.oneOf(["small", "medium", "large"]),
|
|
233
|
+
color: t.oneOf([
|
|
229
234
|
"primary",
|
|
230
235
|
"secondary",
|
|
231
236
|
"success",
|
|
@@ -237,5 +242,5 @@ Y.propTypes = {
|
|
|
237
242
|
])
|
|
238
243
|
};
|
|
239
244
|
export {
|
|
240
|
-
|
|
245
|
+
ae as default
|
|
241
246
|
};
|