@kvdbil/components 8.6.2 → 8.6.3
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,7 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("react-select"),o=require("styled-components"),t=require("../../shared/constants.js"),a=require("../../theme.js"),l=require("../FieldLabel.js");function
|
|
2
|
-
font-family: ${({theme:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("react-select"),o=require("styled-components"),t=require("../../shared/constants.js"),a=require("../../theme.js"),l=require("../FieldLabel.js");function d(x){return x&&typeof x=="object"&&"default"in x?x:{default:x}}require("../../typography/BodyText/index.js"),require("../../shared/media-queries.js");var i=d(e),s=d(r),n=d(o);const u=n.default.div`
|
|
2
|
+
font-family: ${({theme:x})=>x.typography.fontBaseFamily};
|
|
3
3
|
position: relative;
|
|
4
|
-
`,c=
|
|
4
|
+
`,c=x=>x&&{paddingLeft:"2.5rem"},f=x=>x&&{border:`1px solid ${a.default.colors.gray.light1}`,color:a.default.colors.gray.dark1,fill:a.default.colors.gray.light1},m=x=>x&&{border:`2px solid ${a.default.colors.error.dark}`},p=n.default.div`
|
|
5
5
|
position: absolute;
|
|
6
6
|
z-index: 1;
|
|
7
7
|
top: 0.5rem;
|
|
@@ -10,26 +10,25 @@
|
|
|
10
10
|
fill: ${a.default.colors.gray.dark5};
|
|
11
11
|
transition: ${t.DEFAULT_TRANSITION_MS};
|
|
12
12
|
|
|
13
|
-
${
|
|
13
|
+
${x=>x.isDisabled&&`
|
|
14
14
|
fill: ${a.default.colors.gray.light1};
|
|
15
15
|
`}
|
|
16
16
|
|
|
17
|
-
${
|
|
18
|
-
fill: ${
|
|
17
|
+
${x=>x.isFocused&&`
|
|
18
|
+
fill: ${x.theme.colors.text.dark};
|
|
19
19
|
`}
|
|
20
|
-
`,
|
|
20
|
+
`,h=n.default.span`
|
|
21
21
|
display: block;
|
|
22
|
-
font-family: ${({theme:
|
|
22
|
+
font-family: ${({theme:x})=>x.typography.fontBaseFamily};
|
|
23
23
|
font-size: 0.81rem;
|
|
24
24
|
margin-top: 0.25rem;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
`,h=n.default(y=>d.default.createElement("svg",{...y},d.default.createElement("symbol",{id:"icon-arrow",viewBox:"0 0 19 19"},d.default.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"})),d.default.createElement("use",{xlinkHref:"#icon-arrow"})))`
|
|
25
|
+
color: ${({hasError:x})=>x?a.default.colors.error.dark:a.default.colors.text.disabled};
|
|
26
|
+
`,g=n.default(x=>i.default.createElement("svg",{...x},i.default.createElement("symbol",{id:"icon-arrow",viewBox:"0 0 19 19"},i.default.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"})),i.default.createElement("use",{xlinkHref:"#icon-arrow"})))`
|
|
28
27
|
width: 0.8rem;
|
|
29
28
|
height: 0.8rem;
|
|
30
29
|
margin: 0 0.5rem;
|
|
31
|
-
${
|
|
32
|
-
${
|
|
30
|
+
${x=>x.$isFocused&&`color: ${x.$theme.colors.text.dark}`}
|
|
31
|
+
${x=>x.$isDisabled&&`color: ${x.$theme.colors.gray.dark1}`}
|
|
33
32
|
|
|
34
33
|
|
|
35
34
|
path {
|
|
@@ -39,6 +38,6 @@
|
|
|
39
38
|
|
|
40
39
|
transition: transform ${t.DEFAULT_TRANSITION_MS};
|
|
41
40
|
|
|
42
|
-
transform: ${
|
|
41
|
+
transform: ${x=>x.$isMenuOpen?"rotate(-180deg)":"rotate(0deg)"};
|
|
43
42
|
transform-origin: 50% 60%;
|
|
44
|
-
`,
|
|
43
|
+
`,b=({selectProps:{menuIsOpen:x=!1},isFocused:L=!1,isDisabled:B})=>i.default.createElement(g,{$isDisabled:B,$isFocused:L,$isMenuOpen:x,$theme:a.default}),y=({className:x,color:L="primary",forwardRef:B,hasError:S=!1,height:D,helperText:q,isDisabled:E=!1,onBlur:N=()=>null,onFocus:O=()=>null,onInputChange:_=()=>null,placeholder:R="",name:w,...F})=>{var T;const[I,j]=e.useState(!1),[z,A]=e.useState(""),v=({isSelected:$,isFocused:k,isDisabled:C})=>$?a.default.colors[L].main:C?a.default.colors.background.light:k?a.default.colors.background.gray:a.default.colors.background.light,H=(($,k)=>k?a.default.colors.error.main:$?a.default.colors.text.dark:a.default.colors.gray.light1)(I,S);return i.default.createElement(u,{className:x},F.label&&i.default.createElement(l.Label,{htmlFor:w,height:D,isFocused:I,hasValue:Boolean(F.value||z),disabled:E,theme:a.default,hasError:S},F.label),F.prefix&&i.default.createElement(p,{isDisabled:E,isFocused:I},F.prefix),i.default.createElement(s.default,{...F,inputId:w,name:w,ref:B,isDisabled:E,onInputChange:($,k)=>{_($,k),A($)},placeholder:R,onFocus:$=>{j(!0),O($)},onBlur:$=>{j(!1),N($)},styles:{control:$=>({...$,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:H,boxShadow:"none",minHeight:"3rem","&:hover":{borderColor:"none"},...f(E),...m(S),...c(Boolean(F.prefix))}),placeholder:$=>({...$,display:I?"static":"none"}),singleValue:$=>({...$,maxWidth:"calc(100% - 3.3rem)",width:"calc(100% - 3.3rem)"}),menuList:$=>({...$,padding:"8px 0"}),menu:$=>({...$,borderRadius:0,boxShadow:a.default.elevations.elevation2,zIndex:2,padding:"0"}),option:($,{isSelected:k,isFocused:C,isDisabled:M})=>({...$,padding:"1rem",cursor:M?"not-allowed":"pointer","&:hover":{background:v({isSelected:k,isFocused:!0,isDisabled:M})},background:v({isSelected:k,isFocused:C}),...c(Boolean(F.prefix))}),valueContainer:$=>({...$,position:"static",padding:D?D-1+"rem 0 ":0,height:D?"auto":"21px"}),clearIndicator:$=>({...$,paddingTop:0,paddingBottom:0})},components:{IndicatorSeparator:()=>null,DropdownIndicator:b,...(T=F.components)!=null?T:{}}}),q&&i.default.createElement(h,{hasError:S},q))};exports.Select=y,exports.default=y;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import t,{useState as x}from"react";import T from"react-select";import
|
|
1
|
+
import t,{useState as x}from"react";import T from"react-select";import m from"styled-components";import{DEFAULT_TRANSITION_MS as k}from"../../shared/constants.js";import r from"../../theme.js";import{Label as _}from"../FieldLabel.js";import"../../typography/BodyText/index.js";import"../../shared/media-queries.js";const z=m.div`
|
|
2
2
|
font-family: ${({theme:e})=>e.typography.fontBaseFamily};
|
|
3
3
|
position: relative;
|
|
4
|
-
`,
|
|
4
|
+
`,F=e=>e&&{paddingLeft:"2.5rem"},A=e=>e&&{border:`1px solid ${r.colors.gray.light1}`,color:r.colors.gray.dark1,fill:r.colors.gray.light1},M=e=>e&&{border:`2px solid ${r.colors.error.dark}`},O=m.div`
|
|
5
5
|
position: absolute;
|
|
6
6
|
z-index: 1;
|
|
7
7
|
top: 0.5rem;
|
|
8
8
|
margin: 0.35rem 0.75rem;
|
|
9
9
|
|
|
10
10
|
fill: ${r.colors.gray.dark5};
|
|
11
|
-
transition: ${
|
|
11
|
+
transition: ${k};
|
|
12
12
|
|
|
13
13
|
${e=>e.isDisabled&&`
|
|
14
14
|
fill: ${r.colors.gray.light1};
|
|
@@ -17,14 +17,13 @@ import t,{useState as x}from"react";import T from"react-select";import d from"st
|
|
|
17
17
|
${e=>e.isFocused&&`
|
|
18
18
|
fill: ${e.theme.colors.text.dark};
|
|
19
19
|
`}
|
|
20
|
-
`,
|
|
20
|
+
`,H=m.span`
|
|
21
21
|
display: block;
|
|
22
22
|
font-family: ${({theme:e})=>e.typography.fontBaseFamily};
|
|
23
23
|
font-size: 0.81rem;
|
|
24
24
|
margin-top: 0.25rem;
|
|
25
|
-
|
|
26
|
-
|
|
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)`
|
|
25
|
+
color: ${({hasError:e})=>e?r.colors.error.dark:r.colors.text.disabled};
|
|
26
|
+
`,V=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"})),N=m(V)`
|
|
28
27
|
width: 0.8rem;
|
|
29
28
|
height: 0.8rem;
|
|
30
29
|
margin: 0 0.5rem;
|
|
@@ -37,8 +36,8 @@ import t,{useState as x}from"react";import T from"react-select";import d from"st
|
|
|
37
36
|
stroke: currentColor;
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
transition: transform ${
|
|
39
|
+
transition: transform ${k};
|
|
41
40
|
|
|
42
41
|
transform: ${e=>e.$isMenuOpen?"rotate(-180deg)":"rotate(0deg)"};
|
|
43
42
|
transform-origin: 50% 60%;
|
|
44
|
-
`,
|
|
43
|
+
`,P=(e,a)=>a?r.colors.error.main:e?r.colors.text.dark:r.colors.gray.light1,W=({selectProps:{menuIsOpen:e=!1},isFocused:a=!1,isDisabled:u})=>t.createElement(N,{$isDisabled:u,$isFocused:a,$isMenuOpen:e,$theme:r}),C=({className:e,color:a="primary",forwardRef:u,hasError:i=!1,height:s,helperText:p,isDisabled:c=!1,onBlur:v=()=>null,onFocus:B=()=>null,onInputChange:w=()=>null,placeholder:I="",name:g,...n})=>{var h;const[d,y]=x(!1),[L,S]=x(""),E=(o,l)=>{w(o,l),S(o)},b=({isSelected:o,isFocused:l,isDisabled:f})=>o?r.colors[a].main:f?r.colors.background.light:l?r.colors.background.gray:r.colors.background.light,j=o=>{y(!0),B(o)},D=o=>{y(!1),v(o)},R=P(d,i);return t.createElement(z,{className:e},n.label&&t.createElement(_,{htmlFor:g,height:s,isFocused:d,hasValue:Boolean(n.value||L),disabled:c,theme:r,hasError:i},n.label),n.prefix&&t.createElement(O,{isDisabled:c,isFocused:d},n.prefix),t.createElement(T,{...n,inputId:g,name:g,ref:u,isDisabled:c,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(c),...M(i),...F(Boolean(n.prefix))}),placeholder:o=>({...o,display:d?"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:l,isFocused:f,isDisabled:$})=>({...o,padding:"1rem",cursor:$?"not-allowed":"pointer","&:hover":{background:b({isSelected:l,isFocused:!0,isDisabled:$})},background:b({isSelected:l,isFocused:f}),...F(Boolean(n.prefix))}),valueContainer:o=>({...o,position:"static",padding:s?`${s-1}rem 0 `:0,height:s?"auto":"21px"}),clearIndicator:o=>({...o,paddingTop:0,paddingBottom:0})},components:{IndicatorSeparator:()=>null,DropdownIndicator:W,...(h=n.components)!=null?h:{}}}),p&&t.createElement(H,{hasError:i},p))};export{C as Select,C as default};
|