@lanaco/lnc-react-ui 4.0.100 → 4.0.102
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/Button.cjs +8 -8
- package/dist/Button.js +98 -97
- package/dist/NumberInput.cjs +19 -19
- package/dist/NumberInput.js +114 -109
- package/package.json +1 -1
package/dist/Button.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),w=require("react"),o=require("./index-BPVoEhTF.cjs"),C=require("./index-DAOBjHnD.cjs"),c=require("./emotion-styled.browser.esm-BtEseadx.cjs"),t=require("./utils-BWzf4vLl.cjs"),z=require("./Icon.cjs"),W=require("./emotion-element-f0de968e.browser.esm-B7k6i6lC.cjs"),B={small:{regular:"1rem",icon:"0.75rem",justIcon:"0.5rem"},medium:{regular:"1.5rem",icon:"1rem",justIcon:"0.5rem"},large:{regular:"1.5rem",icon:"1rem",justIcon:"0.5rem"}},f=e=>`
|
|
2
2
|
outline: none;
|
|
3
3
|
display: inline-flex;
|
|
4
4
|
flex-direction: row;
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
|
|
14
14
|
padding-left: ${e.hasLeadingIcon?B[e.size].icon:B[e.size].regular};
|
|
15
15
|
padding-right: ${e.hasTrailingIcon?B[e.size].icon:B[e.size].regular};
|
|
16
|
-
`,D=
|
|
16
|
+
`,D=c.styled.span`
|
|
17
17
|
padding-right: ${e=>e.size==="small"?"0.25rem":"0.5rem"};
|
|
18
|
-
`,
|
|
18
|
+
`,N=c.styled.span`
|
|
19
19
|
padding-left: ${e=>e.size==="small"?"0.25rem":"0.5rem"};
|
|
20
|
-
`,
|
|
20
|
+
`,I=c.styled.button`
|
|
21
21
|
${e=>f(e)}
|
|
22
22
|
|
|
23
23
|
${e=>t.getComponentTypographyCss(e.theme,"ButtonFilled",e.size,"enabled")};
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
background-color: ${e=>e.disabled===!1&&t.getColorRgbaValue(e.theme,"ButtonFilled",e.color,"active","background")};
|
|
51
51
|
color: ${e=>e.disabled===!1&&t.getColorRgbaValue(e.theme,"ButtonFilled",e.color,"active","text")};
|
|
52
52
|
}
|
|
53
|
-
`,
|
|
53
|
+
`,E=c.styled.button`
|
|
54
54
|
${e=>f(e)}
|
|
55
55
|
|
|
56
56
|
min-height: ${e=>t.getSizeValueWithUnits(e.theme,e.size)};
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
cursor: default;
|
|
87
87
|
background-color: ${e=>t.getColorRgbaValue(e.theme,"ButtonTinted","gray","disabled","background")};
|
|
88
88
|
}
|
|
89
|
-
`,
|
|
89
|
+
`,O=c.styled.button`
|
|
90
90
|
${e=>f(e)}
|
|
91
91
|
|
|
92
92
|
${e=>t.getComponentTypographyCss(e.theme,"ButtonTinted",e.size,"enabled")};
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
cursor: default;
|
|
122
122
|
background-color: ${e=>t.getColorRgbaValue(e.theme,"ButtonBasic","gray","disabled","background","backgroundOpacity")};
|
|
123
123
|
}
|
|
124
|
-
`,
|
|
124
|
+
`,L=c.styled(O)`
|
|
125
125
|
border: 1px solid
|
|
126
126
|
${e=>t.getColorRgbaValue(e.theme,"ButtonBasic",e.color,"enabled","border","borderOpacity")};
|
|
127
|
-
`,
|
|
127
|
+
`,v=w.forwardRef((e,d)=>{const{text:k="",iconStyle:T="solid",leadingIcon:x=null,trailingIcon:R=null,borderRadius:j="regular",btnType:l="filled",disabled:F=!1,tabIndex:u=0,onFocus:s,onBlur:g,onClick:b,onKeyDown:m,onLeadingIconClick:_,onTrailingIconClick:K,size:$="small",color:V="primary",className:P="",style:S={},children:U,...h}=e,a={theme:W.useTheme(),color:V,size:$,style:S,disabled:F,borderRadius:j,btnType:l,className:"lnc-ui-button "+P},i=!C.isEmpty(x),r=!C.isEmpty(R),q=!C.isEmpty(k),y=()=>n.jsxs(n.Fragment,{children:[i&&n.jsx(D,{size:$,children:n.jsx(z,{icon:x,sizeInUnits:"1.125rem",iconStyle:T})}),k,U,r&&n.jsx(N,{size:$,children:n.jsx(z,{icon:R,sizeInUnits:"1.125rem",iconStyle:T})})]});return l==="filled"?n.jsx(I,{ref:d,"data-type":"filled",...a,className:`${a==null?void 0:a.className} ${V}-${l}-lnc-btn`,hasLeadingIcon:i,hasTrailingIcon:r,onFocus:s,onBlur:g,onClick:b,onKeyDown:m,tabIndex:u,btnType:l,...h,children:y()}):l==="tinted"?n.jsx(E,{ref:d,"data-type":"tinted",...a,hasLeadingIcon:i,hasTrailingIcon:r,onFocus:s,onBlur:g,onClick:b,onKeyDown:m,tabIndex:u,btnType:l,...h,children:y()}):l==="outline"?n.jsx(L,{ref:d,"data-type":"outline",...a,hasLeadingIcon:i,hasTrailingIcon:r,onFocus:s,onBlur:g,onClick:b,onKeyDown:m,tabIndex:u,btnType:l,...h,children:y()}):l==="basic"?n.jsx(O,{ref:d,"data-type":"basic",...a,hasLeadingIcon:i,hasTrailingIcon:r,onFocus:s,onBlur:g,onClick:b,onKeyDown:m,tabIndex:u,btnType:l,...h,children:y()}):n.jsx(I,{ref:d,"data-type":"filled",size:$,...a,hasLeadingIcon:i,hasTrailingIcon:r,onFocus:s,onBlur:g,onClick:b,onKeyDown:m,hasText:q,tabIndex:u,btnType:l,...h,children:y()})});v.propTypes={text:o.PropTypes.string,iconStyle:o.PropTypes.oneOf(["regular","solid"]),leadingIcon:o.PropTypes.string,trailingIcon:o.PropTypes.string,borderRadius:o.PropTypes.oneOf(["slight","regular","edged","curved","none"]),btnType:o.PropTypes.oneOf(["filled","tinted","outline","basic"]),disabled:o.PropTypes.bool,tabIndex:o.PropTypes.number,onBlur:o.PropTypes.func,onFocus:o.PropTypes.func,onClick:o.PropTypes.func,onKeyDown:o.PropTypes.func,className:o.PropTypes.string,style:o.PropTypes.object,color:o.PropTypes.oneOf(["primary","secondary","success","warning","danger","information","neutral","gray"]),size:o.PropTypes.oneOf(["small","medium","large"])};module.exports=v;
|
package/dist/Button.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as i, jsxs as W, Fragment as E } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as P } from "react";
|
|
3
3
|
import { P as o } from "./index-S5Cd7WrG.js";
|
|
4
4
|
import { i as y } from "./index-BlxaTV-D.js";
|
|
5
|
-
import { s as
|
|
6
|
-
import { c as x, b as t, d as
|
|
7
|
-
import
|
|
5
|
+
import { s as d } from "./emotion-styled.browser.esm-BNN1dTl3.js";
|
|
6
|
+
import { c as x, b as t, d as r, h as T, e as z, a as q } from "./utils-BXCGNjIy.js";
|
|
7
|
+
import w from "./Icon.js";
|
|
8
8
|
import { u as A } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js";
|
|
9
9
|
const k = {
|
|
10
10
|
small: {
|
|
@@ -40,11 +40,11 @@ const k = {
|
|
|
40
40
|
|
|
41
41
|
padding-left: ${e.hasLeadingIcon ? k[e.size].icon : k[e.size].regular};
|
|
42
42
|
padding-right: ${e.hasTrailingIcon ? k[e.size].icon : k[e.size].regular};
|
|
43
|
-
`, G =
|
|
43
|
+
`, G = d.span`
|
|
44
44
|
padding-right: ${(e) => e.size === "small" ? "0.25rem" : "0.5rem"};
|
|
45
|
-
`, H =
|
|
45
|
+
`, H = d.span`
|
|
46
46
|
padding-left: ${(e) => e.size === "small" ? "0.25rem" : "0.5rem"};
|
|
47
|
-
`,
|
|
47
|
+
`, R = d.button`
|
|
48
48
|
${(e) => I(e)}
|
|
49
49
|
|
|
50
50
|
${(e) => x(
|
|
@@ -69,8 +69,8 @@ const k = {
|
|
|
69
69
|
"text"
|
|
70
70
|
)};
|
|
71
71
|
|
|
72
|
-
min-height: ${(e) =>
|
|
73
|
-
max-height: ${(e) =>
|
|
72
|
+
min-height: ${(e) => r(e.theme, e.size)};
|
|
73
|
+
max-height: ${(e) => r(e.theme, e.size)};
|
|
74
74
|
|
|
75
75
|
&:disabled {
|
|
76
76
|
${(e) => e.disabled === !0 && T(e.theme)};
|
|
@@ -142,11 +142,11 @@ const k = {
|
|
|
142
142
|
"text"
|
|
143
143
|
)};
|
|
144
144
|
}
|
|
145
|
-
`, J =
|
|
145
|
+
`, J = d.button`
|
|
146
146
|
${(e) => I(e)}
|
|
147
147
|
|
|
148
|
-
min-height: ${(e) =>
|
|
149
|
-
max-height: ${(e) =>
|
|
148
|
+
min-height: ${(e) => r(e.theme, e.size)};
|
|
149
|
+
max-height: ${(e) => r(e.theme, e.size)};
|
|
150
150
|
${(e) => x(
|
|
151
151
|
e.theme,
|
|
152
152
|
"ButtonTinted",
|
|
@@ -241,7 +241,7 @@ const k = {
|
|
|
241
241
|
"background"
|
|
242
242
|
)};
|
|
243
243
|
}
|
|
244
|
-
`,
|
|
244
|
+
`, N = d.button`
|
|
245
245
|
${(e) => I(e)}
|
|
246
246
|
|
|
247
247
|
${(e) => x(
|
|
@@ -268,8 +268,8 @@ const k = {
|
|
|
268
268
|
"backgroundOpacity"
|
|
269
269
|
)};
|
|
270
270
|
|
|
271
|
-
min-height: ${(e) =>
|
|
272
|
-
max-height: ${(e) =>
|
|
271
|
+
min-height: ${(e) => r(e.theme, e.size)};
|
|
272
|
+
max-height: ${(e) => r(e.theme, e.size)};
|
|
273
273
|
|
|
274
274
|
&:hover {
|
|
275
275
|
background-color: ${(e) => t(
|
|
@@ -340,7 +340,7 @@ const k = {
|
|
|
340
340
|
"backgroundOpacity"
|
|
341
341
|
)};
|
|
342
342
|
}
|
|
343
|
-
`, M =
|
|
343
|
+
`, M = d(N)`
|
|
344
344
|
border: 1px solid
|
|
345
345
|
${(e) => t(
|
|
346
346
|
e.theme,
|
|
@@ -350,7 +350,7 @@ const k = {
|
|
|
350
350
|
"border",
|
|
351
351
|
"borderOpacity"
|
|
352
352
|
)};
|
|
353
|
-
`, Q =
|
|
353
|
+
`, Q = P((e, u) => {
|
|
354
354
|
const {
|
|
355
355
|
text: v = "",
|
|
356
356
|
iconStyle: O = "solid",
|
|
@@ -359,33 +359,33 @@ const k = {
|
|
|
359
359
|
borderRadius: L = "regular",
|
|
360
360
|
btnType: n = "filled",
|
|
361
361
|
disabled: S = !1,
|
|
362
|
-
tabIndex:
|
|
362
|
+
tabIndex: s = 0,
|
|
363
363
|
//----------------
|
|
364
|
-
onFocus:
|
|
365
|
-
onBlur:
|
|
366
|
-
onClick:
|
|
367
|
-
onKeyDown:
|
|
364
|
+
onFocus: m,
|
|
365
|
+
onBlur: b,
|
|
366
|
+
onClick: g,
|
|
367
|
+
onKeyDown: h,
|
|
368
368
|
onLeadingIconClick: X,
|
|
369
369
|
onTrailingIconClick: Y,
|
|
370
370
|
//----------------
|
|
371
371
|
size: B = "small",
|
|
372
|
-
color:
|
|
373
|
-
className:
|
|
374
|
-
style:
|
|
375
|
-
children:
|
|
376
|
-
|
|
377
|
-
} = e,
|
|
372
|
+
color: j = "primary",
|
|
373
|
+
className: U = "",
|
|
374
|
+
style: D = {},
|
|
375
|
+
children: V,
|
|
376
|
+
...$
|
|
377
|
+
} = e, a = {
|
|
378
378
|
theme: A(),
|
|
379
|
-
color:
|
|
379
|
+
color: j,
|
|
380
380
|
size: B,
|
|
381
|
-
style:
|
|
381
|
+
style: D,
|
|
382
382
|
disabled: S,
|
|
383
383
|
borderRadius: L,
|
|
384
384
|
btnType: n,
|
|
385
|
-
className: "lnc-ui-button " +
|
|
386
|
-
},
|
|
387
|
-
|
|
388
|
-
|
|
385
|
+
className: "lnc-ui-button " + U
|
|
386
|
+
}, l = !y(F), c = !y(C), K = !y(v), f = () => /* @__PURE__ */ W(E, { children: [
|
|
387
|
+
l && /* @__PURE__ */ i(G, { size: B, children: /* @__PURE__ */ i(
|
|
388
|
+
w,
|
|
389
389
|
{
|
|
390
390
|
icon: F,
|
|
391
391
|
sizeInUnits: "1.125rem",
|
|
@@ -393,9 +393,9 @@ const k = {
|
|
|
393
393
|
}
|
|
394
394
|
) }),
|
|
395
395
|
v,
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
396
|
+
V,
|
|
397
|
+
c && /* @__PURE__ */ i(H, { size: B, children: /* @__PURE__ */ i(
|
|
398
|
+
w,
|
|
399
399
|
{
|
|
400
400
|
icon: C,
|
|
401
401
|
sizeInUnits: "1.125rem",
|
|
@@ -404,91 +404,92 @@ const k = {
|
|
|
404
404
|
) })
|
|
405
405
|
] });
|
|
406
406
|
return n === "filled" ? /* @__PURE__ */ i(
|
|
407
|
-
|
|
407
|
+
R,
|
|
408
408
|
{
|
|
409
|
-
ref:
|
|
409
|
+
ref: u,
|
|
410
410
|
"data-type": "filled",
|
|
411
|
-
...
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
411
|
+
...a,
|
|
412
|
+
className: `${a == null ? void 0 : a.className} ${j}-${n}-lnc-btn`,
|
|
413
|
+
hasLeadingIcon: l,
|
|
414
|
+
hasTrailingIcon: c,
|
|
415
|
+
onFocus: m,
|
|
416
|
+
onBlur: b,
|
|
417
|
+
onClick: g,
|
|
418
|
+
onKeyDown: h,
|
|
419
|
+
tabIndex: s,
|
|
419
420
|
btnType: n,
|
|
420
|
-
|
|
421
|
-
children:
|
|
421
|
+
...$,
|
|
422
|
+
children: f()
|
|
422
423
|
}
|
|
423
424
|
) : n === "tinted" ? /* @__PURE__ */ i(
|
|
424
425
|
J,
|
|
425
426
|
{
|
|
426
|
-
ref:
|
|
427
|
+
ref: u,
|
|
427
428
|
"data-type": "tinted",
|
|
428
|
-
...
|
|
429
|
-
hasLeadingIcon:
|
|
430
|
-
hasTrailingIcon:
|
|
431
|
-
onFocus:
|
|
432
|
-
onBlur:
|
|
433
|
-
onClick:
|
|
434
|
-
onKeyDown:
|
|
435
|
-
tabIndex:
|
|
429
|
+
...a,
|
|
430
|
+
hasLeadingIcon: l,
|
|
431
|
+
hasTrailingIcon: c,
|
|
432
|
+
onFocus: m,
|
|
433
|
+
onBlur: b,
|
|
434
|
+
onClick: g,
|
|
435
|
+
onKeyDown: h,
|
|
436
|
+
tabIndex: s,
|
|
436
437
|
btnType: n,
|
|
437
|
-
|
|
438
|
-
children:
|
|
438
|
+
...$,
|
|
439
|
+
children: f()
|
|
439
440
|
}
|
|
440
441
|
) : n === "outline" ? /* @__PURE__ */ i(
|
|
441
442
|
M,
|
|
442
443
|
{
|
|
443
|
-
ref:
|
|
444
|
+
ref: u,
|
|
444
445
|
"data-type": "outline",
|
|
445
|
-
...
|
|
446
|
-
hasLeadingIcon:
|
|
447
|
-
hasTrailingIcon:
|
|
448
|
-
onFocus:
|
|
449
|
-
onBlur:
|
|
450
|
-
onClick:
|
|
451
|
-
onKeyDown:
|
|
452
|
-
tabIndex:
|
|
446
|
+
...a,
|
|
447
|
+
hasLeadingIcon: l,
|
|
448
|
+
hasTrailingIcon: c,
|
|
449
|
+
onFocus: m,
|
|
450
|
+
onBlur: b,
|
|
451
|
+
onClick: g,
|
|
452
|
+
onKeyDown: h,
|
|
453
|
+
tabIndex: s,
|
|
453
454
|
btnType: n,
|
|
454
|
-
|
|
455
|
-
children:
|
|
455
|
+
...$,
|
|
456
|
+
children: f()
|
|
456
457
|
}
|
|
457
458
|
) : n === "basic" ? /* @__PURE__ */ i(
|
|
458
|
-
|
|
459
|
+
N,
|
|
459
460
|
{
|
|
460
|
-
ref:
|
|
461
|
+
ref: u,
|
|
461
462
|
"data-type": "basic",
|
|
462
|
-
...
|
|
463
|
-
hasLeadingIcon:
|
|
464
|
-
hasTrailingIcon:
|
|
465
|
-
onFocus:
|
|
466
|
-
onBlur:
|
|
467
|
-
onClick:
|
|
468
|
-
onKeyDown:
|
|
469
|
-
tabIndex:
|
|
463
|
+
...a,
|
|
464
|
+
hasLeadingIcon: l,
|
|
465
|
+
hasTrailingIcon: c,
|
|
466
|
+
onFocus: m,
|
|
467
|
+
onBlur: b,
|
|
468
|
+
onClick: g,
|
|
469
|
+
onKeyDown: h,
|
|
470
|
+
tabIndex: s,
|
|
470
471
|
btnType: n,
|
|
471
|
-
|
|
472
|
-
children:
|
|
472
|
+
...$,
|
|
473
|
+
children: f()
|
|
473
474
|
}
|
|
474
475
|
) : /* @__PURE__ */ i(
|
|
475
|
-
|
|
476
|
+
R,
|
|
476
477
|
{
|
|
477
|
-
ref:
|
|
478
|
+
ref: u,
|
|
478
479
|
"data-type": "filled",
|
|
479
480
|
size: B,
|
|
480
|
-
...
|
|
481
|
-
hasLeadingIcon:
|
|
482
|
-
hasTrailingIcon:
|
|
483
|
-
onFocus:
|
|
484
|
-
onBlur:
|
|
485
|
-
onClick:
|
|
486
|
-
onKeyDown:
|
|
487
|
-
hasText:
|
|
488
|
-
tabIndex:
|
|
481
|
+
...a,
|
|
482
|
+
hasLeadingIcon: l,
|
|
483
|
+
hasTrailingIcon: c,
|
|
484
|
+
onFocus: m,
|
|
485
|
+
onBlur: b,
|
|
486
|
+
onClick: g,
|
|
487
|
+
onKeyDown: h,
|
|
488
|
+
hasText: K,
|
|
489
|
+
tabIndex: s,
|
|
489
490
|
btnType: n,
|
|
490
|
-
|
|
491
|
-
children:
|
|
491
|
+
...$,
|
|
492
|
+
children: f()
|
|
492
493
|
}
|
|
493
494
|
);
|
|
494
495
|
});
|
package/dist/NumberInput.cjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";const c=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),t=require("./index-BPVoEhTF.cjs"),s=require("react"),L=require("./index-DaiUAQVF.cjs"),p=require("./emotion-styled.browser.esm-BtEseadx.cjs"),a=require("./utils-BWzf4vLl.cjs"),Q=require("./emotion-element-f0de968e.browser.esm-B7k6i6lC.cjs"),Y=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=>a.getSizeValueWithUnits(e.theme,e.size)};
|
|
6
|
+
max-height: ${e=>a.getSizeValueWithUnits(e.theme,e.size)};
|
|
7
|
+
background-color: ${e=>a.getColorRgbaValue(e.theme,"Input",e.color,"enabled","background")};
|
|
8
8
|
border: 1px solid
|
|
9
|
-
${e=>
|
|
10
|
-
border-radius: ${e=>
|
|
9
|
+
${e=>a.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,e.disabled===!0?"disabled":"enabled","border")};
|
|
10
|
+
border-radius: ${e=>a.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?a.getOutlineCss(e.theme):""}
|
|
13
|
+
${e=>e.disabled===!0?a.getDisabledStateCss(e.theme):""}
|
|
14
|
+
`,O=p.styled.span`
|
|
15
15
|
padding: 0 12px;
|
|
16
|
-
color: ${e=>
|
|
17
|
-
`,
|
|
16
|
+
color: ${e=>a.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","prefix")};
|
|
17
|
+
`,Z=p.styled(O)``,v=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=>a.getComponentTypographyCss(e.theme,"Input",e.size,"enabled")}
|
|
26
|
+
min-height: ${e=>a.getSizeValueWithUnits(e.theme,e.size)};
|
|
27
|
+
max-height: ${e=>a.getSizeValueWithUnits(e.theme,e.size)};
|
|
28
|
+
color: ${e=>a.getColorRgbaValue(e.theme,"Input",e.focused===!0?"primary":e.color,"enabled","text")};
|
|
29
|
+
caret-color: ${e=>a.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=>a.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=>a.getDisabledStateCss(e.theme)}
|
|
43
43
|
background: none;
|
|
44
44
|
}
|
|
45
|
-
`,
|
|
45
|
+
`,E=s.forwardRef((e,_)=>{const{disabled:x,readOnly:P,debounceTime:q=0,step:j=1,min:w=Number.MIN_SAFE_INTEGER,max:D=Number.MAX_SAFE_INTEGER,prefix:m,suffix:y,placeholder:F,value:l,defaultValue:$,onChange:n,onBlur:g,onFocus:b,onKeyDown:f,maxDecimalPlaces:V,className:W="",style:U={},size:C="small",color:u="primary",...A}=e,i=Q.useTheme(),d=s.useRef(l||$||""),[B,S]=s.useState(l||$||""),[h,I]=s.useState(!1);s.useEffect(()=>{l!=null&&(d.current=l,S(d.current))},[l]);const G=s.useCallback(L.debounce((r,o)=>M(r,o),q),[n]),M=(r,o)=>{n&&(n==null||n(r,o))},K=r=>{d.current=r.target.value,S(d.current),G(r,r.target.value)},X=r=>{I(!0),b==null||b(r)},H=r=>{I(!1),g==null||g(r)},J=r=>{var o,R,z,k,N;if(((R=(o=r==null?void 0:r.target)==null?void 0:o.value)==null?void 0:R.length)>0&&(r.key==="+"||r.key==="-")&&r.preventDefault(),((z=r==null?void 0:r.target)==null?void 0:z.value)===""&&(r.key==="+"||r.key==="-")&&(r.target.value=r.key),(k=r==null?void 0:r.target)!=null&&k.value.includes(".")&&V){const T=(N=r==null?void 0:r.target)==null?void 0:N.value.split(".")[1];(T==null?void 0:T.length)>=V&&r.preventDefault()}f==null||f(r)};return c.jsxs(Y,{style:U,className:W,theme:i,color:u,size:C,focused:h,disabled:x,readOnly:P,children:[m&&c.jsx(O,{theme:i,color:u,focused:h,className:"lnc-input-prefix",children:m}),c.jsx(v,{ref:_,type:"number",theme:i,color:u,size:C,placeholder:F,prefix:m,suffix:y,disabled:x,readOnly:P,step:j,min:w,max:D,value:B,onFocus:X,onBlur:H,onChange:K,onKeyDown:J,...A}),y&&c.jsx(Z,{theme:i,color:u,focused:h,className:"lnc-input-suffix",children:y})]})});E.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=E;
|
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
|
|
1
|
+
import { jsxs as q, jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import { P as r } from "./index-S5Cd7WrG.js";
|
|
3
|
+
import { forwardRef as H, useRef as J, useState as R, useEffect as L, useCallback as Q } from "react";
|
|
4
|
+
import { d as Y } from "./index-CkWvbrVT.js";
|
|
5
5
|
import { s as c } from "./emotion-styled.browser.esm-BNN1dTl3.js";
|
|
6
|
-
import { d
|
|
7
|
-
import { u as
|
|
8
|
-
const
|
|
6
|
+
import { d, b as n, a as Z, e as v, h as D, c as ee } from "./utils-BXCGNjIy.js";
|
|
7
|
+
import { u as ae } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js";
|
|
8
|
+
const re = c.div`
|
|
9
9
|
display: flex;
|
|
10
10
|
align-items: center;
|
|
11
11
|
|
|
12
|
-
min-height: ${(e) =>
|
|
13
|
-
max-height: ${(e) =>
|
|
14
|
-
background-color: ${(e) =>
|
|
12
|
+
min-height: ${(e) => d(e.theme, e.size)};
|
|
13
|
+
max-height: ${(e) => d(e.theme, e.size)};
|
|
14
|
+
background-color: ${(e) => n(
|
|
15
15
|
e.theme,
|
|
16
16
|
"Input",
|
|
17
17
|
e.color,
|
|
@@ -19,27 +19,27 @@ const Z = c.div`
|
|
|
19
19
|
"background"
|
|
20
20
|
)};
|
|
21
21
|
border: 1px solid
|
|
22
|
-
${(e) =>
|
|
22
|
+
${(e) => n(
|
|
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) => Z(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 ? v(e.theme) : ""}
|
|
32
|
+
${(e) => e.disabled === !0 ? D(e.theme) : ""}
|
|
33
|
+
`, F = c.span`
|
|
34
34
|
padding: 0 12px;
|
|
35
|
-
color: ${(e) =>
|
|
35
|
+
color: ${(e) => n(
|
|
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
|
+
`, te = c(F)``, le = c.input`
|
|
43
43
|
background: none;
|
|
44
44
|
border: none;
|
|
45
45
|
outline: none;
|
|
@@ -47,22 +47,22 @@ const Z = c.div`
|
|
|
47
47
|
padding-bottom: 0.625rem;
|
|
48
48
|
width: 100%;
|
|
49
49
|
|
|
50
|
-
${(e) =>
|
|
51
|
-
min-height: ${(e) =>
|
|
52
|
-
max-height: ${(e) =>
|
|
53
|
-
color: ${(e) =>
|
|
50
|
+
${(e) => ee(e.theme, "Input", e.size, "enabled")}
|
|
51
|
+
min-height: ${(e) => d(e.theme, e.size)};
|
|
52
|
+
max-height: ${(e) => d(e.theme, e.size)};
|
|
53
|
+
color: ${(e) => n(
|
|
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) => n(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) => n(
|
|
66
66
|
e.theme,
|
|
67
67
|
"Input",
|
|
68
68
|
e.color,
|
|
@@ -76,103 +76,108 @@ const Z = c.div`
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
&:disabled {
|
|
79
|
-
${(e) =>
|
|
79
|
+
${(e) => D(e.theme)}
|
|
80
80
|
background: none;
|
|
81
81
|
}
|
|
82
|
-
`,
|
|
82
|
+
`, ne = H((e, w) => {
|
|
83
83
|
const {
|
|
84
|
-
disabled:
|
|
85
|
-
readOnly:
|
|
86
|
-
debounceTime:
|
|
87
|
-
step:
|
|
88
|
-
min:
|
|
89
|
-
max:
|
|
84
|
+
disabled: $,
|
|
85
|
+
readOnly: I,
|
|
86
|
+
debounceTime: B = 0,
|
|
87
|
+
step: P = 1,
|
|
88
|
+
min: _ = Number.MIN_SAFE_INTEGER,
|
|
89
|
+
max: j = Number.MAX_SAFE_INTEGER,
|
|
90
90
|
prefix: m,
|
|
91
91
|
suffix: f,
|
|
92
|
-
placeholder:
|
|
93
|
-
value:
|
|
94
|
-
defaultValue:
|
|
92
|
+
placeholder: A,
|
|
93
|
+
value: t,
|
|
94
|
+
defaultValue: C,
|
|
95
95
|
//----------------
|
|
96
|
-
onChange:
|
|
96
|
+
onChange: u,
|
|
97
97
|
onBlur: h,
|
|
98
|
-
onFocus:
|
|
99
|
-
onKeyDown:
|
|
98
|
+
onFocus: g,
|
|
99
|
+
onKeyDown: b,
|
|
100
|
+
maxDecimalPlaces: k,
|
|
100
101
|
//----------------
|
|
101
|
-
className:
|
|
102
|
-
style:
|
|
103
|
-
size:
|
|
104
|
-
color:
|
|
105
|
-
...
|
|
106
|
-
} = e,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}, [
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
[
|
|
113
|
-
),
|
|
114
|
-
|
|
102
|
+
className: W = "",
|
|
103
|
+
style: G = {},
|
|
104
|
+
size: N = "small",
|
|
105
|
+
color: o = "primary",
|
|
106
|
+
...K
|
|
107
|
+
} = e, i = ae(), s = J(t || C || ""), [M, S] = R(t || C || ""), [y, T] = R(!1);
|
|
108
|
+
L(() => {
|
|
109
|
+
t != null && (s.current = t, S(s.current));
|
|
110
|
+
}, [t]);
|
|
111
|
+
const U = Q(
|
|
112
|
+
Y((a, l) => X(a, l), B),
|
|
113
|
+
[u]
|
|
114
|
+
), X = (a, l) => {
|
|
115
|
+
u && (u == null || u(a, l));
|
|
115
116
|
};
|
|
116
|
-
return /* @__PURE__ */
|
|
117
|
-
|
|
117
|
+
return /* @__PURE__ */ q(
|
|
118
|
+
re,
|
|
118
119
|
{
|
|
119
|
-
style:
|
|
120
|
-
className:
|
|
121
|
-
theme:
|
|
122
|
-
color:
|
|
123
|
-
size:
|
|
120
|
+
style: G,
|
|
121
|
+
className: W,
|
|
122
|
+
theme: i,
|
|
123
|
+
color: o,
|
|
124
|
+
size: N,
|
|
124
125
|
focused: y,
|
|
125
|
-
disabled:
|
|
126
|
-
readOnly:
|
|
126
|
+
disabled: $,
|
|
127
|
+
readOnly: I,
|
|
127
128
|
children: [
|
|
128
|
-
m && /* @__PURE__ */
|
|
129
|
-
|
|
129
|
+
m && /* @__PURE__ */ x(
|
|
130
|
+
F,
|
|
130
131
|
{
|
|
131
|
-
theme:
|
|
132
|
-
color:
|
|
132
|
+
theme: i,
|
|
133
|
+
color: o,
|
|
133
134
|
focused: y,
|
|
134
135
|
className: "lnc-input-prefix",
|
|
135
136
|
children: m
|
|
136
137
|
}
|
|
137
138
|
),
|
|
138
|
-
/* @__PURE__ */
|
|
139
|
-
|
|
139
|
+
/* @__PURE__ */ x(
|
|
140
|
+
le,
|
|
140
141
|
{
|
|
141
|
-
ref:
|
|
142
|
+
ref: w,
|
|
142
143
|
type: "number",
|
|
143
|
-
theme:
|
|
144
|
-
color:
|
|
145
|
-
size:
|
|
146
|
-
placeholder:
|
|
144
|
+
theme: i,
|
|
145
|
+
color: o,
|
|
146
|
+
size: N,
|
|
147
|
+
placeholder: A,
|
|
147
148
|
prefix: m,
|
|
148
149
|
suffix: f,
|
|
149
|
-
disabled:
|
|
150
|
-
readOnly:
|
|
151
|
-
step:
|
|
152
|
-
min:
|
|
153
|
-
max:
|
|
154
|
-
value:
|
|
150
|
+
disabled: $,
|
|
151
|
+
readOnly: I,
|
|
152
|
+
step: P,
|
|
153
|
+
min: _,
|
|
154
|
+
max: j,
|
|
155
|
+
value: M,
|
|
155
156
|
onFocus: (a) => {
|
|
156
|
-
|
|
157
|
+
T(!0), g == null || g(a);
|
|
157
158
|
},
|
|
158
159
|
onBlur: (a) => {
|
|
159
|
-
|
|
160
|
+
T(!1), h == null || h(a);
|
|
160
161
|
},
|
|
161
162
|
onChange: (a) => {
|
|
162
|
-
|
|
163
|
+
s.current = a.target.value, S(s.current), U(a, a.target.value);
|
|
163
164
|
},
|
|
164
165
|
onKeyDown: (a) => {
|
|
165
|
-
var
|
|
166
|
-
((
|
|
166
|
+
var l, V, O, z, E;
|
|
167
|
+
if (((V = (l = a == null ? void 0 : a.target) == null ? void 0 : l.value) == null ? void 0 : V.length) > 0 && (a.key === "+" || a.key === "-") && a.preventDefault(), ((O = a == null ? void 0 : a.target) == null ? void 0 : O.value) === "" && (a.key === "+" || a.key === "-") && (a.target.value = a.key), (z = a == null ? void 0 : a.target) != null && z.value.includes(".") && k) {
|
|
168
|
+
const p = (E = a == null ? void 0 : a.target) == null ? void 0 : E.value.split(".")[1];
|
|
169
|
+
(p == null ? void 0 : p.length) >= k && a.preventDefault();
|
|
170
|
+
}
|
|
171
|
+
b == null || b(a);
|
|
167
172
|
},
|
|
168
|
-
...
|
|
173
|
+
...K
|
|
169
174
|
}
|
|
170
175
|
),
|
|
171
|
-
f && /* @__PURE__ */
|
|
172
|
-
|
|
176
|
+
f && /* @__PURE__ */ x(
|
|
177
|
+
te,
|
|
173
178
|
{
|
|
174
|
-
theme:
|
|
175
|
-
color:
|
|
179
|
+
theme: i,
|
|
180
|
+
color: o,
|
|
176
181
|
focused: y,
|
|
177
182
|
className: "lnc-input-suffix",
|
|
178
183
|
children: f
|
|
@@ -182,55 +187,55 @@ const Z = c.div`
|
|
|
182
187
|
}
|
|
183
188
|
);
|
|
184
189
|
});
|
|
185
|
-
|
|
186
|
-
id:
|
|
187
|
-
value:
|
|
188
|
-
defaultValue:
|
|
189
|
-
disabled:
|
|
190
|
-
readOnly:
|
|
190
|
+
ne.propTypes = {
|
|
191
|
+
id: r.any,
|
|
192
|
+
value: r.any,
|
|
193
|
+
defaultValue: r.any,
|
|
194
|
+
disabled: r.bool,
|
|
195
|
+
readOnly: r.bool,
|
|
191
196
|
/**
|
|
192
197
|
* Time in miliseconds before onChange event fires after it has been triggered.
|
|
193
198
|
*/
|
|
194
|
-
debounceTime:
|
|
199
|
+
debounceTime: r.number,
|
|
195
200
|
/**
|
|
196
201
|
* The amount that is added to the current value in the input if its incremented using the arrows/spinners.
|
|
197
202
|
*/
|
|
198
|
-
step:
|
|
203
|
+
step: r.number,
|
|
199
204
|
/**
|
|
200
205
|
* Minimum number value user can input.
|
|
201
206
|
*/
|
|
202
|
-
min:
|
|
207
|
+
min: r.number,
|
|
203
208
|
/**
|
|
204
209
|
* Maximum number value user can input.
|
|
205
210
|
*/
|
|
206
|
-
max:
|
|
211
|
+
max: r.number,
|
|
207
212
|
/**
|
|
208
213
|
* Reserved space before input. Intented to be used with plain text or `Icon` component.
|
|
209
214
|
*/
|
|
210
|
-
prefix:
|
|
215
|
+
prefix: r.oneOfType([r.string, r.element]),
|
|
211
216
|
/**
|
|
212
217
|
* Reserved space after input. Intented to be used with plain text or `Icon` component.
|
|
213
218
|
*/
|
|
214
|
-
suffix:
|
|
215
|
-
placeholder:
|
|
216
|
-
tabIndex:
|
|
219
|
+
suffix: r.oneOfType([r.string, r.element]),
|
|
220
|
+
placeholder: r.string,
|
|
221
|
+
tabIndex: r.number,
|
|
217
222
|
/**
|
|
218
223
|
* `(event, value) => void`
|
|
219
224
|
*/
|
|
220
|
-
onChange:
|
|
225
|
+
onChange: r.func,
|
|
221
226
|
/**
|
|
222
227
|
* `(event) => void`
|
|
223
228
|
*/
|
|
224
|
-
onBlur:
|
|
229
|
+
onBlur: r.func,
|
|
225
230
|
/**
|
|
226
231
|
* `(event) => void`
|
|
227
232
|
*/
|
|
228
|
-
onFocus:
|
|
233
|
+
onFocus: r.func,
|
|
229
234
|
//----------------
|
|
230
|
-
className:
|
|
231
|
-
style:
|
|
232
|
-
size:
|
|
233
|
-
color:
|
|
235
|
+
className: r.string,
|
|
236
|
+
style: r.object,
|
|
237
|
+
size: r.oneOf(["small", "medium", "large"]),
|
|
238
|
+
color: r.oneOf([
|
|
234
239
|
"primary",
|
|
235
240
|
"secondary",
|
|
236
241
|
"success",
|
|
@@ -242,5 +247,5 @@ ae.propTypes = {
|
|
|
242
247
|
])
|
|
243
248
|
};
|
|
244
249
|
export {
|
|
245
|
-
|
|
250
|
+
ne as default
|
|
246
251
|
};
|