@truework/forms
Advanced tools
Comparing version 1.6.0 to 1.7.0
# @truework/forms | ||
## 1.7.0 | ||
### Minor Changes | ||
- af31661: Refactor DateInputTypeIn | ||
## 1.6.0 | ||
@@ -4,0 +10,0 @@ |
import * as React from 'react'; | ||
import { FieldConfig } from 'formik'; | ||
import { InputFieldProps, InputProps } from './Input'; | ||
import { InputProps } from './Input'; | ||
export declare type DateValidationOptions = { | ||
@@ -40,3 +40,14 @@ initialMonth?: number; | ||
} & DateInputFieldProps): JSX.Element; | ||
export declare function DateInputTypeIn({ name, hasError, onChange, onBlur, value, ...rest }: InputProps): JSX.Element; | ||
export declare function DateInputTypeInField({ name, validate, ...rest }: InputFieldProps): JSX.Element; | ||
export declare type DateInputTypeInProps = { | ||
validate?: boolean; | ||
pattern?: string; | ||
minDate?: string; | ||
maxDate?: string; | ||
onUpdate?(date: string): void; | ||
} & InputProps; | ||
export declare function DateInputTypeIn({ hasError, onUpdate, pattern, validate, minDate, maxDate, ...props }: DateInputTypeInProps): JSX.Element; | ||
export declare type DateInputTypeInFieldProps = DateInputTypeInProps & FieldConfig; | ||
export declare function DateInputTypeInField({ name, validate, pattern, ...rest }: DateInputTypeInFieldProps): JSX.Element; | ||
export declare function DateInputTypeInFieldWithLabel(props: { | ||
label: string; | ||
} & DateInputTypeInFieldProps): JSX.Element; |
@@ -1,2 +0,2 @@ | ||
import{space as n,color as r,typography as o}from"styled-system";import e from"react-text-mask";import{useSelect as t}from"use-drop";import i,{css as a}from"styled-components";import{Span as l,H5 as s,Icon as c,Box as d,P as p,Circle as u}from"@truework/ui";import{createElement as h,useState as b,useEffect as m,useCallback as f,Fragment as g,forwardRef as v,Children as x,cloneElement as y}from"react";import{Field as w,ErrorMessage as k}from"formik";import{get as O,times as _}from"lodash";import{clean as z,mask as j,format as E}from"parse-ssn";function B(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}var D=Object.freeze([""]),C=i(c)(D),F=i.div(function(n){var r=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?r.colors.primaryDark:r.colors.outline)+";\n transition-property: background, border-color;\n transition-duration: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.ease+";\n\n "+C+" {\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: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.ease+";\n transform: scale(0);\n }\n "}),T=i(s)(function(n){var r=n.theme;return"\n width: calc(100% - 16px);\n transition-property: color;\n transition-duration: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.ease+";\n "}),I=i.input(function(n){var r=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 ~ "+F+" {\n border-color: "+r.colors.primaryDark+";\n }\n &:checked ~ "+F+" {\n background: "+r.colors.primary+";\n border-color: "+r.colors.primaryDark+";\n\n "+C+" {\n transform: scale(1);\n }\n }\n &:focus ~ "+T+", &:focus ~"+l+", &:checked ~ "+l+" {\n color: "+r.colors.primary+";\n }\n\n "+(n.hasError?"\n & ~ "+F+" {\n border-color: "+r.colors.error+" !important;\n }\n ":"")+"\n "}),P=i.label(function(n){var r=n.theme;return"\n display: flex;\n align-items: flex-start;\n width: 100%;\n margin-bottom: 0 !important;\n\n "+(n.disabled?"\n "+F+" {\n background: "+r.colors.background+";\n }\n "+l+" {\n color: "+r.colors.placeholder+";\n }\n ":"\n &:hover "+F+" {\n border-color: "+r.colors.primaryDark+";\n }\n &:hover "+T+", &:hover "+l+" {\n color: "+r.colors.primary+";\n }\n ")+"\n "}),S=i.div(function(n){var r=n.theme;return"\n width: 100%;\n\n "+P+" {\n padding: "+r.space.sm+";\n border: 1px solid "+r.colors.outline+";\n border-top: none;\n display: flex;\n align-items: center;\n }\n\n "+P+":first-child {\n border-top: 1px solid "+r.colors.outline+";\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n }\n\n "+P+":last-child {\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n }\n "});function R(n){var r=n.children,o=n.name,e=n.checked,t=n.disabled,i=B(n,["children","name","checked","disabled"]);return h(P,{htmlFor:o,disabled:t},h(I,Object.assign({},{id:o,name:o,type:"checkbox",checked:e,disabled:t},i)),h(F,{checked:e},h(C,{name:"Check"})),h(l,{display:"block",width:"calc(100% - 16px)",fontSize:1,lineHeight:1,fontWeight:5,style:{transitionProperty:"color",transitionDuration:"150ms",transitionTimingFunction:"ease-in-out"}},r))}function N(n){var r=n.name,o=n.validate,e=n.onChange,t=n.onBlur,i=B(n,["name","validate","onChange","onBlur"]);return h(w,{name:r,validate:o},function(n){var o=n.field,a=Boolean(O(n.form,["errors",r]));return h(R,Object.assign({},i,o,{checked:Boolean(o.value),hasError:a,onChange:function(n){o.onChange(n),e&&e(n)},onBlur:function(n){o.onBlur(n),t&&t(n)}}))})}function H(n){return n<10?"0"+n:""+n}var V=Object.freeze(["\n display: block;\n position: relative;\n font-weight: 500;\n letter-spacing: 0.6px;\n ","\n ","\n ","\n"]),M=i.label(V,o,r,n);function U(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}M.displayName="Label",M.defaultProps={fontSize:1,lineHeight:1,mb:"xs"};var W=i.input(function(n){var r=n.theme,o=n.small,e=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+r.fonts.roboto+";\n color: "+r.colors.body+";\n font-size: "+(o?r.fontSizes[0]:r.fontSizes[1])+";\n line-height: "+r.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 1px;\n border-radius: 4px;\n min-height: "+(o?"34px":"46px")+";\n padding: "+(o?"10px 16px":"14px 16px")+";\n background: transparent;\n color: "+(n.hasValue?r.colors.body:r.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: "+r.colors.secondary+";\n line-height: "+r.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+r.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+r.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+r.colors.background+";\n cursor: not-allowed;\n }\n }\n &:invalid,\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n outline: 0;\n color: "+r.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(e?r.colors.error:r.colors.primary)+";\n }\n & ~ .__tab {\n border-color: "+(e?r.colors.error:r.colors.primary)+";\n color: "+(e?r.colors.error:r.colors.primary)+";\n }\n }\n "+(o?"\n & ~ .__tab {\n padding: 10px;\n }\n ":"")+"\n\n & ~ .__tab svg {\n max-width: "+(o?"14px":"16px")+";\n max-height: "+(o?"14px":"16px")+";\n }\n"});W.displayName="InputElement";var Y=v(function(n,r){var o=n.hasError,e=n.preTab,t=n.postTab,i=U(n,["hasError","preTab","postTab"]),a=Boolean(e),l=e||t;return h(d,{display:"flex",ml:"-2px",mr:"-2px",p:"2px"},h(W,Object.assign({},{ref:r,hasError:o},i)),l&&h(d,{className:"__tab","aria-hidden":"true",display:"flex",alignItems:"center",justifyContent:"center",px:"sm",zIndex:1,color:o?"error":"secondary",bg:o?"#FDEBF0":"background",borderTopLeftRadius:a?"4px":"0",borderBottomLeftRadius:a?"4px":"0",borderTopRightRadius:a?"0":"4px",borderBottomRightRadius:a?"0":"4px",border:["1px solid",o?"error":"outline"],order:a?-1:1,transitionProperty:"border-color, color",transitionDuration:"fast",transitionTimingFunction:"ease"},l),h(d,{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"}),h(d,{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"}))});function A(n){var r=n.name,o=n.validate,e=n.onChange,t=n.onBlur,i=U(n,["name","validate","onChange","onBlur"]);return h(w,{name:r,validate:o},function(n){var o=n.field,a=Boolean(O(n.form,["errors",r]));return h(Y,Object.assign({},i,o,{hasError:a,onChange:function(n){o.onChange(n),e&&e(n)},onBlur:function(n){o.onBlur(n),t&&t(n)}}))})}function L(n){return h(g,null,h(M,{htmlFor:n.name},n.label),h(A,Object.assign({},n)))}function X(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}var q=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 &:hover {\n opacity: 1;\n }\n "]),G=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 "]),J=i.select(function(n){var r=n.theme,o=n.hasError;return a(G,r.fonts.roboto,r.colors.body,r.fontSizes[1],r.fonts.mono,r.lineHeights[0],r.space.sm,r.space.sm,n.hasValue?r.colors.body:r.colors.secondary,function(n){return n.theme.colors.placeholder},r.colors.background,r.colors.body,o?r.colors.error:r.colors.primary,o?r.colors.error:r.colors.primary,o?r.colors.error:r.colors.primary)}),K=i.button(function(n){var r=n.theme;return a(q,r.colors.secondary,r.transitionDurations.fast,r.transitionTimingFunctions.ease)});function Q(n){var r=n.name,o=n.label;void 0===o&&(o="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 s=n.minDay;void 0===s&&(s=1);var p=n.minYear;void 0===p&&(p=1980);var u=n.maxMonth;void 0===u&&(u=12);var g=n.maxDay;void 0===g&&(g=31);var v=n.maxYear;void 0===v&&(v=2030);var x=n.hasError,y=n.onUpdate,w=b(t),k=w[0],O=w[1],z=b(i),j=z[0],E=z[1],B=b(a),D=B[0],C=B[1],F=function(n){return new Date(n.year,n.month,0).getUTCDate()}({year:D||2020,month:k});m(function(){y(D&&k&&j?D+"-"+H(k)+"-"+H(j):"")},[k,j,D]);var T=f(function(){O(0),E(0),C(0)},[O,E,C]);return h(d,{ml:"-2px",mr:"-2px",p:"2px"},h(d,{display:"flex",alignItems:"center",height:"48px",pl:"56px"},h(J,{name:r+"-month",value:k,disabled:e,onChange:function(n){O(parseInt(n.target.value,10))},"aria-label":o+": Month",hasValue:Boolean(k),hasError:x},h("option",{value:"0",disabled:!0},"mm"),_(u-l+1,function(){return""}).map(function(n,r){var o=l+r;return h("option",{key:o,value:o},H(o))})),h(d,{height:"50%",width:"1px",bg:x?"error":"outline",zIndex:2,transform:"rotate(10deg)"}),h(J,{name:r+"-day",value:j,disabled:e,onChange:function(n){E(parseInt(n.target.value,10))},"aria-label":o+": Day",hasValue:Boolean(j),hasError:x},h("option",{value:"0",disabled:!0},"dd"),_(Math.min(g,F)-s+1,function(){return""}).map(function(n,r){var o=s+r;return h("option",{key:o,value:o},H(o))})),h(d,{height:"50%",width:"1px",bg:x?"error":"outline",zIndex:2,transform:"rotate(10deg)"}),h(J,{name:r+"-year",value:D,disabled:e,onChange:function(n){C(parseInt(n.target.value,10))},"aria-label":o+": Year",hasValue:Boolean(D),hasError:x},h("option",{value:"0",disabled:!0},"yyyy"),_(v-p+1,function(n){return p+n}).map(function(n){return h("option",{key:n,value:n},n)})),(k||j||D)&&h(K,{title:"Clear",onClick:T},h(c,{name:"X",width:"12px",height:"12px"})),h(d,{className:"__bg",bg:x?"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"}),h(d,{className:"__border",bg:"white",border:["1px solid",x?"error":"outline"],position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"},h(d,{"aria-hidden":"true",position:"absolute",top:"0",left:"0",display:"flex",alignItems:"center",justifyContent:"center",px:"sm",height:"100%",zIndex:0,color:x?"error":"secondary",bg:x?"#FDEBF0":"background",borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px",borderRight:["1px solid",x?"error":"outline"],transitionProperty:"border-color, color",transitionDuration:"fast",transitionTimingFunction:"ease"},h(c,{name:"Calendar"})))))}function Z(n){var r=n.name,o=n.validate,e=X(n,["name","validate"]);return h(w,{name:r,validate:o},function(n){var o=n.field,t=n.form,i=Boolean(O(t,["errors",r])),a=(o.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=""),h(Q,Object.assign({},{name:r},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(r,n)}}))})}function $(n){return h(g,null,h(M,{htmlFor:n.name},n.label),h(Z,Object.assign({},n)))}var nn=[/\d/,/\d/,"/",/\d/,/\d/,"/",/\d/,/\d/,/\d/,/\d/];function rn(n){var r=n.name,o=n.hasError,t=n.onChange,i=n.onBlur,a=n.value,l=X(n,["name","hasError","onChange","onBlur","value"]);return h(e,{name:r,mask:nn,id:"date",placeholder:"mm/dd/yyyy",type:"text",onChange:t,onBlur:i,value:a,render:function(n,e){return h(Y,Object.assign({},{name:r,ref:n,hasError:o},e,l))}})}function on(n){var r=n.name,o=n.validate,e=X(n,["name","validate"]),t=f(function(n){if(n){var r=require("moment"),o=n.split("/").map(function(n){return parseInt(n)}),e=o[2];return e<1900?"The date you entered is not a valid date.":r([e,o[0]-1,o[1]]).isValid()?void 0:"The date you entered is not a valid date."}},[]);return h(w,{name:r,validate:function(n){return o&&o(n)||t(n)}},function(n){var o=n.field,t=Boolean(O(n.form,["errors",r]));return h(rn,Object.assign({},o,e,{name:r,hasError:t}))})}function en(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}var tn=i(d)(function(n){var r=n.theme,o=n.selected,e=n.highlighted;return"\n display: flex;\n align-items: center;\n padding: "+r.space.sm+";\n color: "+(o||e?r.colors.body:r.colors.secondary)+";\n background-color: "+(o||e?r.colors.background:"white")+";\n cursor: pointer;\n font-size: "+r.fontSizes[1]+";\n font-weight: 400;\n line-height: "+r.lineHeights[1]+";\n letter-spacing: 0.6px;\n\n &:hover {\n background: "+r.colors.background+";\n }\n"});function an(n){var r=n.children,o=en(n,["children"]);return h(tn,Object.assign({},{as:"li"},o),r)}var ln=v(function(n,r){var o=n.children,e=en(n,["children"]);return h(d,Object.assign({},{ref:r,as:"ul",boxShadow:"medium",borderRadius:2,overflow:"auto",width:"100%",bg:"white"},e),o)});ln.displayName="Body";var sn=i.button(function(n){var r=n.theme,o=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: "+r.fontSizes[1]+";\n font-weight: 400;\n line-height: "+r.lineHeights[1]+";\n color: "+r.colors.secondary+";\n transition-property: color;\n transition-duration: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.ease+";\n\n "+(n.disabled?"\n background: transparent;\n color: "+r.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+r.colors.background+";\n cursor: not-allowed;\n }\n ":"\n &:active,\n &:focus,\n &:hover {\n outline: 0;\n color: "+r.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(o?r.colors.error:r.colors.primary)+";\n\n div {\n border-color: "+(o?r.colors.error:r.colors.primary)+";\n color: "+(o?r.colors.error:r.colors.primary)+";\n }\n }\n }\n ")+"\n\n "+(n.isActive?"\n outline: 0;\n color: "+r.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(o?r.colors.error:r.colors.primary)+";\n\n div {\n border-color: "+(o?r.colors.error:r.colors.primary)+";\n color: "+(o?r.colors.error:r.colors.primary)+";\n }\n }\n ":"")+"\n"});sn.displayName="ControlOuter";var cn=v(function(n,r){var o=n.children,e=n.isActive,t=n.hasError,i=en(n,["children","isActive","hasError"]);return h("div",{style:{position:"relative"}},h(sn,Object.assign({},{ref:r,isActive:e,hasError:t,type:"button"},i),h(l,{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},h(l,{width:"100%",fontWeight:4,style:{whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",letterSpacing:"0.6px"}},o),h(c,{name:"ChevronDown",ml:"xs"}))),h(d,{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"}),h(d,{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 dn(n){var r=n.value,o=n.placeholder;return O(n.items.filter(function(n){return n.value===r})[0],"label")||o||"Please select"}function pn(n){var r=n.value,o=n.placeholder,e=n.label,i=n.items,a=n.hasError,l=n.disabled,s=n.onSelect,c=n.onRemove,p=b(dn({items:i,value:r,placeholder:o})),u=p[0],f=p[1];m(function(){f(dn({items:i,value:r,placeholder:o}))},[i,r,o]);var g=t({items:i.map(function(n){return Object.assign({},n,{selected:n.value===r})}),onSelect:function(n){f(n.label),s&&s(n)},onRemove:function(n){f(o||"Please select"),c&&c(n)}}),v=g.items,x=g.isOpen,y=g.getDropProps;return h(d,null,h(cn,Object.assign({},{id:g.id},l?{}:(0,g.getControlProps)(),{"aria-label":e,isActive:x,hasError:a,disabled:l}),u),x&&h(d,{position:"absolute",bottom:"0",width:"100%",transform:"translateY(100%) translateY(6px)",zIndex:1e3},h(ln,Object.assign({},y(),{style:{maxHeight:"240px",overflow:"auto"}}),v.map(function(n){return h(an,Object.assign({},{key:n.value,selected:n.selected,highlighted:n.highlighted},n.getItemProps()),n.label)}))))}function un(n){var r=n.name,o=n.validate,e=en(n,["name","validate"]);return h(w,{name:r,validate:o},function(n){var r=n.field,o=n.form,t=Boolean(o.errors&&o.errors[r.name]);return h(pn,Object.assign({},e,{hasError:t,onSelect:function(n){o.setFieldValue(r.name,n.value),e.onSelect&&e.onSelect(n)}}))})}function hn(n){return h(g,null,h(M,{htmlFor:n.name},n.label),h(un,Object.assign({},n)))}function bn(n){return h(k,{name:n.name,render:function(n){return h(l,{color:"error",fontSize:0},n)}})}function mn(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}cn.displayName="Control";var fn=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"]),gn=i.span(function(n){var r=n.theme;return"\n display: block;\n font-size: "+r.fontSizes[1]+";\n font-weight: "+r.fontWeights[5]+";\n line-height: "+r.lineHeights[0]+";\n transition-property: color;\n transition-duration: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.ease+";\n "}),vn=i.div(function(n){var r=n.theme;return"\n width: 100%;\n border: 1px solid "+r.colors.outline+";\n border-radius: 4px;\n\n "+kn+" {\n padding: "+r.space.sm+";\n border-top: 1px solid "+r.colors.outline+";\n\n &:first-of-type {\n border-top: 0;\n }\n }\n\n "+(n.hasError?"\n border-color: "+r.colors.error+" !important;\n\n & "+kn+" {\n border-color: "+r.colors.error+" !important;\n }\n ":"")+"\n "}),xn=i.div(function(n){var r=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?r.colors.primaryDark:r.colors.outline)+";\n z-index: 1;\n transition-property: background, border-color;\n transition-duration: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.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: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.ease+";\n transform: scale(0);\n }\n "}),yn=i.input(function(n){var r=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 ~ "+xn+" {\n border-color: "+r.colors.primaryDark+";\n }\n &:focus ~ "+d+" "+gn+" {\n color: "+r.colors.primary+";\n }\n\n &:checked ~ "+xn+" {\n background: "+r.colors.primary+";\n border-color: "+r.colors.primaryDark+";\n\n &::after {\n transform: scale(1);\n }\n }\n &:checked ~ "+d+" "+gn+" {\n color: "+r.colors.primary+";\n }\n\n &:disabled ~ "+xn+" {\n border-color: "+r.colors.outline+" !important;\n }\n &:disabled ~ "+wn+" {\n background-color: "+r.colors.background+";\n }\n &:disabled ~ "+d+" "+gn+" {\n color: "+r.colors.secondary+" !important;\n }\n "}),wn=i.span(fn),kn=i.label(function(n){var r=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 "+xn+" {\n border-color: "+r.colors.primaryDark+";\n }\n &:hover "+gn+" {\n color: "+r.colors.primary+";\n }\n "});function On(n){var r=n.name,o=n.checked,e=n.description,t=n.label,i=mn(n,["children","name","checked","description","label"]),a=r+i.value;return h(kn,{htmlFor:a},h(yn,Object.assign({},{id:a,name:r,type:"radio",checked:o},i)),h(xn,{checked:o}),h(d,{display:"block",position:"relative",zIndex:1,width:"calc(100% - 32px)",maxWidth:"calc(100% - 32px)"},t&&h(gn,null,t),e&&h(p,{mt:"xxs",color:"secondary",fontSize:0,fontWeight:4,lineHeight:0},e)),h(wn,null))}function _n(n){var r=n.children,o=n.name,e=n.validate,t=n.onChange,i=n.onBlur,a=mn(n,["children","name","validate","onChange","onBlur"]);return h(w,{name:o,validate:e},function(n){var e=n.field,l=Boolean(O(n.form,["errors",o]));return h(vn,{hasError:l},x.toArray(r).map(function(n){return y(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 zn(n){var r=n.label,o=mn(n,["label"]);return h(g,null,h(M,{htmlFor:o.name},r),h(_n,Object.assign({},o)))}function jn(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}var En=i.select(function(n){var r=n.theme,o=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+r.fonts.roboto+";\n color: "+r.colors.body+";\n font-size: "+r.fontSizes[1]+";\n line-height: "+r.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 0;\n min-height: 48px;\n padding: "+r.space.sm+";\n background: transparent;\n color: "+(n.hasValue?r.colors.body:r.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: "+r.colors.secondary+";\n line-height: "+r.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+r.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+r.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+r.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: "+r.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(o?r.colors.error:r.colors.primary)+";\n\n div {\n border-color: "+(o?r.colors.error:r.colors.primary)+";\n color: "+(o?r.colors.error:r.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: "+r.fontSizes[0]+";\n line-height: "+r.lineHeights[0]+";\n ")+"\n"});En.displayName="SelectElement";var Bn=v(function(n,r){var o=n.children,e=n.hasError,t=n.placeholder;void 0===t&&(t="");var i=jn(n,["children","hasError","placeholder"]);return h(d,{ml:"-2px",mr:"-2px",p:"2px"},h(En,Object.assign({},{ref:r,hasValue:Boolean(i.value),hasError:e},i,{value:i.value||""}),t&&h("option",{value:"",disabled:!0},t),o),h(d,{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"}),h(d,{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"}),h(d,{position:"absolute",right:"0",top:"0",bottom:"0",height:"16px",my:"auto",pr:"sm",style:{pointerEvents:"none"}},h(c,{name:"ChevronDown",color:"secondary"})))});function Dn(n){var r=n.name,o=n.validate,e=n.onChange,t=n.onBlur,i=jn(n,["name","validate","onChange","onBlur"]);return h(w,{name:r,validate:o},function(n){var o=n.field,a=Boolean(O(n.form,["errors",r]));return h(Bn,Object.assign({},i,o,{hasError:a,onChange:function(n){o.onChange(n),e&&e(n)},onBlur:function(n){o.onBlur(n),t&&t(n)}}))})}function Cn(n){return h(g,null,h(M,{htmlFor:n.name},n.label),h(Dn,Object.assign({},n)))}var Fn=i(d)(function(n){return"\n border-left: 2px solid currentColor;\n padding-left: "+n.theme.space.sm+";\n "});function Tn(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}var In=i.textarea(function(n){var r=n.theme,o=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+r.fonts.roboto+";\n color: "+r.colors.body+";\n font-size: "+r.fontSizes[1]+";\n line-height: "+r.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 0;\n min-height: 48px;\n padding: "+r.space.sm+";\n background: transparent;\n color: "+(n.hasValue?r.colors.body:r.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: "+r.colors.secondary+";\n line-height: "+r.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+r.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+r.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+r.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: "+r.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(o?r.colors.error:r.colors.primary)+";\n\n div {\n border-color: "+(o?r.colors.error:r.colors.primary)+";\n color: "+(o?r.colors.error:r.colors.primary)+";\n }\n }\n }\n"});In.displayName="TextareaElement",In.defaultProps={rows:4};var Pn=v(function(n,r){var o=n.hasError,e=Tn(n,["hasError"]);return h(d,{ml:"-2px",mr:"-2px",p:"2px"},h(In,Object.assign({},{ref:r,hasError:o},e)),h(d,{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"}),h(d,{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"}))});function Sn(n){var r=n.name,o=n.validate,e=n.onChange,t=n.onBlur,i=Tn(n,["name","validate","onChange","onBlur"]);return h(w,{name:r,validate:o},function(n){var o=n.field,a=Boolean(O(n.form,["errors",r]));return h(Pn,Object.assign({},i,o,{hasError:a,onChange:function(n){o.onChange(n),e&&e(n)},onBlur:function(n){o.onBlur(n),t&&t(n)}}))})}function Rn(n){return h(g,null,h(M,{htmlFor:n.name},n.label),h(Sn,Object.assign({},n)))}var Nn=Object.freeze(["\n display: block;\n position: relative;\n cursor: pointer;\n"]),Hn=i.label(Nn),Vn=i.div(function(n){var r=n.theme;return"\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n width: 100%;\n padding: "+r.space.med+" "+r.space.sm+";\n color: "+r.colors.body+";\n background-color: "+r.colors.background+";\n border: 1px solid "+(n.hasError?r.colors.error:r.colors.outline)+";\n border-radius: "+r.space.xxs+";\n transition-property: color, background-color, border-color;\n transition-duration: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.ease+";\n"}),Mn=i.input(function(n){var r=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 &:checked\n ~ "+Vn+",\n &:hover\n ~ "+Vn+",\n &:focus\n ~ "+Vn+" {\n border: 1px solid "+r.colors.primary+";\n background-color: rgba(91, 99, 254, 0.1);\n }\n\n &:checked ~ "+Vn+" {\n color: "+r.colors.primary+";\n }\n"});function Un(n){var r=n.icon,o=n.label,e=n.hasError,t=function(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}(n,["icon","label","hasError"]),i=t.name+t.value;return h(Hn,{htmlFor:i},h(Mn,Object.assign({},{id:i,type:"radio"},t)),h(Vn,{hasError:e},r&&h(u,{mb:"xs",background:"white",width:"48px",height:"48px"},r),h(l,{display:"flex",justifyContent:"center",minHeight:"32px",fontSize:0,fontWeight:5,lineHeight:0,width:"100%"},o)))}var Wn=Object.freeze(["\n ","\n"]),Yn="\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",An=i.div(function(n){var r=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 "+r.colors.outline+";\n color: white;\n background: white;\n stroke: white;\n transition-property: transform, background, border-color;\n transition-duration: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.natural+";\n"}),Ln=i.div(function(n){var r=n.theme;return"\n position: relative;\n width: 56px;\n height: 32px;\n border-radius: 100px;\n border: 1px solid "+r.colors.outline+";\n background: "+r.colors.background+";\n cursor: pointer;\n transition-property: background, border-color;\n transition-duration: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.natural+";\n "}),Xn=i.label(function(n){return"\n display: flex;\n align-items: center;\n margin-bottom: 0 !important;\n\n &:hover "+Ln+" {\n "+An+" {\n border-color: "+n.theme.colors.primaryDark+";\n }\n }\n "}),qn=i.input(function(n){var r=n.theme;return"\n "+Yn+"\n\n &:focus ~ "+Ln+" {\n border-color: "+r.colors.primary+";\n }\n &:checked ~ "+Ln+" {\n border-color: "+r.colors.primary+";\n\n "+An+" {\n background: "+r.colors.primary+";\n border-color: "+r.colors.primaryDark+";\n transform: translateX(24px);\n }\n }\n &:disabled ~ "+Ln+" {\n pointer-events: none;\n "+An+" {\n border-color: "+r.colors.outline+";\n }\n }\n "}),Gn=i.span(Wn,Yn);function Jn(n){var r=n.label,o=n.name,e=n.checked,t=function(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}(n,["label","name","checked"]);return h(Xn,{htmlFor:o},h(qn,Object.assign({},{id:o,name:o,type:"checkbox",checked:e},t)),h(Ln,null,h(An,null,h(c,{name:"Check",width:"12px",height:"12px",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",m:"auto",style:{strokeWidth:"2px"}}))),h(Gn,null,r))}function Kn(n){var r=n.label;return h(w,{name:n.name,validate:n.validate},function(n){var o=n.field;return h(Jn,Object.assign({},{label:r},o,{checked:Boolean(o.value)}))})}function Qn(n){var r=n.value;void 0===r&&(r="");var o=n.masker;void 0===o&&(o="*");var e=n.separator;void 0===e&&(e="-");var t=b(r),i=t[0],a=t[1],l=b(!1),s=l[1],c=l[0]?i:E(j(i,o),e),d=f(function(){s(!0)},[s]),p=f(function(){s(!1)},[s]);return m(function(){n.onUpdate&&n.onUpdate(i)},[i,n.onUpdate]),h(Y,Object.assign({},n,{value:c,onFocus:d,onClick:d,onBlur:p,onChange:function(n){var r=n.target.value,o=/\*\*/.test(r);a(o?"":z(r))}}))}function Zn(n){var r=n.name,o=n.validate,e=function(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}(n,["name","validate"]);return h(w,{name:r,validate:o},function(n){var o=n.field,t=n.form,i=Boolean(O(t,["errors",r])),a=f(function(n){t.setFieldValue(r,n)},[r,t.setFieldValue]);return h(Qn,Object.assign({},e,o,{hasError:i,onUpdate:a}))})}function $n(n){return h(g,null,h(M,{htmlFor:n.name},n.label),h(Zn,Object.assign({},n)))}export{S as CheckboxGroup,R as Checkbox,N as CheckboxField,Q as DateInput,Z as DateInputField,$ as DateInputFieldWithLabel,rn as DateInputTypeIn,on as DateInputTypeInField,an as Item,ln as Body,cn as Control,pn as Dropdown,un as DropdownField,hn as DropdownFieldWithLabel,bn as ErrorMessage,Y as Input,A as InputField,L as InputFieldWithLabel,M as Label,On as Radio,_n as RadioField,zn as RadioFieldWithLabel,Bn as Select,Dn as SelectField,Cn as SelectFieldWithLabel,Fn as SubGroup,Pn as Textarea,Sn as TextareaField,Rn as TextareaFieldWithLabel,Un as Tile,Yn as hidden,Jn as Toggle,Kn as ToggleField,Qn as SSNInput,Zn as SSNInputField,$n as SSNInputFieldWithLabel}; | ||
import{picomask as n,transform as r}from"picomask";import{space as o,color as e,typography as t}from"styled-system";import{useSelect as i}from"use-drop";import a,{css as l}from"styled-components";import{Span as s,H5 as c,Icon as d,Box as p,P as u,Circle as b}from"@truework/ui";import{createElement as h,useState as m,useEffect as f,useCallback as g,Fragment as v,useRef as x,useLayoutEffect as y,forwardRef as w,Children as k,cloneElement as O}from"react";import{Field as _,ErrorMessage as D}from"formik";import{get as z,times as j}from"lodash";import{clean as E,mask as F,format as B}from"parse-ssn";function C(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}var T=Object.freeze([""]),I=a(d)(T),P=a.div(function(n){var r=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?r.colors.primaryDark:r.colors.outline)+";\n transition-property: background, border-color;\n transition-duration: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.ease+";\n\n "+I+" {\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: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.ease+";\n transform: scale(0);\n }\n "}),S=a(c)(function(n){var r=n.theme;return"\n width: calc(100% - 16px);\n transition-property: color;\n transition-duration: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.ease+";\n "}),R=a.input(function(n){var r=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 ~ "+P+" {\n border-color: "+r.colors.primaryDark+";\n }\n &:checked ~ "+P+" {\n background: "+r.colors.primary+";\n border-color: "+r.colors.primaryDark+";\n\n "+I+" {\n transform: scale(1);\n }\n }\n &:focus ~ "+S+", &:focus ~"+s+", &:checked ~ "+s+" {\n color: "+r.colors.primary+";\n }\n\n "+(n.hasError?"\n & ~ "+P+" {\n border-color: "+r.colors.error+" !important;\n }\n ":"")+"\n "}),N=a.label(function(n){var r=n.theme;return"\n display: flex;\n align-items: flex-start;\n width: 100%;\n margin-bottom: 0 !important;\n\n "+(n.disabled?"\n "+P+" {\n background: "+r.colors.background+";\n }\n "+s+" {\n color: "+r.colors.placeholder+";\n }\n ":"\n &:hover "+P+" {\n border-color: "+r.colors.primaryDark+";\n }\n &:hover "+S+", &:hover "+s+" {\n color: "+r.colors.primary+";\n }\n ")+"\n "}),H=a.div(function(n){var r=n.theme;return"\n width: 100%;\n\n "+N+" {\n padding: "+r.space.sm+";\n border: 1px solid "+r.colors.outline+";\n border-top: none;\n display: flex;\n align-items: center;\n }\n\n "+N+":first-child {\n border-top: 1px solid "+r.colors.outline+";\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n }\n\n "+N+":last-child {\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n }\n "});function V(n){var r=n.children,o=n.name,e=n.checked,t=n.disabled,i=C(n,["children","name","checked","disabled"]);return h(N,{htmlFor:o,disabled:t},h(R,Object.assign({},{id:o,name:o,type:"checkbox",checked:e,disabled:t},i)),h(P,{checked:e},h(I,{name:"Check"})),h(s,{display:"block",width:"calc(100% - 16px)",fontSize:1,lineHeight:1,fontWeight:5,style:{transitionProperty:"color",transitionDuration:"150ms",transitionTimingFunction:"ease-in-out"}},r))}function M(n){var r=n.name,o=n.validate,e=n.onChange,t=n.onBlur,i=C(n,["name","validate","onChange","onBlur"]);return h(_,{name:r,validate:o},function(n){var o=n.field,a=Boolean(z(n.form,["errors",r]));return h(V,Object.assign({},i,o,{checked:Boolean(o.value),hasError:a,onChange:function(n){o.onChange(n),e&&e(n)},onBlur:function(n){o.onBlur(n),t&&t(n)}}))})}var U="yyyy-mm-dd",A=["January","February","March","April","May","June","July","August","September","October","November","December"];function Y(n){return new Date(n.year,n.month,0).getUTCDate()}function W(n){return n<10?"0"+n:""+n}function L(n){return n.replace(/[^\d]/g,"").slice(0,8)}function J(o){var e=o.date,t=o.min,i=o.max,a=o.pattern;void 0===a&&(a=U);var l=n(e,U),s=l.y,c=l.m,d=l.d,p=parseInt(s),u=parseInt(c),b=parseInt(d),h=Y({month:u,year:p});return u>12?"There are only 12 months":"00"===d?"Day cannot be 0":"00"===c?"Month cannot be 0":"0000"===s?"Year cannot be 0":b>h?"There are only "+h+" days in "+A[u-1]+" "+p:t&&new Date(e)<new Date(t)?"Date must be after "+r(n(t,U),a).value:i&&new Date(e)>new Date(i)?"Date must be before "+r(n(i,U),a).value:void 0}var X=Object.freeze(["\n display: block;\n position: relative;\n font-weight: 500;\n letter-spacing: 0.6px;\n ","\n ","\n ","\n"]),q=a.label(X,t,e,o);function G(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}q.displayName="Label",q.defaultProps={fontSize:1,lineHeight:1,mb:"xs"};var K=a.input(function(n){var r=n.theme,o=n.small,e=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+r.fonts.roboto+";\n color: "+r.colors.body+";\n font-size: "+(o?r.fontSizes[0]:r.fontSizes[1])+";\n line-height: "+r.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 1px;\n border-radius: 4px;\n min-height: "+(o?"34px":"46px")+";\n padding: "+(o?"10px 16px":"14px 16px")+";\n background: transparent;\n color: "+(n.hasValue?r.colors.body:r.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: "+r.colors.secondary+";\n line-height: "+r.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+r.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+r.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+r.colors.background+";\n cursor: not-allowed;\n }\n }\n &:invalid,\n &:not(:disabled):active,\n &:not(:disabled):focus,\n &:not(:disabled):hover {\n outline: 0;\n color: "+r.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(e?r.colors.error:r.colors.primary)+";\n }\n & ~ .__tab {\n border-color: "+(e?r.colors.error:r.colors.primary)+";\n color: "+(e?r.colors.error:r.colors.primary)+";\n }\n }\n "+(o?"\n & ~ .__tab {\n padding: 10px;\n }\n ":"")+"\n\n & ~ .__tab svg {\n max-width: "+(o?"14px":"16px")+";\n max-height: "+(o?"14px":"16px")+";\n }\n"});K.displayName="InputElement";var Q=w(function(n,r){var o=n.hasError,e=n.preTab,t=n.postTab,i=G(n,["hasError","preTab","postTab"]),a=Boolean(e),l=e||t;return h(p,{display:"flex",ml:"-2px",mr:"-2px",p:"2px"},h(K,Object.assign({},{ref:r,hasError:o},i)),l&&h(p,{className:"__tab","aria-hidden":"true",display:"flex",alignItems:"center",justifyContent:"center",px:"sm",zIndex:1,color:o?"error":"secondary",bg:o?"#FDEBF0":"background",borderTopLeftRadius:a?"4px":"0",borderBottomLeftRadius:a?"4px":"0",borderTopRightRadius:a?"0":"4px",borderBottomRightRadius:a?"0":"4px",border:["1px solid",o?"error":"outline"],order:a?-1:1,transitionProperty:"border-color, color",transitionDuration:"fast",transitionTimingFunction:"ease"},l),h(p,{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"}),h(p,{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"}))});function Z(n){var r=n.name,o=n.validate,e=n.onChange,t=n.onBlur,i=G(n,["name","validate","onChange","onBlur"]);return h(_,{name:r,validate:o},function(n){var o=n.field,a=Boolean(z(n.form,["errors",r]));return h(Q,Object.assign({},i,o,{hasError:a,onChange:function(n){o.onChange(n),e&&e(n)},onBlur:function(n){o.onBlur(n),t&&t(n)}}))})}function $(n){return h(v,null,h(q,{htmlFor:n.name},n.label),h(Z,Object.assign({},n)))}function nn(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}var rn=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 &:hover {\n opacity: 1;\n }\n "]),on=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 "]),en=a.select(function(n){var r=n.theme,o=n.hasError;return l(on,r.fonts.roboto,r.colors.body,r.fontSizes[1],r.fonts.mono,r.lineHeights[0],r.space.sm,r.space.sm,n.hasValue?r.colors.body:r.colors.secondary,function(n){return n.theme.colors.placeholder},r.colors.background,r.colors.body,o?r.colors.error:r.colors.primary,o?r.colors.error:r.colors.primary,o?r.colors.error:r.colors.primary)}),tn=a.button(function(n){var r=n.theme;return l(rn,r.colors.secondary,r.transitionDurations.fast,r.transitionTimingFunctions.ease)});function an(n){var r=n.name,o=n.label;void 0===o&&(o="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 s=n.minDay;void 0===s&&(s=1);var c=n.minYear;void 0===c&&(c=1980);var u=n.maxMonth;void 0===u&&(u=12);var b=n.maxDay;void 0===b&&(b=31);var v=n.maxYear;void 0===v&&(v=2030);var x=n.hasError,y=n.onUpdate,w=m(t),k=w[0],O=w[1],_=m(i),D=_[0],z=_[1],E=m(a),F=E[0],B=E[1],C=Y({year:F||2020,month:k});f(function(){y(F&&k&&D?F+"-"+W(k)+"-"+W(D):"")},[k,D,F]);var T=g(function(){O(0),z(0),B(0)},[O,z,B]);return h(p,{ml:"-2px",mr:"-2px",p:"2px"},h(p,{display:"flex",alignItems:"center",height:"48px",pl:"56px"},h(en,{name:r+"-month",value:k,disabled:e,onChange:function(n){O(parseInt(n.target.value,10))},"aria-label":o+": Month",hasValue:Boolean(k),hasError:x},h("option",{value:"0",disabled:!0},"mm"),j(u-l+1,function(){return""}).map(function(n,r){var o=l+r;return h("option",{key:o,value:o},W(o))})),h(p,{height:"50%",width:"1px",bg:x?"error":"outline",zIndex:2,transform:"rotate(10deg)"}),h(en,{name:r+"-day",value:D,disabled:e,onChange:function(n){z(parseInt(n.target.value,10))},"aria-label":o+": Day",hasValue:Boolean(D),hasError:x},h("option",{value:"0",disabled:!0},"dd"),j(Math.min(b,C)-s+1,function(){return""}).map(function(n,r){var o=s+r;return h("option",{key:o,value:o},W(o))})),h(p,{height:"50%",width:"1px",bg:x?"error":"outline",zIndex:2,transform:"rotate(10deg)"}),h(en,{name:r+"-year",value:F,disabled:e,onChange:function(n){B(parseInt(n.target.value,10))},"aria-label":o+": Year",hasValue:Boolean(F),hasError:x},h("option",{value:"0",disabled:!0},"yyyy"),j(v-c+1,function(n){return c+n}).map(function(n){return h("option",{key:n,value:n},n)})),(k||D||F)&&h(tn,{title:"Clear",onClick:T},h(d,{name:"X",width:"12px",height:"12px"})),h(p,{className:"__bg",bg:x?"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"}),h(p,{className:"__border",bg:"white",border:["1px solid",x?"error":"outline"],position:"absolute",top:"0",bottom:"0",left:"0",right:"0",zIndex:0,borderRadius:"4px",transitionProperty:"border-color",transitionDuration:"fast",transitionTimingFunction:"ease"},h(p,{"aria-hidden":"true",position:"absolute",top:"0",left:"0",display:"flex",alignItems:"center",justifyContent:"center",px:"sm",height:"100%",zIndex:0,color:x?"error":"secondary",bg:x?"#FDEBF0":"background",borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px",borderRight:["1px solid",x?"error":"outline"],transitionProperty:"border-color, color",transitionDuration:"fast",transitionTimingFunction:"ease"},h(d,{name:"Calendar"})))))}function ln(n){var r=n.name,o=n.validate,e=nn(n,["name","validate"]);return h(_,{name:r,validate:o},function(n){var o=n.field,t=n.form,i=Boolean(z(t,["errors",r])),a=(o.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=""),h(an,Object.assign({},{name:r},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(r,n)}}))})}function sn(n){return h(v,null,h(q,{htmlFor:n.name},n.label),h(ln,Object.assign({},n)))}function cn(o){var e=o.hasError,t=o.onUpdate,i=o.pattern;void 0===i&&(i=U);var a=o.validate,l=o.minDate,c=o.maxDate,p=nn(o,["hasError","onUpdate","pattern","validate","minDate","maxDate"]),u=x(null),b=x(0),w=m(!1),k=w[0],O=w[1],_=m(""),D=_[0],z=_[1],j=m(L(p.value?r(n(String(p.value),U),i).value:"")),E=j[0],F=j[1],B=n(E,i),C=g(function(n){0===E.length?z(""):E.length<8&&z("Please enter a valid date matching "+i)},[E,z]),T=g(function(r){r.persist(),k||O(!0);var o=r.target.value,e=L(o),t=L(o.slice(0,r.target.selectionEnd||0)),a=n(t,i).value;b.current=a.length,F(e)},[E,F]);return y(function(){u.current&&u.current.setSelectionRange(b.current,b.current)},[E]),f(function(){if(8===E.length){var o=J({date:r(n(E,i),U).value,min:l,max:c,pattern:i});if(z(o||""),k){var e=n(E,i);t&&t(o?"":e.y+"-"+e.m+"-"+e.d)}}else z("")},[E,i,l,c,k,t,z]),h(v,null,h(Q,Object.assign({},{ref:u,preTab:h(d,{name:"Calendar"}),placeholder:i},p,{hasError:a&&Boolean(D)||e,value:B.value,onChange:T,onBlur:function(n){T(n),C(n)}})),a&&D&&h(s,{color:"error",fontSize:0},D))}function dn(n){var r=n.name,o=n.validate,e=n.pattern;void 0===e&&(e=U);var t=nn(n,["name","validate","pattern"]);return h(_,{name:r,validate:o},function(n){var o=n.field,i=n.form,a=Boolean(z(i,["errors",r])),l=g(function(n){i.setFieldValue(r,n),i.setFieldError(r,J({date:n,min:t.minDate,max:t.maxDate,pattern:e}))},[r,i.setFieldValue,i.setFieldError]);return h(cn,Object.assign({},t,o,{pattern:e,hasError:a,onUpdate:l}))})}function pn(n){return h(v,null,h(q,{htmlFor:n.name},n.label),h(dn,Object.assign({},n)))}function un(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}var bn=a(p)(function(n){var r=n.theme,o=n.selected,e=n.highlighted;return"\n display: flex;\n align-items: center;\n padding: "+r.space.sm+";\n color: "+(o||e?r.colors.body:r.colors.secondary)+";\n background-color: "+(o||e?r.colors.background:"white")+";\n cursor: pointer;\n font-size: "+r.fontSizes[1]+";\n font-weight: 400;\n line-height: "+r.lineHeights[1]+";\n letter-spacing: 0.6px;\n\n &:hover {\n background: "+r.colors.background+";\n }\n"});function hn(n){var r=n.children,o=un(n,["children"]);return h(bn,Object.assign({},{as:"li"},o),r)}var mn=w(function(n,r){var o=n.children,e=un(n,["children"]);return h(p,Object.assign({},{ref:r,as:"ul",boxShadow:"medium",borderRadius:2,overflow:"auto",width:"100%",bg:"white"},e),o)});mn.displayName="Body";var fn=a.button(function(n){var r=n.theme,o=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: "+r.fontSizes[1]+";\n font-weight: 400;\n line-height: "+r.lineHeights[1]+";\n color: "+r.colors.secondary+";\n transition-property: color;\n transition-duration: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.ease+";\n\n "+(n.disabled?"\n background: transparent;\n color: "+r.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+r.colors.background+";\n cursor: not-allowed;\n }\n ":"\n &:active,\n &:focus,\n &:hover {\n outline: 0;\n color: "+r.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(o?r.colors.error:r.colors.primary)+";\n\n div {\n border-color: "+(o?r.colors.error:r.colors.primary)+";\n color: "+(o?r.colors.error:r.colors.primary)+";\n }\n }\n }\n ")+"\n\n "+(n.isActive?"\n outline: 0;\n color: "+r.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(o?r.colors.error:r.colors.primary)+";\n\n div {\n border-color: "+(o?r.colors.error:r.colors.primary)+";\n color: "+(o?r.colors.error:r.colors.primary)+";\n }\n }\n ":"")+"\n"});fn.displayName="ControlOuter";var gn=w(function(n,r){var o=n.children,e=n.isActive,t=n.hasError,i=un(n,["children","isActive","hasError"]);return h("div",{style:{position:"relative"}},h(fn,Object.assign({},{ref:r,isActive:e,hasError:t,type:"button"},i),h(s,{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},h(s,{width:"100%",fontWeight:4,style:{whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",letterSpacing:"0.6px"}},o),h(d,{name:"ChevronDown",ml:"xs"}))),h(p,{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"}),h(p,{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 vn(n){var r=n.value,o=n.placeholder;return z(n.items.filter(function(n){return n.value===r})[0],"label")||o||"Please select"}function xn(n){var r=n.value,o=n.placeholder,e=n.label,t=n.items,a=n.hasError,l=n.disabled,s=n.onSelect,c=n.onRemove,d=m(vn({items:t,value:r,placeholder:o})),u=d[0],b=d[1];f(function(){b(vn({items:t,value:r,placeholder:o}))},[t,r,o]);var g=i({items:t.map(function(n){return Object.assign({},n,{selected:n.value===r})}),onSelect:function(n){b(n.label),s&&s(n)},onRemove:function(n){b(o||"Please select"),c&&c(n)}}),v=g.items,x=g.isOpen,y=g.getDropProps;return h(p,null,h(gn,Object.assign({},{id:g.id},l?{}:(0,g.getControlProps)(),{"aria-label":e,isActive:x,hasError:a,disabled:l}),u),x&&h(p,{position:"absolute",bottom:"0",width:"100%",transform:"translateY(100%) translateY(6px)",zIndex:1e3},h(mn,Object.assign({},y(),{style:{maxHeight:"240px",overflow:"auto"}}),v.map(function(n){return h(hn,Object.assign({},{key:n.value,selected:n.selected,highlighted:n.highlighted},n.getItemProps()),n.label)}))))}function yn(n){var r=n.name,o=n.validate,e=un(n,["name","validate"]);return h(_,{name:r,validate:o},function(n){var r=n.field,o=n.form,t=Boolean(o.errors&&o.errors[r.name]);return h(xn,Object.assign({},e,{hasError:t,onSelect:function(n){o.setFieldValue(r.name,n.value),e.onSelect&&e.onSelect(n)}}))})}function wn(n){return h(v,null,h(q,{htmlFor:n.name},n.label),h(yn,Object.assign({},n)))}function kn(n){return h(D,{name:n.name,render:function(n){return h(s,{color:"error",fontSize:0},n)}})}function On(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}gn.displayName="Control";var _n=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"]),Dn=a.span(function(n){var r=n.theme;return"\n display: block;\n font-size: "+r.fontSizes[1]+";\n font-weight: "+r.fontWeights[5]+";\n line-height: "+r.lineHeights[0]+";\n transition-property: color;\n transition-duration: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.ease+";\n "}),zn=a.div(function(n){var r=n.theme;return"\n width: 100%;\n border: 1px solid "+r.colors.outline+";\n border-radius: 4px;\n\n "+Bn+" {\n padding: "+r.space.sm+";\n border-top: 1px solid "+r.colors.outline+";\n\n &:first-of-type {\n border-top: 0;\n }\n }\n\n "+(n.hasError?"\n border-color: "+r.colors.error+" !important;\n\n & "+Bn+" {\n border-color: "+r.colors.error+" !important;\n }\n ":"")+"\n "}),jn=a.div(function(n){var r=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?r.colors.primaryDark:r.colors.outline)+";\n z-index: 1;\n transition-property: background, border-color;\n transition-duration: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.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: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.ease+";\n transform: scale(0);\n }\n "}),En=a.input(function(n){var r=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 ~ "+jn+" {\n border-color: "+r.colors.primaryDark+";\n }\n &:focus ~ "+p+" "+Dn+" {\n color: "+r.colors.primary+";\n }\n\n &:checked ~ "+jn+" {\n background: "+r.colors.primary+";\n border-color: "+r.colors.primaryDark+";\n\n &::after {\n transform: scale(1);\n }\n }\n &:checked ~ "+p+" "+Dn+" {\n color: "+r.colors.primary+";\n }\n\n &:disabled ~ "+jn+" {\n border-color: "+r.colors.outline+" !important;\n }\n &:disabled ~ "+Fn+" {\n background-color: "+r.colors.background+";\n }\n &:disabled ~ "+p+" "+Dn+" {\n color: "+r.colors.secondary+" !important;\n }\n "}),Fn=a.span(_n),Bn=a.label(function(n){var r=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 "+jn+" {\n border-color: "+r.colors.primaryDark+";\n }\n &:hover "+Dn+" {\n color: "+r.colors.primary+";\n }\n "});function Cn(n){var r=n.name,o=n.checked,e=n.description,t=n.label,i=On(n,["children","name","checked","description","label"]),a=r+i.value;return h(Bn,{htmlFor:a},h(En,Object.assign({},{id:a,name:r,type:"radio",checked:o},i)),h(jn,{checked:o}),h(p,{display:"block",position:"relative",zIndex:1,width:"calc(100% - 32px)",maxWidth:"calc(100% - 32px)"},t&&h(Dn,null,t),e&&h(u,{mt:"xxs",color:"secondary",fontSize:0,fontWeight:4,lineHeight:0},e)),h(Fn,null))}function Tn(n){var r=n.children,o=n.name,e=n.validate,t=n.onChange,i=n.onBlur,a=On(n,["children","name","validate","onChange","onBlur"]);return h(_,{name:o,validate:e},function(n){var e=n.field,l=Boolean(z(n.form,["errors",o]));return h(zn,{hasError:l},k.toArray(r).map(function(n){return O(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 In(n){var r=n.label,o=On(n,["label"]);return h(v,null,h(q,{htmlFor:o.name},r),h(Tn,Object.assign({},o)))}function Pn(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}var Sn=a.select(function(n){var r=n.theme,o=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+r.fonts.roboto+";\n color: "+r.colors.body+";\n font-size: "+r.fontSizes[1]+";\n line-height: "+r.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 0;\n min-height: 48px;\n padding: "+r.space.sm+";\n background: transparent;\n color: "+(n.hasValue?r.colors.body:r.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: "+r.colors.secondary+";\n line-height: "+r.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+r.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+r.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+r.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: "+r.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(o?r.colors.error:r.colors.primary)+";\n\n div {\n border-color: "+(o?r.colors.error:r.colors.primary)+";\n color: "+(o?r.colors.error:r.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: "+r.fontSizes[0]+";\n line-height: "+r.lineHeights[0]+";\n ")+"\n"});Sn.displayName="SelectElement";var Rn=w(function(n,r){var o=n.children,e=n.hasError,t=n.placeholder;void 0===t&&(t="");var i=Pn(n,["children","hasError","placeholder"]);return h(p,{ml:"-2px",mr:"-2px",p:"2px"},h(Sn,Object.assign({},{ref:r,hasValue:Boolean(i.value),hasError:e},i,{value:i.value||""}),t&&h("option",{value:"",disabled:!0},t),o),h(p,{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"}),h(p,{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"}),h(p,{position:"absolute",right:"0",top:"0",bottom:"0",height:"16px",my:"auto",pr:"sm",style:{pointerEvents:"none"}},h(d,{name:"ChevronDown",color:"secondary"})))});function Nn(n){var r=n.name,o=n.validate,e=n.onChange,t=n.onBlur,i=Pn(n,["name","validate","onChange","onBlur"]);return h(_,{name:r,validate:o},function(n){var o=n.field,a=Boolean(z(n.form,["errors",r]));return h(Rn,Object.assign({},i,o,{hasError:a,onChange:function(n){o.onChange(n),e&&e(n)},onBlur:function(n){o.onBlur(n),t&&t(n)}}))})}function Hn(n){return h(v,null,h(q,{htmlFor:n.name},n.label),h(Nn,Object.assign({},n)))}var Vn=a(p)(function(n){return"\n border-left: 2px solid currentColor;\n padding-left: "+n.theme.space.sm+";\n "});function Mn(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}var Un=a.textarea(function(n){var r=n.theme,o=n.hasError;return"\n appearance: none;\n border: none;\n display: block;\n position: relative;\n font-family: "+r.fonts.roboto+";\n color: "+r.colors.body+";\n font-size: "+r.fontSizes[1]+";\n line-height: "+r.lineHeights[0]+";\n letter-spacing: 0.6px;\n width: 100%;\n margin: 0;\n min-height: 48px;\n padding: "+r.space.sm+";\n background: transparent;\n color: "+(n.hasValue?r.colors.body:r.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: "+r.colors.secondary+";\n line-height: "+r.lineHeights[0]+";\n opacity: 1;\n }\n &:-webkit-autofill {\n -webkit-text-fill-color: "+r.colors.body+";\n -webkit-box-shadow: 0 0 0px 1000px #fff inset;\n }\n &:disabled {\n background: transparent;\n color: "+r.colors.placeholder+";\n cursor: not-allowed;\n & ~ .__border {\n background: "+r.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: "+r.colors.body+";\n\n & ~ .__bg {\n opacity: 1;\n }\n & ~ .__border {\n border-color: "+(o?r.colors.error:r.colors.primary)+";\n\n div {\n border-color: "+(o?r.colors.error:r.colors.primary)+";\n color: "+(o?r.colors.error:r.colors.primary)+";\n }\n }\n }\n"});Un.displayName="TextareaElement",Un.defaultProps={rows:4};var An=w(function(n,r){var o=n.hasError,e=Mn(n,["hasError"]);return h(p,{ml:"-2px",mr:"-2px",p:"2px"},h(Un,Object.assign({},{ref:r,hasError:o},e)),h(p,{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"}),h(p,{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"}))});function Yn(n){var r=n.name,o=n.validate,e=n.onChange,t=n.onBlur,i=Mn(n,["name","validate","onChange","onBlur"]);return h(_,{name:r,validate:o},function(n){var o=n.field,a=Boolean(z(n.form,["errors",r]));return h(An,Object.assign({},i,o,{hasError:a,onChange:function(n){o.onChange(n),e&&e(n)},onBlur:function(n){o.onBlur(n),t&&t(n)}}))})}function Wn(n){return h(v,null,h(q,{htmlFor:n.name},n.label),h(Yn,Object.assign({},n)))}var Ln=Object.freeze(["\n display: block;\n position: relative;\n cursor: pointer;\n"]),Jn=a.label(Ln),Xn=a.div(function(n){var r=n.theme;return"\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n width: 100%;\n padding: "+r.space.med+" "+r.space.sm+";\n color: "+r.colors.body+";\n background-color: "+r.colors.background+";\n border: 1px solid "+(n.hasError?r.colors.error:r.colors.outline)+";\n border-radius: "+r.space.xxs+";\n transition-property: color, background-color, border-color;\n transition-duration: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.ease+";\n"}),qn=a.input(function(n){var r=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 &:checked\n ~ "+Xn+",\n &:hover\n ~ "+Xn+",\n &:focus\n ~ "+Xn+" {\n border: 1px solid "+r.colors.primary+";\n background-color: rgba(91, 99, 254, 0.1);\n }\n\n &:checked ~ "+Xn+" {\n color: "+r.colors.primary+";\n }\n"});function Gn(n){var r=n.icon,o=n.label,e=n.hasError,t=function(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}(n,["icon","label","hasError"]),i=t.name+t.value;return h(Jn,{htmlFor:i},h(qn,Object.assign({},{id:i,type:"radio"},t)),h(Xn,{hasError:e},r&&h(b,{mb:"xs",background:"white",width:"48px",height:"48px"},r),h(s,{display:"flex",justifyContent:"center",minHeight:"32px",fontSize:0,fontWeight:5,lineHeight:0,width:"100%"},o)))}var Kn=Object.freeze(["\n ","\n"]),Qn="\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",Zn=a.div(function(n){var r=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 "+r.colors.outline+";\n color: white;\n background: white;\n stroke: white;\n transition-property: transform, background, border-color;\n transition-duration: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.natural+";\n"}),$n=a.div(function(n){var r=n.theme;return"\n position: relative;\n width: 56px;\n height: 32px;\n border-radius: 100px;\n border: 1px solid "+r.colors.outline+";\n background: "+r.colors.background+";\n cursor: pointer;\n transition-property: background, border-color;\n transition-duration: "+r.transitionDurations.fast+";\n transition-timing-function: "+r.transitionTimingFunctions.natural+";\n "}),nr=a.label(function(n){return"\n display: flex;\n align-items: center;\n margin-bottom: 0 !important;\n\n &:hover "+$n+" {\n "+Zn+" {\n border-color: "+n.theme.colors.primaryDark+";\n }\n }\n "}),rr=a.input(function(n){var r=n.theme;return"\n "+Qn+"\n\n &:focus ~ "+$n+" {\n border-color: "+r.colors.primary+";\n }\n &:checked ~ "+$n+" {\n border-color: "+r.colors.primary+";\n\n "+Zn+" {\n background: "+r.colors.primary+";\n border-color: "+r.colors.primaryDark+";\n transform: translateX(24px);\n }\n }\n &:disabled ~ "+$n+" {\n pointer-events: none;\n "+Zn+" {\n border-color: "+r.colors.outline+";\n }\n }\n "}),or=a.span(Kn,Qn);function er(n){var r=n.label,o=n.name,e=n.checked,t=function(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}(n,["label","name","checked"]);return h(nr,{htmlFor:o},h(rr,Object.assign({},{id:o,name:o,type:"checkbox",checked:e},t)),h($n,null,h(Zn,null,h(d,{name:"Check",width:"12px",height:"12px",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",m:"auto",style:{strokeWidth:"2px"}}))),h(or,null,r))}function tr(n){var r=n.label;return h(_,{name:n.name,validate:n.validate},function(n){var o=n.field;return h(er,Object.assign({},{label:r},o,{checked:Boolean(o.value)}))})}function ir(n){var r=n.value;void 0===r&&(r="");var o=n.masker;void 0===o&&(o="*");var e=n.separator;void 0===e&&(e="-");var t=m(r),i=t[0],a=t[1],l=m(!1),s=l[1],c=l[0]?i:B(F(i,o),e),d=g(function(){s(!0)},[s]),p=g(function(){s(!1)},[s]);return f(function(){n.onUpdate&&n.onUpdate(i)},[i,n.onUpdate]),h(Q,Object.assign({},n,{value:c,onFocus:d,onClick:d,onBlur:p,onChange:function(n){var r=n.target.value,o=/\*\*/.test(r);a(o?"":E(r))}}))}function ar(n){var r=n.name,o=n.validate,e=function(n,r){var o={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&-1===r.indexOf(e)&&(o[e]=n[e]);return o}(n,["name","validate"]);return h(_,{name:r,validate:o},function(n){var o=n.field,t=n.form,i=Boolean(z(t,["errors",r])),a=g(function(n){t.setFieldValue(r,n)},[r,t.setFieldValue]);return h(ir,Object.assign({},e,o,{hasError:i,onUpdate:a}))})}function lr(n){return h(v,null,h(q,{htmlFor:n.name},n.label),h(ar,Object.assign({},n)))}export{H as CheckboxGroup,V as Checkbox,M as CheckboxField,an as DateInput,ln as DateInputField,sn as DateInputFieldWithLabel,cn as DateInputTypeIn,dn as DateInputTypeInField,pn as DateInputTypeInFieldWithLabel,hn as Item,mn as Body,gn as Control,xn as Dropdown,yn as DropdownField,wn as DropdownFieldWithLabel,kn as ErrorMessage,Q as Input,Z as InputField,$ as InputFieldWithLabel,q as Label,Cn as Radio,Tn as RadioField,In as RadioFieldWithLabel,Rn as Select,Nn as SelectField,Hn as SelectFieldWithLabel,Vn as SubGroup,An as Textarea,Yn as TextareaField,Wn as TextareaFieldWithLabel,Gn as Tile,Qn as hidden,er as Toggle,tr as ToggleField,ir as SSNInput,ar as SSNInputField,lr as SSNInputFieldWithLabel}; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
function n(n){return n&&"object"==typeof n&&"default"in n?n.default:n}var e=require("styled-system"),r=n(require("react-text-mask")),o=require("use-drop"),t=require("styled-components"),a=n(t),i=require("@truework/ui"),l=require("react"),s=require("formik"),c=require("lodash"),d=require("parse-ssn");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}var u=Object.freeze([""]),m=a(i.Icon)(u),b=a.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 "+m+" {\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 "}),h=a(i.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 "}),f=a.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 ~ "+b+" {\n border-color: "+e.colors.primaryDark+";\n }\n &:checked ~ "+b+" {\n background: "+e.colors.primary+";\n border-color: "+e.colors.primaryDark+";\n\n "+m+" {\n transform: scale(1);\n }\n }\n &:focus ~ "+h+", &:focus ~"+i.Span+", &:checked ~ "+i.Span+" {\n color: "+e.colors.primary+";\n }\n\n "+(n.hasError?"\n & ~ "+b+" {\n border-color: "+e.colors.error+" !important;\n }\n ":"")+"\n "}),g=a.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 "+b+" {\n background: "+e.colors.background+";\n }\n "+i.Span+" {\n color: "+e.colors.placeholder+";\n }\n ":"\n &:hover "+b+" {\n border-color: "+e.colors.primaryDark+";\n }\n &:hover "+h+", &:hover "+i.Span+" {\n color: "+e.colors.primary+";\n }\n ")+"\n "}),x=a.div(function(n){var e=n.theme;return"\n width: 100%;\n\n "+g+" {\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 "+g+":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 "+g+":last-child {\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n }\n "});function v(n){var e=n.children,r=n.name,o=n.checked,t=n.disabled,a=p(n,["children","name","checked","disabled"]);return l.createElement(g,{htmlFor:r,disabled:t},l.createElement(f,Object.assign({},{id:r,name:r,type:"checkbox",checked:o,disabled:t},a)),l.createElement(b,{checked:o},l.createElement(m,{name:"Check"})),l.createElement(i.Span,{display:"block",width:"calc(100% - 16px)",fontSize:1,lineHeight:1,fontWeight:5,style:{transitionProperty:"color",transitionDuration:"150ms",transitionTimingFunction:"ease-in-out"}},e))}function y(n){return n<10?"0"+n:""+n}var E=Object.freeze(["\n display: block;\n position: relative;\n font-weight: 500;\n letter-spacing: 0.6px;\n ","\n ","\n ","\n"]),w=a.label(E,e.typography,e.color,e.space);function k(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}w.displayName="Label",w.defaultProps={fontSize:1,lineHeight:1,mb:"xs"};var F=a.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: 1px;\n border-radius: 4px;\n min-height: "+(r?"34px":"46px")+";\n padding: "+(r?"10px 16px":"14px 16px")+";\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 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"});F.displayName="InputElement";var B=l.forwardRef(function(n,e){var r=n.hasError,o=n.preTab,t=n.postTab,a=k(n,["hasError","preTab","postTab"]),s=Boolean(o),c=o||t;return l.createElement(i.Box,{display:"flex",ml:"-2px",mr:"-2px",p:"2px"},l.createElement(F,Object.assign({},{ref:e,hasError:r},a)),c&&l.createElement(i.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),l.createElement(i.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"}),l.createElement(i.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 O(n){var e=n.name,r=n.validate,o=n.onChange,t=n.onBlur,a=k(n,["name","validate","onChange","onBlur"]);return l.createElement(s.Field,{name:e,validate:r},function(n){var r=n.field,i=Boolean(c.get(n.form,["errors",e]));return l.createElement(B,Object.assign({},a,r,{hasError:i,onChange:function(n){r.onChange(n),o&&o(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}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}var j=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 &:hover {\n opacity: 1;\n }\n "]),z=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 "]),C=a.select(function(n){var e=n.theme,r=n.hasError;return t.css(z,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)}),D=a.button(function(n){var e=n.theme;return t.css(j,e.colors.secondary,e.transitionDurations.fast,e.transitionTimingFunctions.ease)});function I(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 a=n.initialDay;void 0===a&&(a=0);var s=n.initialYear;void 0===s&&(s=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=l.useState(t),v=x[0],E=x[1],w=l.useState(a),k=w[0],F=w[1],B=l.useState(s),O=B[0],_=B[1],j=function(n){return new Date(n.year,n.month,0).getUTCDate()}({year:O||2020,month:v});l.useEffect(function(){g(O&&v&&k?O+"-"+y(v)+"-"+y(k):"")},[v,k,O]);var z=l.useCallback(function(){E(0),F(0),_(0)},[E,F,_]);return l.createElement(i.Box,{ml:"-2px",mr:"-2px",p:"2px"},l.createElement(i.Box,{display:"flex",alignItems:"center",height:"48px",pl:"56px"},l.createElement(C,{name:e+"-month",value:v,disabled:o,onChange:function(n){E(parseInt(n.target.value,10))},"aria-label":r+": Month",hasValue:Boolean(v),hasError:f},l.createElement("option",{value:"0",disabled:!0},"mm"),c.times(m-d+1,function(){return""}).map(function(n,e){var r=d+e;return l.createElement("option",{key:r,value:r},y(r))})),l.createElement(i.Box,{height:"50%",width:"1px",bg:f?"error":"outline",zIndex:2,transform:"rotate(10deg)"}),l.createElement(C,{name:e+"-day",value:k,disabled:o,onChange:function(n){F(parseInt(n.target.value,10))},"aria-label":r+": Day",hasValue:Boolean(k),hasError:f},l.createElement("option",{value:"0",disabled:!0},"dd"),c.times(Math.min(b,j)-p+1,function(){return""}).map(function(n,e){var r=p+e;return l.createElement("option",{key:r,value:r},y(r))})),l.createElement(i.Box,{height:"50%",width:"1px",bg:f?"error":"outline",zIndex:2,transform:"rotate(10deg)"}),l.createElement(C,{name:e+"-year",value:O,disabled:o,onChange:function(n){_(parseInt(n.target.value,10))},"aria-label":r+": Year",hasValue:Boolean(O),hasError:f},l.createElement("option",{value:"0",disabled:!0},"yyyy"),c.times(h-u+1,function(n){return u+n}).map(function(n){return l.createElement("option",{key:n,value:n},n)})),(v||k||O)&&l.createElement(D,{title:"Clear",onClick:z},l.createElement(i.Icon,{name:"X",width:"12px",height:"12px"})),l.createElement(i.Box,{className:"__bg",bg:f?"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"}),l.createElement(i.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"},l.createElement(i.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"},l.createElement(i.Icon,{name:"Calendar"})))))}function S(n){var e=n.name,r=n.validate,o=_(n,["name","validate"]);return l.createElement(s.Field,{name:e,validate:r},function(n){var r=n.field,t=n.form,a=Boolean(c.get(t,["errors",e])),i=(r.value||"").split("-"),s=i[0];void 0===s&&(s="");var d=i[1];void 0===d&&(d="");var p=i[2];return void 0===p&&(p=""),l.createElement(I,Object.assign({},{name:e},o,{initialMonth:d?parseInt(d,10):void 0,initialDay:p?parseInt(p,10):void 0,initialYear:s?parseInt(s,10):void 0,hasError:a,onUpdate:function(n){t.setFieldValue(e,n)}}))})}var T=[/\d/,/\d/,"/",/\d/,/\d/,"/",/\d/,/\d/,/\d/,/\d/];function P(n){var e=n.name,o=n.hasError,t=n.onChange,a=n.onBlur,i=n.value,s=_(n,["name","hasError","onChange","onBlur","value"]);return l.createElement(r,{name:e,mask:T,id:"date",placeholder:"mm/dd/yyyy",type:"text",onChange:t,onBlur:a,value:i,render:function(n,r){return l.createElement(B,Object.assign({},{name:e,ref:n,hasError:o},r,s))}})}function R(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 N=a(i.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 H(n){var e=n.children,r=R(n,["children"]);return l.createElement(N,Object.assign({},{as:"li"},r),e)}var W=l.forwardRef(function(n,e){var r=n.children,o=R(n,["children"]);return l.createElement(i.Box,Object.assign({},{ref:e,as:"ul",boxShadow:"medium",borderRadius:2,overflow:"auto",width:"100%",bg:"white"},o),r)});W.displayName="Body";var L=a.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"});L.displayName="ControlOuter";var V=l.forwardRef(function(n,e){var r=n.children,o=n.isActive,t=n.hasError,a=R(n,["children","isActive","hasError"]);return l.createElement("div",{style:{position:"relative"}},l.createElement(L,Object.assign({},{ref:e,isActive:o,hasError:t,type:"button"},a),l.createElement(i.Span,{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},l.createElement(i.Span,{width:"100%",fontWeight:4,style:{whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",letterSpacing:"0.6px"}},r),l.createElement(i.Icon,{name:"ChevronDown",ml:"xs"}))),l.createElement(i.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"}),l.createElement(i.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 q(n){var e=n.value,r=n.placeholder;return c.get(n.items.filter(function(n){return n.value===e})[0],"label")||r||"Please select"}function M(n){var e=n.value,r=n.placeholder,t=n.label,a=n.items,s=n.hasError,c=n.disabled,d=n.onSelect,p=n.onRemove,u=l.useState(q({items:a,value:e,placeholder:r})),m=u[0],b=u[1];l.useEffect(function(){b(q({items:a,value:e,placeholder:r}))},[a,e,r]);var h=o.useSelect({items:a.map(function(n){return Object.assign({},n,{selected:n.value===e})}),onSelect:function(n){b(n.label),d&&d(n)},onRemove:function(n){b(r||"Please select"),p&&p(n)}}),f=h.items,g=h.isOpen,x=h.getDropProps;return l.createElement(i.Box,null,l.createElement(V,Object.assign({},{id:h.id},c?{}:(0,h.getControlProps)(),{"aria-label":t,isActive:g,hasError:s,disabled:c}),m),g&&l.createElement(i.Box,{position:"absolute",bottom:"0",width:"100%",transform:"translateY(100%) translateY(6px)",zIndex:1e3},l.createElement(W,Object.assign({},x(),{style:{maxHeight:"240px",overflow:"auto"}}),f.map(function(n){return l.createElement(H,Object.assign({},{key:n.value,selected:n.selected,highlighted:n.highlighted},n.getItemProps()),n.label)}))))}function U(n){var e=n.name,r=n.validate,o=R(n,["name","validate"]);return l.createElement(s.Field,{name:e,validate:r},function(n){var e=n.field,r=n.form,t=Boolean(r.errors&&r.errors[e.name]);return l.createElement(M,Object.assign({},o,{hasError:t,onSelect:function(n){r.setFieldValue(e.name,n.value),o.onSelect&&o.onSelect(n)}}))})}function Y(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}V.displayName="Control";var A=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"]),G=a.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 transition-property: color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n "}),X=a.div(function(n){var e=n.theme;return"\n width: 100%;\n border: 1px solid "+e.colors.outline+";\n border-radius: 4px;\n\n "+Z+" {\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 & "+Z+" {\n border-color: "+e.colors.error+" !important;\n }\n ":"")+"\n "}),J=a.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 "}),K=a.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 ~ "+J+" {\n border-color: "+e.colors.primaryDark+";\n }\n &:focus ~ "+i.Box+" "+G+" {\n color: "+e.colors.primary+";\n }\n\n &:checked ~ "+J+" {\n background: "+e.colors.primary+";\n border-color: "+e.colors.primaryDark+";\n\n &::after {\n transform: scale(1);\n }\n }\n &:checked ~ "+i.Box+" "+G+" {\n color: "+e.colors.primary+";\n }\n\n &:disabled ~ "+J+" {\n border-color: "+e.colors.outline+" !important;\n }\n &:disabled ~ "+Q+" {\n background-color: "+e.colors.background+";\n }\n &:disabled ~ "+i.Box+" "+G+" {\n color: "+e.colors.secondary+" !important;\n }\n "}),Q=a.span(A),Z=a.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 "+J+" {\n border-color: "+e.colors.primaryDark+";\n }\n &:hover "+G+" {\n color: "+e.colors.primary+";\n }\n "});function $(n){var e=n.children,r=n.name,o=n.validate,t=n.onChange,a=n.onBlur,i=Y(n,["children","name","validate","onChange","onBlur"]);return l.createElement(s.Field,{name:r,validate:o},function(n){var o=n.field,s=Boolean(c.get(n.form,["errors",r]));return l.createElement(X,{hasError:s},l.Children.toArray(e).map(function(n){return l.cloneElement(n,Object.assign({},o,i,{value:n.props.value,hasError:s,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 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=a.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"});en.displayName="SelectElement";var rn=l.forwardRef(function(n,e){var r=n.children,o=n.hasError,t=n.placeholder;void 0===t&&(t="");var a=nn(n,["children","hasError","placeholder"]);return l.createElement(i.Box,{ml:"-2px",mr:"-2px",p:"2px"},l.createElement(en,Object.assign({},{ref:e,hasValue:Boolean(a.value),hasError:o},a,{value:a.value||""}),t&&l.createElement("option",{value:"",disabled:!0},t),r),l.createElement(i.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"}),l.createElement(i.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"}),l.createElement(i.Box,{position:"absolute",right:"0",top:"0",bottom:"0",height:"16px",my:"auto",pr:"sm",style:{pointerEvents:"none"}},l.createElement(i.Icon,{name:"ChevronDown",color:"secondary"})))});function on(n){var e=n.name,r=n.validate,o=n.onChange,t=n.onBlur,a=nn(n,["name","validate","onChange","onBlur"]);return l.createElement(s.Field,{name:e,validate:r},function(n){var r=n.field,i=Boolean(c.get(n.form,["errors",e]));return l.createElement(rn,Object.assign({},a,r,{hasError:i,onChange:function(n){r.onChange(n),o&&o(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}var tn=a(i.Box)(function(n){return"\n border-left: 2px solid currentColor;\n padding-left: "+n.theme.space.sm+";\n "});function an(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 ln=a.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"});ln.displayName="TextareaElement",ln.defaultProps={rows:4};var sn=l.forwardRef(function(n,e){var r=n.hasError,o=an(n,["hasError"]);return l.createElement(i.Box,{ml:"-2px",mr:"-2px",p:"2px"},l.createElement(ln,Object.assign({},{ref:e,hasError:r},o)),l.createElement(i.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"}),l.createElement(i.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 cn(n){var e=n.name,r=n.validate,o=n.onChange,t=n.onBlur,a=an(n,["name","validate","onChange","onBlur"]);return l.createElement(s.Field,{name:e,validate:r},function(n){var r=n.field,i=Boolean(c.get(n.form,["errors",e]));return l.createElement(sn,Object.assign({},a,r,{hasError:i,onChange:function(n){r.onChange(n),o&&o(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}var dn=Object.freeze(["\n display: block;\n position: relative;\n cursor: pointer;\n"]),pn=a.label(dn),un=a.div(function(n){var e=n.theme;return"\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n width: 100%;\n padding: "+e.space.med+" "+e.space.sm+";\n color: "+e.colors.body+";\n background-color: "+e.colors.background+";\n border: 1px solid "+(n.hasError?e.colors.error:e.colors.outline)+";\n border-radius: "+e.space.xxs+";\n transition-property: color, background-color, border-color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n"}),mn=a.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 &:checked\n ~ "+un+",\n &:hover\n ~ "+un+",\n &:focus\n ~ "+un+" {\n border: 1px solid "+e.colors.primary+";\n background-color: rgba(91, 99, 254, 0.1);\n }\n\n &:checked ~ "+un+" {\n color: "+e.colors.primary+";\n }\n"}),bn=Object.freeze(["\n ","\n"]),hn="\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",fn=a.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"}),gn=a.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 "}),xn=a.label(function(n){return"\n display: flex;\n align-items: center;\n margin-bottom: 0 !important;\n\n &:hover "+gn+" {\n "+fn+" {\n border-color: "+n.theme.colors.primaryDark+";\n }\n }\n "}),vn=a.input(function(n){var e=n.theme;return"\n "+hn+"\n\n &:focus ~ "+gn+" {\n border-color: "+e.colors.primary+";\n }\n &:checked ~ "+gn+" {\n border-color: "+e.colors.primary+";\n\n "+fn+" {\n background: "+e.colors.primary+";\n border-color: "+e.colors.primaryDark+";\n transform: translateX(24px);\n }\n }\n &:disabled ~ "+gn+" {\n pointer-events: none;\n "+fn+" {\n border-color: "+e.colors.outline+";\n }\n }\n "}),yn=a.span(bn,hn);function En(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 l.createElement(xn,{htmlFor:r},l.createElement(vn,Object.assign({},{id:r,name:r,type:"checkbox",checked:o},t)),l.createElement(gn,null,l.createElement(fn,null,l.createElement(i.Icon,{name:"Check",width:"12px",height:"12px",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",m:"auto",style:{strokeWidth:"2px"}}))),l.createElement(yn,null,e))}function wn(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=l.useState(e),a=t[0],i=t[1],s=l.useState(!1),c=s[1],p=s[0]?a:d.format(d.mask(a,r),o),u=l.useCallback(function(){c(!0)},[c]),m=l.useCallback(function(){c(!1)},[c]);return l.useEffect(function(){n.onUpdate&&n.onUpdate(a)},[a,n.onUpdate]),l.createElement(B,Object.assign({},n,{value:p,onFocus:u,onClick:u,onBlur:m,onChange:function(n){var e=n.target.value,r=/\*\*/.test(e);i(r?"":d.clean(e))}}))}function kn(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 l.createElement(s.Field,{name:e,validate:r},function(n){var r=n.field,t=n.form,a=Boolean(c.get(t,["errors",e])),i=l.useCallback(function(n){t.setFieldValue(e,n)},[e,t.setFieldValue]);return l.createElement(wn,Object.assign({},o,r,{hasError:a,onUpdate:i}))})}exports.CheckboxGroup=x,exports.Checkbox=v,exports.CheckboxField=function(n){var e=n.name,r=n.validate,o=n.onChange,t=n.onBlur,a=p(n,["name","validate","onChange","onBlur"]);return l.createElement(s.Field,{name:e,validate:r},function(n){var r=n.field,i=Boolean(c.get(n.form,["errors",e]));return l.createElement(v,Object.assign({},a,r,{checked:Boolean(r.value),hasError:i,onChange:function(n){r.onChange(n),o&&o(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})},exports.DateInput=I,exports.DateInputField=S,exports.DateInputFieldWithLabel=function(n){return l.createElement(l.Fragment,null,l.createElement(w,{htmlFor:n.name},n.label),l.createElement(S,Object.assign({},n)))},exports.DateInputTypeIn=P,exports.DateInputTypeInField=function(n){var e=n.name,r=n.validate,o=_(n,["name","validate"]),t=l.useCallback(function(n){if(n){var e=require("moment"),r=n.split("/").map(function(n){return parseInt(n)}),o=r[2];return o<1900?"The date you entered is not a valid date.":e([o,r[0]-1,r[1]]).isValid()?void 0:"The date you entered is not a valid date."}},[]);return l.createElement(s.Field,{name:e,validate:function(n){return r&&r(n)||t(n)}},function(n){var r=n.field,t=Boolean(c.get(n.form,["errors",e]));return l.createElement(P,Object.assign({},r,o,{name:e,hasError:t}))})},exports.Item=H,exports.Body=W,exports.Control=V,exports.Dropdown=M,exports.DropdownField=U,exports.DropdownFieldWithLabel=function(n){return l.createElement(l.Fragment,null,l.createElement(w,{htmlFor:n.name},n.label),l.createElement(U,Object.assign({},n)))},exports.ErrorMessage=function(n){return l.createElement(s.ErrorMessage,{name:n.name,render:function(n){return l.createElement(i.Span,{color:"error",fontSize:0},n)}})},exports.Input=B,exports.InputField=O,exports.InputFieldWithLabel=function(n){return l.createElement(l.Fragment,null,l.createElement(w,{htmlFor:n.name},n.label),l.createElement(O,Object.assign({},n)))},exports.Label=w,exports.Radio=function(n){var e=n.name,r=n.checked,o=n.description,t=n.label,a=Y(n,["children","name","checked","description","label"]),s=e+a.value;return l.createElement(Z,{htmlFor:s},l.createElement(K,Object.assign({},{id:s,name:e,type:"radio",checked:r},a)),l.createElement(J,{checked:r}),l.createElement(i.Box,{display:"block",position:"relative",zIndex:1,width:"calc(100% - 32px)",maxWidth:"calc(100% - 32px)"},t&&l.createElement(G,null,t),o&&l.createElement(i.P,{mt:"xxs",color:"secondary",fontSize:0,fontWeight:4,lineHeight:0},o)),l.createElement(Q,null))},exports.RadioField=$,exports.RadioFieldWithLabel=function(n){var e=n.label,r=Y(n,["label"]);return l.createElement(l.Fragment,null,l.createElement(w,{htmlFor:r.name},e),l.createElement($,Object.assign({},r)))},exports.Select=rn,exports.SelectField=on,exports.SelectFieldWithLabel=function(n){return l.createElement(l.Fragment,null,l.createElement(w,{htmlFor:n.name},n.label),l.createElement(on,Object.assign({},n)))},exports.SubGroup=tn,exports.Textarea=sn,exports.TextareaField=cn,exports.TextareaFieldWithLabel=function(n){return l.createElement(l.Fragment,null,l.createElement(w,{htmlFor:n.name},n.label),l.createElement(cn,Object.assign({},n)))},exports.Tile=function(n){var e=n.icon,r=n.label,o=n.hasError,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,["icon","label","hasError"]),a=t.name+t.value;return l.createElement(pn,{htmlFor:a},l.createElement(mn,Object.assign({},{id:a,type:"radio"},t)),l.createElement(un,{hasError:o},e&&l.createElement(i.Circle,{mb:"xs",background:"white",width:"48px",height:"48px"},e),l.createElement(i.Span,{display:"flex",justifyContent:"center",minHeight:"32px",fontSize:0,fontWeight:5,lineHeight:0,width:"100%"},r)))},exports.hidden=hn,exports.Toggle=En,exports.ToggleField=function(n){var e=n.label;return l.createElement(s.Field,{name:n.name,validate:n.validate},function(n){var r=n.field;return l.createElement(En,Object.assign({},{label:e},r,{checked:Boolean(r.value)}))})},exports.SSNInput=wn,exports.SSNInputField=kn,exports.SSNInputFieldWithLabel=function(n){return l.createElement(l.Fragment,null,l.createElement(w,{htmlFor:n.name},n.label),l.createElement(kn,Object.assign({},n)))}; | ||
var n,e=require("picomask"),r=require("styled-system"),o=require("use-drop"),t=require("styled-components"),a=(n=t)&&"object"==typeof n&&"default"in n?n.default:n,i=require("@truework/ui"),l=require("react"),s=require("formik"),c=require("lodash"),d=require("parse-ssn");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}var u=Object.freeze([""]),m=a(i.Icon)(u),b=a.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 "+m+" {\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 "}),h=a(i.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 "}),f=a.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 ~ "+b+" {\n border-color: "+e.colors.primaryDark+";\n }\n &:checked ~ "+b+" {\n background: "+e.colors.primary+";\n border-color: "+e.colors.primaryDark+";\n\n "+m+" {\n transform: scale(1);\n }\n }\n &:focus ~ "+h+", &:focus ~"+i.Span+", &:checked ~ "+i.Span+" {\n color: "+e.colors.primary+";\n }\n\n "+(n.hasError?"\n & ~ "+b+" {\n border-color: "+e.colors.error+" !important;\n }\n ":"")+"\n "}),g=a.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 "+b+" {\n background: "+e.colors.background+";\n }\n "+i.Span+" {\n color: "+e.colors.placeholder+";\n }\n ":"\n &:hover "+b+" {\n border-color: "+e.colors.primaryDark+";\n }\n &:hover "+h+", &:hover "+i.Span+" {\n color: "+e.colors.primary+";\n }\n ")+"\n "}),x=a.div(function(n){var e=n.theme;return"\n width: 100%;\n\n "+g+" {\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 "+g+":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 "+g+":last-child {\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n }\n "});function v(n){var e=n.children,r=n.name,o=n.checked,t=n.disabled,a=p(n,["children","name","checked","disabled"]);return l.createElement(g,{htmlFor:r,disabled:t},l.createElement(f,Object.assign({},{id:r,name:r,type:"checkbox",checked:o,disabled:t},a)),l.createElement(b,{checked:o},l.createElement(m,{name:"Check"})),l.createElement(i.Span,{display:"block",width:"calc(100% - 16px)",fontSize:1,lineHeight:1,fontWeight:5,style:{transitionProperty:"color",transitionDuration:"150ms",transitionTimingFunction:"ease-in-out"}},e))}var y="yyyy-mm-dd",E=["January","February","March","April","May","June","July","August","September","October","November","December"];function k(n){return new Date(n.year,n.month,0).getUTCDate()}function w(n){return n<10?"0"+n:""+n}function F(n){return n.replace(/[^\d]/g,"").slice(0,8)}function B(n){var r=n.date,o=n.min,t=n.max,a=n.pattern;void 0===a&&(a=y);var i=e.picomask(r,y),l=i.y,s=i.m,c=i.d,d=parseInt(l),p=parseInt(s),u=parseInt(c),m=k({month:p,year:d});return p>12?"There are only 12 months":"00"===c?"Day cannot be 0":"00"===s?"Month cannot be 0":"0000"===l?"Year cannot be 0":u>m?"There are only "+m+" days in "+E[p-1]+" "+d:o&&new Date(r)<new Date(o)?"Date must be after "+e.transform(e.picomask(o,y),a).value:t&&new Date(r)>new Date(t)?"Date must be before "+e.transform(e.picomask(t,y),a).value:void 0}var O=Object.freeze(["\n display: block;\n position: relative;\n font-weight: 500;\n letter-spacing: 0.6px;\n ","\n ","\n ","\n"]),D=a.label(O,r.typography,r.color,r.space);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}D.displayName="Label",D.defaultProps={fontSize:1,lineHeight:1,mb:"xs"};var j=a.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: 1px;\n border-radius: 4px;\n min-height: "+(r?"34px":"46px")+";\n padding: "+(r?"10px 16px":"14px 16px")+";\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 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"});j.displayName="InputElement";var z=l.forwardRef(function(n,e){var r=n.hasError,o=n.preTab,t=n.postTab,a=_(n,["hasError","preTab","postTab"]),s=Boolean(o),c=o||t;return l.createElement(i.Box,{display:"flex",ml:"-2px",mr:"-2px",p:"2px"},l.createElement(j,Object.assign({},{ref:e,hasError:r},a)),c&&l.createElement(i.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),l.createElement(i.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"}),l.createElement(i.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 C(n){var e=n.name,r=n.validate,o=n.onChange,t=n.onBlur,a=_(n,["name","validate","onChange","onBlur"]);return l.createElement(s.Field,{name:e,validate:r},function(n){var r=n.field,i=Boolean(c.get(n.form,["errors",e]));return l.createElement(z,Object.assign({},a,r,{hasError:i,onChange:function(n){r.onChange(n),o&&o(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}function S(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 I=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 &:hover {\n opacity: 1;\n }\n "]),T=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 "]),R=a.select(function(n){var e=n.theme,r=n.hasError;return t.css(T,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)}),P=a.button(function(n){var e=n.theme;return t.css(I,e.colors.secondary,e.transitionDurations.fast,e.transitionTimingFunctions.ease)});function N(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 a=n.initialDay;void 0===a&&(a=0);var s=n.initialYear;void 0===s&&(s=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=l.useState(t),v=x[0],y=x[1],E=l.useState(a),F=E[0],B=E[1],O=l.useState(s),D=O[0],_=O[1],j=k({year:D||2020,month:v});l.useEffect(function(){g(D&&v&&F?D+"-"+w(v)+"-"+w(F):"")},[v,F,D]);var z=l.useCallback(function(){y(0),B(0),_(0)},[y,B,_]);return l.createElement(i.Box,{ml:"-2px",mr:"-2px",p:"2px"},l.createElement(i.Box,{display:"flex",alignItems:"center",height:"48px",pl:"56px"},l.createElement(R,{name:e+"-month",value:v,disabled:o,onChange:function(n){y(parseInt(n.target.value,10))},"aria-label":r+": Month",hasValue:Boolean(v),hasError:f},l.createElement("option",{value:"0",disabled:!0},"mm"),c.times(m-d+1,function(){return""}).map(function(n,e){var r=d+e;return l.createElement("option",{key:r,value:r},w(r))})),l.createElement(i.Box,{height:"50%",width:"1px",bg:f?"error":"outline",zIndex:2,transform:"rotate(10deg)"}),l.createElement(R,{name:e+"-day",value:F,disabled:o,onChange:function(n){B(parseInt(n.target.value,10))},"aria-label":r+": Day",hasValue:Boolean(F),hasError:f},l.createElement("option",{value:"0",disabled:!0},"dd"),c.times(Math.min(b,j)-p+1,function(){return""}).map(function(n,e){var r=p+e;return l.createElement("option",{key:r,value:r},w(r))})),l.createElement(i.Box,{height:"50%",width:"1px",bg:f?"error":"outline",zIndex:2,transform:"rotate(10deg)"}),l.createElement(R,{name:e+"-year",value:D,disabled:o,onChange:function(n){_(parseInt(n.target.value,10))},"aria-label":r+": Year",hasValue:Boolean(D),hasError:f},l.createElement("option",{value:"0",disabled:!0},"yyyy"),c.times(h-u+1,function(n){return u+n}).map(function(n){return l.createElement("option",{key:n,value:n},n)})),(v||F||D)&&l.createElement(P,{title:"Clear",onClick:z},l.createElement(i.Icon,{name:"X",width:"12px",height:"12px"})),l.createElement(i.Box,{className:"__bg",bg:f?"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"}),l.createElement(i.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"},l.createElement(i.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"},l.createElement(i.Icon,{name:"Calendar"})))))}function H(n){var e=n.name,r=n.validate,o=S(n,["name","validate"]);return l.createElement(s.Field,{name:e,validate:r},function(n){var r=n.field,t=n.form,a=Boolean(c.get(t,["errors",e])),i=(r.value||"").split("-"),s=i[0];void 0===s&&(s="");var d=i[1];void 0===d&&(d="");var p=i[2];return void 0===p&&(p=""),l.createElement(N,Object.assign({},{name:e},o,{initialMonth:d?parseInt(d,10):void 0,initialDay:p?parseInt(p,10):void 0,initialYear:s?parseInt(s,10):void 0,hasError:a,onUpdate:function(n){t.setFieldValue(e,n)}}))})}function L(n){var r=n.hasError,o=n.onUpdate,t=n.pattern;void 0===t&&(t=y);var a=n.validate,s=n.minDate,c=n.maxDate,d=S(n,["hasError","onUpdate","pattern","validate","minDate","maxDate"]),p=l.useRef(null),u=l.useRef(0),m=l.useState(!1),b=m[0],h=m[1],f=l.useState(""),g=f[0],x=f[1],v=l.useState(F(d.value?e.transform(e.picomask(String(d.value),y),t).value:"")),E=v[0],k=v[1],w=e.picomask(E,t),O=l.useCallback(function(n){0===E.length?x(""):E.length<8&&x("Please enter a valid date matching "+t)},[E,x]),D=l.useCallback(function(n){n.persist(),b||h(!0);var r=n.target.value,o=F(r),a=F(r.slice(0,n.target.selectionEnd||0)),i=e.picomask(a,t).value;u.current=i.length,k(o)},[E,k]);return l.useLayoutEffect(function(){p.current&&p.current.setSelectionRange(u.current,u.current)},[E]),l.useEffect(function(){if(8===E.length){var n=B({date:e.transform(e.picomask(E,t),y).value,min:s,max:c,pattern:t});if(x(n||""),b){var r=e.picomask(E,t);o&&o(n?"":r.y+"-"+r.m+"-"+r.d)}}else x("")},[E,t,s,c,b,o,x]),l.createElement(l.Fragment,null,l.createElement(z,Object.assign({},{ref:p,preTab:l.createElement(i.Icon,{name:"Calendar"}),placeholder:t},d,{hasError:a&&Boolean(g)||r,value:w.value,onChange:D,onBlur:function(n){D(n),O(n)}})),a&&g&&l.createElement(i.Span,{color:"error",fontSize:0},g))}function W(n){var e=n.name,r=n.validate,o=n.pattern;void 0===o&&(o=y);var t=S(n,["name","validate","pattern"]);return l.createElement(s.Field,{name:e,validate:r},function(n){var r=n.field,a=n.form,i=Boolean(c.get(a,["errors",e])),s=l.useCallback(function(n){a.setFieldValue(e,n),a.setFieldError(e,B({date:n,min:t.minDate,max:t.maxDate,pattern:o}))},[e,a.setFieldValue,a.setFieldError]);return l.createElement(L,Object.assign({},t,r,{pattern:o,hasError:i,onUpdate:s}))})}function V(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 M=a(i.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 U(n){var e=n.children,r=V(n,["children"]);return l.createElement(M,Object.assign({},{as:"li"},r),e)}var q=l.forwardRef(function(n,e){var r=n.children,o=V(n,["children"]);return l.createElement(i.Box,Object.assign({},{ref:e,as:"ul",boxShadow:"medium",borderRadius:2,overflow:"auto",width:"100%",bg:"white"},o),r)});q.displayName="Body";var A=a.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"});A.displayName="ControlOuter";var Y=l.forwardRef(function(n,e){var r=n.children,o=n.isActive,t=n.hasError,a=V(n,["children","isActive","hasError"]);return l.createElement("div",{style:{position:"relative"}},l.createElement(A,Object.assign({},{ref:e,isActive:o,hasError:t,type:"button"},a),l.createElement(i.Span,{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},l.createElement(i.Span,{width:"100%",fontWeight:4,style:{whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",letterSpacing:"0.6px"}},r),l.createElement(i.Icon,{name:"ChevronDown",ml:"xs"}))),l.createElement(i.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"}),l.createElement(i.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 J(n){var e=n.value,r=n.placeholder;return c.get(n.items.filter(function(n){return n.value===e})[0],"label")||r||"Please select"}function G(n){var e=n.value,r=n.placeholder,t=n.label,a=n.items,s=n.hasError,c=n.disabled,d=n.onSelect,p=n.onRemove,u=l.useState(J({items:a,value:e,placeholder:r})),m=u[0],b=u[1];l.useEffect(function(){b(J({items:a,value:e,placeholder:r}))},[a,e,r]);var h=o.useSelect({items:a.map(function(n){return Object.assign({},n,{selected:n.value===e})}),onSelect:function(n){b(n.label),d&&d(n)},onRemove:function(n){b(r||"Please select"),p&&p(n)}}),f=h.items,g=h.isOpen,x=h.getDropProps;return l.createElement(i.Box,null,l.createElement(Y,Object.assign({},{id:h.id},c?{}:(0,h.getControlProps)(),{"aria-label":t,isActive:g,hasError:s,disabled:c}),m),g&&l.createElement(i.Box,{position:"absolute",bottom:"0",width:"100%",transform:"translateY(100%) translateY(6px)",zIndex:1e3},l.createElement(q,Object.assign({},x(),{style:{maxHeight:"240px",overflow:"auto"}}),f.map(function(n){return l.createElement(U,Object.assign({},{key:n.value,selected:n.selected,highlighted:n.highlighted},n.getItemProps()),n.label)}))))}function X(n){var e=n.name,r=n.validate,o=V(n,["name","validate"]);return l.createElement(s.Field,{name:e,validate:r},function(n){var e=n.field,r=n.form,t=Boolean(r.errors&&r.errors[e.name]);return l.createElement(G,Object.assign({},o,{hasError:t,onSelect:function(n){r.setFieldValue(e.name,n.value),o.onSelect&&o.onSelect(n)}}))})}function K(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}Y.displayName="Control";var Q=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"]),Z=a.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 transition-property: color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n "}),$=a.div(function(n){var e=n.theme;return"\n width: 100%;\n border: 1px solid "+e.colors.outline+";\n border-radius: 4px;\n\n "+on+" {\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 & "+on+" {\n border-color: "+e.colors.error+" !important;\n }\n ":"")+"\n "}),nn=a.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 "}),en=a.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 ~ "+nn+" {\n border-color: "+e.colors.primaryDark+";\n }\n &:focus ~ "+i.Box+" "+Z+" {\n color: "+e.colors.primary+";\n }\n\n &:checked ~ "+nn+" {\n background: "+e.colors.primary+";\n border-color: "+e.colors.primaryDark+";\n\n &::after {\n transform: scale(1);\n }\n }\n &:checked ~ "+i.Box+" "+Z+" {\n color: "+e.colors.primary+";\n }\n\n &:disabled ~ "+nn+" {\n border-color: "+e.colors.outline+" !important;\n }\n &:disabled ~ "+rn+" {\n background-color: "+e.colors.background+";\n }\n &:disabled ~ "+i.Box+" "+Z+" {\n color: "+e.colors.secondary+" !important;\n }\n "}),rn=a.span(Q),on=a.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 "+nn+" {\n border-color: "+e.colors.primaryDark+";\n }\n &:hover "+Z+" {\n color: "+e.colors.primary+";\n }\n "});function tn(n){var e=n.children,r=n.name,o=n.validate,t=n.onChange,a=n.onBlur,i=K(n,["children","name","validate","onChange","onBlur"]);return l.createElement(s.Field,{name:r,validate:o},function(n){var o=n.field,s=Boolean(c.get(n.form,["errors",r]));return l.createElement($,{hasError:s},l.Children.toArray(e).map(function(n){return l.cloneElement(n,Object.assign({},o,i,{value:n.props.value,hasError:s,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 an(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 ln=a.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"});ln.displayName="SelectElement";var sn=l.forwardRef(function(n,e){var r=n.children,o=n.hasError,t=n.placeholder;void 0===t&&(t="");var a=an(n,["children","hasError","placeholder"]);return l.createElement(i.Box,{ml:"-2px",mr:"-2px",p:"2px"},l.createElement(ln,Object.assign({},{ref:e,hasValue:Boolean(a.value),hasError:o},a,{value:a.value||""}),t&&l.createElement("option",{value:"",disabled:!0},t),r),l.createElement(i.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"}),l.createElement(i.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"}),l.createElement(i.Box,{position:"absolute",right:"0",top:"0",bottom:"0",height:"16px",my:"auto",pr:"sm",style:{pointerEvents:"none"}},l.createElement(i.Icon,{name:"ChevronDown",color:"secondary"})))});function cn(n){var e=n.name,r=n.validate,o=n.onChange,t=n.onBlur,a=an(n,["name","validate","onChange","onBlur"]);return l.createElement(s.Field,{name:e,validate:r},function(n){var r=n.field,i=Boolean(c.get(n.form,["errors",e]));return l.createElement(sn,Object.assign({},a,r,{hasError:i,onChange:function(n){r.onChange(n),o&&o(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}var dn=a(i.Box)(function(n){return"\n border-left: 2px solid currentColor;\n padding-left: "+n.theme.space.sm+";\n "});function pn(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 un=a.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"});un.displayName="TextareaElement",un.defaultProps={rows:4};var mn=l.forwardRef(function(n,e){var r=n.hasError,o=pn(n,["hasError"]);return l.createElement(i.Box,{ml:"-2px",mr:"-2px",p:"2px"},l.createElement(un,Object.assign({},{ref:e,hasError:r},o)),l.createElement(i.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"}),l.createElement(i.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 bn(n){var e=n.name,r=n.validate,o=n.onChange,t=n.onBlur,a=pn(n,["name","validate","onChange","onBlur"]);return l.createElement(s.Field,{name:e,validate:r},function(n){var r=n.field,i=Boolean(c.get(n.form,["errors",e]));return l.createElement(mn,Object.assign({},a,r,{hasError:i,onChange:function(n){r.onChange(n),o&&o(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})}var hn=Object.freeze(["\n display: block;\n position: relative;\n cursor: pointer;\n"]),fn=a.label(hn),gn=a.div(function(n){var e=n.theme;return"\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n width: 100%;\n padding: "+e.space.med+" "+e.space.sm+";\n color: "+e.colors.body+";\n background-color: "+e.colors.background+";\n border: 1px solid "+(n.hasError?e.colors.error:e.colors.outline)+";\n border-radius: "+e.space.xxs+";\n transition-property: color, background-color, border-color;\n transition-duration: "+e.transitionDurations.fast+";\n transition-timing-function: "+e.transitionTimingFunctions.ease+";\n"}),xn=a.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 &:checked\n ~ "+gn+",\n &:hover\n ~ "+gn+",\n &:focus\n ~ "+gn+" {\n border: 1px solid "+e.colors.primary+";\n background-color: rgba(91, 99, 254, 0.1);\n }\n\n &:checked ~ "+gn+" {\n color: "+e.colors.primary+";\n }\n"}),vn=Object.freeze(["\n ","\n"]),yn="\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",En=a.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"}),kn=a.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 "}),wn=a.label(function(n){return"\n display: flex;\n align-items: center;\n margin-bottom: 0 !important;\n\n &:hover "+kn+" {\n "+En+" {\n border-color: "+n.theme.colors.primaryDark+";\n }\n }\n "}),Fn=a.input(function(n){var e=n.theme;return"\n "+yn+"\n\n &:focus ~ "+kn+" {\n border-color: "+e.colors.primary+";\n }\n &:checked ~ "+kn+" {\n border-color: "+e.colors.primary+";\n\n "+En+" {\n background: "+e.colors.primary+";\n border-color: "+e.colors.primaryDark+";\n transform: translateX(24px);\n }\n }\n &:disabled ~ "+kn+" {\n pointer-events: none;\n "+En+" {\n border-color: "+e.colors.outline+";\n }\n }\n "}),Bn=a.span(vn,yn);function On(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 l.createElement(wn,{htmlFor:r},l.createElement(Fn,Object.assign({},{id:r,name:r,type:"checkbox",checked:o},t)),l.createElement(kn,null,l.createElement(En,null,l.createElement(i.Icon,{name:"Check",width:"12px",height:"12px",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",m:"auto",style:{strokeWidth:"2px"}}))),l.createElement(Bn,null,e))}function Dn(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=l.useState(e),a=t[0],i=t[1],s=l.useState(!1),c=s[1],p=s[0]?a:d.format(d.mask(a,r),o),u=l.useCallback(function(){c(!0)},[c]),m=l.useCallback(function(){c(!1)},[c]);return l.useEffect(function(){n.onUpdate&&n.onUpdate(a)},[a,n.onUpdate]),l.createElement(z,Object.assign({},n,{value:p,onFocus:u,onClick:u,onBlur:m,onChange:function(n){var e=n.target.value,r=/\*\*/.test(e);i(r?"":d.clean(e))}}))}function _n(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 l.createElement(s.Field,{name:e,validate:r},function(n){var r=n.field,t=n.form,a=Boolean(c.get(t,["errors",e])),i=l.useCallback(function(n){t.setFieldValue(e,n)},[e,t.setFieldValue]);return l.createElement(Dn,Object.assign({},o,r,{hasError:a,onUpdate:i}))})}exports.CheckboxGroup=x,exports.Checkbox=v,exports.CheckboxField=function(n){var e=n.name,r=n.validate,o=n.onChange,t=n.onBlur,a=p(n,["name","validate","onChange","onBlur"]);return l.createElement(s.Field,{name:e,validate:r},function(n){var r=n.field,i=Boolean(c.get(n.form,["errors",e]));return l.createElement(v,Object.assign({},a,r,{checked:Boolean(r.value),hasError:i,onChange:function(n){r.onChange(n),o&&o(n)},onBlur:function(n){r.onBlur(n),t&&t(n)}}))})},exports.DateInput=N,exports.DateInputField=H,exports.DateInputFieldWithLabel=function(n){return l.createElement(l.Fragment,null,l.createElement(D,{htmlFor:n.name},n.label),l.createElement(H,Object.assign({},n)))},exports.DateInputTypeIn=L,exports.DateInputTypeInField=W,exports.DateInputTypeInFieldWithLabel=function(n){return l.createElement(l.Fragment,null,l.createElement(D,{htmlFor:n.name},n.label),l.createElement(W,Object.assign({},n)))},exports.Item=U,exports.Body=q,exports.Control=Y,exports.Dropdown=G,exports.DropdownField=X,exports.DropdownFieldWithLabel=function(n){return l.createElement(l.Fragment,null,l.createElement(D,{htmlFor:n.name},n.label),l.createElement(X,Object.assign({},n)))},exports.ErrorMessage=function(n){return l.createElement(s.ErrorMessage,{name:n.name,render:function(n){return l.createElement(i.Span,{color:"error",fontSize:0},n)}})},exports.Input=z,exports.InputField=C,exports.InputFieldWithLabel=function(n){return l.createElement(l.Fragment,null,l.createElement(D,{htmlFor:n.name},n.label),l.createElement(C,Object.assign({},n)))},exports.Label=D,exports.Radio=function(n){var e=n.name,r=n.checked,o=n.description,t=n.label,a=K(n,["children","name","checked","description","label"]),s=e+a.value;return l.createElement(on,{htmlFor:s},l.createElement(en,Object.assign({},{id:s,name:e,type:"radio",checked:r},a)),l.createElement(nn,{checked:r}),l.createElement(i.Box,{display:"block",position:"relative",zIndex:1,width:"calc(100% - 32px)",maxWidth:"calc(100% - 32px)"},t&&l.createElement(Z,null,t),o&&l.createElement(i.P,{mt:"xxs",color:"secondary",fontSize:0,fontWeight:4,lineHeight:0},o)),l.createElement(rn,null))},exports.RadioField=tn,exports.RadioFieldWithLabel=function(n){var e=n.label,r=K(n,["label"]);return l.createElement(l.Fragment,null,l.createElement(D,{htmlFor:r.name},e),l.createElement(tn,Object.assign({},r)))},exports.Select=sn,exports.SelectField=cn,exports.SelectFieldWithLabel=function(n){return l.createElement(l.Fragment,null,l.createElement(D,{htmlFor:n.name},n.label),l.createElement(cn,Object.assign({},n)))},exports.SubGroup=dn,exports.Textarea=mn,exports.TextareaField=bn,exports.TextareaFieldWithLabel=function(n){return l.createElement(l.Fragment,null,l.createElement(D,{htmlFor:n.name},n.label),l.createElement(bn,Object.assign({},n)))},exports.Tile=function(n){var e=n.icon,r=n.label,o=n.hasError,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,["icon","label","hasError"]),a=t.name+t.value;return l.createElement(fn,{htmlFor:a},l.createElement(xn,Object.assign({},{id:a,type:"radio"},t)),l.createElement(gn,{hasError:o},e&&l.createElement(i.Circle,{mb:"xs",background:"white",width:"48px",height:"48px"},e),l.createElement(i.Span,{display:"flex",justifyContent:"center",minHeight:"32px",fontSize:0,fontWeight:5,lineHeight:0,width:"100%"},r)))},exports.hidden=yn,exports.Toggle=On,exports.ToggleField=function(n){var e=n.label;return l.createElement(s.Field,{name:n.name,validate:n.validate},function(n){var r=n.field;return l.createElement(On,Object.assign({},{label:e},r,{checked:Boolean(r.value)}))})},exports.SSNInput=Dn,exports.SSNInputField=_n,exports.SSNInputFieldWithLabel=function(n){return l.createElement(l.Fragment,null,l.createElement(D,{htmlFor:n.name},n.label),l.createElement(_n,Object.assign({},n)))}; | ||
//# sourceMappingURL=index.js.map |
@@ -0,1 +1,2 @@ | ||
export declare const DATE_FORMAT = "yyyy-mm-dd"; | ||
export declare function getLastDayOfMonth({ year, month }: { | ||
@@ -6,1 +7,11 @@ year: number; | ||
export declare function zeroPadDate(value: number): string; | ||
export declare function sanitizeDate(datestring: string): string; | ||
/** | ||
* All values must be DATE_FORMAT | ||
*/ | ||
export declare function validateDate({ date, min, max, pattern, }: { | ||
date: string; | ||
min?: string; | ||
max?: string; | ||
pattern?: string; | ||
}): string | undefined; |
{ | ||
"name": "@truework/forms", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "", | ||
@@ -36,3 +36,2 @@ "main": "dist/index.js", | ||
"@types/react-router-dom": "^5.1.3", | ||
"@types/react-text-mask": "^5.4.8", | ||
"@types/styled-components": "^5.0.1", | ||
@@ -52,6 +51,5 @@ "@types/styled-system": "^5.1.1", | ||
"lodash": "^4.17.15", | ||
"moment": "^2.29.1", | ||
"parse-ssn": "^0.3.2", | ||
"picomask": "^1.3.1", | ||
"react": "16", | ||
"react-text-mask": "^5.4.3", | ||
"styled-components": "5", | ||
@@ -58,0 +56,0 @@ "styled-system": "5", |
@@ -11,8 +11,4 @@ # @truework/forms ![npm](https://img.shields.io/npm/v/@truework/forms) [![](https://badgen.net/bundlephobia/minzip/@truework/forms)](https://bundlephobia.com/result?p=@truework/forms) | ||
## Related Projects | ||
- `@truework/ui` - [repo](https://github.com/truework/ui) | ||
### License | ||
MIT License © [Truework](https://truework.com) |
@@ -0,1 +1,20 @@ | ||
import { picomask, transform } from 'picomask' | ||
export const DATE_FORMAT = 'yyyy-mm-dd' | ||
const months = [ | ||
'January', | ||
'February', | ||
'March', | ||
'April', | ||
'May', | ||
'June', | ||
'July', | ||
'August', | ||
'September', | ||
'October', | ||
'November', | ||
'December', | ||
] | ||
export function getLastDayOfMonth({ year, month }: { year: number; month: number }) { | ||
@@ -9,1 +28,48 @@ const d = new Date(year, month, 0) | ||
} | ||
export function sanitizeDate(datestring: string) { | ||
return datestring.replace(/[^\d]/g, '').slice(0, 8) | ||
} | ||
/** | ||
* All values must be DATE_FORMAT | ||
*/ | ||
export function validateDate({ | ||
date, | ||
min, | ||
max, | ||
pattern = DATE_FORMAT, | ||
}: { | ||
date: string | ||
min?: string | ||
max?: string | ||
pattern?: string | ||
}) { | ||
const { y, m, d } = picomask(date, DATE_FORMAT) | ||
const year = parseInt(y) | ||
const month = parseInt(m) | ||
const day = parseInt(d) | ||
const lastDayOfMonth = getLastDayOfMonth({ month, year }) | ||
if (month > 12) { | ||
return `There are only 12 months` | ||
} | ||
if (d === '00') { | ||
return `Day cannot be 0` | ||
} | ||
if (m === '00') { | ||
return `Month cannot be 0` | ||
} | ||
if (y === '0000') { | ||
return `Year cannot be 0` | ||
} | ||
if (day > lastDayOfMonth) { | ||
return `There are only ${lastDayOfMonth} days in ${months[month - 1]} ${year}` | ||
} | ||
if (min && new Date(date) < new Date(min)) { | ||
return `Date must be after ${transform(picomask(min, DATE_FORMAT), pattern).value}` | ||
} | ||
if (max && new Date(date) > new Date(max)) { | ||
return `Date must be before ${transform(picomask(max, DATE_FORMAT), pattern).value}` | ||
} | ||
} |
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
334390
9
13
3174
14
+ Addedpicomask@^1.3.1
+ Addedelectron-to-chromium@1.5.18(transitive)
+ Addedpicomask@1.3.1(transitive)
- Removedmoment@^2.29.1
- Removedreact-text-mask@^5.4.3
- Removedelectron-to-chromium@1.5.16(transitive)
- Removedmoment@2.30.1(transitive)
- Removedreact-text-mask@5.5.0(transitive)