@kvdbil/components 8.4.0 → 8.4.1
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/cjs/components/FieldLabel.js +27 -22
- package/cjs/components/Select/index.js +1 -1
- package/cjs/components/Textfield/index.js +26 -24
- package/esm/components/FieldLabel.js +21 -16
- package/esm/components/Select/index.js +2 -2
- package/esm/components/Textfield/index.js +19 -17
- package/package.json +1 -1
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),r=require("../typography/BodyText/index.js");function o(
|
|
2
|
-
color: ${({theme:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),r=require("../typography/BodyText/index.js");function o(c){return c&&typeof c=="object"&&"default"in c?c:{default:c}}require("react"),require("../shared/media-queries.js");var t=o(e);const s=e.css`
|
|
2
|
+
color: ${({theme:c,hasError:n})=>n?c.colors.error.dark:c.colors.text.dark};
|
|
3
3
|
`,a=e.css`
|
|
4
|
-
color: ${({theme:
|
|
5
|
-
background-color: ${({theme:
|
|
4
|
+
color: ${({theme:c})=>c.colors.gray.light1};
|
|
5
|
+
background-color: ${({theme:c})=>c.colors.background.light};
|
|
6
6
|
`,l=e.css`
|
|
7
|
-
|
|
8
|
-
width: 100%;
|
|
7
|
+
width: max-content;
|
|
9
8
|
left: 0;
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
right: 0;
|
|
10
|
+
margin-right: auto;
|
|
11
|
+
margin-left: auto;
|
|
12
|
+
`,i=t.default.label`
|
|
13
|
+
${r.BodyTextStyle}
|
|
12
14
|
pointer-events: none;
|
|
13
15
|
position: absolute;
|
|
16
|
+
max-width: calc(100% - 2rem);
|
|
14
17
|
z-index: 1;
|
|
15
|
-
top: ${({height:
|
|
18
|
+
top: ${({height:c})=>c?`${c}rem`:"0.75rem"};
|
|
16
19
|
left: calc(0.75rem + 2px);
|
|
17
20
|
transition: 150ms;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
color: ${({theme:c})=>c.colors.gray.dark5};
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
white-space: nowrap;
|
|
24
|
+
text-overflow: ellipsis;
|
|
22
25
|
|
|
23
|
-
${({
|
|
24
|
-
${({
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
${({hasValue:c,isFocused:n,height:h=.7,hasError:u})=>(c||n)&&((m,g)=>e.css`
|
|
27
|
+
background-color: ${({theme:d})=>d.colors.background.light};
|
|
28
|
+
transform: translateY(${m});
|
|
29
|
+
line-height: 0.875rem;
|
|
30
|
+
font-size: 0.75rem;
|
|
27
31
|
transform-origin: 0 0;
|
|
28
32
|
padding: 0 ${"0.5rem"};
|
|
29
33
|
left: ${"0.5rem"};
|
|
30
|
-
color: ${({theme:
|
|
31
|
-
`)(
|
|
32
|
-
${({isFocused:
|
|
33
|
-
${({
|
|
34
|
-
|
|
34
|
+
color: ${({theme:d})=>g?d.colors.error.dark:d.colors.text.dark};
|
|
35
|
+
`)(`-${h+.4}rem`,u)}
|
|
36
|
+
${({centered:c,hasValue:n,isFocused:h})=>(n||h)&&c&&l}
|
|
37
|
+
${({isFocused:c})=>c&&s}
|
|
38
|
+
${({disabled:c})=>c&&a}
|
|
39
|
+
`;exports.Label=i;
|
|
@@ -41,4 +41,4 @@
|
|
|
41
41
|
|
|
42
42
|
transform: ${y=>y.$isMenuOpen?"rotate(-180deg)":"rotate(0deg)"};
|
|
43
43
|
transform-origin: 50% 60%;
|
|
44
|
-
`,g=({selectProps:{menuIsOpen:y=!1},isFocused:D=!1,isDisabled:I})=>d.default.createElement(h,{$isDisabled:I,$isFocused:D,$isMenuOpen:y,$theme:a.default}),b=({className:y,color:D="primary",forwardRef:I,hasError:L=!1,height:v,helperText:C,isDisabled:S=!1,onBlur:M=()=>null,onFocus:N=()=>null,onInputChange:O=()=>null,placeholder:_="",name:B,...$})=>{var q;const[k,T]=e.useState(!1),[R,z]=e.useState(""),E=({isSelected:x,isFocused:F,isDisabled:w})=>x?a.default.colors[D].main:w?a.default.colors.background.light:F?a.default.colors.background.gray:a.default.colors.background.light,A=((x,F)=>F?a.default.colors.error.main:x?a.default.colors.text.dark:a.default.colors.gray.light1)(k,L);return d.default.createElement(u,{className:y},$.label&&d.default.createElement(l.Label,{htmlFor:B,height:v,isFocused:k,hasValue:Boolean($.value||R),disabled:S,theme:a.default,hasError:L},$.label),$.prefix&&d.default.createElement(m,{isDisabled:S,isFocused:k},$.prefix),d.default.createElement(s.default,{...$,inputId:B,name:B,ref:I,isDisabled:S,onInputChange:(x,F)=>{O(x,F),z(x)},placeholder:_,onFocus:x=>{T(!0),N(x)},onBlur:x=>{T(!1),M(x)},styles:{control:x=>({...x,borderRadius:0,color:a.default.colors.text.dark,fontFamily:a.default.typography.fontBaseFamily,fontSize:"1rem",fontWeight:400,cursor:"pointer",padding:"0.7rem 0.75rem",backgroundColor:a.default.colors.background.light,borderColor:A,boxShadow:"none","&:hover":{borderColor:"none"},...f(S),...c(Boolean($.prefix))}),placeholder:x=>({...x,display:k?"static":"none"}),singleValue:x=>({...x,maxWidth:"calc(100% - 3.3rem)",width:"calc(100% - 3.3rem)"}),menuList:x=>({...x,padding:"8px 0"}),menu:x=>({...x,borderRadius:0,boxShadow:a.default.elevations.elevation2,zIndex:2,padding:"0"}),option:(x,{isSelected:F,isFocused:w,isDisabled:j})=>({...x,padding:"1rem",cursor:j?"not-allowed":"pointer","&:hover":{background:E({isSelected:F,isFocused:!0,isDisabled:j})},background:E({isSelected:F,isFocused:w}),...c(Boolean($.prefix))}),valueContainer:x=>({...x,position:"static",padding:v?v-1+"rem 0 ":0,height:v?"auto":"21px"}),clearIndicator:x=>({...x,paddingTop:0,paddingBottom:0})},components:{IndicatorSeparator:()=>null,DropdownIndicator:g,...(q=$.components)!=null?q:{}}}),C&&d.default.createElement(p,{hasError:L},C))};exports.Select=b,exports.default=b;
|
|
44
|
+
`,g=({selectProps:{menuIsOpen:y=!1},isFocused:D=!1,isDisabled:I})=>d.default.createElement(h,{$isDisabled:I,$isFocused:D,$isMenuOpen:y,$theme:a.default}),b=({className:y,color:D="primary",forwardRef:I,hasError:L=!1,height:v,helperText:C,isDisabled:S=!1,onBlur:M=()=>null,onFocus:N=()=>null,onInputChange:O=()=>null,placeholder:_="",name:B,...$})=>{var q;const[k,T]=e.useState(!1),[R,z]=e.useState(""),E=({isSelected:x,isFocused:F,isDisabled:w})=>x?a.default.colors[D].main:w?a.default.colors.background.light:F?a.default.colors.background.gray:a.default.colors.background.light,A=((x,F)=>F?a.default.colors.error.main:x?a.default.colors.text.dark:a.default.colors.gray.light1)(k,L);return d.default.createElement(u,{className:y},$.label&&d.default.createElement(l.Label,{htmlFor:B,height:v,isFocused:k,hasValue:Boolean($.value||R),disabled:S,theme:a.default,hasError:L},$.label),$.prefix&&d.default.createElement(m,{isDisabled:S,isFocused:k},$.prefix),d.default.createElement(s.default,{...$,inputId:B,name:B,ref:I,isDisabled:S,onInputChange:(x,F)=>{O(x,F),z(x)},placeholder:_,onFocus:x=>{T(!0),N(x)},onBlur:x=>{T(!1),M(x)},styles:{control:x=>({...x,borderRadius:0,color:a.default.colors.text.dark,fontFamily:a.default.typography.fontBaseFamily,fontSize:"1rem",fontWeight:400,cursor:"pointer",padding:"0.7rem 0.75rem",backgroundColor:a.default.colors.background.light,borderColor:A,boxShadow:"none",minHeight:"3rem","&:hover":{borderColor:"none"},...f(S),...c(Boolean($.prefix))}),placeholder:x=>({...x,display:k?"static":"none"}),singleValue:x=>({...x,maxWidth:"calc(100% - 3.3rem)",width:"calc(100% - 3.3rem)"}),menuList:x=>({...x,padding:"8px 0"}),menu:x=>({...x,borderRadius:0,boxShadow:a.default.elevations.elevation2,zIndex:2,padding:"0"}),option:(x,{isSelected:F,isFocused:w,isDisabled:j})=>({...x,padding:"1rem",cursor:j?"not-allowed":"pointer","&:hover":{background:E({isSelected:F,isFocused:!0,isDisabled:j})},background:E({isSelected:F,isFocused:w}),...c(Boolean($.prefix))}),valueContainer:x=>({...x,position:"static",padding:v?v-1+"rem 0 ":0,height:v?"auto":"21px"}),clearIndicator:x=>({...x,paddingTop:0,paddingBottom:0})},components:{IndicatorSeparator:()=>null,DropdownIndicator:g,...(q=$.components)!=null?q:{}}}),C&&d.default.createElement(p,{hasError:L},C))};exports.Select=b,exports.default=b;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("styled-components"),t=require("../FieldLabel.js"),l=require("../../typography/BodyText/index.js"),a=require("../../shared/helpers.js");function o(
|
|
2
|
-
border: 1px solid ${({theme:
|
|
3
|
-
color: ${({theme:
|
|
4
|
-
fill: ${({theme:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("styled-components"),t=require("../FieldLabel.js"),l=require("../../typography/BodyText/index.js"),a=require("../../shared/helpers.js");function o(y){return y&&typeof y=="object"&&"default"in y?y:{default:y}}require("../../shared/media-queries.js");var d=o(e),s=o(r);const i=r.css`
|
|
2
|
+
border: 1px solid ${({theme:y})=>y.colors.gray.light2}};
|
|
3
|
+
color: ${({theme:y})=>y.colors.text.disabled};
|
|
4
|
+
fill: ${({theme:y})=>y.colors.text.disabled};
|
|
5
5
|
`,n=r.css`
|
|
6
|
-
border: 2px solid ${({theme:
|
|
6
|
+
border: 2px solid ${({theme:y})=>y.colors.error.dark};
|
|
7
7
|
`,c=r.css`
|
|
8
|
-
border: 2px solid ${({theme:
|
|
9
|
-
color: ${({theme:
|
|
10
|
-
fill: ${({theme:
|
|
8
|
+
border: 2px solid ${({theme:y})=>y.colors.gray.dark5}};
|
|
9
|
+
color: ${({theme:y})=>y.colors.text.dark};
|
|
10
|
+
fill: ${({theme:y})=>y.colors.text.dark};
|
|
11
11
|
`,u=s.default.div`
|
|
12
12
|
position: relative;
|
|
13
13
|
padding: 0;
|
|
14
14
|
display: block;
|
|
15
|
-
`,
|
|
15
|
+
`,m=s.default.div`
|
|
16
16
|
display: flex;
|
|
17
17
|
text-align: center;
|
|
18
18
|
align-items: center;
|
|
19
19
|
box-sizing: border-box;
|
|
20
20
|
height: 3rem;
|
|
21
21
|
|
|
22
|
-
background-color: ${({theme:
|
|
22
|
+
background-color: ${({theme:y})=>y.colors.background.light};
|
|
23
23
|
|
|
24
|
-
border: 1px solid ${({theme:
|
|
24
|
+
border: 1px solid ${({theme:y})=>y.colors.gray.dark5};
|
|
25
25
|
transition: all 150ms;
|
|
26
26
|
|
|
27
|
-
padding: 0.
|
|
27
|
+
padding: 0.75rem 0.6rem;
|
|
28
28
|
|
|
29
|
-
${({hasError:
|
|
30
|
-
${({disabled:
|
|
31
|
-
${({hasError:
|
|
32
|
-
${({centered:
|
|
33
|
-
`,
|
|
29
|
+
${({hasError:y,isFocused:k})=>!y&&k&&c}
|
|
30
|
+
${({disabled:y})=>y&&i}
|
|
31
|
+
${({hasError:y})=>y&&n}
|
|
32
|
+
${({centered:y})=>y&&"text-align: center;"}
|
|
33
|
+
`,h=s.default.input`
|
|
34
34
|
${l.BodyTextStyle}
|
|
35
35
|
width: 100%;
|
|
36
36
|
cursor: text;
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
background-color: transparent;
|
|
40
40
|
|
|
41
41
|
:disabled {
|
|
42
|
-
color: ${({theme:
|
|
43
|
-
fill: ${({theme:
|
|
42
|
+
color: ${({theme:y})=>y.colors.text.disabled};
|
|
43
|
+
fill: ${({theme:y})=>y.colors.text.disabled};
|
|
44
44
|
}
|
|
45
45
|
`,f=s.default.span`
|
|
46
46
|
display: flex;
|
|
47
|
-
font-family: ${({theme:
|
|
47
|
+
font-family: ${({theme:y})=>y.typography.fontBaseFamily};
|
|
48
48
|
font-size: 1.25rem;
|
|
49
49
|
line-height: 1.5rem;
|
|
50
50
|
|
|
@@ -56,9 +56,11 @@
|
|
|
56
56
|
${l.CaptionStyle}
|
|
57
57
|
margin-top: 0.25rem;
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
${({centered:g})=>g&&"width: 100%; text-align: center;"}
|
|
59
|
+
${({centered:y})=>y&&"width: 100%; text-align: center;"}
|
|
62
60
|
`,b=s.default.span`
|
|
63
61
|
display: block;
|
|
64
|
-
|
|
62
|
+
color: ${({theme:y})=>y.colors.text.disabled};
|
|
63
|
+
`,x=s.default.span`
|
|
64
|
+
display: block;
|
|
65
|
+
color: ${({theme:y})=>y.colors.error.dark};
|
|
66
|
+
`,g=({placeholder:y="",isDisabled:k=!1,centered:F=!1,hasError:w=!1,className:z,helperText:j,label:E="",onBlur:L=()=>null,onFocus:P=()=>null,forwardRef:_,suffix:T,name:q=a.generateNameHash("text-input"),errors:v,...N})=>{const[B,S]=e.useState(!1),C=Boolean(N.value);return d.default.createElement(u,{className:z},d.default.createElement(m,{isFocused:B,disabled:k,centered:F,hasError:w,hasPlaceholder:!!y},d.default.createElement(h,{...N,id:q,name:q,"aria-label":E||q,ref:_,onFocus:$=>{S(!0),P($)},onBlur:$=>{S(!1),L($)},disabled:k,placeholder:E&&!B?"":y}),T&&d.default.createElement(f,null,T)),E&&d.default.createElement(t.Label,{htmlFor:q,isFocused:B,centered:F,hasError:w,hasValue:C,disabled:k},E),(j||v)&&d.default.createElement(p,{centered:F},j&&d.default.createElement(b,null,j),v&&v.map($=>d.default.createElement(x,{key:$},$))))};exports.TextField=g,exports.default=g;
|
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a,{css as e}from"styled-components";import{BodyTextStyle as c}from"../typography/BodyText/index.js";import"react";import"../shared/media-queries.js";const l="0.5rem",n=(o,t)=>e`
|
|
2
2
|
background-color: ${({theme:r})=>r.colors.background.light};
|
|
3
|
-
transform:
|
|
3
|
+
transform: translateY(${o});
|
|
4
|
+
line-height: 0.875rem;
|
|
5
|
+
font-size: 0.75rem;
|
|
4
6
|
transform-origin: 0 0;
|
|
5
|
-
padding: 0 ${
|
|
6
|
-
left: ${
|
|
7
|
+
padding: 0 ${l};
|
|
8
|
+
left: ${l};
|
|
7
9
|
color: ${({theme:r})=>t?r.colors.error.dark:r.colors.text.dark};
|
|
8
10
|
`,i=e`
|
|
9
11
|
color: ${({theme:o,hasError:t})=>t?o.colors.error.dark:o.colors.text.dark};
|
|
10
12
|
`,d=e`
|
|
11
13
|
color: ${({theme:o})=>o.colors.gray.light1};
|
|
12
14
|
background-color: ${({theme:o})=>o.colors.background.light};
|
|
13
|
-
`,
|
|
14
|
-
|
|
15
|
-
width: 100%;
|
|
15
|
+
`,m=e`
|
|
16
|
+
width: max-content;
|
|
16
17
|
left: 0;
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
right: 0;
|
|
19
|
+
margin-right: auto;
|
|
20
|
+
margin-left: auto;
|
|
21
|
+
`,g=a.label`
|
|
22
|
+
${c}
|
|
19
23
|
pointer-events: none;
|
|
20
24
|
position: absolute;
|
|
25
|
+
max-width: calc(100% - 2rem);
|
|
21
26
|
z-index: 1;
|
|
22
|
-
top: ${({height:o})=>o?`${o}rem`:"
|
|
27
|
+
top: ${({height:o})=>o?`${o}rem`:"0.75rem"};
|
|
23
28
|
left: calc(0.75rem + 2px);
|
|
24
29
|
transition: 150ms;
|
|
25
|
-
height: 16px;
|
|
26
|
-
line-height: 16px;
|
|
27
|
-
font-size: 16px;
|
|
28
30
|
color: ${({theme:o})=>o.colors.gray.dark5};
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
text-overflow: ellipsis;
|
|
29
34
|
|
|
30
|
-
${({
|
|
31
|
-
${({
|
|
35
|
+
${({hasValue:o,isFocused:t,height:r=.7,hasError:s})=>(o||t)&&n(`-${r+.4}rem`,s)}
|
|
36
|
+
${({centered:o,hasValue:t,isFocused:r})=>(t||r)&&o&&m}
|
|
32
37
|
${({isFocused:o})=>o&&i}
|
|
33
38
|
${({disabled:o})=>o&&d}
|
|
34
|
-
`;export{
|
|
39
|
+
`;export{g as Label};
|
|
@@ -24,7 +24,7 @@ import t,{useState as x}from"react";import T from"react-select";import d from"st
|
|
|
24
24
|
margin-top: 0.25rem;
|
|
25
25
|
margin-left: 0.85rem;
|
|
26
26
|
color: ${({hasError:e})=>e?r.colors.error.main:r.colors.text.disabled};
|
|
27
|
-
`,
|
|
27
|
+
`,H=e=>t.createElement("svg",{...e},t.createElement("symbol",{id:"icon-arrow",viewBox:"0 0 19 19"},t.createElement("path",{d:"M2.03039 7.95496L9.80856 15.7331C9.90619 15.8308 10.0645 15.8308 10.1621 15.7331L17.9403 7.95496L19.0009 9.01562L11.2228 16.7938C10.5394 17.4772 9.43132 17.4772 8.7479 16.7938L0.969727 9.01562L2.03039 7.95496Z"})),t.createElement("use",{xlinkHref:"#icon-arrow"})),V=d(H)`
|
|
28
28
|
width: 0.8rem;
|
|
29
29
|
height: 0.8rem;
|
|
30
30
|
margin: 0 0.5rem;
|
|
@@ -41,4 +41,4 @@ import t,{useState as x}from"react";import T from"react-select";import d from"st
|
|
|
41
41
|
|
|
42
42
|
transform: ${e=>e.$isMenuOpen?"rotate(-180deg)":"rotate(0deg)"};
|
|
43
43
|
transform-origin: 50% 60%;
|
|
44
|
-
`,N=(e,l)=>l?r.colors.error.main:e?r.colors.text.dark:r.colors.gray.light1,P=({selectProps:{menuIsOpen:e=!1},isFocused:l=!1,isDisabled:m})=>t.createElement(
|
|
44
|
+
`,N=(e,l)=>l?r.colors.error.main:e?r.colors.text.dark:r.colors.gray.light1,P=({selectProps:{menuIsOpen:e=!1},isFocused:l=!1,isDisabled:m})=>t.createElement(V,{$isDisabled:m,$isFocused:l,$isMenuOpen:e,$theme:r}),C=({className:e,color:l="primary",forwardRef:m,hasError:u=!1,height:i,helperText:p,isDisabled:s=!1,onBlur:v=()=>null,onFocus:B=()=>null,onInputChange:w=()=>null,placeholder:I="",name:g,...n})=>{var h;const[c,y]=x(!1),[L,S]=x(""),E=(o,a)=>{w(o,a),S(o)},b=({isSelected:o,isFocused:a,isDisabled:f})=>o?r.colors[l].main:f?r.colors.background.light:a?r.colors.background.gray:r.colors.background.light,j=o=>{y(!0),B(o)},D=o=>{y(!1),v(o)},R=N(c,u);return t.createElement(z,{className:e},n.label&&t.createElement(_,{htmlFor:g,height:i,isFocused:c,hasValue:Boolean(n.value||L),disabled:s,theme:r,hasError:u},n.label),n.prefix&&t.createElement(M,{isDisabled:s,isFocused:c},n.prefix),t.createElement(T,{...n,inputId:g,name:g,ref:m,isDisabled:s,onInputChange:E,placeholder:I,onFocus:j,onBlur:D,styles:{control:o=>({...o,borderRadius:0,color:r.colors.text.dark,fontFamily:r.typography.fontBaseFamily,fontSize:"1rem",fontWeight:400,cursor:"pointer",padding:"0.7rem 0.75rem",backgroundColor:r.colors.background.light,borderColor:R,boxShadow:"none",minHeight:"3rem","&:hover":{borderColor:"none"},...A(s),...k(Boolean(n.prefix))}),placeholder:o=>({...o,display:c?"static":"none"}),singleValue:o=>({...o,maxWidth:"calc(100% - 3.3rem)",width:"calc(100% - 3.3rem)"}),menuList:o=>({...o,padding:"8px 0"}),menu:o=>({...o,borderRadius:0,boxShadow:r.elevations.elevation2,zIndex:2,padding:"0"}),option:(o,{isSelected:a,isFocused:f,isDisabled:$})=>({...o,padding:"1rem",cursor:$?"not-allowed":"pointer","&:hover":{background:b({isSelected:a,isFocused:!0,isDisabled:$})},background:b({isSelected:a,isFocused:f}),...k(Boolean(n.prefix))}),valueContainer:o=>({...o,position:"static",padding:i?`${i-1}rem 0 `:0,height:i?"auto":"21px"}),clearIndicator:o=>({...o,paddingTop:0,paddingBottom:0})},components:{IndicatorSeparator:()=>null,DropdownIndicator:P,...(h=n.components)!=null?h:{}}}),p&&t.createElement(O,{hasError:u},p))};export{C as Select,C as default};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t,{useState as S}from"react";import o,{css as p}from"styled-components";import{Label as v}from"../FieldLabel.js";import{BodyTextStyle as B,CaptionStyle as T}from"../../typography/BodyText/index.js";import{generateNameHash as j}from"../../shared/helpers.js";import"../../shared/media-queries.js";const w=p`
|
|
2
2
|
border: 1px solid ${({theme:e})=>e.colors.gray.light2}};
|
|
3
3
|
color: ${({theme:e})=>e.colors.text.disabled};
|
|
4
4
|
fill: ${({theme:e})=>e.colors.text.disabled};
|
|
5
|
-
`,
|
|
5
|
+
`,H=p`
|
|
6
6
|
border: 2px solid ${({theme:e})=>e.colors.error.dark};
|
|
7
|
-
`,
|
|
7
|
+
`,I=p`
|
|
8
8
|
border: 2px solid ${({theme:e})=>e.colors.gray.dark5}};
|
|
9
9
|
color: ${({theme:e})=>e.colors.text.dark};
|
|
10
10
|
fill: ${({theme:e})=>e.colors.text.dark};
|
|
11
|
-
`,
|
|
11
|
+
`,z=o.div`
|
|
12
12
|
position: relative;
|
|
13
13
|
padding: 0;
|
|
14
14
|
display: block;
|
|
15
|
-
`,
|
|
15
|
+
`,C=o.div`
|
|
16
16
|
display: flex;
|
|
17
17
|
text-align: center;
|
|
18
18
|
align-items: center;
|
|
@@ -24,14 +24,14 @@ import o,{useState as B}from"react";import r,{css as m}from"styled-components";i
|
|
|
24
24
|
border: 1px solid ${({theme:e})=>e.colors.gray.dark5};
|
|
25
25
|
transition: all 150ms;
|
|
26
26
|
|
|
27
|
-
padding: 0.
|
|
27
|
+
padding: 0.75rem 0.6rem;
|
|
28
28
|
|
|
29
|
-
${({hasError:e,isFocused:
|
|
30
|
-
${({disabled:e})=>e&&
|
|
31
|
-
${({hasError:e})=>e&&
|
|
29
|
+
${({hasError:e,isFocused:l})=>!e&&l&&I}
|
|
30
|
+
${({disabled:e})=>e&&w}
|
|
31
|
+
${({hasError:e})=>e&&H}
|
|
32
32
|
${({centered:e})=>e&&"text-align: center;"}
|
|
33
|
-
`,
|
|
34
|
-
${
|
|
33
|
+
`,L=o.input`
|
|
34
|
+
${B}
|
|
35
35
|
width: 100%;
|
|
36
36
|
cursor: text;
|
|
37
37
|
outline: none;
|
|
@@ -42,7 +42,7 @@ import o,{useState as B}from"react";import r,{css as m}from"styled-components";i
|
|
|
42
42
|
color: ${({theme:e})=>e.colors.text.disabled};
|
|
43
43
|
fill: ${({theme:e})=>e.colors.text.disabled};
|
|
44
44
|
}
|
|
45
|
-
`,
|
|
45
|
+
`,W=o.span`
|
|
46
46
|
display: flex;
|
|
47
47
|
font-family: ${({theme:e})=>e.typography.fontBaseFamily};
|
|
48
48
|
font-size: 1.25rem;
|
|
@@ -52,13 +52,15 @@ import o,{useState as B}from"react";import r,{css as m}from"styled-components";i
|
|
|
52
52
|
width: 1.375rem;
|
|
53
53
|
height: 1.375rem;
|
|
54
54
|
}
|
|
55
|
-
`,
|
|
55
|
+
`,_=o.div`
|
|
56
56
|
${T}
|
|
57
57
|
margin-top: 0.25rem;
|
|
58
58
|
|
|
59
|
-
color: ${({hasError:e,theme:t})=>e?t.colors.error.dark:t.colors.text.disabled};
|
|
60
|
-
|
|
61
59
|
${({centered:e})=>e&&"width: 100%; text-align: center;"}
|
|
62
|
-
`,
|
|
60
|
+
`,q=o.span`
|
|
61
|
+
display: block;
|
|
62
|
+
color: ${({theme:e})=>e.colors.text.disabled};
|
|
63
|
+
`,A=o.span`
|
|
63
64
|
display: block;
|
|
64
|
-
|
|
65
|
+
color: ${({theme:e})=>e.colors.error.dark};
|
|
66
|
+
`,f=({placeholder:e="",isDisabled:l=!1,centered:n=!1,hasError:m=!1,className:g,helperText:d,label:s="",onBlur:b=()=>null,onFocus:$=()=>null,forwardRef:h,suffix:u,name:a=j("text-input"),errors:i,...x})=>{const[c,y]=S(!1),k=Boolean(x.value),E=r=>{y(!0),$(r)},F=r=>{y(!1),b(r)};return t.createElement(z,{className:g},t.createElement(C,{isFocused:c,disabled:l,centered:n,hasError:m,hasPlaceholder:!!e},t.createElement(L,{...x,id:a,name:a,"aria-label":s||a,ref:h,onFocus:E,onBlur:F,disabled:l,placeholder:s&&!c?"":e}),u&&t.createElement(W,null,u)),s&&t.createElement(v,{htmlFor:a,isFocused:c,centered:n,hasError:m,hasValue:k,disabled:l},s),(d||i)&&t.createElement(_,{centered:n},d&&t.createElement(q,null,d),i&&i.map(r=>t.createElement(A,{key:r},r))))};export{f as TextField,f as default};
|