@kvdbil/components 15.1.1 → 15.1.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,15 +1,14 @@
1
- "use strict";var e=require("styled-components"),r=require("../typography/BodyText/index.js");require("react/jsx-runtime"),require("../shared/media-queries.js");var o,t=(o=e)&&o.__esModule?o:{default:o};const s="0.5rem",a=e.css`
1
+ "use strict";var e=require("styled-components"),r=require("../typography/BodyText/index.js");require("react/jsx-runtime"),require("../shared/media-queries.js");var o,t=(o=e)&&o.__esModule?o:{default:o};const s=e.css`
2
2
  color: ${({theme:e,hasError:r})=>r?e.colors.error.dark:e.colors.text.dark};
3
- `,l=e.css`
3
+ `,a=e.css`
4
4
  color: ${({theme:e})=>e.colors.gray.light1};
5
- background-color: ${({theme:e})=>e.colors.background.light};
6
5
  `,i=e.css`
7
6
  width: max-content;
8
7
  left: 0;
9
8
  right: 0;
10
9
  margin-right: auto;
11
10
  margin-left: auto;
12
- `,c=t.default.label`
11
+ `,n=t.default.label`
13
12
  ${r.BodyTextStyle}
14
13
  pointer-events: none;
15
14
  position: absolute;
@@ -22,18 +21,20 @@
22
21
  overflow: hidden;
23
22
  white-space: nowrap;
24
23
  text-overflow: ellipsis;
24
+ background: transparent;
25
25
 
26
- ${({hasValue:r,isFocused:o,height:t=.7,hasError:a})=>(r||o)&&((r,o)=>e.css`
27
- background-color: ${({theme:e})=>e.colors.background.light};
26
+ ${({theme:e,hasValue:r,isFocused:o})=>(r||o)&&`\n span {\n display: block;\n width: 100%;\n height: 8px;\n position: absolute;\n top: 5px;\n left: 0;\n background-color: ${e.colors.background.light};\n z-index: -1;\n }\n `}
27
+
28
+ ${({hasValue:r,isFocused:o,height:t=.7,hasError:s})=>(r||o)&&((r,o)=>e.css`
28
29
  transform: translateY(${r});
29
30
  line-height: 0.875rem;
30
31
  font-size: 0.75rem;
31
32
  transform-origin: 0 0;
32
- padding: 0 ${s};
33
- left: ${s};
33
+ padding: 0 5px;
34
+ left: 0.5rem;
34
35
  color: ${({theme:e})=>o?e.colors.error.dark:e.colors.text.dark};
35
- `)(`-${t+.4}rem`,a)}
36
+ `)(`-${t+.4}rem`,s)}
36
37
  ${({centered:e,hasValue:r,isFocused:o})=>(r||o)&&e&&i}
37
- ${({isFocused:e})=>e&&a}
38
- ${({disabled:e})=>e&&l}
39
- `;exports.Label=c;
38
+ ${({isFocused:e})=>e&&s}
39
+ ${({disabled:e})=>e&&a}
40
+ `;exports.Label=n;
@@ -1,23 +1,23 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),o=require("react-select"),t=require("styled-components"),i=require("../../shared/constants.js"),a=require("../../theme.js"),l=require("../../typography/BodyText/index.js"),s=require("../FieldLabel.js");function d(e){return e&&e.__esModule?e:{default:e}}require("../../shared/media-queries.js");var n=d(o),c=d(t);const u=c.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),o=require("react-select"),t=require("styled-components"),a=require("../../shared/constants.js"),i=require("../../theme.js"),l=require("../../typography/BodyText/index.js"),s=require("../FieldLabel.js");function d(e){return e&&e.__esModule?e:{default:e}}require("../../shared/media-queries.js");var n=d(o),c=d(t);const u=c.default.div`
2
2
  font-family: ${({theme:e})=>e.typography.fontBaseFamily};
3
3
  position: relative;
4
- `,p=e=>e&&{paddingLeft:"2.5rem"},m=e=>e&&{border:`1px solid ${a.default.colors.gray.light1}`,color:a.default.colors.gray.dark1,fill:a.default.colors.gray.light1},f=e=>e&&{border:`2px solid ${a.default.colors.error.dark}`},g=c.default.div`
4
+ `,p=e=>e&&{paddingLeft:"2.5rem"},m=e=>e&&{border:`1px solid ${i.default.colors.gray.light1}`,color:i.default.colors.gray.dark1,fill:i.default.colors.gray.light1},f=e=>e&&{border:`2px solid ${i.default.colors.error.dark}`},g=c.default.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
- fill: ${a.default.colors.gray.dark5};
11
- transition: ${i.DEFAULT_TRANSITION_MS};
10
+ fill: ${i.default.colors.gray.dark5};
11
+ transition: ${a.DEFAULT_TRANSITION_MS};
12
12
 
13
- ${e=>e.isDisabled&&` fill: ${a.default.colors.gray.light1}; `}
13
+ ${e=>e.isDisabled&&` fill: ${i.default.colors.gray.light1}; `}
14
14
 
15
15
  ${e=>e.isFocused&&` fill: ${e.theme.colors.text.dark}; `}
16
16
  `,h=c.default.span`
17
17
  ${l.CaptionStyle}
18
18
  display: block;
19
19
  margin-top: 0.25rem;
20
- color: ${({hasError:e})=>e?a.default.colors.error.dark:a.default.colors.text.disabled};
20
+ color: ${({hasError:e})=>e?i.default.colors.error.dark:i.default.colors.text.disabled};
21
21
  `,x=c.default((r=>e.jsxs("svg",{...r,children:[e.jsx("symbol",{id:"icon-arrow",viewBox:"0 0 19 19",children:e.jsx("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"})}),e.jsx("use",{xlinkHref:"#icon-arrow"})]})))`
22
22
  width: 0.75rem;
23
23
  height: 0.75rem;
@@ -31,9 +31,9 @@
31
31
  stroke: currentColor;
32
32
  }
33
33
 
34
- transition: transform ${i.DEFAULT_TRANSITION_MS};
34
+ transition: transform ${a.DEFAULT_TRANSITION_MS};
35
35
 
36
36
  transform: ${e=>e.$isMenuOpen?"rotate(-180deg)":"rotate(0deg)"};
37
37
 
38
38
  transform-origin: 50% 60%;
39
- `,b=({selectProps:{menuIsOpen:r=!1},isFocused:o=!1,isDisabled:t})=>e.jsx(x,{$isDisabled:t,$isFocused:o,$isMenuOpen:r,$theme:a.default});function y({className:o,color:t="primary",forwardRef:i,hasError:l=!1,height:d,helperText:c,isDisabled:x=!1,onBlur:y=(()=>null),onFocus:$=(()=>null),onInputChange:k=(()=>null),placeholder:F="",name:S,...j}){const[v,D]=r.useState(!1),[w,L]=r.useState(""),I=({isSelected:e,isFocused:r,isDisabled:o})=>e?a.default.colors[t].main:o?a.default.colors.background.light:r?a.default.colors.background.gray:a.default.colors.background.light,T=((e,r)=>r?a.default.colors.error.main:e?a.default.colors.text.dark:a.default.colors.gray.light1)(v,l),C=!j.label;return e.jsxs(u,{className:o,children:[!C&&j.label&&e.jsx(s.Label,{htmlFor:S,height:d,isFocused:v,hasValue:!(!j.value&&!w),disabled:x,theme:a.default,hasError:l,children:j.label}),j.prefix&&e.jsx(g,{isDisabled:x,isFocused:v,children:j.prefix}),e.jsx(n.default,{...j,id:"react-select",inputId:S,name:S,ref:i,isDisabled:x,onInputChange:(e,r)=>{k(e,r),L(e)},placeholder:F,onFocus:e=>{D(!0),$(e)},onBlur:e=>{D(!1),y(e)},styles:{control:e=>({...e,borderRadius:0,color:a.default.colors.text.dark,fontFamily:a.default.typography.fontBaseFamily,fontSize:"1rem",fontWeight:400,cursor:"pointer",padding:"0.7rem 0.5rem",backgroundColor:a.default.colors.background.light,borderColor:T,boxShadow:"none",minHeight:"3rem","&:hover":{borderColor:"none"},...m(x),...f(l),...p(!!j.prefix)}),input:e=>({...e,height:"auto",margin:0,padding:0}),placeholder:e=>{const r={...e,fontSize:"1rem",lineHeight:"1.5rem",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",margin:0};return C?{...r,color:a.default.colors.text.dark,fontWeight:600}:{...r,display:v?"static":"none"}},menuList:e=>({...e,padding:"0.5rem 0",paddingBottom:"5rem",marginTop:0,border:`1px solid ${T}`,borderTop:"none",display:"flex",flexDirection:"column",gap:"0.5rem"}),menu:e=>({...e,borderRadius:0,boxShadow:"none",zIndex:5,padding:"0",marginTop:"-0.1rem"}),option:(e,{isSelected:r,isFocused:o,isDisabled:t})=>({...e,padding:"0.5rem",lineHeight:"1.5rem",fontSize:"1rem",fontWeight:400,cursor:t?"not-allowed":"pointer","&:hover":{background:I({isSelected:r,isFocused:!0,isDisabled:t})},background:I({isSelected:r,isFocused:o}),...p(!!j.prefix)}),valueContainer:e=>({...e,position:"static",padding:d?d-1+"rem 0 ":0,height:d?"auto":"1.5rem"}),clearIndicator:e=>({...e,paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:"0.2rem"})},components:{IndicatorSeparator:()=>null,DropdownIndicator:b,...j.components??{}}}),c&&e.jsx(h,{hasError:l,children:c})]})}exports.Select=y,exports.default=y;
39
+ `,b=({selectProps:{menuIsOpen:r=!1},isFocused:o=!1,isDisabled:t})=>e.jsx(x,{$isDisabled:t,$isFocused:o,$isMenuOpen:r,$theme:i.default});function y({className:o,color:t="primary",forwardRef:a,hasError:l=!1,height:d,helperText:c,isDisabled:x=!1,onBlur:y=(()=>null),onFocus:$=(()=>null),onInputChange:k=(()=>null),placeholder:F="",name:j,...S}){const[v,D]=r.useState(!1),[w,L]=r.useState(""),I=({isSelected:e,isFocused:r,isDisabled:o})=>e?i.default.colors[t].main:o?i.default.colors.background.light:r?i.default.colors.background.gray:i.default.colors.background.light,T=((e,r)=>r?i.default.colors.error.main:e?i.default.colors.text.dark:i.default.colors.gray.light1)(v,l),C=!S.label;return e.jsxs(u,{className:o,children:[!C&&S.label&&e.jsx(s.Label,{htmlFor:j,height:d,isFocused:v,hasValue:!(!S.value&&!w),disabled:x,theme:i.default,hasError:l,children:e.jsxs(e.Fragment,{children:[S.label,e.jsx("span",{})]})}),S.prefix&&e.jsx(g,{isDisabled:x,isFocused:v,children:S.prefix}),e.jsx(n.default,{...S,id:"react-select",inputId:j,name:j,ref:a,isDisabled:x,onInputChange:(e,r)=>{k(e,r),L(e)},placeholder:F,onFocus:e=>{D(!0),$(e)},onBlur:e=>{D(!1),y(e)},styles:{control:e=>({...e,borderRadius:0,color:i.default.colors.text.dark,fontFamily:i.default.typography.fontBaseFamily,fontSize:"1rem",fontWeight:400,cursor:"pointer",padding:"0.7rem 0.5rem",backgroundColor:i.default.colors.background.light,borderColor:T,boxShadow:"none",minHeight:"3rem","&:hover":{borderColor:"none"},...m(x),...f(l),...p(!!S.prefix)}),input:e=>({...e,height:"auto",margin:0,padding:0}),placeholder:e=>{const r={...e,fontSize:"1rem",lineHeight:"1.5rem",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",margin:0};return C?{...r,color:i.default.colors.text.dark,fontWeight:600}:{...r,display:v?"static":"none"}},menuList:e=>({...e,padding:"0.5rem 0",paddingBottom:"5rem",marginTop:0,border:`1px solid ${T}`,borderTop:"none",display:"flex",flexDirection:"column",gap:"0.5rem"}),menu:e=>({...e,borderRadius:0,boxShadow:"none",zIndex:5,padding:"0",marginTop:"-0.1rem"}),option:(e,{isSelected:r,isFocused:o,isDisabled:t})=>({...e,padding:"0.5rem",lineHeight:"1.5rem",fontSize:"1rem",fontWeight:400,cursor:t?"not-allowed":"pointer","&:hover":{background:I({isSelected:r,isFocused:!0,isDisabled:t})},background:I({isSelected:r,isFocused:o}),...p(!!S.prefix)}),valueContainer:e=>({...e,position:"static",padding:d?d-1+"rem 0 ":0,height:d?"auto":"1.5rem"}),clearIndicator:e=>({...e,paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:"0.2rem"})},components:{IndicatorSeparator:()=>null,DropdownIndicator:b,...S.components??{}}}),c&&e.jsx(h,{hasError:l,children:c})]})}exports.Select=y,exports.default=y;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),l=require("styled-components"),a=require("../../theme.js"),o=require("../FieldLabel.js"),s=require("../../typography/BodyText/index.js");require("../../shared/media-queries.js");var t,d=(t=l)&&t.__esModule?t:{default:t};const i=l.css`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),l=require("styled-components"),a=require("../../theme.js"),s=require("../FieldLabel.js"),o=require("../../typography/BodyText/index.js");require("../../shared/media-queries.js");var t,d=(t=l)&&t.__esModule?t:{default:t};const i=l.css`
2
2
  border: 1px solid ${a.default.colors.gray.light1};
3
3
  color: ${a.default.colors.gray.dark1};
4
4
  fill: ${a.default.colors.gray.light1};
@@ -29,7 +29,7 @@
29
29
  ${({hasError:e})=>e&&c}
30
30
  ${({centered:e})=>e&&"text-align: center;"}
31
31
  `,f=d.default.textarea`
32
- ${s.BodyTextStyle}
32
+ ${o.BodyTextStyle}
33
33
 
34
34
  width: 100%;
35
35
  cursor: text;
@@ -41,14 +41,14 @@
41
41
  `,x=d.default.div`
42
42
  font-family: ${({theme:e})=>e.typography.fontBaseFamily};
43
43
  `,p=d.default.div`
44
- ${s.CaptionStyle}
44
+ ${o.CaptionStyle}
45
45
  margin-top: 0.25rem;
46
46
 
47
47
  ${({centered:e})=>e&&"width: 100%; text-align: center;"}
48
- `,b=d.default.span`
48
+ `,m=d.default.span`
49
49
  display: block;
50
50
  color: ${({theme:e})=>e.colors.text.disabled};
51
- `,m=d.default.span`
51
+ `,b=d.default.span`
52
52
  display: block;
53
53
  color: ${({theme:e})=>e.colors.error.dark};
54
- `,g=({placeholder:l="",isDisabled:s=!1,centered:t=!1,hasError:d=!1,className:i,helperText:c,label:n="",resize:g=!0,name:y,errors:$,...j})=>{const[k,v]=r.useState(!1),q=!!j.value;return e.jsxs(u,{className:i,children:[e.jsxs(h,{isFocused:k,disabled:s,centered:t,hasError:d,hasPlaceholder:!!l,children:[e.jsx(f,{...j,name:y,"aria-label":n||y,resize:g,onFocus:()=>v(!0),onBlur:()=>v(!1),disabled:s,theme:a.default,placeholder:n&&!k?"":l}),j.suffix&&e.jsx(x,{children:j.suffix})]}),n&&e.jsx(o.Label,{htmlFor:y,isFocused:k,centered:t,hasError:d,hasValue:q,disabled:s,theme:a.default,children:n}),(c||$)&&e.jsxs(p,{centered:t,children:[c&&e.jsx(b,{children:c}),$&&$.map((r=>e.jsx(m,{children:r},r)))]})]})};exports.TextArea=g,exports.default=g;
54
+ `,g=({placeholder:l="",isDisabled:o=!1,centered:t=!1,hasError:d=!1,className:i,helperText:c,label:n="",resize:g=!0,name:y,errors:$,...j})=>{const[k,v]=r.useState(!1),q=!!j.value;return e.jsxs(u,{className:i,children:[e.jsxs(h,{isFocused:k,disabled:o,centered:t,hasError:d,hasPlaceholder:!!l,children:[e.jsx(f,{...j,name:y,"aria-label":n||y,resize:g,onFocus:()=>v(!0),onBlur:()=>v(!1),disabled:o,theme:a.default,placeholder:n&&!k?"":l}),j.suffix&&e.jsx(x,{children:j.suffix})]}),n&&e.jsx(s.Label,{htmlFor:y,isFocused:k,centered:t,hasError:d,hasValue:q,disabled:o,theme:a.default,children:e.jsxs(e.Fragment,{children:[n,e.jsx("span",{})]})}),(c||$)&&e.jsxs(p,{centered:t,children:[c&&e.jsx(m,{children:c}),$&&$.map((r=>e.jsx(b,{children:r},r)))]})]})};exports.TextArea=g,exports.default=g;
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),l=require("styled-components"),s=require("../FieldLabel.js"),o=require("../../typography/BodyText/index.js"),t=require("../../shared/helpers.js");require("../../shared/media-queries.js");var a,d=(a=l)&&a.__esModule?a:{default:a};const i=l.css`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),s=require("styled-components"),l=require("../FieldLabel.js"),o=require("../../typography/BodyText/index.js"),t=require("../../shared/helpers.js");require("../../shared/media-queries.js");var a,d=(a=s)&&a.__esModule?a:{default:a};const i=s.css`
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
- `,c=l.css`
5
+ `,n=s.css`
6
6
  border: 2px solid ${({theme:e})=>e.colors.error.dark};
7
- `,n=l.css`
7
+ `,c=s.css`
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};
@@ -26,9 +26,9 @@
26
26
 
27
27
  padding: 0.75rem 0.6rem;
28
28
 
29
- ${({hasError:e,isFocused:r})=>!e&&r&&n}
29
+ ${({hasError:e,isFocused:r})=>!e&&r&&c}
30
30
  ${({disabled:e})=>e&&i}
31
- ${({hasError:e})=>e&&c}
31
+ ${({hasError:e})=>e&&n}
32
32
  ${({centered:e})=>e&&"text-align: center;"}
33
33
  `,x=d.default.input`
34
34
  ${o.BodyTextStyle}
@@ -60,7 +60,7 @@
60
60
  `,b=d.default.span`
61
61
  display: block;
62
62
  color: ${({theme:e})=>e.colors.text.disabled};
63
- `,f=d.default.span`
63
+ `,g=d.default.span`
64
64
  display: block;
65
65
  color: ${({theme:e})=>e.colors.error.dark};
66
- `,g=({placeholder:l="",isDisabled:o=!1,centered:a=!1,hasError:d=!1,className:i,helperText:c,label:n="",onBlur:g=(()=>null),onFocus:y=(()=>null),forwardRef:$,suffix:j,name:k=t.generateNameHash("text-input"),errors:F,isAutoFocused:v=!1,...q})=>{const[B,E]=r.useState(!1),w=!!q.value,T=F&&Array.isArray(F)&&F?.length>0;return e.jsxs(h,{className:i,children:[e.jsxs(u,{isFocused:B,disabled:o,centered:a,hasError:d,hasPlaceholder:!!l,children:[e.jsx(x,{...q,id:k,name:k,"aria-label":n||k,ref:$,onFocus:e=>{E(!0),y(e)},onBlur:e=>{E(!1),g(e)},disabled:o,placeholder:n&&!B?"":l,autoFocus:v}),j&&e.jsx(m,{children:j})]}),n&&e.jsx(s.Label,{htmlFor:k,isFocused:B,centered:a,hasError:d,hasValue:w,disabled:o,children:n}),(c||T)&&e.jsxs(p,{centered:a,children:[c&&e.jsx(b,{children:c}),T&&F.map((r=>e.jsx(f,{children:r},r)))]})]})};exports.TextField=g,exports.default=g;
66
+ `,f=({placeholder:s="",isDisabled:o=!1,centered:a=!1,hasError:d=!1,className:i,helperText:n,label:c="",onBlur:f=(()=>null),onFocus:y=(()=>null),forwardRef:$,suffix:j,name:F=t.generateNameHash("text-input"),errors:k,isAutoFocused:v=!1,...q})=>{const[B,E]=r.useState(!1),w=!!q.value,T=k&&Array.isArray(k)&&k?.length>0;return console.log("isFocused",B),e.jsxs(h,{className:i,children:[e.jsxs(u,{isFocused:B,disabled:o,centered:a,hasError:d,hasPlaceholder:!!s,children:[e.jsx(x,{...q,id:F,name:F,"aria-label":c||F,ref:$,onFocus:e=>{E(!0),y(e)},onBlur:e=>{E(!1),f(e)},disabled:o,placeholder:c&&!B?"":s,autoFocus:v}),j&&e.jsx(m,{children:j})]}),c&&e.jsx(l.Label,{htmlFor:F,isFocused:B,centered:a,hasError:d,hasValue:w,disabled:o,children:e.jsxs(e.Fragment,{children:[c,e.jsx("span",{})]})}),(n||T)&&e.jsxs(p,{centered:a,children:[n&&e.jsx(b,{children:n}),T&&k.map((r=>e.jsx(g,{children:r},r)))]})]})};exports.TextField=f,exports.default=f;
@@ -1,25 +1,23 @@
1
- import i,{css as t}from"styled-components";import{BodyTextStyle as s}from"../typography/BodyText/index.js";import"react/jsx-runtime";import"../shared/media-queries.js";const l="0.5rem",c=(o,e)=>t`
2
- background-color: ${({theme:r})=>r.colors.background.light};
1
+ import s,{css as t}from"styled-components";import{BodyTextStyle as i}from"../typography/BodyText/index.js";import"react/jsx-runtime";import"../shared/media-queries.js";const l=(o,r)=>t`
3
2
  transform: translateY(${o});
4
3
  line-height: 0.875rem;
5
4
  font-size: 0.75rem;
6
5
  transform-origin: 0 0;
7
- padding: 0 ${l};
8
- left: ${l};
9
- color: ${({theme:r})=>e?r.colors.error.dark:r.colors.text.dark};
6
+ padding: 0 5px;
7
+ left: 0.5rem;
8
+ color: ${({theme:e})=>r?e.colors.error.dark:e.colors.text.dark};
10
9
  `,n=t`
11
- color: ${({theme:o,hasError:e})=>e?o.colors.error.dark:o.colors.text.dark};
12
- `,m=t`
10
+ color: ${({theme:o,hasError:r})=>r?o.colors.error.dark:o.colors.text.dark};
11
+ `,c=t`
13
12
  color: ${({theme:o})=>o.colors.gray.light1};
14
- background-color: ${({theme:o})=>o.colors.background.light};
15
- `,h=t`
13
+ `,d=t`
16
14
  width: max-content;
17
15
  left: 0;
18
16
  right: 0;
19
17
  margin-right: auto;
20
18
  margin-left: auto;
21
- `,d=i.label`
22
- ${s}
19
+ `,h=s.label`
20
+ ${i}
23
21
  pointer-events: none;
24
22
  position: absolute;
25
23
  max-width: calc(100% - 2rem);
@@ -31,9 +29,23 @@ import i,{css as t}from"styled-components";import{BodyTextStyle as s}from"../typ
31
29
  overflow: hidden;
32
30
  white-space: nowrap;
33
31
  text-overflow: ellipsis;
32
+ background: transparent;
34
33
 
35
- ${({hasValue:o,isFocused:e,height:r=.7,hasError:a})=>(o||e)&&c(`-${r+.4}rem`,a)}
36
- ${({centered:o,hasValue:e,isFocused:r})=>(e||r)&&o&&h}
34
+ ${({theme:o,hasValue:r,isFocused:e})=>(r||e)&&`
35
+ span {
36
+ display: block;
37
+ width: 100%;
38
+ height: 8px;
39
+ position: absolute;
40
+ top: 5px;
41
+ left: 0;
42
+ background-color: ${o.colors.background.light};
43
+ z-index: -1;
44
+ }
45
+ `}
46
+
47
+ ${({hasValue:o,isFocused:r,height:e=.7,hasError:a})=>(o||r)&&l(`-${e+.4}rem`,a)}
48
+ ${({centered:o,hasValue:r,isFocused:e})=>(r||e)&&o&&d}
37
49
  ${({isFocused:o})=>o&&n}
38
- ${({disabled:o})=>o&&m}
39
- `;export{d as Label};
50
+ ${({disabled:o})=>o&&c}
51
+ `;export{h as Label};
@@ -1,7 +1,7 @@
1
- import{jsxs as k,jsx as l}from"react/jsx-runtime";import{useState as F}from"react";import O from"react-select";import m from"styled-components";import{DEFAULT_TRANSITION_MS as S}from"../../shared/constants.js";import e from"../../theme.js";import{CaptionStyle as R}from"../../typography/BodyText/index.js";import{Label as H}from"../FieldLabel.js";import"../../shared/media-queries.js";const M=m.div`
1
+ import{jsxs as u,jsx as t,Fragment as N}from"react/jsx-runtime";import{useState as F}from"react";import R from"react-select";import m from"styled-components";import{DEFAULT_TRANSITION_MS as S}from"../../shared/constants.js";import e from"../../theme.js";import{CaptionStyle as H}from"../../typography/BodyText/index.js";import{Label as M}from"../FieldLabel.js";import"../../shared/media-queries.js";const W=m.div`
2
2
  font-family: ${({theme:o})=>o.typography.fontBaseFamily};
3
3
  position: relative;
4
- `,D=o=>o&&{paddingLeft:"2.5rem"},W=o=>o&&{border:`1px solid ${e.colors.gray.light1}`,color:e.colors.gray.dark1,fill:e.colors.gray.light1},j=o=>o&&{border:`2px solid ${e.colors.error.dark}`},A=m.div`
4
+ `,D=o=>o&&{paddingLeft:"2.5rem"},j=o=>o&&{border:`1px solid ${e.colors.gray.light1}`,color:e.colors.gray.dark1,fill:e.colors.gray.light1},A=o=>o&&{border:`2px solid ${e.colors.error.dark}`},_=m.div`
5
5
  position: absolute;
6
6
  z-index: 1;
7
7
  top: 0.5rem;
@@ -13,12 +13,12 @@ import{jsxs as k,jsx as l}from"react/jsx-runtime";import{useState as F}from"reac
13
13
  ${o=>o.isDisabled&&` fill: ${e.colors.gray.light1}; `}
14
14
 
15
15
  ${o=>o.isFocused&&` fill: ${o.theme.colors.text.dark}; `}
16
- `,_=m.span`
17
- ${R}
16
+ `,P=m.span`
17
+ ${H}
18
18
  display: block;
19
19
  margin-top: 0.25rem;
20
20
  color: ${({hasError:o})=>o?e.colors.error.dark:e.colors.text.disabled};
21
- `,P=o=>k("svg",{...o,children:[l("symbol",{id:"icon-arrow",viewBox:"0 0 19 19",children:l("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"})}),l("use",{xlinkHref:"#icon-arrow"})]}),V=m(P)`
21
+ `,V=o=>u("svg",{...o,children:[t("symbol",{id:"icon-arrow",viewBox:"0 0 19 19",children:t("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("use",{xlinkHref:"#icon-arrow"})]}),G=m(V)`
22
22
  width: 0.75rem;
23
23
  height: 0.75rem;
24
24
  margin: 0;
@@ -36,4 +36,4 @@ import{jsxs as k,jsx as l}from"react/jsx-runtime";import{useState as F}from"reac
36
36
  transform: ${o=>o.$isMenuOpen?"rotate(-180deg)":"rotate(0deg)"};
37
37
 
38
38
  transform-origin: 50% 60%;
39
- `,G=(o,t)=>t?e.colors.error.main:o?e.colors.text.dark:e.colors.gray.light1,U=({selectProps:{menuIsOpen:o=!1},isFocused:t=!1,isDisabled:p})=>l(V,{$isDisabled:p,$isFocused:t,$isMenuOpen:o,$theme:e});function w({className:o,color:t="primary",forwardRef:p,hasError:s=!1,height:n,helperText:u,isDisabled:d=!1,onBlur:L=()=>null,onFocus:v=()=>null,onInputChange:C=()=>null,placeholder:I="",name:g,...i}){const[c,f]=F(!1),[T,B]=F(""),z=(r,a)=>{C(r,a),B(r)},b=({isSelected:r,isFocused:a,isDisabled:h})=>r?e.colors[t].main:h?e.colors.background.light:a?e.colors.background.gray:e.colors.background.light,E=r=>{f(!0),v(r)},N=r=>{f(!1),L(r)},x=G(c,s),$=!i.label;return k(M,{className:o,children:[!$&&i.label&&l(H,{htmlFor:g,height:n,isFocused:c,hasValue:!!(i.value||T),disabled:d,theme:e,hasError:s,children:i.label}),i.prefix&&l(A,{isDisabled:d,isFocused:c,children:i.prefix}),l(O,{...i,id:"react-select",inputId:g,name:g,ref:p,isDisabled:d,onInputChange:z,placeholder:I,onFocus:E,onBlur:N,styles:{control:r=>({...r,borderRadius:0,color:e.colors.text.dark,fontFamily:e.typography.fontBaseFamily,fontSize:"1rem",fontWeight:400,cursor:"pointer",padding:"0.7rem 0.5rem",backgroundColor:e.colors.background.light,borderColor:x,boxShadow:"none",minHeight:"3rem","&:hover":{borderColor:"none"},...W(d),...j(s),...D(!!i.prefix)}),input:r=>({...r,height:"auto",margin:0,padding:0}),placeholder:r=>{const a={...r,fontSize:"1rem",lineHeight:"1.5rem",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",margin:0};return $?{...a,color:e.colors.text.dark,fontWeight:600}:{...a,display:c?"static":"none"}},menuList:r=>({...r,padding:"0.5rem 0",paddingBottom:"5rem",marginTop:0,border:`1px solid ${x}`,borderTop:"none",display:"flex",flexDirection:"column",gap:"0.5rem"}),menu:r=>({...r,borderRadius:0,boxShadow:"none",zIndex:5,padding:"0",marginTop:"-0.1rem"}),option:(r,{isSelected:a,isFocused:h,isDisabled:y})=>({...r,padding:"0.5rem",lineHeight:"1.5rem",fontSize:"1rem",fontWeight:400,cursor:y?"not-allowed":"pointer","&:hover":{background:b({isSelected:a,isFocused:!0,isDisabled:y})},background:b({isSelected:a,isFocused:h}),...D(!!i.prefix)}),valueContainer:r=>({...r,position:"static",padding:n?`${n-1}rem 0 `:0,height:n?"auto":"1.5rem"}),clearIndicator:r=>({...r,paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:"0.2rem"})},components:{IndicatorSeparator:()=>null,DropdownIndicator:U,...i.components??{}}}),u&&l(_,{hasError:s,children:u})]})}export{w as Select,w as default};
39
+ `,U=(o,l)=>l?e.colors.error.main:o?e.colors.text.dark:e.colors.gray.light1,Z=({selectProps:{menuIsOpen:o=!1},isFocused:l=!1,isDisabled:p})=>t(G,{$isDisabled:p,$isFocused:l,$isMenuOpen:o,$theme:e});function w({className:o,color:l="primary",forwardRef:p,hasError:s=!1,height:n,helperText:f,isDisabled:d=!1,onBlur:L=()=>null,onFocus:v=()=>null,onInputChange:C=()=>null,placeholder:I="",name:g,...i}){const[c,b]=F(!1),[T,B]=F(""),z=(r,a)=>{C(r,a),B(r)},$=({isSelected:r,isFocused:a,isDisabled:h})=>r?e.colors[l].main:h?e.colors.background.light:a?e.colors.background.gray:e.colors.background.light,E=r=>{b(!0),v(r)},O=r=>{b(!1),L(r)},x=U(c,s),y=!i.label;return u(W,{className:o,children:[!y&&i.label&&t(M,{htmlFor:g,height:n,isFocused:c,hasValue:!!(i.value||T),disabled:d,theme:e,hasError:s,children:u(N,{children:[i.label,t("span",{})]})}),i.prefix&&t(_,{isDisabled:d,isFocused:c,children:i.prefix}),t(R,{...i,id:"react-select",inputId:g,name:g,ref:p,isDisabled:d,onInputChange:z,placeholder:I,onFocus:E,onBlur:O,styles:{control:r=>({...r,borderRadius:0,color:e.colors.text.dark,fontFamily:e.typography.fontBaseFamily,fontSize:"1rem",fontWeight:400,cursor:"pointer",padding:"0.7rem 0.5rem",backgroundColor:e.colors.background.light,borderColor:x,boxShadow:"none",minHeight:"3rem","&:hover":{borderColor:"none"},...j(d),...A(s),...D(!!i.prefix)}),input:r=>({...r,height:"auto",margin:0,padding:0}),placeholder:r=>{const a={...r,fontSize:"1rem",lineHeight:"1.5rem",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",margin:0};return y?{...a,color:e.colors.text.dark,fontWeight:600}:{...a,display:c?"static":"none"}},menuList:r=>({...r,padding:"0.5rem 0",paddingBottom:"5rem",marginTop:0,border:`1px solid ${x}`,borderTop:"none",display:"flex",flexDirection:"column",gap:"0.5rem"}),menu:r=>({...r,borderRadius:0,boxShadow:"none",zIndex:5,padding:"0",marginTop:"-0.1rem"}),option:(r,{isSelected:a,isFocused:h,isDisabled:k})=>({...r,padding:"0.5rem",lineHeight:"1.5rem",fontSize:"1rem",fontWeight:400,cursor:k?"not-allowed":"pointer","&:hover":{background:$({isSelected:a,isFocused:!0,isDisabled:k})},background:$({isSelected:a,isFocused:h}),...D(!!i.prefix)}),valueContainer:r=>({...r,position:"static",padding:n?`${n-1}rem 0 `:0,height:n?"auto":"1.5rem"}),clearIndicator:r=>({...r,paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:"0.2rem"})},components:{IndicatorSeparator:()=>null,DropdownIndicator:Z,...i.components??{}}}),f&&t(P,{hasError:s,children:f})]})}export{w as Select,w as default};
@@ -1,18 +1,18 @@
1
- import{jsxs as m,jsx as a}from"react/jsx-runtime";import{useState as k}from"react";import o,{css as p}from"styled-components";import e from"../../theme.js";import{Label as v}from"../FieldLabel.js";import{BodyTextStyle as F,CaptionStyle as E}from"../../typography/BodyText/index.js";import"../../shared/media-queries.js";const z=p`
1
+ import{jsxs as i,jsx as l,Fragment as k}from"react/jsx-runtime";import{useState as F}from"react";import o,{css as p}from"styled-components";import e from"../../theme.js";import{Label as v}from"../FieldLabel.js";import{BodyTextStyle as E,CaptionStyle as z}from"../../typography/BodyText/index.js";import"../../shared/media-queries.js";const S=p`
2
2
  border: 1px solid ${e.colors.gray.light1};
3
3
  color: ${e.colors.gray.dark1};
4
4
  fill: ${e.colors.gray.light1};
5
- `,S=p`
6
- border: 1px solid ${e.colors.error.main};
7
5
  `,B=p`
6
+ border: 1px solid ${e.colors.error.main};
7
+ `,T=p`
8
8
  color: ${e.colors.text.dark};
9
9
  border: 1px solid ${e.colors.text.dark};
10
10
  fill: ${e.colors.text.dark};
11
- `,T=o.div`
11
+ `,j=o.div`
12
12
  position: relative;
13
13
  padding: 0;
14
14
  display: inline-block;
15
- `,j=o.div`
15
+ `,w=o.div`
16
16
  display: inline-black;
17
17
 
18
18
  color: ${e.colors.gray.light1};
@@ -24,12 +24,12 @@ import{jsxs as m,jsx as a}from"react/jsx-runtime";import{useState as k}from"reac
24
24
 
25
25
  padding: 0.7rem 0.75rem;
26
26
 
27
- ${({hasError:r,isFocused:l})=>!r&&l&&B}
28
- ${({disabled:r})=>r&&z}
29
- ${({hasError:r})=>r&&S}
27
+ ${({hasError:r,isFocused:a})=>!r&&a&&T}
28
+ ${({disabled:r})=>r&&S}
29
+ ${({hasError:r})=>r&&B}
30
30
  ${({centered:r})=>r&&"text-align: center;"}
31
- `,w=o.textarea`
32
- ${F}
31
+ `,C=o.textarea`
32
+ ${E}
33
33
 
34
34
  width: 100%;
35
35
  cursor: text;
@@ -38,17 +38,17 @@ import{jsxs as m,jsx as a}from"react/jsx-runtime";import{useState as k}from"reac
38
38
  background-color: transparent;
39
39
 
40
40
  ${({resize:r})=>!r&&"resize: none;"}
41
- `,C=o.div`
42
- font-family: ${({theme:r})=>r.typography.fontBaseFamily};
43
41
  `,N=o.div`
44
- ${E}
42
+ font-family: ${({theme:r})=>r.typography.fontBaseFamily};
43
+ `,P=o.div`
44
+ ${z}
45
45
  margin-top: 0.25rem;
46
46
 
47
47
  ${({centered:r})=>r&&"width: 100%; text-align: center;"}
48
- `,P=o.span`
48
+ `,A=o.span`
49
49
  display: block;
50
50
  color: ${({theme:r})=>r.colors.text.disabled};
51
- `,A=o.span`
51
+ `,D=o.span`
52
52
  display: block;
53
53
  color: ${({theme:r})=>r.colors.error.dark};
54
- `,g=({placeholder:r="",isDisabled:l=!1,centered:t=!1,hasError:f=!1,className:u,helperText:d,label:s="",resize:x=!0,name:c,errors:n,...i})=>{const[h,$]=k(!1),y=!!i.value;return m(T,{className:u,children:[m(j,{isFocused:h,disabled:l,centered:t,hasError:f,hasPlaceholder:!!r,children:[a(w,{...i,name:c,"aria-label":s||c,resize:x,onFocus:()=>$(!0),onBlur:()=>$(!1),disabled:l,theme:e,placeholder:s&&!h?"":r}),i.suffix&&a(C,{children:i.suffix})]}),s&&a(v,{htmlFor:c,isFocused:h,centered:t,hasError:f,hasValue:y,disabled:l,theme:e,children:s}),(d||n)&&m(N,{centered:t,children:[d&&a(P,{children:d}),n&&n.map(b=>a(A,{children:b},b))]})]})};export{g as TextArea,g as default};
54
+ `,u=({placeholder:r="",isDisabled:a=!1,centered:d=!1,hasError:f=!1,className:$,helperText:n,label:s="",resize:x=!0,name:c,errors:h,...t})=>{const[m,g]=F(!1),y=!!t.value;return i(j,{className:$,children:[i(w,{isFocused:m,disabled:a,centered:d,hasError:f,hasPlaceholder:!!r,children:[l(C,{...t,name:c,"aria-label":s||c,resize:x,onFocus:()=>g(!0),onBlur:()=>g(!1),disabled:a,theme:e,placeholder:s&&!m?"":r}),t.suffix&&l(N,{children:t.suffix})]}),s&&l(v,{htmlFor:c,isFocused:m,centered:d,hasError:f,hasValue:y,disabled:a,theme:e,children:i(k,{children:[s,l("span",{})]})}),(n||h)&&i(P,{centered:d,children:[n&&l(A,{children:n}),h&&h.map(b=>l(D,{children:b},b))]})]})};export{u as TextArea,u as default};
@@ -1,18 +1,18 @@
1
- import{jsxs as h,jsx as t}from"react/jsx-runtime";import{useState as B}from"react";import r,{css as m}from"styled-components";import{Label as E}from"../FieldLabel.js";import{BodyTextStyle as A,CaptionStyle as N}from"../../typography/BodyText/index.js";import{generateNameHash as T}from"../../shared/helpers.js";import"../../shared/media-queries.js";const S=m`
1
+ import{jsxs as n,jsx as l,Fragment as A}from"react/jsx-runtime";import{useState as N}from"react";import r,{css as m}from"styled-components";import{Label as T}from"../FieldLabel.js";import{BodyTextStyle as z,CaptionStyle as S}from"../../typography/BodyText/index.js";import{generateNameHash as j}from"../../shared/helpers.js";import"../../shared/media-queries.js";const C=m`
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
- `,j=m`
5
+ `,L=m`
6
6
  border: 2px solid ${({theme:e})=>e.colors.error.dark};
7
- `,z=m`
7
+ `,D=m`
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
- `,C=r.div`
11
+ `,H=r.div`
12
12
  position: relative;
13
13
  padding: 0;
14
14
  display: block;
15
- `,L=r.div`
15
+ `,M=r.div`
16
16
  display: flex;
17
17
  text-align: center;
18
18
  align-items: center;
@@ -26,12 +26,12 @@ import{jsxs as h,jsx as t}from"react/jsx-runtime";import{useState as B}from"reac
26
26
 
27
27
  padding: 0.75rem 0.6rem;
28
28
 
29
- ${({hasError:e,isFocused:l})=>!e&&l&&z}
30
- ${({disabled:e})=>e&&S}
31
- ${({hasError:e})=>e&&j}
29
+ ${({hasError:e,isFocused:t})=>!e&&t&&D}
30
+ ${({disabled:e})=>e&&C}
31
+ ${({hasError:e})=>e&&L}
32
32
  ${({centered:e})=>e&&"text-align: center;"}
33
- `,P=r.input`
34
- ${A}
33
+ `,O=r.input`
34
+ ${z}
35
35
  width: 100%;
36
36
  cursor: text;
37
37
  outline: none;
@@ -42,7 +42,7 @@ import{jsxs as h,jsx as t}from"react/jsx-runtime";import{useState as B}from"reac
42
42
  color: ${({theme:e})=>e.colors.text.disabled};
43
43
  fill: ${({theme:e})=>e.colors.text.disabled};
44
44
  }
45
- `,D=r.span`
45
+ `,P=r.span`
46
46
  display: flex;
47
47
  font-family: ${({theme:e})=>e.typography.fontBaseFamily};
48
48
  font-size: 1.25rem;
@@ -52,15 +52,15 @@ import{jsxs as h,jsx as t}from"react/jsx-runtime";import{useState as B}from"reac
52
52
  width: 1.375rem;
53
53
  height: 1.375rem;
54
54
  }
55
- `,H=r.div`
56
- ${N}
55
+ `,R=r.div`
56
+ ${S}
57
57
  margin-top: 0.25rem;
58
58
 
59
59
  ${({centered:e})=>e&&"width: 100%; text-align: center;"}
60
- `,I=r.span`
60
+ `,V=r.span`
61
61
  display: block;
62
62
  color: ${({theme:e})=>e.colors.text.disabled};
63
- `,M=r.span`
63
+ `,W=r.span`
64
64
  display: block;
65
65
  color: ${({theme:e})=>e.colors.error.dark};
66
- `,g=({placeholder:e="",isDisabled:l=!1,centered:d=!1,hasError:p=!1,className:$,helperText:c,label:s="",onBlur:y=()=>null,onFocus:k=()=>null,forwardRef:F,suffix:b,name:a=T("text-input"),errors:i,isAutoFocused:v=!1,...u})=>{const[n,f]=B(!1),w=!!u.value,x=i&&Array.isArray(i)&&i?.length>0;return h(C,{className:$,children:[h(L,{isFocused:n,disabled:l,centered:d,hasError:p,hasPlaceholder:!!e,children:[t(P,{...u,id:a,name:a,"aria-label":s||a,ref:F,onFocus:o=>{f(!0),k(o)},onBlur:o=>{f(!1),y(o)},disabled:l,placeholder:s&&!n?"":e,autoFocus:v}),b&&t(D,{children:b})]}),s&&t(E,{htmlFor:a,isFocused:n,centered:d,hasError:p,hasValue:w,disabled:l,children:s}),(c||x)&&h(H,{centered:d,children:[c&&t(I,{children:c}),x&&i.map(o=>t(M,{children:o},o))]})]})};export{g as TextField,g as default};
66
+ `,g=({placeholder:e="",isDisabled:t=!1,centered:c=!1,hasError:p=!1,className:$,helperText:h,label:s="",onBlur:y=()=>null,onFocus:k=()=>null,forwardRef:F,suffix:u,name:a=j("text-input"),errors:d,isAutoFocused:v=!1,...b})=>{const[i,f]=N(!1),w=!!b.value,x=d&&Array.isArray(d)&&d?.length>0,B=o=>{f(!0),k(o)},E=o=>{f(!1),y(o)};return console.log("isFocused",i),n(H,{className:$,children:[n(M,{isFocused:i,disabled:t,centered:c,hasError:p,hasPlaceholder:!!e,children:[l(O,{...b,id:a,name:a,"aria-label":s||a,ref:F,onFocus:B,onBlur:E,disabled:t,placeholder:s&&!i?"":e,autoFocus:v}),u&&l(P,{children:u})]}),s&&l(T,{htmlFor:a,isFocused:i,centered:c,hasError:p,hasValue:w,disabled:t,children:n(A,{children:[s,l("span",{})]})}),(h||x)&&n(R,{centered:c,children:[h&&l(V,{children:h}),x&&d.map(o=>l(W,{children:o},o))]})]})};export{g as TextField,g as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvdbil/components",
3
- "version": "15.1.1",
3
+ "version": "15.1.3",
4
4
  "sideEffects": false,
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
package/package.json.tmp CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvdbil/components",
3
- "version": "15.1.1",
3
+ "version": "15.1.3",
4
4
  "sideEffects": false,
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",