@truework/forms
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -1,2 +0,2 @@ | ||
import{space as n,color as o,typography as r}from"styled-system";import{useSelect as e}from"use-drop";import t,{css as i}from"styled-components";import{Span as a,H5 as l,Icon as s,Box as c,P as d}from"@truework/ui";import{createElement as p,useRef as u,useState as b,useEffect as h,useCallback as m,Fragment as f,forwardRef as g,Children as v,cloneElement as x}from"react";import{Field as y,ErrorMessage as w}from"formik";import{get as k,times as O}from"lodash";import{clean as _,mask as z,format as j}from"parse-ssn";function D(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}var E=Object.freeze([""]),B=t(s)(E),C=t.div(function(n){var o=n.theme;return"\n position: relative;\n width: 16px;\n height: 16px;\n border-radius: 2px;\n margin-top: 2px;\n margin-right: 8px;\n border: 1px solid "+(n.checked?o.colors.primaryDark:o.colors.outline)+";\n transition-property: background, border-color;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.ease+";\n\n "+B+" {\n display: block;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n width: 12px;\n height: 12px;\n color: white;\n stroke: white;\n stroke-width: 2px;\n transition-property: transform;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.ease+";\n transform: scale(0);\n }\n "}),F=t(l)(function(n){var o=n.theme;return"\n width: calc(100% - 16px);\n transition-property: color;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.ease+";\n "}),T=t.input(function(n){var o=n.theme;return"\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n width: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n position: absolute;\n whitespace: nowrap;\n wordwrap: normal;\n\n &:focus ~ "+C+" {\n border-color: "+o.colors.primaryDark+";\n }\n &:checked ~ "+C+" {\n background: "+o.colors.primary+";\n border-color: "+o.colors.primaryDark+";\n\n "+B+" {\n transform: scale(1);\n }\n }\n &:focus ~ "+F+", &:focus ~"+a+", &:checked ~ "+a+" {\n color: "+o.colors.primary+";\n }\n\n "+(n.hasError?"\n & ~ "+C+" {\n border-color: "+o.colors.error+" !important;\n }\n ":"")+"\n "}),I=t.label(function(n){var o=n.theme;return"\n display: flex;\n align-items: flex-start;\n width: 100%;\n margin-bottom: 0 !important;\n\n "+(n.disabled?"\n "+C+" {\n background: "+o.colors.background+";\n }\n "+a+" {\n color: "+o.colors.placeholder+";\n }\n ":"\n &:hover "+C+" {\n border-color: "+o.colors.primaryDark+";\n }\n &:hover "+F+", &:hover "+a+" {\n color: "+o.colors.primary+";\n }\n ")+"\n "}),P=t.div(function(n){var o=n.theme;return"\n width: 100%;\n\n "+I+" {\n padding: "+o.space.sm+";\n border: 1px solid "+o.colors.outline+";\n border-top: none;\n display: flex;\n align-items: center;\n }\n\n "+I+":first-child {\n border-top: 1px solid "+o.colors.outline+";\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n }\n\n "+I+":last-child {\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n }\n "});function R(n){var o=n.children,r=n.name,e=n.checked,t=n.disabled,i=D(n,["children","name","checked","disabled"]);return p(I,{htmlFor:r,disabled:t},p(T,Object.assign({id:r,name:r,type:"checkbox",checked:e,disabled:t},i)),p(C,{checked:e},p(B,{name:"Check"})),p(a,{display:"block",width:"calc(100% - 16px)",fontSize:1,lineHeight:1,fontWeight:5,style:{transitionProperty:"color",transitionDuration:"150ms",transitionTimingFunction:"ease-in-out"}},o))}function S(n){var o=n.name,r=n.validate,e=n.onChange,t=n.onBlur,i=D(n,["name","validate","onChange","onBlur"]);return p(y,{name:o,validate:r},function(n){var r=n.field,a=Boolean(k(n.form,["errors",o]));return p(R,Object.assign({},i,r,{checked:Boolean(r.value),hasError:a,onChange:function(n){r.onChange(n),e&&e(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}function N(n){return n<10?"0"+n:""+n}var H=Object.freeze(["\n display: block;\n position: relative;\n font-weight: 500;\n letter-spacing: 0.6px;\n ","\n ","\n ","\n"]),V=t.label(H,r,o,n);V.displayName="Label",V.defaultProps={fontSize:1,lineHeight:1,mb:"xs"};var M=Object.freeze(["\n position: absolute;\n top: 0;\n bottom: 0;\n right: 12px;\n z-index: 1;\n height: 16px;\n width: 16px;\n margin: auto 0;\n border: 1px solid currentColor;\n border-radius: 16px;\n color: ",";\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: 0.5;\n transition: opacity ","\n ",";\n\n &:hover {\n opacity: 1;\n }\n "]),U=Object.freeze(["\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: ",";\n color: ",";\n font-size: ",";\n font-family: ",";\n line-height: ",";\n letter-spacing: 0.6px;\n margin: 0;\n min-height: 48px;\n padding: "," 8px "," 10px;\n text-align: center;\n max-width: 33.333333%;\n background: transparent;\n color: ",";\n cursor: pointer;\n z-index: 2;\n transition-property: border-color, color;\n transition-duration: 150ms;\n transition-timing-function: ease-in-out;\n\n &::-ms-expand {\n display: none;\n }\n &:disabled {\n background: transparent;\n color: ",";\n cursor: not-allowed;\n & ~ .__border {\n background: ",";\n cursor: not-allowed;\n }\n }\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n outline: 0;\n color: ",";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: ",";\n\n div {\n border-color: ",";\n color: ",";\n }\n }\n }\n "]),Y=t.select(function(n){var o=n.theme,r=n.hasError;return i(U,o.fonts.roboto,o.colors.body,o.fontSizes[1],o.fonts.mono,o.lineHeights[0],o.space.sm,o.space.sm,n.hasValue?o.colors.body:o.colors.secondary,function(n){return n.theme.colors.placeholder},o.colors.background,o.colors.body,r?o.colors.error:o.colors.primary,r?o.colors.error:o.colors.primary,r?o.colors.error:o.colors.primary)}),A=t.button(function(n){var o=n.theme;return i(M,o.colors.secondary,o.transitionDurations.fast,o.transitionTimingFunctions.ease)});function L(n){var o=n.name,r=n.label;void 0===r&&(r="Date");var e=n.disabled,t=n.initialMonth;void 0===t&&(t=0);var i=n.initialDay;void 0===i&&(i=0);var a=n.initialYear;void 0===a&&(a=0);var l=n.minMonth;void 0===l&&(l=1);var d=n.minDay;void 0===d&&(d=1);var f=n.minYear;void 0===f&&(f=1980);var g=n.maxMonth;void 0===g&&(g=12);var v=n.maxDay;void 0===v&&(v=31);var x=n.maxYear;void 0===x&&(x=2030);var y=n.hasError,w=n.onUpdate,k=u(null),_=u(null),z=u(null),j=b(t),D=j[0],E=j[1],B=b(i),C=B[0],F=B[1],T=b(a),I=T[0],P=T[1],R=function(n){return new Date(n.year,n.month,0).getUTCDate()}({year:I||2020,month:D});h(function(){I&&D&&C&&w(I+"-"+N(D)+"-"+N(C))},[D,C,I]);var S=m(function(){E(0),F(0),P(0)},[E,F,P]);return p(c,{ml:"-4px",mr:"-4px",p:"4px"},p(c,{display:"flex",alignItems:"center",height:"48px",pl:"56px"},p(Y,{ref:k,name:o+"-month",value:D,disabled:e,onChange:function(n){E(parseInt(n.target.value,10)),_.current&&_.current.focus()},"aria-label":r+": Month",hasValue:Boolean(D),hasError:y},p("option",{value:"0",disabled:!0},"mm"),O(g-l+1,function(){return""}).map(function(n,o){var r=l+o;return p("option",{key:r,value:r},N(r))})),p(c,{height:"50%",width:"1px",bg:y?"error":"outline",zIndex:2,transform:"rotate(10deg)"}),p(Y,{ref:_,name:o+"-day",value:C,disabled:e,onChange:function(n){F(parseInt(n.target.value,10)),z.current&&z.current.focus()},"aria-label":r+": Day",hasValue:Boolean(C),hasError:y},p("option",{value:"0",disabled:!0},"dd"),O(Math.min(v,R)-d+1,function(){return""}).map(function(n,o){var r=d+o;return p("option",{key:r,value:r},N(r))})),p(c,{height:"50%",width:"1px",bg:y?"error":"outline",zIndex:2,transform:"rotate(10deg)"}),p(Y,{ref:z,name:o+"-year",value:I,disabled:e,onChange:function(n){P(parseInt(n.target.value,10))},"aria-label":r+": Year",hasValue:Boolean(I),hasError:y},p("option",{value:"0",disabled:!0},"yyyy"),O(x-f+1,function(n){return f+n}).map(function(n){return p("option",{key:n,value:n},n)})),(D||C||I)&&p(A,{title:"Clear",onClick:S},p(s,{name:"X",width:"12px",height:"12px"})),p(c,{className:"__bg",bg:y?"error-alpha01":"primary-alpha01",position:"absolute",top:"-4px",bottom:"-4px",left:"-4px",right:"-4px",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),p(c,{className:"__border",bg:"white",border:["1px solid",y?"error":"outline"],position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"},p(c,{"aria-hidden":"true",position:"absolute",top:"0",left:"0",display:"flex",alignItems:"center",justifyContent:"center",px:"sm",height:"100%",zIndex:0,color:y?"error":"secondary",bg:y?"#FDEBF0":"background",borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px",borderRight:["1px solid",y?"error":"outline"],transitionProperty:"border-color, color",transitionDuration:"fast",transitionTimingFunction:"ease"},p(s,{name:"Calendar"})))))}function W(n){var o=n.name,r=n.validate,e=function(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}(n,["name","validate"]);return p(y,{name:o,validate:r},function(n){var r=n.field,t=n.form,i=Boolean(k(t,["errors",o])),a=(r.value||"").split("-"),l=a[0];void 0===l&&(l="");var s=a[1];void 0===s&&(s="");var c=a[2];return void 0===c&&(c=""),p(L,Object.assign({name:o},e,{initialMonth:s?parseInt(s,10):void 0,initialDay:c?parseInt(c,10):void 0,initialYear:l?parseInt(l,10):void 0,hasError:i,onUpdate:function(n){t.setFieldValue(o,n)}}))})}function K(n){return p(f,null,p(V,{htmlFor:n.name},n.label),p(W,Object.assign({},n)))}function X(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}var q=t(c)(function(n){var o=n.theme,r=n.selected,e=n.highlighted;return"\n display: flex;\n align-items: center;\n padding: "+o.space.sm+";\n color: "+(r||e?o.colors.body:o.colors.secondary)+";\n background-color: "+(r||e?o.colors.background:"white")+";\n cursor: pointer;\n font-size: "+o.fontSizes[1]+";\n font-weight: 400;\n line-height: "+o.lineHeights[1]+";\n letter-spacing: 0.6px;\n\n &:hover {\n background: "+o.colors.background+";\n }\n"});function G(n){var o=n.children,r=X(n,["children"]);return p(q,Object.assign({as:"li"},r),o)}var J=g(function(n,o){var r=n.children,e=X(n,["children"]);return p(c,Object.assign({ref:o,as:"ul",boxShadow:"medium",borderRadius:2,overflow:"auto",width:"100%",bg:"white"},e),r)});J.displayName="Body";var Q=t.button(function(n){var o=n.theme,r=n.hasError;return"\n display: block;\n position: relative;\n width: 100%;\n z-index: 1;\n height: 48px;\n padding: 0 16px;\n text-align: left;\n font-size: "+o.fontSizes[1]+";\n font-weight: 400;\n line-height: "+o.lineHeights[1]+";\n color: "+o.colors.secondary+";\n transition-property: color;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.ease+";\n\n "+(n.disabled?"\n background: transparent;\n color: "+o.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+o.colors.background+";\n cursor: not-allowed;\n }\n ":"\n &:active,\n &:focus,\n &:hover {\n outline: 0;\n color: "+o.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(r?o.colors.error:o.colors.primary)+";\n\n div {\n border-color: "+(r?o.colors.error:o.colors.primary)+";\n color: "+(r?o.colors.error:o.colors.primary)+";\n }\n }\n }\n ")+"\n\n "+(n.isActive?"\n outline: 0;\n color: "+o.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(r?o.colors.error:o.colors.primary)+";\n\n div {\n border-color: "+(r?o.colors.error:o.colors.primary)+";\n color: "+(r?o.colors.error:o.colors.primary)+";\n }\n }\n ":"")+"\n"});Q.displayName="ControlOuter";var Z=g(function(n,o){var r=n.children,e=n.isActive,t=n.hasError,i=X(n,["children","isActive","hasError"]);return p("div",{style:{position:"relative"}},p(Q,Object.assign({ref:o,isActive:e,hasError:t,type:"button"},i),p(a,{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},p(a,{width:"100%",fontWeight:4,style:{whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",letterSpacing:"0.6px"}},r),p(s,{name:"ChevronDown",ml:"xs"}))),p(c,{className:"__bg",bg:t?"error-alpha01":"primary-alpha01",position:"absolute",top:"-2px",bottom:"-2px",left:"-2px",right:"-2px",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),p(c,{className:"__border",bg:"white",border:["1px solid",t?"error":"outline"],position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"}))});function $(n){var o=n.value,r=n.placeholder,t=n.label,i=n.items,a=n.hasError,l=n.disabled,s=n.onSelect,d=n.onRemove,u=b(k(i.filter(function(n){return n.value===o})[0],"label")||r||"Please select"),h=u[0],m=u[1],f=e({items:i.map(function(n){return Object.assign({},n,{selected:n.value===o})}),onSelect:function(n){m(n.label),s&&s(n)},onRemove:function(n){m("Please select"),d&&d(n)}}),g=f.items,v=f.isOpen,x=f.getDropProps;return p(c,null,p(Z,Object.assign({id:f.id},l?{}:(0,f.getControlProps)(),{"aria-label":t,isActive:v,hasError:a,disabled:l}),h),v&&p(c,{position:"absolute",bottom:"0",width:"100%",transform:"translateY(100%) translateY(6px)",zIndex:1e3},p(J,Object.assign({},x(),{style:{maxHeight:"240px",overflow:"auto"}}),g.map(function(n){return p(G,Object.assign({key:n.value,selected:n.selected,highlighted:n.highlighted},n.getItemProps()),n.label)}))))}function nn(n){var o=n.name,r=n.validate,e=X(n,["name","validate"]);return p(y,{name:o,validate:r},function(n){var o=n.field,r=n.form,t=Boolean(r.errors&&r.errors[o.name]);return p($,Object.assign({},e,{hasError:t,onSelect:function(n){r.setFieldValue(o.name,n.value),e.onSelect&&e.onSelect(n)}}))})}function on(n){return p(f,null,p(V,{htmlFor:n.name},n.label),p(nn,Object.assign({},n)))}function rn(n){return p(w,{name:n.name,render:function(n){return p(a,{color:"error",fontSize:0},n)}})}function en(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}Z.displayName="Control";var tn=t.input(function(n){var o=n.theme,r=n.small,e=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+o.fonts.roboto+";\n color: "+o.colors.body+";\n font-size: "+(r?o.fontSizes[0]:o.fontSizes[1])+";\n line-height: "+o.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 0;\n min-height: "+(r?"36px":"48px")+";\n padding: "+(r?"10px":o.space.sm)+";\n background: transparent;\n color: "+(n.hasValue?o.colors.body:o.colors.secondary)+";\n cursor: pointer;\n z-index: 2;\n transition-property: border-color, color;\n transition-duration: 150ms;\n transition-timing-function: ease-in-out;\n\n &::placeholder {\n color: "+o.colors.secondary+";\n line-height: "+o.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+o.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+o.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+o.colors.background+";\n cursor: not-allowed;\n }\n }\n &:invalid,\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n box-shadow: none;\n outline: 0;\n color: "+o.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(e?o.colors.error:o.colors.primary)+";\n }\n & ~ .__tab {\n border-color: "+(e?o.colors.error:o.colors.primary)+";\n color: "+(e?o.colors.error:o.colors.primary)+";\n }\n }\n "+(r?"\n & ~ .__tab {\n padding: 10px;\n }\n ":"")+"\n"});tn.displayName="InputElement";var an=g(function(n,o){var r=n.hasError,e=n.preTab,t=n.postTab,i=en(n,["hasError","preTab","postTab"]),a=Boolean(e),l=e||t;return p(c,{display:"flex",ml:"-2px",mr:"-2px",p:"2px"},p(tn,Object.assign({ref:o,hasError:r},i)),l&&p(c,{className:"__tab","aria-hidden":"true",display:"flex",alignItems:"center",justifyContent:"center",px:"sm",zIndex:1,color:r?"error":"secondary",bg:r?"#FDEBF0":"background",borderTopLeftRadius:a?"4px":"0",borderBottomLeftRadius:a?"4px":"0",borderTopRightRadius:a?"0":"4px",borderBottomRightRadius:a?"0":"4px",border:["1px solid",r?"error":"outline"],order:a?-1:1,transitionProperty:"border-color, color",transitionDuration:"fast",transitionTimingFunction:"ease"},l),p(c,{className:"__bg",bg:r?"error-alpha01":"primary-alpha01",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),p(c,{className:"__border",bg:"white",border:["1px solid",r?"error":"outline"],position:"absolute",top:"2px",bottom:"2px",left:"2px",right:"2px",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"}))});function ln(n){var o=n.name,r=n.validate,e=n.onChange,t=n.onBlur,i=en(n,["name","validate","onChange","onBlur"]);return p(y,{name:o,validate:r},function(n){var r=n.field,a=Boolean(k(n.form,["errors",o]));return p(an,Object.assign({},i,r,{hasError:a,onChange:function(n){r.onChange(n),e&&e(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}function sn(n){return p(f,null,p(V,{htmlFor:n.name},n.label),p(ln,Object.assign({},n)))}function cn(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}var dn=Object.freeze(["\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n cursor: pointer;\n z-index: 0;\n"]),pn=t.span(function(n){var o=n.theme;return"\n display: block;\n font-size: "+o.fontSizes[1]+";\n font-weight: "+o.fontWeights[5]+";\n line-height: "+o.lineHeights[0]+";\n margin-bottom: "+o.space.xxs+";\n transition-property: color;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.ease+";\n "}),un=t.div(function(n){var o=n.theme;return"\n width: 100%;\n border: 1px solid "+o.colors.outline+";\n border-radius: 4px;\n\n "+fn+" {\n padding: "+o.space.sm+";\n border-top: 1px solid "+o.colors.outline+";\n\n &:first-of-type {\n border-top: 0;\n }\n }\n\n "+(n.hasError?"\n border-color: "+o.colors.error+" !important;\n\n & "+fn+" {\n border-color: "+o.colors.error+" !important;\n }\n ":"")+"\n "}),bn=t.div(function(n){var o=n.theme;return"\n position: relative;\n width: 16px;\n height: 16px;\n border-radius: 100%;\n margin-top: 2px;\n margin-right: 16px;\n border: 1px solid "+(n.checked?o.colors.primaryDark:o.colors.outline)+";\n z-index: 1;\n transition-property: background, border-color;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.ease+";\n\n &::after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n width: 8px;\n height: 8px;\n border-radius: 100%;\n background: white;\n transition-property: transform;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.ease+";\n transform: scale(0);\n }\n "}),hn=t.input(function(n){var o=n.theme;return"\n position: relative;\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n width: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n position: absolute;\n whitespace: nowrap;\n wordwrap: normal;\n z-index: 1;\n\n &:focus ~ "+bn+" {\n border-color: "+o.colors.primaryDark+";\n }\n &:focus ~ "+c+" "+pn+" {\n color: "+o.colors.primary+";\n }\n\n &:checked ~ "+bn+" {\n background: "+o.colors.primary+";\n border-color: "+o.colors.primaryDark+";\n\n &::after {\n transform: scale(1);\n }\n }\n &:checked ~ "+c+" "+pn+" {\n color: "+o.colors.primary+";\n }\n\n &:disabled ~ "+bn+" {\n border-color: "+o.colors.outline+" !important;\n }\n &:disabled ~ "+mn+" {\n background-color: "+o.colors.background+";\n }\n &:disabled ~ "+c+" "+pn+" {\n color: "+o.colors.secondary+" !important;\n }\n "}),mn=t.span(dn),fn=t.label(function(n){var o=n.theme;return"\n display: flex;\n align-items: center;\n position: relative;\n width: 100%;\n margin-bottom: 0 !important;\n cursor: pointer;\n overflow: hidden;\n\n &:hover "+bn+" {\n border-color: "+o.colors.primaryDark+";\n }\n &:hover "+pn+" {\n color: "+o.colors.primary+";\n }\n "});function gn(n){var o=n.name,r=n.checked,e=n.description,t=n.label,i=cn(n,["children","name","checked","description","label"]),a=o+i.value;return p(fn,{htmlFor:a},p(hn,Object.assign({id:a,name:o,type:"radio",checked:r},i)),p(bn,{checked:r}),p(c,{display:"block",position:"relative",zIndex:1,width:"calc(100% - 32px)",maxWidth:"calc(100% - 32px)"},t&&p(pn,null,t),e&&p(d,{color:"secondary",fontSize:0,fontWeight:4,lineHeight:0},e)),p(mn,null))}function vn(n){var o=n.children,r=n.name,e=n.validate,t=n.onChange,i=n.onBlur,a=cn(n,["children","name","validate","onChange","onBlur"]);return p(y,{name:r,validate:e},function(n){var e=n.field,l=Boolean(k(n.form,["errors",r]));return p(un,{hasError:l},v.toArray(o).map(function(n){return x(n,Object.assign({},e,a,{value:n.props.value,hasError:l,checked:Boolean(e.value===n.props.value),onChange:function(n){e.onChange(n),t&&t(n)},onBlur:function(n){e.onBlur(n),i&&i(n)}}))}))})}function xn(n){var o=n.label,r=cn(n,["label"]);return p(f,null,p(V,{htmlFor:r.name},o),p(vn,Object.assign({},r)))}function yn(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}var wn=t.select(function(n){var o=n.theme,r=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+o.fonts.roboto+";\n color: "+o.colors.body+";\n font-size: "+o.fontSizes[1]+";\n line-height: "+o.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 0;\n min-height: 48px;\n padding: "+o.space.sm+";\n background: transparent;\n color: "+(n.hasValue?o.colors.body:o.colors.secondary)+";\n cursor: pointer;\n z-index: 2;\n transition-property: border-color, color;\n transition-duration: 150ms;\n transition-timing-function: ease-in-out;\n\n &::placeholder {\n color: "+o.colors.secondary+";\n line-height: "+o.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+o.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+o.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+o.colors.background+";\n cursor: not-allowed;\n }\n }\n &:invalid,\n &:-moz-ui-invalid,\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n box-shadow: none;\n outline: 0;\n color: "+o.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(r?o.colors.error:o.colors.primary)+";\n\n div {\n border-color: "+(r?o.colors.error:o.colors.primary)+";\n color: "+(r?o.colors.error:o.colors.primary)+";\n }\n }\n }\n"});wn.displayName="SelectElement";var kn=g(function(n,o){var r=n.children,e=n.hasError,t=n.placeholder;void 0===t&&(t="");var i=yn(n,["children","hasError","placeholder"]);return p(c,{ml:"-2px",mr:"-2px",p:"2px"},p(wn,Object.assign({ref:o,hasValue:Boolean(i.value),hasError:e},i,{value:i.value||""}),t&&p("option",{value:"",disabled:!0},t),r),p(c,{className:"__bg",bg:e?"error-alpha01":"primary-alpha01",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),p(c,{className:"__border",bg:"white",border:["1px solid",e?"error":"outline"],position:"absolute",top:"2px",bottom:"2px",left:"2px",right:"2px",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"}),p(c,{position:"absolute",right:"0",top:"0",bottom:"0",height:"16px",my:"auto",pr:"sm",style:{pointerEvents:"none"}},p(s,{name:"ChevronDown",color:"secondary"})))});function On(n){var o=n.name,r=n.validate,e=n.onChange,t=n.onBlur,i=yn(n,["name","validate","onChange","onBlur"]);return p(y,{name:o,validate:r},function(n){var r=n.field,a=Boolean(k(n.form,["errors",o]));return p(kn,Object.assign({},i,r,{hasError:a,onChange:function(n){r.onChange(n),e&&e(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}function _n(n){return p(f,null,p(V,{htmlFor:n.name},n.label),p(On,Object.assign({},n)))}var zn=t(c)(function(n){return"\n border-left: 2px solid currentColor;\n padding-left: "+n.theme.space.sm+";\n "});function jn(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}var Dn=t.textarea(function(n){var o=n.theme,r=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+o.fonts.roboto+";\n color: "+o.colors.body+";\n font-size: "+o.fontSizes[1]+";\n line-height: "+o.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 0;\n min-height: 48px;\n padding: "+o.space.sm+";\n background: transparent;\n color: "+(n.hasValue?o.colors.body:o.colors.secondary)+";\n cursor: pointer;\n z-index: 2;\n transition-property: border-color, color;\n transition-duration: 150ms;\n transition-timing-function: ease-in-out;\n\n &::placeholder {\n color: "+o.colors.secondary+";\n line-height: "+o.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+o.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+o.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+o.colors.background+";\n cursor: not-allowed;\n }\n }\n &:invalid,\n &:-moz-ui-invalid,\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n box-shadow: none;\n outline: 0;\n color: "+o.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(r?o.colors.error:o.colors.primary)+";\n\n div {\n border-color: "+(r?o.colors.error:o.colors.primary)+";\n color: "+(r?o.colors.error:o.colors.primary)+";\n }\n }\n }\n"});Dn.displayName="TextareaElement",Dn.defaultProps={rows:4};var En=g(function(n,o){var r=n.hasError,e=jn(n,["hasError"]);return p(c,{ml:"-2px",mr:"-2px",p:"2px"},p(Dn,Object.assign({ref:o,hasError:r},e)),p(c,{className:"__bg",bg:r?"error-alpha01":"primary-alpha01",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),p(c,{className:"__border",bg:"white",border:["1px solid",r?"error":"outline"],position:"absolute",top:"2px",bottom:"2px",left:"2px",right:"2px",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"}))});function Bn(n){var o=n.name,r=n.validate,e=n.onChange,t=n.onBlur,i=jn(n,["name","validate","onChange","onBlur"]);return p(y,{name:o,validate:r},function(n){var r=n.field,a=Boolean(k(n.form,["errors",o]));return p(En,Object.assign({},i,r,{hasError:a,onChange:function(n){r.onChange(n),e&&e(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}function Cn(n){return p(f,null,p(V,{htmlFor:n.name},n.label),p(Bn,Object.assign({},n)))}var Fn=Object.freeze(["\n ","\n"]),Tn="\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n width: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n position: absolute;\n whitespace: nowrap;\n wordwrap: normal;\n",In=t.div(function(n){var o=n.theme;return"\n display: block;\n position: absolute;\n top: 3px;\n bottom: 0;\n left: 3px;\n width: 24px;\n height: 24px;\n border-radius: 100px;\n border: 1px solid "+o.colors.outline+";\n color: white;\n background: white;\n stroke: white;\n transition-property: transform, background, border-color;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.natural+";\n"}),Pn=t.div(function(n){var o=n.theme;return"\n position: relative;\n width: 56px;\n height: 32px;\n border-radius: 100px;\n border: 1px solid "+o.colors.outline+";\n background: "+o.colors.background+";\n cursor: pointer;\n transition-property: background, border-color;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.natural+";\n "}),Rn=t.label(function(n){return"\n display: flex;\n align-items: center;\n margin-bottom: 0 !important;\n\n &:hover "+Pn+" {\n "+In+" {\n border-color: "+n.theme.colors.primaryDark+";\n }\n }\n "}),Sn=t.input(function(n){var o=n.theme;return"\n "+Tn+"\n\n &:focus ~ "+Pn+" {\n border-color: "+o.colors.primary+";\n }\n &:checked ~ "+Pn+" {\n border-color: "+o.colors.primary+";\n\n "+In+" {\n background: "+o.colors.primary+";\n border-color: "+o.colors.primaryDark+";\n transform: translateX(24px);\n }\n }\n &:disabled ~ "+Pn+" {\n pointer-events: none;\n "+In+" {\n border-color: "+o.colors.outline+";\n }\n }\n "}),Nn=t.span(Fn,Tn);function Hn(n){var o=n.label,r=n.name,e=n.checked,t=function(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}(n,["label","name","checked"]);return p(Rn,{htmlFor:r},p(Sn,Object.assign({id:r,name:r,type:"checkbox",checked:e},t)),p(Pn,null,p(In,null,p(s,{name:"Check",width:"12px",height:"12px",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",m:"auto",style:{strokeWidth:"2px"}}))),p(Nn,null,o))}function Vn(n){var o=n.label;return p(y,{name:n.name,validate:n.validate},function(n){var r=n.field;return p(Hn,Object.assign({label:o},r,{checked:Boolean(r.value)}))})}function Mn(n){var o=n.value;void 0===o&&(o="");var r=n.masker;void 0===r&&(r="*");var e=n.separator;void 0===e&&(e="-");var t=new RegExp("[^0-9"+e+"]").test(o)?"":_(o,r),i=j(z(t,r),e),a=b(t),l=a[0],s=a[1],c=b(i),d=c[0],u=c[1],f=m(function(n){n.persist();var o=n.target.value,t=o.slice(-1);if(!(new RegExp("[^0-9"+e+r+"]").test(t)||o.length>11)){var i=_(o,r),a=_(l),c=i.length<a.length?a.slice(0,i.length):new RegExp("["+e+r+"]").test(t)?a:a+i.slice(-1);s(c),u(j(z(c,r),e))}},[l,s,d,u]),g=m(function(n){n.persist();var o=n.target.value.length;n.target.setSelectionRange(o,o)},[]);return h(function(){n.onUpdate&&n.onUpdate(l)},[l]),p(an,Object.assign({},n,{value:d,onChange:f,onFocus:g,onKeyUp:g,onKeyDown:g,onClick:g}))}function Un(n){var o=n.name,r=n.validate,e=function(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}(n,["name","validate"]);return p(y,{name:o,validate:r},function(n){var r=n.field,t=n.form,i=Boolean(k(t,["errors",o]));return p(Mn,Object.assign({},e,r,{hasError:i,onUpdate:function(n){t.setFieldValue(o,n)}}))})}function Yn(n){return p(f,null,p(V,{htmlFor:n.name},n.label),p(Un,Object.assign({},n)))}export{P as CheckboxGroup,R as Checkbox,S as CheckboxField,L as DateInput,W as DateInputField,K as DateInputFieldWithLabel,G as Item,J as Body,Z as Control,$ as Dropdown,nn as DropdownField,on as DropdownFieldWithLabel,rn as ErrorMessage,an as Input,ln as InputField,sn as InputFieldWithLabel,V as Label,gn as Radio,vn as RadioField,xn as RadioFieldWithLabel,kn as Select,On as SelectField,_n as SelectFieldWithLabel,zn as SubGroup,En as Textarea,Bn as TextareaField,Cn as TextareaFieldWithLabel,Tn as hidden,Hn as Toggle,Vn as ToggleField,Mn as SSNInput,Un as SSNInputField,Yn as SSNInputFieldWithLabel}; | ||
import{space as n,color as o,typography as r}from"styled-system";import{useSelect as e}from"use-drop";import t,{css as i}from"styled-components";import{Span as a,H5 as l,Icon as s,Box as c,P as d}from"@truework/ui";import{createElement as p,useRef as u,useState as b,useEffect as h,useCallback as m,Fragment as f,forwardRef as g,Children as v,cloneElement as x}from"react";import{Field as y,ErrorMessage as w}from"formik";import{get as k,times as O}from"lodash";import{clean as _,mask as z,format as j}from"parse-ssn";function D(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}var E=Object.freeze([""]),B=t(s)(E),C=t.div(function(n){var o=n.theme;return"\n position: relative;\n width: 16px;\n height: 16px;\n border-radius: 2px;\n margin-top: 2px;\n margin-right: 8px;\n border: 1px solid "+(n.checked?o.colors.primaryDark:o.colors.outline)+";\n transition-property: background, border-color;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.ease+";\n\n "+B+" {\n display: block;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n width: 12px;\n height: 12px;\n color: white;\n stroke: white;\n stroke-width: 2px;\n transition-property: transform;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.ease+";\n transform: scale(0);\n }\n "}),F=t(l)(function(n){var o=n.theme;return"\n width: calc(100% - 16px);\n transition-property: color;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.ease+";\n "}),T=t.input(function(n){var o=n.theme;return"\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n width: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n position: absolute;\n whitespace: nowrap;\n wordwrap: normal;\n\n &:focus ~ "+C+" {\n border-color: "+o.colors.primaryDark+";\n }\n &:checked ~ "+C+" {\n background: "+o.colors.primary+";\n border-color: "+o.colors.primaryDark+";\n\n "+B+" {\n transform: scale(1);\n }\n }\n &:focus ~ "+F+", &:focus ~"+a+", &:checked ~ "+a+" {\n color: "+o.colors.primary+";\n }\n\n "+(n.hasError?"\n & ~ "+C+" {\n border-color: "+o.colors.error+" !important;\n }\n ":"")+"\n "}),I=t.label(function(n){var o=n.theme;return"\n display: flex;\n align-items: flex-start;\n width: 100%;\n margin-bottom: 0 !important;\n\n "+(n.disabled?"\n "+C+" {\n background: "+o.colors.background+";\n }\n "+a+" {\n color: "+o.colors.placeholder+";\n }\n ":"\n &:hover "+C+" {\n border-color: "+o.colors.primaryDark+";\n }\n &:hover "+F+", &:hover "+a+" {\n color: "+o.colors.primary+";\n }\n ")+"\n "}),P=t.div(function(n){var o=n.theme;return"\n width: 100%;\n\n "+I+" {\n padding: "+o.space.sm+";\n border: 1px solid "+o.colors.outline+";\n border-top: none;\n display: flex;\n align-items: center;\n }\n\n "+I+":first-child {\n border-top: 1px solid "+o.colors.outline+";\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n }\n\n "+I+":last-child {\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n }\n "});function R(n){var o=n.children,r=n.name,e=n.checked,t=n.disabled,i=D(n,["children","name","checked","disabled"]);return p(I,{htmlFor:r,disabled:t},p(T,Object.assign({id:r,name:r,type:"checkbox",checked:e,disabled:t},i)),p(C,{checked:e},p(B,{name:"Check"})),p(a,{display:"block",width:"calc(100% - 16px)",fontSize:1,lineHeight:1,fontWeight:5,style:{transitionProperty:"color",transitionDuration:"150ms",transitionTimingFunction:"ease-in-out"}},o))}function S(n){var o=n.name,r=n.validate,e=n.onChange,t=n.onBlur,i=D(n,["name","validate","onChange","onBlur"]);return p(y,{name:o,validate:r},function(n){var r=n.field,a=Boolean(k(n.form,["errors",o]));return p(R,Object.assign({},i,r,{checked:Boolean(r.value),hasError:a,onChange:function(n){r.onChange(n),e&&e(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}function N(n){return n<10?"0"+n:""+n}var H=Object.freeze(["\n display: block;\n position: relative;\n font-weight: 500;\n letter-spacing: 0.6px;\n ","\n ","\n ","\n"]),V=t.label(H,r,o,n);V.displayName="Label",V.defaultProps={fontSize:1,lineHeight:1,mb:"xs"};var M=Object.freeze(["\n position: absolute;\n top: 0;\n bottom: 0;\n right: 12px;\n z-index: 1;\n height: 16px;\n width: 16px;\n margin: auto 0;\n border: 1px solid currentColor;\n border-radius: 16px;\n color: ",";\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: 0.5;\n transition: opacity ","\n ",";\n\n &:hover {\n opacity: 1;\n }\n "]),U=Object.freeze(["\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: ",";\n color: ",";\n font-size: ",";\n font-family: ",";\n line-height: ",";\n letter-spacing: 0.6px;\n margin: 0;\n min-height: 48px;\n padding: "," 8px "," 10px;\n text-align: center;\n max-width: 33.333333%;\n background: transparent;\n color: ",";\n cursor: pointer;\n z-index: 2;\n transition-property: border-color, color;\n transition-duration: 150ms;\n transition-timing-function: ease-in-out;\n\n &::-ms-expand {\n display: none;\n }\n &:disabled {\n background: transparent;\n color: ",";\n cursor: not-allowed;\n & ~ .__border {\n background: ",";\n cursor: not-allowed;\n }\n }\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n outline: 0;\n color: ",";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: ",";\n\n div {\n border-color: ",";\n color: ",";\n }\n }\n }\n "]),Y=t.select(function(n){var o=n.theme,r=n.hasError;return i(U,o.fonts.roboto,o.colors.body,o.fontSizes[1],o.fonts.mono,o.lineHeights[0],o.space.sm,o.space.sm,n.hasValue?o.colors.body:o.colors.secondary,function(n){return n.theme.colors.placeholder},o.colors.background,o.colors.body,r?o.colors.error:o.colors.primary,r?o.colors.error:o.colors.primary,r?o.colors.error:o.colors.primary)}),A=t.button(function(n){var o=n.theme;return i(M,o.colors.secondary,o.transitionDurations.fast,o.transitionTimingFunctions.ease)});function L(n){var o=n.name,r=n.label;void 0===r&&(r="Date");var e=n.disabled,t=n.initialMonth;void 0===t&&(t=0);var i=n.initialDay;void 0===i&&(i=0);var a=n.initialYear;void 0===a&&(a=0);var l=n.minMonth;void 0===l&&(l=1);var d=n.minDay;void 0===d&&(d=1);var f=n.minYear;void 0===f&&(f=1980);var g=n.maxMonth;void 0===g&&(g=12);var v=n.maxDay;void 0===v&&(v=31);var x=n.maxYear;void 0===x&&(x=2030);var y=n.hasError,w=n.onUpdate,k=u(null),_=u(null),z=u(null),j=b(t),D=j[0],E=j[1],B=b(i),C=B[0],F=B[1],T=b(a),I=T[0],P=T[1],R=function(n){return new Date(n.year,n.month,0).getUTCDate()}({year:I||2020,month:D});h(function(){I&&D&&C&&w(I+"-"+N(D)+"-"+N(C))},[D,C,I]);var S=m(function(){E(0),F(0),P(0)},[E,F,P]);return p(c,{ml:"-4px",mr:"-4px",p:"4px"},p(c,{display:"flex",alignItems:"center",height:"48px",pl:"56px"},p(Y,{ref:k,name:o+"-month",value:D,disabled:e,onChange:function(n){E(parseInt(n.target.value,10)),_.current&&_.current.focus()},"aria-label":r+": Month",hasValue:Boolean(D),hasError:y},p("option",{value:"0",disabled:!0},"mm"),O(g-l+1,function(){return""}).map(function(n,o){var r=l+o;return p("option",{key:r,value:r},N(r))})),p(c,{height:"50%",width:"1px",bg:y?"error":"outline",zIndex:2,transform:"rotate(10deg)"}),p(Y,{ref:_,name:o+"-day",value:C,disabled:e,onChange:function(n){F(parseInt(n.target.value,10)),z.current&&z.current.focus()},"aria-label":r+": Day",hasValue:Boolean(C),hasError:y},p("option",{value:"0",disabled:!0},"dd"),O(Math.min(v,R)-d+1,function(){return""}).map(function(n,o){var r=d+o;return p("option",{key:r,value:r},N(r))})),p(c,{height:"50%",width:"1px",bg:y?"error":"outline",zIndex:2,transform:"rotate(10deg)"}),p(Y,{ref:z,name:o+"-year",value:I,disabled:e,onChange:function(n){P(parseInt(n.target.value,10))},"aria-label":r+": Year",hasValue:Boolean(I),hasError:y},p("option",{value:"0",disabled:!0},"yyyy"),O(x-f+1,function(n){return f+n}).map(function(n){return p("option",{key:n,value:n},n)})),(D||C||I)&&p(A,{title:"Clear",onClick:S},p(s,{name:"X",width:"12px",height:"12px"})),p(c,{className:"__bg",bg:y?"error-alpha01":"primary-alpha01",position:"absolute",top:"-4px",bottom:"-4px",left:"-4px",right:"-4px",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),p(c,{className:"__border",bg:"white",border:["1px solid",y?"error":"outline"],position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"},p(c,{"aria-hidden":"true",position:"absolute",top:"0",left:"0",display:"flex",alignItems:"center",justifyContent:"center",px:"sm",height:"100%",zIndex:0,color:y?"error":"secondary",bg:y?"#FDEBF0":"background",borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px",borderRight:["1px solid",y?"error":"outline"],transitionProperty:"border-color, color",transitionDuration:"fast",transitionTimingFunction:"ease"},p(s,{name:"Calendar"})))))}function W(n){var o=n.name,r=n.validate,e=function(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}(n,["name","validate"]);return p(y,{name:o,validate:r},function(n){var r=n.field,t=n.form,i=Boolean(k(t,["errors",o])),a=(r.value||"").split("-"),l=a[0];void 0===l&&(l="");var s=a[1];void 0===s&&(s="");var c=a[2];return void 0===c&&(c=""),p(L,Object.assign({name:o},e,{initialMonth:s?parseInt(s,10):void 0,initialDay:c?parseInt(c,10):void 0,initialYear:l?parseInt(l,10):void 0,hasError:i,onUpdate:function(n){t.setFieldValue(o,n)}}))})}function K(n){return p(f,null,p(V,{htmlFor:n.name},n.label),p(W,Object.assign({},n)))}function X(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}var q=t(c)(function(n){var o=n.theme,r=n.selected,e=n.highlighted;return"\n display: flex;\n align-items: center;\n padding: "+o.space.sm+";\n color: "+(r||e?o.colors.body:o.colors.secondary)+";\n background-color: "+(r||e?o.colors.background:"white")+";\n cursor: pointer;\n font-size: "+o.fontSizes[1]+";\n font-weight: 400;\n line-height: "+o.lineHeights[1]+";\n letter-spacing: 0.6px;\n\n &:hover {\n background: "+o.colors.background+";\n }\n"});function G(n){var o=n.children,r=X(n,["children"]);return p(q,Object.assign({as:"li"},r),o)}var J=g(function(n,o){var r=n.children,e=X(n,["children"]);return p(c,Object.assign({ref:o,as:"ul",boxShadow:"medium",borderRadius:2,overflow:"auto",width:"100%",bg:"white"},e),r)});J.displayName="Body";var Q=t.button(function(n){var o=n.theme,r=n.hasError;return"\n display: block;\n position: relative;\n width: 100%;\n z-index: 1;\n height: 48px;\n padding: 0 16px;\n text-align: left;\n font-size: "+o.fontSizes[1]+";\n font-weight: 400;\n line-height: "+o.lineHeights[1]+";\n color: "+o.colors.secondary+";\n transition-property: color;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.ease+";\n\n "+(n.disabled?"\n background: transparent;\n color: "+o.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+o.colors.background+";\n cursor: not-allowed;\n }\n ":"\n &:active,\n &:focus,\n &:hover {\n outline: 0;\n color: "+o.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(r?o.colors.error:o.colors.primary)+";\n\n div {\n border-color: "+(r?o.colors.error:o.colors.primary)+";\n color: "+(r?o.colors.error:o.colors.primary)+";\n }\n }\n }\n ")+"\n\n "+(n.isActive?"\n outline: 0;\n color: "+o.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(r?o.colors.error:o.colors.primary)+";\n\n div {\n border-color: "+(r?o.colors.error:o.colors.primary)+";\n color: "+(r?o.colors.error:o.colors.primary)+";\n }\n }\n ":"")+"\n"});Q.displayName="ControlOuter";var Z=g(function(n,o){var r=n.children,e=n.isActive,t=n.hasError,i=X(n,["children","isActive","hasError"]);return p("div",{style:{position:"relative"}},p(Q,Object.assign({ref:o,isActive:e,hasError:t,type:"button"},i),p(a,{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},p(a,{width:"100%",fontWeight:4,style:{whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",letterSpacing:"0.6px"}},r),p(s,{name:"ChevronDown",ml:"xs"}))),p(c,{className:"__bg",bg:t?"error-alpha01":"primary-alpha01",position:"absolute",top:"-2px",bottom:"-2px",left:"-2px",right:"-2px",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),p(c,{className:"__border",bg:"white",border:["1px solid",t?"error":"outline"],position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"}))});function $(n){var o=n.value,r=n.placeholder,t=n.label,i=n.items,a=n.hasError,l=n.disabled,s=n.onSelect,d=n.onRemove,u=b(k(i.filter(function(n){return n.value===o})[0],"label")||r||"Please select"),h=u[0],m=u[1],f=e({items:i.map(function(n){return Object.assign({},n,{selected:n.value===o})}),onSelect:function(n){m(n.label),s&&s(n)},onRemove:function(n){m("Please select"),d&&d(n)}}),g=f.items,v=f.isOpen,x=f.getDropProps;return p(c,null,p(Z,Object.assign({id:f.id},l?{}:(0,f.getControlProps)(),{"aria-label":t,isActive:v,hasError:a,disabled:l}),h),v&&p(c,{position:"absolute",bottom:"0",width:"100%",transform:"translateY(100%) translateY(6px)",zIndex:1e3},p(J,Object.assign({},x(),{style:{maxHeight:"240px",overflow:"auto"}}),g.map(function(n){return p(G,Object.assign({key:n.value,selected:n.selected,highlighted:n.highlighted},n.getItemProps()),n.label)}))))}function nn(n){var o=n.name,r=n.validate,e=X(n,["name","validate"]);return p(y,{name:o,validate:r},function(n){var o=n.field,r=n.form,t=Boolean(r.errors&&r.errors[o.name]);return p($,Object.assign({},e,{hasError:t,onSelect:function(n){r.setFieldValue(o.name,n.value),e.onSelect&&e.onSelect(n)}}))})}function on(n){return p(f,null,p(V,{htmlFor:n.name},n.label),p(nn,Object.assign({},n)))}function rn(n){return p(w,{name:n.name,render:function(n){return p(a,{color:"error",fontSize:0},n)}})}function en(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}Z.displayName="Control";var tn=t.input(function(n){var o=n.theme,r=n.small,e=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+o.fonts.roboto+";\n color: "+o.colors.body+";\n font-size: "+(r?o.fontSizes[0]:o.fontSizes[1])+";\n line-height: "+o.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 0;\n min-height: "+(r?"36px":"48px")+";\n padding: "+(r?"10px 16px":o.space.sm)+";\n background: transparent;\n color: "+(n.hasValue?o.colors.body:o.colors.secondary)+";\n cursor: pointer;\n z-index: 2;\n transition-property: border-color, color;\n transition-duration: 150ms;\n transition-timing-function: ease-in-out;\n\n &::placeholder {\n color: "+o.colors.secondary+";\n line-height: "+o.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+o.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+o.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+o.colors.background+";\n cursor: not-allowed;\n }\n }\n &:invalid,\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n box-shadow: none;\n outline: 0;\n color: "+o.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(e?o.colors.error:o.colors.primary)+";\n }\n & ~ .__tab {\n border-color: "+(e?o.colors.error:o.colors.primary)+";\n color: "+(e?o.colors.error:o.colors.primary)+";\n }\n }\n "+(r?"\n & ~ .__tab {\n padding: 10px;\n }\n ":"")+"\n\n & ~ .__tab svg {\n max-width: "+(r?"14px":"16px")+";\n max-height: "+(r?"14px":"16px")+";\n }\n"});tn.displayName="InputElement";var an=g(function(n,o){var r=n.hasError,e=n.preTab,t=n.postTab,i=en(n,["hasError","preTab","postTab"]),a=Boolean(e),l=e||t;return p(c,{display:"flex",ml:"-2px",mr:"-2px",p:"2px"},p(tn,Object.assign({ref:o,hasError:r},i)),l&&p(c,{className:"__tab","aria-hidden":"true",display:"flex",alignItems:"center",justifyContent:"center",px:"sm",zIndex:1,color:r?"error":"secondary",bg:r?"#FDEBF0":"background",borderTopLeftRadius:a?"4px":"0",borderBottomLeftRadius:a?"4px":"0",borderTopRightRadius:a?"0":"4px",borderBottomRightRadius:a?"0":"4px",border:["1px solid",r?"error":"outline"],order:a?-1:1,transitionProperty:"border-color, color",transitionDuration:"fast",transitionTimingFunction:"ease"},l),p(c,{className:"__bg",bg:r?"error-alpha01":"primary-alpha01",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),p(c,{className:"__border",bg:"white",border:["1px solid",r?"error":"outline"],position:"absolute",top:"2px",bottom:"2px",left:"2px",right:"2px",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"}))});function ln(n){var o=n.name,r=n.validate,e=n.onChange,t=n.onBlur,i=en(n,["name","validate","onChange","onBlur"]);return p(y,{name:o,validate:r},function(n){var r=n.field,a=Boolean(k(n.form,["errors",o]));return p(an,Object.assign({},i,r,{hasError:a,onChange:function(n){r.onChange(n),e&&e(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}function sn(n){return p(f,null,p(V,{htmlFor:n.name},n.label),p(ln,Object.assign({},n)))}function cn(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}var dn=Object.freeze(["\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n cursor: pointer;\n z-index: 0;\n"]),pn=t.span(function(n){var o=n.theme;return"\n display: block;\n font-size: "+o.fontSizes[1]+";\n font-weight: "+o.fontWeights[5]+";\n line-height: "+o.lineHeights[0]+";\n margin-bottom: "+o.space.xxs+";\n transition-property: color;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.ease+";\n "}),un=t.div(function(n){var o=n.theme;return"\n width: 100%;\n border: 1px solid "+o.colors.outline+";\n border-radius: 4px;\n\n "+fn+" {\n padding: "+o.space.sm+";\n border-top: 1px solid "+o.colors.outline+";\n\n &:first-of-type {\n border-top: 0;\n }\n }\n\n "+(n.hasError?"\n border-color: "+o.colors.error+" !important;\n\n & "+fn+" {\n border-color: "+o.colors.error+" !important;\n }\n ":"")+"\n "}),bn=t.div(function(n){var o=n.theme;return"\n position: relative;\n width: 16px;\n height: 16px;\n border-radius: 100%;\n margin-top: 2px;\n margin-right: 16px;\n border: 1px solid "+(n.checked?o.colors.primaryDark:o.colors.outline)+";\n z-index: 1;\n transition-property: background, border-color;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.ease+";\n\n &::after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n width: 8px;\n height: 8px;\n border-radius: 100%;\n background: white;\n transition-property: transform;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.ease+";\n transform: scale(0);\n }\n "}),hn=t.input(function(n){var o=n.theme;return"\n position: relative;\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n width: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n position: absolute;\n whitespace: nowrap;\n wordwrap: normal;\n z-index: 1;\n\n &:focus ~ "+bn+" {\n border-color: "+o.colors.primaryDark+";\n }\n &:focus ~ "+c+" "+pn+" {\n color: "+o.colors.primary+";\n }\n\n &:checked ~ "+bn+" {\n background: "+o.colors.primary+";\n border-color: "+o.colors.primaryDark+";\n\n &::after {\n transform: scale(1);\n }\n }\n &:checked ~ "+c+" "+pn+" {\n color: "+o.colors.primary+";\n }\n\n &:disabled ~ "+bn+" {\n border-color: "+o.colors.outline+" !important;\n }\n &:disabled ~ "+mn+" {\n background-color: "+o.colors.background+";\n }\n &:disabled ~ "+c+" "+pn+" {\n color: "+o.colors.secondary+" !important;\n }\n "}),mn=t.span(dn),fn=t.label(function(n){var o=n.theme;return"\n display: flex;\n align-items: center;\n position: relative;\n width: 100%;\n margin-bottom: 0 !important;\n cursor: pointer;\n overflow: hidden;\n\n &:hover "+bn+" {\n border-color: "+o.colors.primaryDark+";\n }\n &:hover "+pn+" {\n color: "+o.colors.primary+";\n }\n "});function gn(n){var o=n.name,r=n.checked,e=n.description,t=n.label,i=cn(n,["children","name","checked","description","label"]),a=o+i.value;return p(fn,{htmlFor:a},p(hn,Object.assign({id:a,name:o,type:"radio",checked:r},i)),p(bn,{checked:r}),p(c,{display:"block",position:"relative",zIndex:1,width:"calc(100% - 32px)",maxWidth:"calc(100% - 32px)"},t&&p(pn,null,t),e&&p(d,{color:"secondary",fontSize:0,fontWeight:4,lineHeight:0},e)),p(mn,null))}function vn(n){var o=n.children,r=n.name,e=n.validate,t=n.onChange,i=n.onBlur,a=cn(n,["children","name","validate","onChange","onBlur"]);return p(y,{name:r,validate:e},function(n){var e=n.field,l=Boolean(k(n.form,["errors",r]));return p(un,{hasError:l},v.toArray(o).map(function(n){return x(n,Object.assign({},e,a,{value:n.props.value,hasError:l,checked:Boolean(e.value===n.props.value),onChange:function(n){e.onChange(n),t&&t(n)},onBlur:function(n){e.onBlur(n),i&&i(n)}}))}))})}function xn(n){var o=n.label,r=cn(n,["label"]);return p(f,null,p(V,{htmlFor:r.name},o),p(vn,Object.assign({},r)))}function yn(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}var wn=t.select(function(n){var o=n.theme,r=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+o.fonts.roboto+";\n color: "+o.colors.body+";\n font-size: "+o.fontSizes[1]+";\n line-height: "+o.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 0;\n min-height: 48px;\n padding: "+o.space.sm+";\n background: transparent;\n color: "+(n.hasValue?o.colors.body:o.colors.secondary)+";\n cursor: pointer;\n z-index: 2;\n transition-property: border-color, color;\n transition-duration: 150ms;\n transition-timing-function: ease-in-out;\n\n &::placeholder {\n color: "+o.colors.secondary+";\n line-height: "+o.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+o.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+o.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+o.colors.background+";\n cursor: not-allowed;\n }\n }\n &:invalid,\n &:-moz-ui-invalid,\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n box-shadow: none;\n outline: 0;\n color: "+o.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(r?o.colors.error:o.colors.primary)+";\n\n div {\n border-color: "+(r?o.colors.error:o.colors.primary)+";\n color: "+(r?o.colors.error:o.colors.primary)+";\n }\n }\n }\n\n "+(n.small&&"\n height: 36px;\n min-height: 36px;\n padding: 0px 32px 0 16px;\n margin-right: 16px;\n font-size: "+o.fontSizes[0]+";\n line-height: "+o.lineHeights[0]+";\n ")+"\n"});wn.displayName="SelectElement";var kn=g(function(n,o){var r=n.children,e=n.hasError,t=n.placeholder;void 0===t&&(t="");var i=yn(n,["children","hasError","placeholder"]);return p(c,{ml:"-2px",mr:"-2px",p:"2px"},p(wn,Object.assign({ref:o,hasValue:Boolean(i.value),hasError:e},i,{value:i.value||""}),t&&p("option",{value:"",disabled:!0},t),r),p(c,{className:"__bg",bg:e?"error-alpha01":"primary-alpha01",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),p(c,{className:"__border",bg:"white",border:["1px solid",e?"error":"outline"],position:"absolute",top:"2px",bottom:"2px",left:"2px",right:"2px",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"}),p(c,{position:"absolute",right:"0",top:"0",bottom:"0",height:"16px",my:"auto",pr:"sm",style:{pointerEvents:"none"}},p(s,{name:"ChevronDown",color:"secondary"})))});function On(n){var o=n.name,r=n.validate,e=n.onChange,t=n.onBlur,i=yn(n,["name","validate","onChange","onBlur"]);return p(y,{name:o,validate:r},function(n){var r=n.field,a=Boolean(k(n.form,["errors",o]));return p(kn,Object.assign({},i,r,{hasError:a,onChange:function(n){r.onChange(n),e&&e(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}function _n(n){return p(f,null,p(V,{htmlFor:n.name},n.label),p(On,Object.assign({},n)))}var zn=t(c)(function(n){return"\n border-left: 2px solid currentColor;\n padding-left: "+n.theme.space.sm+";\n "});function jn(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}var Dn=t.textarea(function(n){var o=n.theme,r=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+o.fonts.roboto+";\n color: "+o.colors.body+";\n font-size: "+o.fontSizes[1]+";\n line-height: "+o.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 0;\n min-height: 48px;\n padding: "+o.space.sm+";\n background: transparent;\n color: "+(n.hasValue?o.colors.body:o.colors.secondary)+";\n cursor: pointer;\n z-index: 2;\n transition-property: border-color, color;\n transition-duration: 150ms;\n transition-timing-function: ease-in-out;\n\n &::placeholder {\n color: "+o.colors.secondary+";\n line-height: "+o.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+o.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+o.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+o.colors.background+";\n cursor: not-allowed;\n }\n }\n &:invalid,\n &:-moz-ui-invalid,\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n box-shadow: none;\n outline: 0;\n color: "+o.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(r?o.colors.error:o.colors.primary)+";\n\n div {\n border-color: "+(r?o.colors.error:o.colors.primary)+";\n color: "+(r?o.colors.error:o.colors.primary)+";\n }\n }\n }\n"});Dn.displayName="TextareaElement",Dn.defaultProps={rows:4};var En=g(function(n,o){var r=n.hasError,e=jn(n,["hasError"]);return p(c,{ml:"-2px",mr:"-2px",p:"2px"},p(Dn,Object.assign({ref:o,hasError:r},e)),p(c,{className:"__bg",bg:r?"error-alpha01":"primary-alpha01",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),p(c,{className:"__border",bg:"white",border:["1px solid",r?"error":"outline"],position:"absolute",top:"2px",bottom:"2px",left:"2px",right:"2px",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"}))});function Bn(n){var o=n.name,r=n.validate,e=n.onChange,t=n.onBlur,i=jn(n,["name","validate","onChange","onBlur"]);return p(y,{name:o,validate:r},function(n){var r=n.field,a=Boolean(k(n.form,["errors",o]));return p(En,Object.assign({},i,r,{hasError:a,onChange:function(n){r.onChange(n),e&&e(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}function Cn(n){return p(f,null,p(V,{htmlFor:n.name},n.label),p(Bn,Object.assign({},n)))}var Fn=Object.freeze(["\n ","\n"]),Tn="\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n width: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n position: absolute;\n whitespace: nowrap;\n wordwrap: normal;\n",In=t.div(function(n){var o=n.theme;return"\n display: block;\n position: absolute;\n top: 3px;\n bottom: 0;\n left: 3px;\n width: 24px;\n height: 24px;\n border-radius: 100px;\n border: 1px solid "+o.colors.outline+";\n color: white;\n background: white;\n stroke: white;\n transition-property: transform, background, border-color;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.natural+";\n"}),Pn=t.div(function(n){var o=n.theme;return"\n position: relative;\n width: 56px;\n height: 32px;\n border-radius: 100px;\n border: 1px solid "+o.colors.outline+";\n background: "+o.colors.background+";\n cursor: pointer;\n transition-property: background, border-color;\n transition-duration: "+o.transitionDurations.fast+";\n transition-timing-function: "+o.transitionTimingFunctions.natural+";\n "}),Rn=t.label(function(n){return"\n display: flex;\n align-items: center;\n margin-bottom: 0 !important;\n\n &:hover "+Pn+" {\n "+In+" {\n border-color: "+n.theme.colors.primaryDark+";\n }\n }\n "}),Sn=t.input(function(n){var o=n.theme;return"\n "+Tn+"\n\n &:focus ~ "+Pn+" {\n border-color: "+o.colors.primary+";\n }\n &:checked ~ "+Pn+" {\n border-color: "+o.colors.primary+";\n\n "+In+" {\n background: "+o.colors.primary+";\n border-color: "+o.colors.primaryDark+";\n transform: translateX(24px);\n }\n }\n &:disabled ~ "+Pn+" {\n pointer-events: none;\n "+In+" {\n border-color: "+o.colors.outline+";\n }\n }\n "}),Nn=t.span(Fn,Tn);function Hn(n){var o=n.label,r=n.name,e=n.checked,t=function(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}(n,["label","name","checked"]);return p(Rn,{htmlFor:r},p(Sn,Object.assign({id:r,name:r,type:"checkbox",checked:e},t)),p(Pn,null,p(In,null,p(s,{name:"Check",width:"12px",height:"12px",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",m:"auto",style:{strokeWidth:"2px"}}))),p(Nn,null,o))}function Vn(n){var o=n.label;return p(y,{name:n.name,validate:n.validate},function(n){var r=n.field;return p(Hn,Object.assign({label:o},r,{checked:Boolean(r.value)}))})}function Mn(n){var o=n.value;void 0===o&&(o="");var r=n.masker;void 0===r&&(r="*");var e=n.separator;void 0===e&&(e="-");var t=new RegExp("[^0-9"+e+"]").test(o)?"":_(o,r),i=j(z(t,r),e),a=b(t),l=a[0],s=a[1],c=b(i),d=c[0],u=c[1],f=m(function(n){n.persist();var o=n.target.value,t=o.slice(-1);if(!(new RegExp("[^0-9"+e+r+"]").test(t)||o.length>11)){var i=_(o,r),a=_(l),c=i.length<a.length?a.slice(0,i.length):new RegExp("["+e+r+"]").test(t)?a:a+i.slice(-1);s(c),u(j(z(c,r),e))}},[l,s,d,u]),g=m(function(n){n.persist();var o=n.target.value.length;n.target.setSelectionRange(o,o)},[]);return h(function(){n.onUpdate&&n.onUpdate(l)},[l]),p(an,Object.assign({},n,{value:d,onChange:f,onFocus:g,onKeyUp:g,onKeyDown:g,onClick:g}))}function Un(n){var o=n.name,r=n.validate,e=function(n,o){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===o.indexOf(e)&&(r[e]=n[e]);return r}(n,["name","validate"]);return p(y,{name:o,validate:r},function(n){var r=n.field,t=n.form,i=Boolean(k(t,["errors",o]));return p(Mn,Object.assign({},e,r,{hasError:i,onUpdate:function(n){t.setFieldValue(o,n)}}))})}function Yn(n){return p(f,null,p(V,{htmlFor:n.name},n.label),p(Un,Object.assign({},n)))}export{P as CheckboxGroup,R as Checkbox,S as CheckboxField,L as DateInput,W as DateInputField,K as DateInputFieldWithLabel,G as Item,J as Body,Z as Control,$ as Dropdown,nn as DropdownField,on as DropdownFieldWithLabel,rn as ErrorMessage,an as Input,ln as InputField,sn as InputFieldWithLabel,V as Label,gn as Radio,vn as RadioField,xn as RadioFieldWithLabel,kn as Select,On as SelectField,_n as SelectFieldWithLabel,zn as SubGroup,En as Textarea,Bn as TextareaField,Cn as TextareaFieldWithLabel,Tn as hidden,Hn as Toggle,Vn as ToggleField,Mn as SSNInput,Un as SSNInputField,Yn as SSNInputFieldWithLabel}; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
var n,e=require("styled-system"),r=require("use-drop"),o=require("styled-components"),t=(n=o)&&"object"==typeof n&&"default"in n?n.default:n,a=require("@truework/ui"),i=require("react"),l=require("formik"),s=require("lodash"),c=require("parse-ssn");function d(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}var p=Object.freeze([""]),u=t(a.Icon)(p),m=t.div(function(n){var e=n.theme;return"\n position: relative;\n width: 16px;\n height: 16px;\n border-radius: 2px;\n margin-top: 2px;\n margin-right: 8px;\n border: 1px solid "+(n.checked?e.colors.primaryDark:e.colors.outline)+";\n transition-property: background, border-color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n\n "+u+" {\n display: block;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n width: 12px;\n height: 12px;\n color: white;\n stroke: white;\n stroke-width: 2px;\n transition-property: transform;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n transform: scale(0);\n }\n "}),b=t(a.H5)(function(n){var e=n.theme;return"\n width: calc(100% - 16px);\n transition-property: color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n "}),h=t.input(function(n){var e=n.theme;return"\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n width: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n position: absolute;\n whitespace: nowrap;\n wordwrap: normal;\n\n &:focus ~ "+m+" {\n border-color: "+e.colors.primaryDark+";\n }\n &:checked ~ "+m+" {\n background: "+e.colors.primary+";\n border-color: "+e.colors.primaryDark+";\n\n "+u+" {\n transform: scale(1);\n }\n }\n &:focus ~ "+b+", &:focus ~"+a.Span+", &:checked ~ "+a.Span+" {\n color: "+e.colors.primary+";\n }\n\n "+(n.hasError?"\n & ~ "+m+" {\n border-color: "+e.colors.error+" !important;\n }\n ":"")+"\n "}),f=t.label(function(n){var e=n.theme;return"\n display: flex;\n align-items: flex-start;\n width: 100%;\n margin-bottom: 0 !important;\n\n "+(n.disabled?"\n "+m+" {\n background: "+e.colors.background+";\n }\n "+a.Span+" {\n color: "+e.colors.placeholder+";\n }\n ":"\n &:hover "+m+" {\n border-color: "+e.colors.primaryDark+";\n }\n &:hover "+b+", &:hover "+a.Span+" {\n color: "+e.colors.primary+";\n }\n ")+"\n "}),g=t.div(function(n){var e=n.theme;return"\n width: 100%;\n\n "+f+" {\n padding: "+e.space.sm+";\n border: 1px solid "+e.colors.outline+";\n border-top: none;\n display: flex;\n align-items: center;\n }\n\n "+f+":first-child {\n border-top: 1px solid "+e.colors.outline+";\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n }\n\n "+f+":last-child {\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n }\n "});function x(n){var e=n.children,r=n.name,o=n.checked,t=n.disabled,l=d(n,["children","name","checked","disabled"]);return i.createElement(f,{htmlFor:r,disabled:t},i.createElement(h,Object.assign({id:r,name:r,type:"checkbox",checked:o,disabled:t},l)),i.createElement(m,{checked:o},i.createElement(u,{name:"Check"})),i.createElement(a.Span,{display:"block",width:"calc(100% - 16px)",fontSize:1,lineHeight:1,fontWeight:5,style:{transitionProperty:"color",transitionDuration:"150ms",transitionTimingFunction:"ease-in-out"}},e))}function v(n){return n<10?"0"+n:""+n}var y=Object.freeze(["\n display: block;\n position: relative;\n font-weight: 500;\n letter-spacing: 0.6px;\n ","\n ","\n ","\n"]),E=t.label(y,e.typography,e.color,e.space);E.displayName="Label",E.defaultProps={fontSize:1,lineHeight:1,mb:"xs"};var w=Object.freeze(["\n position: absolute;\n top: 0;\n bottom: 0;\n right: 12px;\n z-index: 1;\n height: 16px;\n width: 16px;\n margin: auto 0;\n border: 1px solid currentColor;\n border-radius: 16px;\n color: ",";\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: 0.5;\n transition: opacity ","\n ",";\n\n &:hover {\n opacity: 1;\n }\n "]),k=Object.freeze(["\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: ",";\n color: ",";\n font-size: ",";\n font-family: ",";\n line-height: ",";\n letter-spacing: 0.6px;\n margin: 0;\n min-height: 48px;\n padding: "," 8px "," 10px;\n text-align: center;\n max-width: 33.333333%;\n background: transparent;\n color: ",";\n cursor: pointer;\n z-index: 2;\n transition-property: border-color, color;\n transition-duration: 150ms;\n transition-timing-function: ease-in-out;\n\n &::-ms-expand {\n display: none;\n }\n &:disabled {\n background: transparent;\n color: ",";\n cursor: not-allowed;\n & ~ .__border {\n background: ",";\n cursor: not-allowed;\n }\n }\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n outline: 0;\n color: ",";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: ",";\n\n div {\n border-color: ",";\n color: ",";\n }\n }\n }\n "]),F=t.select(function(n){var e=n.theme,r=n.hasError;return o.css(k,e.fonts.roboto,e.colors.body,e.fontSizes[1],e.fonts.mono,e.lineHeights[0],e.space.sm,e.space.sm,n.hasValue?e.colors.body:e.colors.secondary,function(n){return n.theme.colors.placeholder},e.colors.background,e.colors.body,r?e.colors.error:e.colors.primary,r?e.colors.error:e.colors.primary,r?e.colors.error:e.colors.primary)}),B=t.button(function(n){var e=n.theme;return o.css(w,e.colors.secondary,e.transitionDurations.fast,e.transitionTimingFunctions.ease)});function O(n){var e=n.name,r=n.label;void 0===r&&(r="Date");var o=n.disabled,t=n.initialMonth;void 0===t&&(t=0);var l=n.initialDay;void 0===l&&(l=0);var c=n.initialYear;void 0===c&&(c=0);var d=n.minMonth;void 0===d&&(d=1);var p=n.minDay;void 0===p&&(p=1);var u=n.minYear;void 0===u&&(u=1980);var m=n.maxMonth;void 0===m&&(m=12);var b=n.maxDay;void 0===b&&(b=31);var h=n.maxYear;void 0===h&&(h=2030);var f=n.hasError,g=n.onUpdate,x=i.useRef(null),y=i.useRef(null),E=i.useRef(null),w=i.useState(t),k=w[0],O=w[1],_=i.useState(l),D=_[0],z=_[1],j=i.useState(c),C=j[0],S=j[1],I=function(n){return new Date(n.year,n.month,0).getUTCDate()}({year:C||2020,month:k});i.useEffect(function(){C&&k&&D&&g(C+"-"+v(k)+"-"+v(D))},[k,D,C]);var R=i.useCallback(function(){O(0),z(0),S(0)},[O,z,S]);return i.createElement(a.Box,{ml:"-4px",mr:"-4px",p:"4px"},i.createElement(a.Box,{display:"flex",alignItems:"center",height:"48px",pl:"56px"},i.createElement(F,{ref:x,name:e+"-month",value:k,disabled:o,onChange:function(n){O(parseInt(n.target.value,10)),y.current&&y.current.focus()},"aria-label":r+": Month",hasValue:Boolean(k),hasError:f},i.createElement("option",{value:"0",disabled:!0},"mm"),s.times(m-d+1,function(){return""}).map(function(n,e){var r=d+e;return i.createElement("option",{key:r,value:r},v(r))})),i.createElement(a.Box,{height:"50%",width:"1px",bg:f?"error":"outline",zIndex:2,transform:"rotate(10deg)"}),i.createElement(F,{ref:y,name:e+"-day",value:D,disabled:o,onChange:function(n){z(parseInt(n.target.value,10)),E.current&&E.current.focus()},"aria-label":r+": Day",hasValue:Boolean(D),hasError:f},i.createElement("option",{value:"0",disabled:!0},"dd"),s.times(Math.min(b,I)-p+1,function(){return""}).map(function(n,e){var r=p+e;return i.createElement("option",{key:r,value:r},v(r))})),i.createElement(a.Box,{height:"50%",width:"1px",bg:f?"error":"outline",zIndex:2,transform:"rotate(10deg)"}),i.createElement(F,{ref:E,name:e+"-year",value:C,disabled:o,onChange:function(n){S(parseInt(n.target.value,10))},"aria-label":r+": Year",hasValue:Boolean(C),hasError:f},i.createElement("option",{value:"0",disabled:!0},"yyyy"),s.times(h-u+1,function(n){return u+n}).map(function(n){return i.createElement("option",{key:n,value:n},n)})),(k||D||C)&&i.createElement(B,{title:"Clear",onClick:R},i.createElement(a.Icon,{name:"X",width:"12px",height:"12px"})),i.createElement(a.Box,{className:"__bg",bg:f?"error-alpha01":"primary-alpha01",position:"absolute",top:"-4px",bottom:"-4px",left:"-4px",right:"-4px",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),i.createElement(a.Box,{className:"__border",bg:"white",border:["1px solid",f?"error":"outline"],position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"},i.createElement(a.Box,{"aria-hidden":"true",position:"absolute",top:"0",left:"0",display:"flex",alignItems:"center",justifyContent:"center",px:"sm",height:"100%",zIndex:0,color:f?"error":"secondary",bg:f?"#FDEBF0":"background",borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px",borderRight:["1px solid",f?"error":"outline"],transitionProperty:"border-color, color",transitionDuration:"fast",transitionTimingFunction:"ease"},i.createElement(a.Icon,{name:"Calendar"})))))}function _(n){var e=n.name,r=n.validate,o=function(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}(n,["name","validate"]);return i.createElement(l.Field,{name:e,validate:r},function(n){var r=n.field,t=n.form,a=Boolean(s.get(t,["errors",e])),l=(r.value||"").split("-"),c=l[0];void 0===c&&(c="");var d=l[1];void 0===d&&(d="");var p=l[2];return void 0===p&&(p=""),i.createElement(O,Object.assign({name:e},o,{initialMonth:d?parseInt(d,10):void 0,initialDay:p?parseInt(p,10):void 0,initialYear:c?parseInt(c,10):void 0,hasError:a,onUpdate:function(n){t.setFieldValue(e,n)}}))})}function D(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}var z=t(a.Box)(function(n){var e=n.theme,r=n.selected,o=n.highlighted;return"\n display: flex;\n align-items: center;\n padding: "+e.space.sm+";\n color: "+(r||o?e.colors.body:e.colors.secondary)+";\n background-color: "+(r||o?e.colors.background:"white")+";\n cursor: pointer;\n font-size: "+e.fontSizes[1]+";\n font-weight: 400;\n line-height: "+e.lineHeights[1]+";\n letter-spacing: 0.6px;\n\n &:hover {\n background: "+e.colors.background+";\n }\n"});function j(n){var e=n.children,r=D(n,["children"]);return i.createElement(z,Object.assign({as:"li"},r),e)}var C=i.forwardRef(function(n,e){var r=n.children,o=D(n,["children"]);return i.createElement(a.Box,Object.assign({ref:e,as:"ul",boxShadow:"medium",borderRadius:2,overflow:"auto",width:"100%",bg:"white"},o),r)});C.displayName="Body";var S=t.button(function(n){var e=n.theme,r=n.hasError;return"\n display: block;\n position: relative;\n width: 100%;\n z-index: 1;\n height: 48px;\n padding: 0 16px;\n text-align: left;\n font-size: "+e.fontSizes[1]+";\n font-weight: 400;\n line-height: "+e.lineHeights[1]+";\n color: "+e.colors.secondary+";\n transition-property: color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n\n "+(n.disabled?"\n background: transparent;\n color: "+e.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+e.colors.background+";\n cursor: not-allowed;\n }\n ":"\n &:active,\n &:focus,\n &:hover {\n outline: 0;\n color: "+e.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(r?e.colors.error:e.colors.primary)+";\n\n div {\n border-color: "+(r?e.colors.error:e.colors.primary)+";\n color: "+(r?e.colors.error:e.colors.primary)+";\n }\n }\n }\n ")+"\n\n "+(n.isActive?"\n outline: 0;\n color: "+e.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(r?e.colors.error:e.colors.primary)+";\n\n div {\n border-color: "+(r?e.colors.error:e.colors.primary)+";\n color: "+(r?e.colors.error:e.colors.primary)+";\n }\n }\n ":"")+"\n"});S.displayName="ControlOuter";var I=i.forwardRef(function(n,e){var r=n.children,o=n.isActive,t=n.hasError,l=D(n,["children","isActive","hasError"]);return i.createElement("div",{style:{position:"relative"}},i.createElement(S,Object.assign({ref:e,isActive:o,hasError:t,type:"button"},l),i.createElement(a.Span,{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},i.createElement(a.Span,{width:"100%",fontWeight:4,style:{whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",letterSpacing:"0.6px"}},r),i.createElement(a.Icon,{name:"ChevronDown",ml:"xs"}))),i.createElement(a.Box,{className:"__bg",bg:t?"error-alpha01":"primary-alpha01",position:"absolute",top:"-2px",bottom:"-2px",left:"-2px",right:"-2px",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),i.createElement(a.Box,{className:"__border",bg:"white",border:["1px solid",t?"error":"outline"],position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"}))});function R(n){var e=n.value,o=n.placeholder,t=n.label,l=n.items,c=n.hasError,d=n.disabled,p=n.onSelect,u=n.onRemove,m=i.useState(s.get(l.filter(function(n){return n.value===e})[0],"label")||o||"Please select"),b=m[0],h=m[1],f=r.useSelect({items:l.map(function(n){return Object.assign({},n,{selected:n.value===e})}),onSelect:function(n){h(n.label),p&&p(n)},onRemove:function(n){h("Please select"),u&&u(n)}}),g=f.items,x=f.isOpen,v=f.getDropProps;return i.createElement(a.Box,null,i.createElement(I,Object.assign({id:f.id},d?{}:(0,f.getControlProps)(),{"aria-label":t,isActive:x,hasError:c,disabled:d}),b),x&&i.createElement(a.Box,{position:"absolute",bottom:"0",width:"100%",transform:"translateY(100%) translateY(6px)",zIndex:1e3},i.createElement(C,Object.assign({},v(),{style:{maxHeight:"240px",overflow:"auto"}}),g.map(function(n){return i.createElement(j,Object.assign({key:n.value,selected:n.selected,highlighted:n.highlighted},n.getItemProps()),n.label)}))))}function T(n){var e=n.name,r=n.validate,o=D(n,["name","validate"]);return i.createElement(l.Field,{name:e,validate:r},function(n){var e=n.field,r=n.form,t=Boolean(r.errors&&r.errors[e.name]);return i.createElement(R,Object.assign({},o,{hasError:t,onSelect:function(n){r.setFieldValue(e.name,n.value),o.onSelect&&o.onSelect(n)}}))})}function P(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}I.displayName="Control";var N=t.input(function(n){var e=n.theme,r=n.small,o=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+e.fonts.roboto+";\n color: "+e.colors.body+";\n font-size: "+(r?e.fontSizes[0]:e.fontSizes[1])+";\n line-height: "+e.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 0;\n min-height: "+(r?"36px":"48px")+";\n padding: "+(r?"10px":e.space.sm)+";\n background: transparent;\n color: "+(n.hasValue?e.colors.body:e.colors.secondary)+";\n cursor: pointer;\n z-index: 2;\n transition-property: border-color, color;\n transition-duration: 150ms;\n transition-timing-function: ease-in-out;\n\n &::placeholder {\n color: "+e.colors.secondary+";\n line-height: "+e.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+e.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+e.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+e.colors.background+";\n cursor: not-allowed;\n }\n }\n &:invalid,\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n box-shadow: none;\n outline: 0;\n color: "+e.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(o?e.colors.error:e.colors.primary)+";\n }\n & ~ .__tab {\n border-color: "+(o?e.colors.error:e.colors.primary)+";\n color: "+(o?e.colors.error:e.colors.primary)+";\n }\n }\n "+(r?"\n & ~ .__tab {\n padding: 10px;\n }\n ":"")+"\n"});N.displayName="InputElement";var H=i.forwardRef(function(n,e){var r=n.hasError,o=n.preTab,t=n.postTab,l=P(n,["hasError","preTab","postTab"]),s=Boolean(o),c=o||t;return i.createElement(a.Box,{display:"flex",ml:"-2px",mr:"-2px",p:"2px"},i.createElement(N,Object.assign({ref:e,hasError:r},l)),c&&i.createElement(a.Box,{className:"__tab","aria-hidden":"true",display:"flex",alignItems:"center",justifyContent:"center",px:"sm",zIndex:1,color:r?"error":"secondary",bg:r?"#FDEBF0":"background",borderTopLeftRadius:s?"4px":"0",borderBottomLeftRadius:s?"4px":"0",borderTopRightRadius:s?"0":"4px",borderBottomRightRadius:s?"0":"4px",border:["1px solid",r?"error":"outline"],order:s?-1:1,transitionProperty:"border-color, color",transitionDuration:"fast",transitionTimingFunction:"ease"},c),i.createElement(a.Box,{className:"__bg",bg:r?"error-alpha01":"primary-alpha01",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),i.createElement(a.Box,{className:"__border",bg:"white",border:["1px solid",r?"error":"outline"],position:"absolute",top:"2px",bottom:"2px",left:"2px",right:"2px",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"}))});function L(n){var e=n.name,r=n.validate,o=n.onChange,t=n.onBlur,a=P(n,["name","validate","onChange","onBlur"]);return i.createElement(l.Field,{name:e,validate:r},function(n){var r=n.field,l=Boolean(s.get(n.form,["errors",e]));return i.createElement(H,Object.assign({},a,r,{hasError:l,onChange:function(n){r.onChange(n),o&&o(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}function W(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}var V=Object.freeze(["\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n cursor: pointer;\n z-index: 0;\n"]),q=t.span(function(n){var e=n.theme;return"\n display: block;\n font-size: "+e.fontSizes[1]+";\n font-weight: "+e.fontWeights[5]+";\n line-height: "+e.lineHeights[0]+";\n margin-bottom: "+e.space.xxs+";\n transition-property: color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n "}),M=t.div(function(n){var e=n.theme;return"\n width: 100%;\n border: 1px solid "+e.colors.outline+";\n border-radius: 4px;\n\n "+G+" {\n padding: "+e.space.sm+";\n border-top: 1px solid "+e.colors.outline+";\n\n &:first-of-type {\n border-top: 0;\n }\n }\n\n "+(n.hasError?"\n border-color: "+e.colors.error+" !important;\n\n & "+G+" {\n border-color: "+e.colors.error+" !important;\n }\n ":"")+"\n "}),U=t.div(function(n){var e=n.theme;return"\n position: relative;\n width: 16px;\n height: 16px;\n border-radius: 100%;\n margin-top: 2px;\n margin-right: 16px;\n border: 1px solid "+(n.checked?e.colors.primaryDark:e.colors.outline)+";\n z-index: 1;\n transition-property: background, border-color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n\n &::after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n width: 8px;\n height: 8px;\n border-radius: 100%;\n background: white;\n transition-property: transform;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n transform: scale(0);\n }\n "}),Y=t.input(function(n){var e=n.theme;return"\n position: relative;\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n width: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n position: absolute;\n whitespace: nowrap;\n wordwrap: normal;\n z-index: 1;\n\n &:focus ~ "+U+" {\n border-color: "+e.colors.primaryDark+";\n }\n &:focus ~ "+a.Box+" "+q+" {\n color: "+e.colors.primary+";\n }\n\n &:checked ~ "+U+" {\n background: "+e.colors.primary+";\n border-color: "+e.colors.primaryDark+";\n\n &::after {\n transform: scale(1);\n }\n }\n &:checked ~ "+a.Box+" "+q+" {\n color: "+e.colors.primary+";\n }\n\n &:disabled ~ "+U+" {\n border-color: "+e.colors.outline+" !important;\n }\n &:disabled ~ "+A+" {\n background-color: "+e.colors.background+";\n }\n &:disabled ~ "+a.Box+" "+q+" {\n color: "+e.colors.secondary+" !important;\n }\n "}),A=t.span(V),G=t.label(function(n){var e=n.theme;return"\n display: flex;\n align-items: center;\n position: relative;\n width: 100%;\n margin-bottom: 0 !important;\n cursor: pointer;\n overflow: hidden;\n\n &:hover "+U+" {\n border-color: "+e.colors.primaryDark+";\n }\n &:hover "+q+" {\n color: "+e.colors.primary+";\n }\n "});function K(n){var e=n.children,r=n.name,o=n.validate,t=n.onChange,a=n.onBlur,c=W(n,["children","name","validate","onChange","onBlur"]);return i.createElement(l.Field,{name:r,validate:o},function(n){var o=n.field,l=Boolean(s.get(n.form,["errors",r]));return i.createElement(M,{hasError:l},i.Children.toArray(e).map(function(n){return i.cloneElement(n,Object.assign({},o,c,{value:n.props.value,hasError:l,checked:Boolean(o.value===n.props.value),onChange:function(n){o.onChange(n),t&&t(n)},onBlur:function(n){o.onBlur(n),a&&a(n)}}))}))})}function X(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}var J=t.select(function(n){var e=n.theme,r=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+e.fonts.roboto+";\n color: "+e.colors.body+";\n font-size: "+e.fontSizes[1]+";\n line-height: "+e.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 0;\n min-height: 48px;\n padding: "+e.space.sm+";\n background: transparent;\n color: "+(n.hasValue?e.colors.body:e.colors.secondary)+";\n cursor: pointer;\n z-index: 2;\n transition-property: border-color, color;\n transition-duration: 150ms;\n transition-timing-function: ease-in-out;\n\n &::placeholder {\n color: "+e.colors.secondary+";\n line-height: "+e.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+e.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+e.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+e.colors.background+";\n cursor: not-allowed;\n }\n }\n &:invalid,\n &:-moz-ui-invalid,\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n box-shadow: none;\n outline: 0;\n color: "+e.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(r?e.colors.error:e.colors.primary)+";\n\n div {\n border-color: "+(r?e.colors.error:e.colors.primary)+";\n color: "+(r?e.colors.error:e.colors.primary)+";\n }\n }\n }\n"});J.displayName="SelectElement";var Q=i.forwardRef(function(n,e){var r=n.children,o=n.hasError,t=n.placeholder;void 0===t&&(t="");var l=X(n,["children","hasError","placeholder"]);return i.createElement(a.Box,{ml:"-2px",mr:"-2px",p:"2px"},i.createElement(J,Object.assign({ref:e,hasValue:Boolean(l.value),hasError:o},l,{value:l.value||""}),t&&i.createElement("option",{value:"",disabled:!0},t),r),i.createElement(a.Box,{className:"__bg",bg:o?"error-alpha01":"primary-alpha01",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),i.createElement(a.Box,{className:"__border",bg:"white",border:["1px solid",o?"error":"outline"],position:"absolute",top:"2px",bottom:"2px",left:"2px",right:"2px",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"}),i.createElement(a.Box,{position:"absolute",right:"0",top:"0",bottom:"0",height:"16px",my:"auto",pr:"sm",style:{pointerEvents:"none"}},i.createElement(a.Icon,{name:"ChevronDown",color:"secondary"})))});function Z(n){var e=n.name,r=n.validate,o=n.onChange,t=n.onBlur,a=X(n,["name","validate","onChange","onBlur"]);return i.createElement(l.Field,{name:e,validate:r},function(n){var r=n.field,l=Boolean(s.get(n.form,["errors",e]));return i.createElement(Q,Object.assign({},a,r,{hasError:l,onChange:function(n){r.onChange(n),o&&o(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}var $=t(a.Box)(function(n){return"\n border-left: 2px solid currentColor;\n padding-left: "+n.theme.space.sm+";\n "});function nn(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}var en=t.textarea(function(n){var e=n.theme,r=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+e.fonts.roboto+";\n color: "+e.colors.body+";\n font-size: "+e.fontSizes[1]+";\n line-height: "+e.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 0;\n min-height: 48px;\n padding: "+e.space.sm+";\n background: transparent;\n color: "+(n.hasValue?e.colors.body:e.colors.secondary)+";\n cursor: pointer;\n z-index: 2;\n transition-property: border-color, color;\n transition-duration: 150ms;\n transition-timing-function: ease-in-out;\n\n &::placeholder {\n color: "+e.colors.secondary+";\n line-height: "+e.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+e.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+e.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+e.colors.background+";\n cursor: not-allowed;\n }\n }\n &:invalid,\n &:-moz-ui-invalid,\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n box-shadow: none;\n outline: 0;\n color: "+e.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(r?e.colors.error:e.colors.primary)+";\n\n div {\n border-color: "+(r?e.colors.error:e.colors.primary)+";\n color: "+(r?e.colors.error:e.colors.primary)+";\n }\n }\n }\n"});en.displayName="TextareaElement",en.defaultProps={rows:4};var rn=i.forwardRef(function(n,e){var r=n.hasError,o=nn(n,["hasError"]);return i.createElement(a.Box,{ml:"-2px",mr:"-2px",p:"2px"},i.createElement(en,Object.assign({ref:e,hasError:r},o)),i.createElement(a.Box,{className:"__bg",bg:r?"error-alpha01":"primary-alpha01",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),i.createElement(a.Box,{className:"__border",bg:"white",border:["1px solid",r?"error":"outline"],position:"absolute",top:"2px",bottom:"2px",left:"2px",right:"2px",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"}))});function on(n){var e=n.name,r=n.validate,o=n.onChange,t=n.onBlur,a=nn(n,["name","validate","onChange","onBlur"]);return i.createElement(l.Field,{name:e,validate:r},function(n){var r=n.field,l=Boolean(s.get(n.form,["errors",e]));return i.createElement(rn,Object.assign({},a,r,{hasError:l,onChange:function(n){r.onChange(n),o&&o(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}var tn=Object.freeze(["\n ","\n"]),an="\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n width: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n position: absolute;\n whitespace: nowrap;\n wordwrap: normal;\n",ln=t.div(function(n){var e=n.theme;return"\n display: block;\n position: absolute;\n top: 3px;\n bottom: 0;\n left: 3px;\n width: 24px;\n height: 24px;\n border-radius: 100px;\n border: 1px solid "+e.colors.outline+";\n color: white;\n background: white;\n stroke: white;\n transition-property: transform, background, border-color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.natural+";\n"}),sn=t.div(function(n){var e=n.theme;return"\n position: relative;\n width: 56px;\n height: 32px;\n border-radius: 100px;\n border: 1px solid "+e.colors.outline+";\n background: "+e.colors.background+";\n cursor: pointer;\n transition-property: background, border-color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.natural+";\n "}),cn=t.label(function(n){return"\n display: flex;\n align-items: center;\n margin-bottom: 0 !important;\n\n &:hover "+sn+" {\n "+ln+" {\n border-color: "+n.theme.colors.primaryDark+";\n }\n }\n "}),dn=t.input(function(n){var e=n.theme;return"\n "+an+"\n\n &:focus ~ "+sn+" {\n border-color: "+e.colors.primary+";\n }\n &:checked ~ "+sn+" {\n border-color: "+e.colors.primary+";\n\n "+ln+" {\n background: "+e.colors.primary+";\n border-color: "+e.colors.primaryDark+";\n transform: translateX(24px);\n }\n }\n &:disabled ~ "+sn+" {\n pointer-events: none;\n "+ln+" {\n border-color: "+e.colors.outline+";\n }\n }\n "}),pn=t.span(tn,an);function un(n){var e=n.label,r=n.name,o=n.checked,t=function(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}(n,["label","name","checked"]);return i.createElement(cn,{htmlFor:r},i.createElement(dn,Object.assign({id:r,name:r,type:"checkbox",checked:o},t)),i.createElement(sn,null,i.createElement(ln,null,i.createElement(a.Icon,{name:"Check",width:"12px",height:"12px",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",m:"auto",style:{strokeWidth:"2px"}}))),i.createElement(pn,null,e))}function mn(n){var e=n.value;void 0===e&&(e="");var r=n.masker;void 0===r&&(r="*");var o=n.separator;void 0===o&&(o="-");var t=new RegExp("[^0-9"+o+"]").test(e)?"":c.clean(e,r),a=c.format(c.mask(t,r),o),l=i.useState(t),s=l[0],d=l[1],p=i.useState(a),u=p[0],m=p[1],b=i.useCallback(function(n){n.persist();var e=n.target.value,t=e.slice(-1);if(!(new RegExp("[^0-9"+o+r+"]").test(t)||e.length>11)){var a=c.clean(e,r),i=c.clean(s),l=a.length<i.length?i.slice(0,a.length):new RegExp("["+o+r+"]").test(t)?i:i+a.slice(-1);d(l),m(c.format(c.mask(l,r),o))}},[s,d,u,m]),h=i.useCallback(function(n){n.persist();var e=n.target.value.length;n.target.setSelectionRange(e,e)},[]);return i.useEffect(function(){n.onUpdate&&n.onUpdate(s)},[s]),i.createElement(H,Object.assign({},n,{value:u,onChange:b,onFocus:h,onKeyUp:h,onKeyDown:h,onClick:h}))}function bn(n){var e=n.name,r=n.validate,o=function(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}(n,["name","validate"]);return i.createElement(l.Field,{name:e,validate:r},function(n){var r=n.field,t=n.form,a=Boolean(s.get(t,["errors",e]));return i.createElement(mn,Object.assign({},o,r,{hasError:a,onUpdate:function(n){t.setFieldValue(e,n)}}))})}exports.CheckboxGroup=g,exports.Checkbox=x,exports.CheckboxField=function(n){var e=n.name,r=n.validate,o=n.onChange,t=n.onBlur,a=d(n,["name","validate","onChange","onBlur"]);return i.createElement(l.Field,{name:e,validate:r},function(n){var r=n.field,l=Boolean(s.get(n.form,["errors",e]));return i.createElement(x,Object.assign({},a,r,{checked:Boolean(r.value),hasError:l,onChange:function(n){r.onChange(n),o&&o(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})},exports.DateInput=O,exports.DateInputField=_,exports.DateInputFieldWithLabel=function(n){return i.createElement(i.Fragment,null,i.createElement(E,{htmlFor:n.name},n.label),i.createElement(_,Object.assign({},n)))},exports.Item=j,exports.Body=C,exports.Control=I,exports.Dropdown=R,exports.DropdownField=T,exports.DropdownFieldWithLabel=function(n){return i.createElement(i.Fragment,null,i.createElement(E,{htmlFor:n.name},n.label),i.createElement(T,Object.assign({},n)))},exports.ErrorMessage=function(n){return i.createElement(l.ErrorMessage,{name:n.name,render:function(n){return i.createElement(a.Span,{color:"error",fontSize:0},n)}})},exports.Input=H,exports.InputField=L,exports.InputFieldWithLabel=function(n){return i.createElement(i.Fragment,null,i.createElement(E,{htmlFor:n.name},n.label),i.createElement(L,Object.assign({},n)))},exports.Label=E,exports.Radio=function(n){var e=n.name,r=n.checked,o=n.description,t=n.label,l=W(n,["children","name","checked","description","label"]),s=e+l.value;return i.createElement(G,{htmlFor:s},i.createElement(Y,Object.assign({id:s,name:e,type:"radio",checked:r},l)),i.createElement(U,{checked:r}),i.createElement(a.Box,{display:"block",position:"relative",zIndex:1,width:"calc(100% - 32px)",maxWidth:"calc(100% - 32px)"},t&&i.createElement(q,null,t),o&&i.createElement(a.P,{color:"secondary",fontSize:0,fontWeight:4,lineHeight:0},o)),i.createElement(A,null))},exports.RadioField=K,exports.RadioFieldWithLabel=function(n){var e=n.label,r=W(n,["label"]);return i.createElement(i.Fragment,null,i.createElement(E,{htmlFor:r.name},e),i.createElement(K,Object.assign({},r)))},exports.Select=Q,exports.SelectField=Z,exports.SelectFieldWithLabel=function(n){return i.createElement(i.Fragment,null,i.createElement(E,{htmlFor:n.name},n.label),i.createElement(Z,Object.assign({},n)))},exports.SubGroup=$,exports.Textarea=rn,exports.TextareaField=on,exports.TextareaFieldWithLabel=function(n){return i.createElement(i.Fragment,null,i.createElement(E,{htmlFor:n.name},n.label),i.createElement(on,Object.assign({},n)))},exports.hidden=an,exports.Toggle=un,exports.ToggleField=function(n){var e=n.label;return i.createElement(l.Field,{name:n.name,validate:n.validate},function(n){var r=n.field;return i.createElement(un,Object.assign({label:e},r,{checked:Boolean(r.value)}))})},exports.SSNInput=mn,exports.SSNInputField=bn,exports.SSNInputFieldWithLabel=function(n){return i.createElement(i.Fragment,null,i.createElement(E,{htmlFor:n.name},n.label),i.createElement(bn,Object.assign({},n)))}; | ||
var n,e=require("styled-system"),r=require("use-drop"),o=require("styled-components"),t=(n=o)&&"object"==typeof n&&"default"in n?n.default:n,a=require("@truework/ui"),i=require("react"),l=require("formik"),s=require("lodash"),c=require("parse-ssn");function d(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}var p=Object.freeze([""]),u=t(a.Icon)(p),m=t.div(function(n){var e=n.theme;return"\n position: relative;\n width: 16px;\n height: 16px;\n border-radius: 2px;\n margin-top: 2px;\n margin-right: 8px;\n border: 1px solid "+(n.checked?e.colors.primaryDark:e.colors.outline)+";\n transition-property: background, border-color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n\n "+u+" {\n display: block;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n width: 12px;\n height: 12px;\n color: white;\n stroke: white;\n stroke-width: 2px;\n transition-property: transform;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n transform: scale(0);\n }\n "}),b=t(a.H5)(function(n){var e=n.theme;return"\n width: calc(100% - 16px);\n transition-property: color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n "}),h=t.input(function(n){var e=n.theme;return"\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n width: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n position: absolute;\n whitespace: nowrap;\n wordwrap: normal;\n\n &:focus ~ "+m+" {\n border-color: "+e.colors.primaryDark+";\n }\n &:checked ~ "+m+" {\n background: "+e.colors.primary+";\n border-color: "+e.colors.primaryDark+";\n\n "+u+" {\n transform: scale(1);\n }\n }\n &:focus ~ "+b+", &:focus ~"+a.Span+", &:checked ~ "+a.Span+" {\n color: "+e.colors.primary+";\n }\n\n "+(n.hasError?"\n & ~ "+m+" {\n border-color: "+e.colors.error+" !important;\n }\n ":"")+"\n "}),f=t.label(function(n){var e=n.theme;return"\n display: flex;\n align-items: flex-start;\n width: 100%;\n margin-bottom: 0 !important;\n\n "+(n.disabled?"\n "+m+" {\n background: "+e.colors.background+";\n }\n "+a.Span+" {\n color: "+e.colors.placeholder+";\n }\n ":"\n &:hover "+m+" {\n border-color: "+e.colors.primaryDark+";\n }\n &:hover "+b+", &:hover "+a.Span+" {\n color: "+e.colors.primary+";\n }\n ")+"\n "}),g=t.div(function(n){var e=n.theme;return"\n width: 100%;\n\n "+f+" {\n padding: "+e.space.sm+";\n border: 1px solid "+e.colors.outline+";\n border-top: none;\n display: flex;\n align-items: center;\n }\n\n "+f+":first-child {\n border-top: 1px solid "+e.colors.outline+";\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n }\n\n "+f+":last-child {\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n }\n "});function x(n){var e=n.children,r=n.name,o=n.checked,t=n.disabled,l=d(n,["children","name","checked","disabled"]);return i.createElement(f,{htmlFor:r,disabled:t},i.createElement(h,Object.assign({id:r,name:r,type:"checkbox",checked:o,disabled:t},l)),i.createElement(m,{checked:o},i.createElement(u,{name:"Check"})),i.createElement(a.Span,{display:"block",width:"calc(100% - 16px)",fontSize:1,lineHeight:1,fontWeight:5,style:{transitionProperty:"color",transitionDuration:"150ms",transitionTimingFunction:"ease-in-out"}},e))}function v(n){return n<10?"0"+n:""+n}var y=Object.freeze(["\n display: block;\n position: relative;\n font-weight: 500;\n letter-spacing: 0.6px;\n ","\n ","\n ","\n"]),E=t.label(y,e.typography,e.color,e.space);E.displayName="Label",E.defaultProps={fontSize:1,lineHeight:1,mb:"xs"};var w=Object.freeze(["\n position: absolute;\n top: 0;\n bottom: 0;\n right: 12px;\n z-index: 1;\n height: 16px;\n width: 16px;\n margin: auto 0;\n border: 1px solid currentColor;\n border-radius: 16px;\n color: ",";\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: 0.5;\n transition: opacity ","\n ",";\n\n &:hover {\n opacity: 1;\n }\n "]),k=Object.freeze(["\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: ",";\n color: ",";\n font-size: ",";\n font-family: ",";\n line-height: ",";\n letter-spacing: 0.6px;\n margin: 0;\n min-height: 48px;\n padding: "," 8px "," 10px;\n text-align: center;\n max-width: 33.333333%;\n background: transparent;\n color: ",";\n cursor: pointer;\n z-index: 2;\n transition-property: border-color, color;\n transition-duration: 150ms;\n transition-timing-function: ease-in-out;\n\n &::-ms-expand {\n display: none;\n }\n &:disabled {\n background: transparent;\n color: ",";\n cursor: not-allowed;\n & ~ .__border {\n background: ",";\n cursor: not-allowed;\n }\n }\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n outline: 0;\n color: ",";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: ",";\n\n div {\n border-color: ",";\n color: ",";\n }\n }\n }\n "]),F=t.select(function(n){var e=n.theme,r=n.hasError;return o.css(k,e.fonts.roboto,e.colors.body,e.fontSizes[1],e.fonts.mono,e.lineHeights[0],e.space.sm,e.space.sm,n.hasValue?e.colors.body:e.colors.secondary,function(n){return n.theme.colors.placeholder},e.colors.background,e.colors.body,r?e.colors.error:e.colors.primary,r?e.colors.error:e.colors.primary,r?e.colors.error:e.colors.primary)}),B=t.button(function(n){var e=n.theme;return o.css(w,e.colors.secondary,e.transitionDurations.fast,e.transitionTimingFunctions.ease)});function O(n){var e=n.name,r=n.label;void 0===r&&(r="Date");var o=n.disabled,t=n.initialMonth;void 0===t&&(t=0);var l=n.initialDay;void 0===l&&(l=0);var c=n.initialYear;void 0===c&&(c=0);var d=n.minMonth;void 0===d&&(d=1);var p=n.minDay;void 0===p&&(p=1);var u=n.minYear;void 0===u&&(u=1980);var m=n.maxMonth;void 0===m&&(m=12);var b=n.maxDay;void 0===b&&(b=31);var h=n.maxYear;void 0===h&&(h=2030);var f=n.hasError,g=n.onUpdate,x=i.useRef(null),y=i.useRef(null),E=i.useRef(null),w=i.useState(t),k=w[0],O=w[1],_=i.useState(l),z=_[0],D=_[1],j=i.useState(c),C=j[0],S=j[1],I=function(n){return new Date(n.year,n.month,0).getUTCDate()}({year:C||2020,month:k});i.useEffect(function(){C&&k&&z&&g(C+"-"+v(k)+"-"+v(z))},[k,z,C]);var R=i.useCallback(function(){O(0),D(0),S(0)},[O,D,S]);return i.createElement(a.Box,{ml:"-4px",mr:"-4px",p:"4px"},i.createElement(a.Box,{display:"flex",alignItems:"center",height:"48px",pl:"56px"},i.createElement(F,{ref:x,name:e+"-month",value:k,disabled:o,onChange:function(n){O(parseInt(n.target.value,10)),y.current&&y.current.focus()},"aria-label":r+": Month",hasValue:Boolean(k),hasError:f},i.createElement("option",{value:"0",disabled:!0},"mm"),s.times(m-d+1,function(){return""}).map(function(n,e){var r=d+e;return i.createElement("option",{key:r,value:r},v(r))})),i.createElement(a.Box,{height:"50%",width:"1px",bg:f?"error":"outline",zIndex:2,transform:"rotate(10deg)"}),i.createElement(F,{ref:y,name:e+"-day",value:z,disabled:o,onChange:function(n){D(parseInt(n.target.value,10)),E.current&&E.current.focus()},"aria-label":r+": Day",hasValue:Boolean(z),hasError:f},i.createElement("option",{value:"0",disabled:!0},"dd"),s.times(Math.min(b,I)-p+1,function(){return""}).map(function(n,e){var r=p+e;return i.createElement("option",{key:r,value:r},v(r))})),i.createElement(a.Box,{height:"50%",width:"1px",bg:f?"error":"outline",zIndex:2,transform:"rotate(10deg)"}),i.createElement(F,{ref:E,name:e+"-year",value:C,disabled:o,onChange:function(n){S(parseInt(n.target.value,10))},"aria-label":r+": Year",hasValue:Boolean(C),hasError:f},i.createElement("option",{value:"0",disabled:!0},"yyyy"),s.times(h-u+1,function(n){return u+n}).map(function(n){return i.createElement("option",{key:n,value:n},n)})),(k||z||C)&&i.createElement(B,{title:"Clear",onClick:R},i.createElement(a.Icon,{name:"X",width:"12px",height:"12px"})),i.createElement(a.Box,{className:"__bg",bg:f?"error-alpha01":"primary-alpha01",position:"absolute",top:"-4px",bottom:"-4px",left:"-4px",right:"-4px",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),i.createElement(a.Box,{className:"__border",bg:"white",border:["1px solid",f?"error":"outline"],position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"},i.createElement(a.Box,{"aria-hidden":"true",position:"absolute",top:"0",left:"0",display:"flex",alignItems:"center",justifyContent:"center",px:"sm",height:"100%",zIndex:0,color:f?"error":"secondary",bg:f?"#FDEBF0":"background",borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px",borderRight:["1px solid",f?"error":"outline"],transitionProperty:"border-color, color",transitionDuration:"fast",transitionTimingFunction:"ease"},i.createElement(a.Icon,{name:"Calendar"})))))}function _(n){var e=n.name,r=n.validate,o=function(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}(n,["name","validate"]);return i.createElement(l.Field,{name:e,validate:r},function(n){var r=n.field,t=n.form,a=Boolean(s.get(t,["errors",e])),l=(r.value||"").split("-"),c=l[0];void 0===c&&(c="");var d=l[1];void 0===d&&(d="");var p=l[2];return void 0===p&&(p=""),i.createElement(O,Object.assign({name:e},o,{initialMonth:d?parseInt(d,10):void 0,initialDay:p?parseInt(p,10):void 0,initialYear:c?parseInt(c,10):void 0,hasError:a,onUpdate:function(n){t.setFieldValue(e,n)}}))})}function z(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}var D=t(a.Box)(function(n){var e=n.theme,r=n.selected,o=n.highlighted;return"\n display: flex;\n align-items: center;\n padding: "+e.space.sm+";\n color: "+(r||o?e.colors.body:e.colors.secondary)+";\n background-color: "+(r||o?e.colors.background:"white")+";\n cursor: pointer;\n font-size: "+e.fontSizes[1]+";\n font-weight: 400;\n line-height: "+e.lineHeights[1]+";\n letter-spacing: 0.6px;\n\n &:hover {\n background: "+e.colors.background+";\n }\n"});function j(n){var e=n.children,r=z(n,["children"]);return i.createElement(D,Object.assign({as:"li"},r),e)}var C=i.forwardRef(function(n,e){var r=n.children,o=z(n,["children"]);return i.createElement(a.Box,Object.assign({ref:e,as:"ul",boxShadow:"medium",borderRadius:2,overflow:"auto",width:"100%",bg:"white"},o),r)});C.displayName="Body";var S=t.button(function(n){var e=n.theme,r=n.hasError;return"\n display: block;\n position: relative;\n width: 100%;\n z-index: 1;\n height: 48px;\n padding: 0 16px;\n text-align: left;\n font-size: "+e.fontSizes[1]+";\n font-weight: 400;\n line-height: "+e.lineHeights[1]+";\n color: "+e.colors.secondary+";\n transition-property: color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n\n "+(n.disabled?"\n background: transparent;\n color: "+e.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+e.colors.background+";\n cursor: not-allowed;\n }\n ":"\n &:active,\n &:focus,\n &:hover {\n outline: 0;\n color: "+e.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(r?e.colors.error:e.colors.primary)+";\n\n div {\n border-color: "+(r?e.colors.error:e.colors.primary)+";\n color: "+(r?e.colors.error:e.colors.primary)+";\n }\n }\n }\n ")+"\n\n "+(n.isActive?"\n outline: 0;\n color: "+e.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(r?e.colors.error:e.colors.primary)+";\n\n div {\n border-color: "+(r?e.colors.error:e.colors.primary)+";\n color: "+(r?e.colors.error:e.colors.primary)+";\n }\n }\n ":"")+"\n"});S.displayName="ControlOuter";var I=i.forwardRef(function(n,e){var r=n.children,o=n.isActive,t=n.hasError,l=z(n,["children","isActive","hasError"]);return i.createElement("div",{style:{position:"relative"}},i.createElement(S,Object.assign({ref:e,isActive:o,hasError:t,type:"button"},l),i.createElement(a.Span,{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},i.createElement(a.Span,{width:"100%",fontWeight:4,style:{whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",letterSpacing:"0.6px"}},r),i.createElement(a.Icon,{name:"ChevronDown",ml:"xs"}))),i.createElement(a.Box,{className:"__bg",bg:t?"error-alpha01":"primary-alpha01",position:"absolute",top:"-2px",bottom:"-2px",left:"-2px",right:"-2px",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),i.createElement(a.Box,{className:"__border",bg:"white",border:["1px solid",t?"error":"outline"],position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"}))});function R(n){var e=n.value,o=n.placeholder,t=n.label,l=n.items,c=n.hasError,d=n.disabled,p=n.onSelect,u=n.onRemove,m=i.useState(s.get(l.filter(function(n){return n.value===e})[0],"label")||o||"Please select"),b=m[0],h=m[1],f=r.useSelect({items:l.map(function(n){return Object.assign({},n,{selected:n.value===e})}),onSelect:function(n){h(n.label),p&&p(n)},onRemove:function(n){h("Please select"),u&&u(n)}}),g=f.items,x=f.isOpen,v=f.getDropProps;return i.createElement(a.Box,null,i.createElement(I,Object.assign({id:f.id},d?{}:(0,f.getControlProps)(),{"aria-label":t,isActive:x,hasError:c,disabled:d}),b),x&&i.createElement(a.Box,{position:"absolute",bottom:"0",width:"100%",transform:"translateY(100%) translateY(6px)",zIndex:1e3},i.createElement(C,Object.assign({},v(),{style:{maxHeight:"240px",overflow:"auto"}}),g.map(function(n){return i.createElement(j,Object.assign({key:n.value,selected:n.selected,highlighted:n.highlighted},n.getItemProps()),n.label)}))))}function T(n){var e=n.name,r=n.validate,o=z(n,["name","validate"]);return i.createElement(l.Field,{name:e,validate:r},function(n){var e=n.field,r=n.form,t=Boolean(r.errors&&r.errors[e.name]);return i.createElement(R,Object.assign({},o,{hasError:t,onSelect:function(n){r.setFieldValue(e.name,n.value),o.onSelect&&o.onSelect(n)}}))})}function P(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}I.displayName="Control";var N=t.input(function(n){var e=n.theme,r=n.small,o=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+e.fonts.roboto+";\n color: "+e.colors.body+";\n font-size: "+(r?e.fontSizes[0]:e.fontSizes[1])+";\n line-height: "+e.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 0;\n min-height: "+(r?"36px":"48px")+";\n padding: "+(r?"10px 16px":e.space.sm)+";\n background: transparent;\n color: "+(n.hasValue?e.colors.body:e.colors.secondary)+";\n cursor: pointer;\n z-index: 2;\n transition-property: border-color, color;\n transition-duration: 150ms;\n transition-timing-function: ease-in-out;\n\n &::placeholder {\n color: "+e.colors.secondary+";\n line-height: "+e.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+e.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+e.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+e.colors.background+";\n cursor: not-allowed;\n }\n }\n &:invalid,\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n box-shadow: none;\n outline: 0;\n color: "+e.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(o?e.colors.error:e.colors.primary)+";\n }\n & ~ .__tab {\n border-color: "+(o?e.colors.error:e.colors.primary)+";\n color: "+(o?e.colors.error:e.colors.primary)+";\n }\n }\n "+(r?"\n & ~ .__tab {\n padding: 10px;\n }\n ":"")+"\n\n & ~ .__tab svg {\n max-width: "+(r?"14px":"16px")+";\n max-height: "+(r?"14px":"16px")+";\n }\n"});N.displayName="InputElement";var H=i.forwardRef(function(n,e){var r=n.hasError,o=n.preTab,t=n.postTab,l=P(n,["hasError","preTab","postTab"]),s=Boolean(o),c=o||t;return i.createElement(a.Box,{display:"flex",ml:"-2px",mr:"-2px",p:"2px"},i.createElement(N,Object.assign({ref:e,hasError:r},l)),c&&i.createElement(a.Box,{className:"__tab","aria-hidden":"true",display:"flex",alignItems:"center",justifyContent:"center",px:"sm",zIndex:1,color:r?"error":"secondary",bg:r?"#FDEBF0":"background",borderTopLeftRadius:s?"4px":"0",borderBottomLeftRadius:s?"4px":"0",borderTopRightRadius:s?"0":"4px",borderBottomRightRadius:s?"0":"4px",border:["1px solid",r?"error":"outline"],order:s?-1:1,transitionProperty:"border-color, color",transitionDuration:"fast",transitionTimingFunction:"ease"},c),i.createElement(a.Box,{className:"__bg",bg:r?"error-alpha01":"primary-alpha01",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),i.createElement(a.Box,{className:"__border",bg:"white",border:["1px solid",r?"error":"outline"],position:"absolute",top:"2px",bottom:"2px",left:"2px",right:"2px",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"}))});function L(n){var e=n.name,r=n.validate,o=n.onChange,t=n.onBlur,a=P(n,["name","validate","onChange","onBlur"]);return i.createElement(l.Field,{name:e,validate:r},function(n){var r=n.field,l=Boolean(s.get(n.form,["errors",e]));return i.createElement(H,Object.assign({},a,r,{hasError:l,onChange:function(n){r.onChange(n),o&&o(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}function W(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}var V=Object.freeze(["\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n cursor: pointer;\n z-index: 0;\n"]),q=t.span(function(n){var e=n.theme;return"\n display: block;\n font-size: "+e.fontSizes[1]+";\n font-weight: "+e.fontWeights[5]+";\n line-height: "+e.lineHeights[0]+";\n margin-bottom: "+e.space.xxs+";\n transition-property: color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n "}),M=t.div(function(n){var e=n.theme;return"\n width: 100%;\n border: 1px solid "+e.colors.outline+";\n border-radius: 4px;\n\n "+G+" {\n padding: "+e.space.sm+";\n border-top: 1px solid "+e.colors.outline+";\n\n &:first-of-type {\n border-top: 0;\n }\n }\n\n "+(n.hasError?"\n border-color: "+e.colors.error+" !important;\n\n & "+G+" {\n border-color: "+e.colors.error+" !important;\n }\n ":"")+"\n "}),U=t.div(function(n){var e=n.theme;return"\n position: relative;\n width: 16px;\n height: 16px;\n border-radius: 100%;\n margin-top: 2px;\n margin-right: 16px;\n border: 1px solid "+(n.checked?e.colors.primaryDark:e.colors.outline)+";\n z-index: 1;\n transition-property: background, border-color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n\n &::after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n width: 8px;\n height: 8px;\n border-radius: 100%;\n background: white;\n transition-property: transform;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n transform: scale(0);\n }\n "}),Y=t.input(function(n){var e=n.theme;return"\n position: relative;\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n width: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n position: absolute;\n whitespace: nowrap;\n wordwrap: normal;\n z-index: 1;\n\n &:focus ~ "+U+" {\n border-color: "+e.colors.primaryDark+";\n }\n &:focus ~ "+a.Box+" "+q+" {\n color: "+e.colors.primary+";\n }\n\n &:checked ~ "+U+" {\n background: "+e.colors.primary+";\n border-color: "+e.colors.primaryDark+";\n\n &::after {\n transform: scale(1);\n }\n }\n &:checked ~ "+a.Box+" "+q+" {\n color: "+e.colors.primary+";\n }\n\n &:disabled ~ "+U+" {\n border-color: "+e.colors.outline+" !important;\n }\n &:disabled ~ "+A+" {\n background-color: "+e.colors.background+";\n }\n &:disabled ~ "+a.Box+" "+q+" {\n color: "+e.colors.secondary+" !important;\n }\n "}),A=t.span(V),G=t.label(function(n){var e=n.theme;return"\n display: flex;\n align-items: center;\n position: relative;\n width: 100%;\n margin-bottom: 0 !important;\n cursor: pointer;\n overflow: hidden;\n\n &:hover "+U+" {\n border-color: "+e.colors.primaryDark+";\n }\n &:hover "+q+" {\n color: "+e.colors.primary+";\n }\n "});function K(n){var e=n.children,r=n.name,o=n.validate,t=n.onChange,a=n.onBlur,c=W(n,["children","name","validate","onChange","onBlur"]);return i.createElement(l.Field,{name:r,validate:o},function(n){var o=n.field,l=Boolean(s.get(n.form,["errors",r]));return i.createElement(M,{hasError:l},i.Children.toArray(e).map(function(n){return i.cloneElement(n,Object.assign({},o,c,{value:n.props.value,hasError:l,checked:Boolean(o.value===n.props.value),onChange:function(n){o.onChange(n),t&&t(n)},onBlur:function(n){o.onBlur(n),a&&a(n)}}))}))})}function X(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}var J=t.select(function(n){var e=n.theme,r=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+e.fonts.roboto+";\n color: "+e.colors.body+";\n font-size: "+e.fontSizes[1]+";\n line-height: "+e.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 0;\n min-height: 48px;\n padding: "+e.space.sm+";\n background: transparent;\n color: "+(n.hasValue?e.colors.body:e.colors.secondary)+";\n cursor: pointer;\n z-index: 2;\n transition-property: border-color, color;\n transition-duration: 150ms;\n transition-timing-function: ease-in-out;\n\n &::placeholder {\n color: "+e.colors.secondary+";\n line-height: "+e.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+e.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+e.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+e.colors.background+";\n cursor: not-allowed;\n }\n }\n &:invalid,\n &:-moz-ui-invalid,\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n box-shadow: none;\n outline: 0;\n color: "+e.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(r?e.colors.error:e.colors.primary)+";\n\n div {\n border-color: "+(r?e.colors.error:e.colors.primary)+";\n color: "+(r?e.colors.error:e.colors.primary)+";\n }\n }\n }\n\n "+(n.small&&"\n height: 36px;\n min-height: 36px;\n padding: 0px 32px 0 16px;\n margin-right: 16px;\n font-size: "+e.fontSizes[0]+";\n line-height: "+e.lineHeights[0]+";\n ")+"\n"});J.displayName="SelectElement";var Q=i.forwardRef(function(n,e){var r=n.children,o=n.hasError,t=n.placeholder;void 0===t&&(t="");var l=X(n,["children","hasError","placeholder"]);return i.createElement(a.Box,{ml:"-2px",mr:"-2px",p:"2px"},i.createElement(J,Object.assign({ref:e,hasValue:Boolean(l.value),hasError:o},l,{value:l.value||""}),t&&i.createElement("option",{value:"",disabled:!0},t),r),i.createElement(a.Box,{className:"__bg",bg:o?"error-alpha01":"primary-alpha01",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),i.createElement(a.Box,{className:"__border",bg:"white",border:["1px solid",o?"error":"outline"],position:"absolute",top:"2px",bottom:"2px",left:"2px",right:"2px",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"}),i.createElement(a.Box,{position:"absolute",right:"0",top:"0",bottom:"0",height:"16px",my:"auto",pr:"sm",style:{pointerEvents:"none"}},i.createElement(a.Icon,{name:"ChevronDown",color:"secondary"})))});function Z(n){var e=n.name,r=n.validate,o=n.onChange,t=n.onBlur,a=X(n,["name","validate","onChange","onBlur"]);return i.createElement(l.Field,{name:e,validate:r},function(n){var r=n.field,l=Boolean(s.get(n.form,["errors",e]));return i.createElement(Q,Object.assign({},a,r,{hasError:l,onChange:function(n){r.onChange(n),o&&o(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}var $=t(a.Box)(function(n){return"\n border-left: 2px solid currentColor;\n padding-left: "+n.theme.space.sm+";\n "});function nn(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}var en=t.textarea(function(n){var e=n.theme,r=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+e.fonts.roboto+";\n color: "+e.colors.body+";\n font-size: "+e.fontSizes[1]+";\n line-height: "+e.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 0;\n min-height: 48px;\n padding: "+e.space.sm+";\n background: transparent;\n color: "+(n.hasValue?e.colors.body:e.colors.secondary)+";\n cursor: pointer;\n z-index: 2;\n transition-property: border-color, color;\n transition-duration: 150ms;\n transition-timing-function: ease-in-out;\n\n &::placeholder {\n color: "+e.colors.secondary+";\n line-height: "+e.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+e.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+e.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+e.colors.background+";\n cursor: not-allowed;\n }\n }\n &:invalid,\n &:-moz-ui-invalid,\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n box-shadow: none;\n outline: 0;\n color: "+e.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(r?e.colors.error:e.colors.primary)+";\n\n div {\n border-color: "+(r?e.colors.error:e.colors.primary)+";\n color: "+(r?e.colors.error:e.colors.primary)+";\n }\n }\n }\n"});en.displayName="TextareaElement",en.defaultProps={rows:4};var rn=i.forwardRef(function(n,e){var r=n.hasError,o=nn(n,["hasError"]);return i.createElement(a.Box,{ml:"-2px",mr:"-2px",p:"2px"},i.createElement(en,Object.assign({ref:e,hasError:r},o)),i.createElement(a.Box,{className:"__bg",bg:r?"error-alpha01":"primary-alpha01",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"6px",opacity:0,transitionProperty:"opacity",transitionDuration:"fast",transitionTimingFunction:"ease"}),i.createElement(a.Box,{className:"__border",bg:"white",border:["1px solid",r?"error":"outline"],position:"absolute",top:"2px",bottom:"2px",left:"2px",right:"2px",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"}))});function on(n){var e=n.name,r=n.validate,o=n.onChange,t=n.onBlur,a=nn(n,["name","validate","onChange","onBlur"]);return i.createElement(l.Field,{name:e,validate:r},function(n){var r=n.field,l=Boolean(s.get(n.form,["errors",e]));return i.createElement(rn,Object.assign({},a,r,{hasError:l,onChange:function(n){r.onChange(n),o&&o(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}var tn=Object.freeze(["\n ","\n"]),an="\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n width: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n position: absolute;\n whitespace: nowrap;\n wordwrap: normal;\n",ln=t.div(function(n){var e=n.theme;return"\n display: block;\n position: absolute;\n top: 3px;\n bottom: 0;\n left: 3px;\n width: 24px;\n height: 24px;\n border-radius: 100px;\n border: 1px solid "+e.colors.outline+";\n color: white;\n background: white;\n stroke: white;\n transition-property: transform, background, border-color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.natural+";\n"}),sn=t.div(function(n){var e=n.theme;return"\n position: relative;\n width: 56px;\n height: 32px;\n border-radius: 100px;\n border: 1px solid "+e.colors.outline+";\n background: "+e.colors.background+";\n cursor: pointer;\n transition-property: background, border-color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.natural+";\n "}),cn=t.label(function(n){return"\n display: flex;\n align-items: center;\n margin-bottom: 0 !important;\n\n &:hover "+sn+" {\n "+ln+" {\n border-color: "+n.theme.colors.primaryDark+";\n }\n }\n "}),dn=t.input(function(n){var e=n.theme;return"\n "+an+"\n\n &:focus ~ "+sn+" {\n border-color: "+e.colors.primary+";\n }\n &:checked ~ "+sn+" {\n border-color: "+e.colors.primary+";\n\n "+ln+" {\n background: "+e.colors.primary+";\n border-color: "+e.colors.primaryDark+";\n transform: translateX(24px);\n }\n }\n &:disabled ~ "+sn+" {\n pointer-events: none;\n "+ln+" {\n border-color: "+e.colors.outline+";\n }\n }\n "}),pn=t.span(tn,an);function un(n){var e=n.label,r=n.name,o=n.checked,t=function(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}(n,["label","name","checked"]);return i.createElement(cn,{htmlFor:r},i.createElement(dn,Object.assign({id:r,name:r,type:"checkbox",checked:o},t)),i.createElement(sn,null,i.createElement(ln,null,i.createElement(a.Icon,{name:"Check",width:"12px",height:"12px",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",m:"auto",style:{strokeWidth:"2px"}}))),i.createElement(pn,null,e))}function mn(n){var e=n.value;void 0===e&&(e="");var r=n.masker;void 0===r&&(r="*");var o=n.separator;void 0===o&&(o="-");var t=new RegExp("[^0-9"+o+"]").test(e)?"":c.clean(e,r),a=c.format(c.mask(t,r),o),l=i.useState(t),s=l[0],d=l[1],p=i.useState(a),u=p[0],m=p[1],b=i.useCallback(function(n){n.persist();var e=n.target.value,t=e.slice(-1);if(!(new RegExp("[^0-9"+o+r+"]").test(t)||e.length>11)){var a=c.clean(e,r),i=c.clean(s),l=a.length<i.length?i.slice(0,a.length):new RegExp("["+o+r+"]").test(t)?i:i+a.slice(-1);d(l),m(c.format(c.mask(l,r),o))}},[s,d,u,m]),h=i.useCallback(function(n){n.persist();var e=n.target.value.length;n.target.setSelectionRange(e,e)},[]);return i.useEffect(function(){n.onUpdate&&n.onUpdate(s)},[s]),i.createElement(H,Object.assign({},n,{value:u,onChange:b,onFocus:h,onKeyUp:h,onKeyDown:h,onClick:h}))}function bn(n){var e=n.name,r=n.validate,o=function(n,e){var r={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&-1===e.indexOf(o)&&(r[o]=n[o]);return r}(n,["name","validate"]);return i.createElement(l.Field,{name:e,validate:r},function(n){var r=n.field,t=n.form,a=Boolean(s.get(t,["errors",e]));return i.createElement(mn,Object.assign({},o,r,{hasError:a,onUpdate:function(n){t.setFieldValue(e,n)}}))})}exports.CheckboxGroup=g,exports.Checkbox=x,exports.CheckboxField=function(n){var e=n.name,r=n.validate,o=n.onChange,t=n.onBlur,a=d(n,["name","validate","onChange","onBlur"]);return i.createElement(l.Field,{name:e,validate:r},function(n){var r=n.field,l=Boolean(s.get(n.form,["errors",e]));return i.createElement(x,Object.assign({},a,r,{checked:Boolean(r.value),hasError:l,onChange:function(n){r.onChange(n),o&&o(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})},exports.DateInput=O,exports.DateInputField=_,exports.DateInputFieldWithLabel=function(n){return i.createElement(i.Fragment,null,i.createElement(E,{htmlFor:n.name},n.label),i.createElement(_,Object.assign({},n)))},exports.Item=j,exports.Body=C,exports.Control=I,exports.Dropdown=R,exports.DropdownField=T,exports.DropdownFieldWithLabel=function(n){return i.createElement(i.Fragment,null,i.createElement(E,{htmlFor:n.name},n.label),i.createElement(T,Object.assign({},n)))},exports.ErrorMessage=function(n){return i.createElement(l.ErrorMessage,{name:n.name,render:function(n){return i.createElement(a.Span,{color:"error",fontSize:0},n)}})},exports.Input=H,exports.InputField=L,exports.InputFieldWithLabel=function(n){return i.createElement(i.Fragment,null,i.createElement(E,{htmlFor:n.name},n.label),i.createElement(L,Object.assign({},n)))},exports.Label=E,exports.Radio=function(n){var e=n.name,r=n.checked,o=n.description,t=n.label,l=W(n,["children","name","checked","description","label"]),s=e+l.value;return i.createElement(G,{htmlFor:s},i.createElement(Y,Object.assign({id:s,name:e,type:"radio",checked:r},l)),i.createElement(U,{checked:r}),i.createElement(a.Box,{display:"block",position:"relative",zIndex:1,width:"calc(100% - 32px)",maxWidth:"calc(100% - 32px)"},t&&i.createElement(q,null,t),o&&i.createElement(a.P,{color:"secondary",fontSize:0,fontWeight:4,lineHeight:0},o)),i.createElement(A,null))},exports.RadioField=K,exports.RadioFieldWithLabel=function(n){var e=n.label,r=W(n,["label"]);return i.createElement(i.Fragment,null,i.createElement(E,{htmlFor:r.name},e),i.createElement(K,Object.assign({},r)))},exports.Select=Q,exports.SelectField=Z,exports.SelectFieldWithLabel=function(n){return i.createElement(i.Fragment,null,i.createElement(E,{htmlFor:n.name},n.label),i.createElement(Z,Object.assign({},n)))},exports.SubGroup=$,exports.Textarea=rn,exports.TextareaField=on,exports.TextareaFieldWithLabel=function(n){return i.createElement(i.Fragment,null,i.createElement(E,{htmlFor:n.name},n.label),i.createElement(on,Object.assign({},n)))},exports.hidden=an,exports.Toggle=un,exports.ToggleField=function(n){var e=n.label;return i.createElement(l.Field,{name:n.name,validate:n.validate},function(n){var r=n.field;return i.createElement(un,Object.assign({label:e},r,{checked:Boolean(r.value)}))})},exports.SSNInput=mn,exports.SSNInputField=bn,exports.SSNInputFieldWithLabel=function(n){return i.createElement(i.Fragment,null,i.createElement(E,{htmlFor:n.name},n.label),i.createElement(bn,Object.assign({},n)))}; | ||
//# sourceMappingURL=index.js.map |
@@ -6,2 +6,3 @@ import * as React from 'react'; | ||
hasError?: boolean; | ||
small?: boolean; | ||
} & React.InputHTMLAttributes<HTMLSelectElement>; | ||
@@ -17,4 +18,5 @@ export declare type SelectFieldProps = { | ||
hasError?: boolean | undefined; | ||
small?: boolean | undefined; | ||
} & React.InputHTMLAttributes<HTMLSelectElement> & React.RefAttributes<HTMLSelectElement>>; | ||
export declare function SelectField({ name, validate, onChange, onBlur, ...rest }: SelectFieldProps): JSX.Element; | ||
export declare function SelectFieldWithLabel(props: SelectFieldWithLabelProps): JSX.Element; |
{ | ||
"name": "@truework/forms", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
295296
2947