@solace-health/ui 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8,8 +8,8 @@ import * as V2 from 'contentful';
8
8
  import { ThemeProvider, Global, css } from '@emotion/react';
9
9
  import { useFormContext, Controller, useForm, FormProvider } from 'react-hook-form';
10
10
  export { useForm } from 'react-hook-form';
11
- import { useIMask } from 'react-imask';
12
- import Ct, { getGeocode } from 'use-places-autocomplete';
11
+ import { IMaskMixin } from 'react-imask';
12
+ import gt, { getGeocode } from 'use-places-autocomplete';
13
13
  import { useLoadScript } from '@react-google-maps/api';
14
14
 
15
15
  var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1=o.div`
@@ -352,7 +352,7 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
352
352
  transition: background-color 5000s ease-in-out 0s;
353
353
  background-clip: content-box !important;
354
354
  }
355
- `,w5=o.textarea`
355
+ `,w5=IMaskMixin(({inputRef:t,...e})=>jsx(v5,{ref:t,...e})),k5=o.textarea`
356
356
  width: 100%;
357
357
  resize: none;
358
358
  height: 200px;
@@ -370,14 +370,14 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
370
370
  outline-style: solid;
371
371
  border-color: ${({theme:t})=>t.colors.secondaryGreen};
372
372
  }
373
- `,k5=({name:t,label:e=null,details:r=null,type:n="text",options:s={},textArea:i=!1,marginBottom:l=null,isLabelBold:d=!0,format:a=String,...m})=>{let{register:u,control:v}=useFormContext(),x=useIMask({mask:a});return jsxs(Fragment,{children:[e&&jsx(b5,{size:"lg",isLabelBold:d,children:e}),r&&jsx(L5,{children:r}),i?jsx(w5,{...m,...u(t,s),marginBottom:l}):jsx(Controller,{render:h=>jsx(v5,{...m,name:h.field.name,onBlur:h.field.onBlur,defaultValue:s.value||h.field.value,ref:x.ref,onChange:()=>h.field.onChange({target:{value:x.unmaskedValue}}),autoComplete:a?"off":"on",marginBottom:l,type:n}),name:t,rules:s,control:v})]})},E=k5;var P5=o.div`
373
+ `,S5=({name:t,label:e=null,details:r=null,type:n="text",options:s={},textArea:i=!1,marginBottom:l=null,isLabelBold:d=!0,format:a=String,...m})=>{let{register:u,control:v}=useFormContext();return jsxs(Fragment,{children:[e&&jsx(b5,{size:"lg",isLabelBold:d,children:e}),r&&jsx(L5,{children:r}),i?jsx(k5,{...m,...u(t,s),marginBottom:l}):jsx(Controller,{render:y=>jsx(w5,{...m,mask:a,name:y.field.name,onBlur:y.field.onBlur,defaultValue:s.value||y.field.value,onAccept:x=>y.field.onChange({target:{value:x}}),marginBottom:l,type:n}),name:t,rules:s,control:v})]})},R=S5;var B5=o.div`
374
374
  margin-bottom: 32px;
375
- `,B5=o.div`
375
+ `,D5=o.div`
376
376
  display: ${({inline:t})=>t?"flex":"block"};
377
377
  gap: 20px;
378
378
  flex-wrap: wrap;
379
379
  margin: 20px 0;
380
- `,D5=o.div`
380
+ `,$5=o.div`
381
381
  display: flex;
382
382
  gap: 30rem;
383
383
  align-items: center;
@@ -388,7 +388,7 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
388
388
  label {
389
389
  padding-left: 35px;
390
390
  }
391
- `,$5=o.input`
391
+ `,O5=o.input`
392
392
  -webkit-appearance: none;
393
393
  position: absolute;
394
394
  appearance: none;
@@ -442,12 +442,12 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
442
442
  &:checked + label::before {
443
443
  background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOSIgdmlld0JveD0iMCAwIDEyIDkiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0xMC42NjY3IDEuNTAwMTJMNC4yNTAwNCA3LjkxNjc5TDEuMzMzMzcgNS4wMDAxMiIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==")
444
444
  }
445
- `,O5=o(c.Body)`
445
+ `,V5=o(c.Body)`
446
446
  margin-bottom: 5px;
447
447
  font-weight: bold;
448
- `,V5=o(c.Body)`
448
+ `,H5=o(c.Body)`
449
449
  margin-bottom: 5px;
450
- `,H5=o.div`
450
+ `,E5=o.div`
451
451
  display: flex;
452
452
  gap: 15px;
453
453
  align-items: center;
@@ -456,7 +456,7 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
456
456
  input[type="text"] {
457
457
  margin: 0;
458
458
  }
459
- `,U=({option:t,name:e})=>{let{register:r}=useFormContext();return jsxs(D5,{children:[jsx($5,{type:"checkbox",value:t.value,...r(e)}),jsx("label",{htmlFor:e,children:jsx(c.Body,{children:t.label})})]})},I2=({name:t,label:e,details:r="",options:n=[],inline:s=!1,other:i={}})=>jsxs(P5,{children:[jsx(O5,{size:"lg",children:e}),r&&jsx(V5,{children:r}),jsxs(B5,{inline:s,children:[n.map(l=>jsx(U,{option:l,name:t},`${t}-${l.value}`)),i.label&&jsxs(H5,{children:[jsx(U,{option:{label:i.label,value:"other"},name:t},t),jsx(E,{name:`${t}_other`})]})]})]});var Z5=({formMethods:t=null,formOptions:e={},onSubmit:r,children:n,className:s=""})=>{let i={mode:"onBlur",...e},l=useForm(i),d=t||l,a=m=>r(m);return jsx(FormProvider,{...d,children:jsx("form",{className:s,onSubmit:d.handleSubmit(a),children:n})})},N2=Z5;var F5=({label:t,name:e,options:r={}})=>{let{register:n}=useFormContext(),s=o.div`
459
+ `,U=({option:t,name:e})=>{let{register:r}=useFormContext();return jsxs($5,{children:[jsx(O5,{type:"checkbox",value:t.value,...r(e)}),jsx("label",{htmlFor:e,children:jsx(c.Body,{children:t.label})})]})},I2=({name:t,label:e,details:r="",options:n=[],inline:s=!1,other:i={}})=>jsxs(B5,{children:[jsx(V5,{size:"lg",children:e}),r&&jsx(H5,{children:r}),jsxs(D5,{inline:s,children:[n.map(l=>jsx(U,{option:l,name:t},`${t}-${l.value}`)),i.label&&jsxs(E5,{children:[jsx(U,{option:{label:i.label,value:"other"},name:t},t),jsx(R,{name:`${t}_other`})]})]})]});var T5=({formMethods:t=null,formOptions:e={},onSubmit:r,children:n,className:s=""})=>{let i={mode:"onBlur",...e},l=useForm(i),d=t||l,a=m=>r(m);return jsx(FormProvider,{...d,children:jsx("form",{className:s,onSubmit:d.handleSubmit(a),children:n})})},N2=T5;var A5=({label:t,name:e,options:r={}})=>{let{register:n}=useFormContext(),s=o.div`
460
460
  position: relative;
461
461
  margin-bottom: 24px;
462
462
 
@@ -483,14 +483,14 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
483
483
  font-size: 24px;
484
484
  font-style: normal;
485
485
  width: 100%;
486
- `;return jsxs(s,{children:[jsxs(i,{children:[jsx(W,{}),jsx(l,{...n(e,r)})]}),jsx("label",{htmlFor:e,children:jsx(c.Body,{children:t})})]})},K2=F5;var I5=o.div`
486
+ `;return jsxs(s,{children:[jsxs(i,{children:[jsx(W,{}),jsx(l,{...n(e,r)})]}),jsx("label",{htmlFor:e,children:jsx(c.Body,{children:t})})]})},K2=A5;var G5=o.div`
487
487
  margin-bottom: 32px;
488
- `,G5=o.div`
488
+ `,N5=o.div`
489
489
  display: ${({inline:t})=>t?"flex":"block"};
490
490
  gap: 20px;
491
491
  flex-wrap: wrap;
492
492
  margin: 20px 0;
493
- `,N5=o.div`
493
+ `,W5=o.div`
494
494
  display: flex;
495
495
  gap: 30rem;
496
496
  align-items: center;
@@ -501,7 +501,7 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
501
501
  label {
502
502
  padding-left: 32px;
503
503
  }
504
- `,W5=o.input`
504
+ `,K5=o.input`
505
505
  -webkit-appearance: none;
506
506
  position: absolute;
507
507
  appearance: none;
@@ -554,12 +554,12 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
554
554
  transform: scale(1.65);
555
555
  background: #1d4339;
556
556
  }
557
- `,K5=o(c.Body)`
557
+ `,_5=o(c.Body)`
558
558
  margin-bottom: 5px;
559
559
  font-weight: bold;
560
- `,_5=o(c.Body)`
560
+ `,U5=o(c.Body)`
561
561
  margin-bottom: 5px;
562
- `,U5=o.div`
562
+ `,X5=o.div`
563
563
  display: flex;
564
564
  gap: 15px;
565
565
  align-items: center;
@@ -567,16 +567,16 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
567
567
  input[type="text"] {
568
568
  margin: 0;
569
569
  }
570
- `,Y=({option:t,name:e,inline:r})=>{let{register:n}=useFormContext();return jsxs(N5,{inline:r,children:[jsx(W5,{type:"radio",value:t.value,...n(e)}),jsx("label",{htmlFor:e,children:jsx(c.Body,{children:t.label})})]})},_2=({name:t,label:e,details:r="",options:n=[],inline:s=!1,allowOther:i=!1})=>jsxs(I5,{children:[jsx(K5,{size:"lg",children:e}),r&&jsx(_5,{children:r}),jsxs(G5,{inline:s,children:[n.map(l=>jsx(Y,{option:l,name:t,inline:s},`${t}-${l.value}`)),i&&jsxs(U5,{children:[jsx(Y,{option:{label:"Other",value:"other"},name:t,inline:s},t),jsx(E,{name:`${t}_other`})]})]})]});var q5=o.div`
570
+ `,Y=({option:t,name:e,inline:r})=>{let{register:n}=useFormContext();return jsxs(W5,{inline:r,children:[jsx(K5,{type:"radio",value:t.value,...n(e)}),jsx("label",{htmlFor:e,children:jsx(c.Body,{children:t.label})})]})},_2=({name:t,label:e,details:r="",options:n=[],inline:s=!1,allowOther:i=!1})=>jsxs(G5,{children:[jsx(_5,{size:"lg",children:e}),r&&jsx(U5,{children:r}),jsxs(N5,{inline:s,children:[n.map(l=>jsx(Y,{option:l,name:t,inline:s},`${t}-${l.value}`)),i&&jsxs(X5,{children:[jsx(Y,{option:{label:"Other",value:"other"},name:t,inline:s},t),jsx(R,{name:`${t}_other`})]})]})]});var j5=o.div`
571
571
  position: relative;
572
572
  margin-bottom: 24px;
573
573
  z-index: 40;
574
- `,j5=o(c.Body)`
574
+ `,tt=o(c.Body)`
575
575
  margin-bottom: 5px;
576
576
  font-weight: bold;
577
- `,tt=o(c.Body)`
577
+ `,et=o(c.Body)`
578
578
  margin-bottom: 12px;
579
- `,et=o.div`
579
+ `,ot=o.div`
580
580
  position: relative;
581
581
  padding: 15px 23px;
582
582
  margin-top: 8px;
@@ -592,7 +592,7 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
592
592
  right: 25px;
593
593
  top: 17px;
594
594
  }
595
- `,ot=o(animated.div)`
595
+ `,rt=o(animated.div)`
596
596
  position: absolute;
597
597
  background: #fff;
598
598
  border-radius: 8px;
@@ -602,7 +602,7 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
602
602
  right: 0;
603
603
  max-height: 180px;
604
604
  overflow: scroll;
605
- `,rt=o.div`
605
+ `,nt=o.div`
606
606
  cursor: pointer;
607
607
  padding: 13px 24px;
608
608
  position: relative;
@@ -612,7 +612,7 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
612
612
  background: #3f937c;
613
613
  }
614
614
  }
615
- `,nt=o.div`
615
+ `,it=o.div`
616
616
  display: flex;
617
617
  align-items: center;
618
618
  justify-content: center;
@@ -626,22 +626,22 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
626
626
  border: 0.766898px solid;
627
627
  border-color: ${t=>t.isCurrent?"#285E50 !important":"#3f937c"};
628
628
  background: ${t=>t.isCurrent?"#285E50 !important":"#FFF"};
629
- `,it=o.input`
629
+ `,st=o.input`
630
630
  outline: none;
631
631
  border: none;
632
632
  background: none;
633
633
  position: absolute;
634
634
  left: 20px;
635
- `,st=({label:t="",name:e,details:r="",options:n=[],allowInput:s=!1,formOptions:i={}})=>{let l=useRef(),d=useFormContext();d.register(e,i);let[a,m]=useState(!1),[u,v]=useState(""),[x,h]=useState(n),S=useSpring(a?{opacity:1,transform:"translate(0px, 0px)",display:"block",config:{duration:150}}:{opacity:0,transform:"translate(0px, -2px)",display:"none",config:{duration:150}});useEffect(()=>{let f=y=>{a&&l.current&&!l.current.contains(y.target)&&m(!1);};return document.addEventListener("mousedown",y=>f(y)),()=>{document.removeEventListener("mousedown",y=>f(y));}},[a]);let $=n.find(f=>f.value===d.getValues(e))?.label,O=f=>{v(""),d.setValue(e,f.value),d.trigger(e),m(!1);};useEffect(()=>{if(m(!!u),u){let f=n.filter(y=>y.value.match(u.toLowerCase()));h(f),d.setValue(e,u);}else h(n);},[u]);let V=f=>{f.code==="Enter"&&f.preventDefault();};return jsxs(q5,{children:[jsx(j5,{size:"lg",children:t}),r&&jsx(tt,{children:r}),jsxs(et,{onClick:()=>m(!a),children:[$,s&&jsx(it,{onKeyDown:V,value:u,onChange:f=>v(f.target.value),type:"text"}),jsx(H.Caret,{direction:a?"up":"down"}),jsx(ot,{style:S,ref:l,children:x.map(f=>{let{label:y}=f,C=f.label===$;return jsxs(rt,{onClick:()=>O(f),children:[jsx(c.Body,{size:"lg",children:y}),jsx(nt,{isCurrent:C,children:jsx(H.Check,{color:"#fff"})})]},f.value)})})]})]})},X2=st;var dt=({label:t="Submit",isSubmitting:e=!1,hideWhenInvalid:r=!1,...n})=>{let s=useFormContext(),{isValid:i}=s.formState,d=useSpring((r?i:!0)?{position:"relative",zIndex:0,opacity:1,transform:"translate(0px, 0px)",display:"block",config:{duration:250}}:{opacity:0,transform:"translate(0px, -3px)",display:"none",config:{duration:250}});return jsx(animated.div,{style:d,...n,children:jsx(t2.Primary,{type:"submit",isSubmitting:e,...n,children:t})})},Y2=dt;var ut=o.div`
635
+ `,at=({label:t="",name:e,details:r="",options:n=[],allowInput:s=!1,formOptions:i={}})=>{let l=useRef(),d=useFormContext();d.register(e,i);let[a,m]=useState(!1),[u,v]=useState(""),[y,x]=useState(n),S=useSpring(a?{opacity:1,transform:"translate(0px, 0px)",display:"block",config:{duration:150}}:{opacity:0,transform:"translate(0px, -2px)",display:"none",config:{duration:150}});useEffect(()=>{let f=h=>{a&&l.current&&!l.current.contains(h.target)&&m(!1);};return document.addEventListener("mousedown",h=>f(h)),()=>{document.removeEventListener("mousedown",h=>f(h));}},[a]);let $=n.find(f=>f.value===d.getValues(e))?.label,O=f=>{v(""),d.setValue(e,f.value),d.trigger(e),m(!1);};useEffect(()=>{if(m(!!u),u){let f=n.filter(h=>h.value.match(u.toLowerCase()));x(f),d.setValue(e,u);}else x(n);},[u]);let V=f=>{f.code==="Enter"&&f.preventDefault();};return jsxs(j5,{children:[jsx(tt,{size:"lg",children:t}),r&&jsx(et,{children:r}),jsxs(ot,{onClick:()=>m(!a),children:[$,s&&jsx(st,{onKeyDown:V,value:u,onChange:f=>v(f.target.value),type:"text"}),jsx(H.Caret,{direction:a?"up":"down"}),jsx(rt,{style:S,ref:l,children:y.map(f=>{let{label:h}=f,C=f.label===$;return jsxs(nt,{onClick:()=>O(f),children:[jsx(c.Body,{size:"lg",children:h}),jsx(it,{isCurrent:C,children:jsx(H.Check,{color:"#fff"})})]},f.value)})})]})]})},X2=at;var ct=({label:t="Submit",isSubmitting:e=!1,hideWhenInvalid:r=!1,...n})=>{let s=useFormContext(),{isValid:i}=s.formState,d=useSpring((r?i:!0)?{position:"relative",zIndex:0,opacity:1,transform:"translate(0px, 0px)",display:"block",config:{duration:250}}:{opacity:0,transform:"translate(0px, -3px)",display:"none",config:{duration:250}});return jsx(animated.div,{style:d,...n,children:jsx(t2.Primary,{type:"submit",isSubmitting:e,...n,children:t})})},Y2=ct;var ht=o.div`
636
636
  position: relative;
637
637
  margin-bottom: 24px;
638
638
  z-index: 100;
639
- `,ht=o(c.Body)`
639
+ `,yt=o(c.Body)`
640
640
  margin-bottom: 5px;
641
641
  font-weight: bold;
642
- `,yt=o(c.Body)`
642
+ `,xt=o(c.Body)`
643
643
  margin-bottom: 12px;
644
- `,xt=o.div`
644
+ `,bt=o.div`
645
645
  position: relative;
646
646
  display: flex;
647
647
  align-items: center;
@@ -652,7 +652,7 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
652
652
  border-radius: 8px;
653
653
  height: 50px;
654
654
  background-color: #fff;
655
- `,bt=o(animated.div)`
655
+ `,Lt=o(animated.div)`
656
656
  position: absolute;
657
657
  background: #fff;
658
658
  border-radius: 8px;
@@ -662,7 +662,7 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
662
662
  right: 0;
663
663
  max-height: 180px;
664
664
  overflow: scroll;
665
- `,Lt=o(animated.div)`
665
+ `,vt=o(animated.div)`
666
666
  position: absolute;
667
667
  display: block;
668
668
  width: 45px;
@@ -676,7 +676,7 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
676
676
  right: 20px;
677
677
  top: 17px;
678
678
  }
679
- `,vt=o.div`
679
+ `,wt=o.div`
680
680
  cursor: pointer;
681
681
  padding: 13px 24px;
682
682
  position: relative;
@@ -687,7 +687,7 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
687
687
  color: #fff;
688
688
  }
689
689
  }
690
- `,wt=o.input`
690
+ `,kt=o.input`
691
691
  outline: none;
692
692
  border: none;
693
693
  background: none;
@@ -700,16 +700,16 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
700
700
  padding: 0 20px;
701
701
  width: 100%;
702
702
  height: 100%;
703
- `,kt=t=>{let e="",r="";t.address_components.forEach(i=>{let l=i.types.some(a=>a==="locality"),d=i.types.some(a=>a==="administrative_area_level_1");l?e=i.short_name:d&&(r=i.short_name);});let n=t.geometry.location.lat(),s=t.geometry.location.lng();return {city:e,state:r,lat:n,long:s}},St=({handleSelect:t,option:e,value:r})=>{let{description:n}=e,s=n===r,i=n.replace(", USA","");return jsx(vt,{isCurrent:s,onClick:()=>t(i),children:jsx(c.Body,{size:"lg",children:i})})},Mt=({label:t="",details:e="",required:r=!0})=>{let n=useRef(),[s,i]=useState(!1),[l,d]=useState(!1),a=useFormContext();a.register("city",{required:r});let m=useSpring(s?{opacity:1,transform:"translate(0px, 0px)",display:"block",config:{duration:150}}:{opacity:0,transform:"translate(0px, -2px)",display:"none",config:{duration:150}});useEffect(()=>{let C=b=>{s&&n.current&&!n.current.contains(b.target)&&i(!1);};return document.addEventListener("mousedown",b=>C(b)),()=>{document.removeEventListener("mousedown",b=>C(b));}},[s]);let u=a.getValues("city")?`${a.getValues("city")}, ${a.getValues("state")}`:"",{value:v,suggestions:{data:x,loading:h},setValue:S,clearSuggestions:$}=Ct({requestOptions:{types:["locality","postal_code"],componentRestrictions:{country:"us"}}});useEffect(()=>{if(h){d(h);return}setTimeout(()=>{d(h);},2e3);},[h]);let O=useSpring(l?{opacity:1,transform:"translate(0px, 0px)",config:{duration:400}}:{opacity:0,transform:"translate(5px, 0px)",config:{duration:200}}),V=C=>{S(C.target.value),a.setValue("city",null),a.setValue("state",null),a.trigger("city"),C.target.value.length>=3&&i(!0);},f=C=>{S(C,!1),$(),!(C.length<=2)&&getGeocode({address:C}).then(b=>{let{city:p,state:g,lat:j,long:l1}=kt(b[0]);a.setValue("city",p),a.setValue("state",g),a.setValue("lat",j),a.setValue("long",l1),a.trigger("city");}).catch(b=>console.error(`Google Maps API error: ${b}`));},y=C=>{C.code==="Enter"&&C.preventDefault();};return jsxs(ut,{children:[jsx(ht,{size:"lg",children:t}),e&&jsx(yt,{children:e}),jsxs(xt,{children:[jsx(wt,{onKeyDown:y,value:v||u,onChange:C=>V(C),type:"text"}),x.length>0&&jsx(bt,{style:m,ref:n,children:x.map(C=>jsx(St,{handleSelect:f,option:C,value:v},C.description))}),jsx(Lt,{style:O,children:jsx(M,{size:"sm"})})]})]})},o1=t=>{let{isLoaded:e}=useLoadScript({googleMapsApiKey:t.api_key||process.env.GOOGLE_MAPS_API_KEY||"",libraries:["places"]});return e?jsx(Mt,{...t}):null};var n1=({color:t="#5A5A5A"})=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.9999 10.9999H12.2099L11.9299 10.7299C13.1299 9.32989 13.7499 7.41989 13.4099 5.38989C12.9399 2.60989 10.6199 0.389893 7.81989 0.0498932C3.58989 -0.470107 0.0298932 3.08989 0.549893 7.31989C0.889893 10.1199 3.10989 12.4399 5.88989 12.9099C7.91989 13.2499 9.82989 12.6299 11.2299 11.4299L11.4999 11.7099V12.4999L15.7499 16.7499C16.1599 17.1599 16.8299 17.1599 17.2399 16.7499C17.6499 16.3399 17.6499 15.6699 17.2399 15.2599L12.9999 10.9999ZM6.99989 10.9999C4.50989 10.9999 2.49989 8.98989 2.49989 6.49989C2.49989 4.00989 4.50989 1.99989 6.99989 1.99989C9.48989 1.99989 11.4999 4.00989 11.4999 6.49989C11.4999 8.98989 9.48989 10.9999 6.99989 10.9999Z",fill:"#5A5A5A",color:t})});var Dt=o.div`
703
+ `,St=t=>{let e="",r="";t.address_components.forEach(i=>{let l=i.types.some(a=>a==="locality"),d=i.types.some(a=>a==="administrative_area_level_1");l?e=i.short_name:d&&(r=i.short_name);});let n=t.geometry.location.lat(),s=t.geometry.location.lng();return {city:e,state:r,lat:n,long:s}},Mt=({handleSelect:t,option:e,value:r})=>{let{description:n}=e,s=n===r,i=n.replace(", USA","");return jsx(wt,{isCurrent:s,onClick:()=>t(i),children:jsx(c.Body,{size:"lg",children:i})})},zt=({label:t="",details:e="",required:r=!0})=>{let n=useRef(),[s,i]=useState(!1),[l,d]=useState(!1),a=useFormContext();a.register("city",{required:r});let m=useSpring(s?{opacity:1,transform:"translate(0px, 0px)",display:"block",config:{duration:150}}:{opacity:0,transform:"translate(0px, -2px)",display:"none",config:{duration:150}});useEffect(()=>{let C=b=>{s&&n.current&&!n.current.contains(b.target)&&i(!1);};return document.addEventListener("mousedown",b=>C(b)),()=>{document.removeEventListener("mousedown",b=>C(b));}},[s]);let u=a.getValues("city")?`${a.getValues("city")}, ${a.getValues("state")}`:"",{value:v,suggestions:{data:y,loading:x},setValue:S,clearSuggestions:$}=gt({requestOptions:{types:["locality","postal_code"],componentRestrictions:{country:"us"}}});useEffect(()=>{if(x){d(x);return}setTimeout(()=>{d(x);},2e3);},[x]);let O=useSpring(l?{opacity:1,transform:"translate(0px, 0px)",config:{duration:400}}:{opacity:0,transform:"translate(5px, 0px)",config:{duration:200}}),V=C=>{S(C.target.value),a.setValue("city",null),a.setValue("state",null),a.trigger("city"),C.target.value.length>=3&&i(!0);},f=C=>{S(C,!1),$(),!(C.length<=2)&&getGeocode({address:C}).then(b=>{let{city:p,state:g,lat:j,long:l1}=St(b[0]);a.setValue("city",p),a.setValue("state",g),a.setValue("lat",j),a.setValue("long",l1),a.trigger("city");}).catch(b=>console.error(`Google Maps API error: ${b}`));},h=C=>{C.code==="Enter"&&C.preventDefault();};return jsxs(ht,{children:[jsx(yt,{size:"lg",children:t}),e&&jsx(xt,{children:e}),jsxs(bt,{children:[jsx(kt,{onKeyDown:h,value:v||u,onChange:C=>V(C),type:"text"}),y.length>0&&jsx(Lt,{style:m,ref:n,children:y.map(C=>jsx(Mt,{handleSelect:f,option:C,value:v},C.description))}),jsx(vt,{style:O,children:jsx(M,{size:"sm"})})]})]})},o1=t=>{let{isLoaded:e}=useLoadScript({googleMapsApiKey:t.api_key||process.env.GOOGLE_MAPS_API_KEY||"",libraries:["places"]});return e?jsx(zt,{...t}):null};var n1=({color:t="#5A5A5A"})=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.9999 10.9999H12.2099L11.9299 10.7299C13.1299 9.32989 13.7499 7.41989 13.4099 5.38989C12.9399 2.60989 10.6199 0.389893 7.81989 0.0498932C3.58989 -0.470107 0.0298932 3.08989 0.549893 7.31989C0.889893 10.1199 3.10989 12.4399 5.88989 12.9099C7.91989 13.2499 9.82989 12.6299 11.2299 11.4299L11.4999 11.7099V12.4999L15.7499 16.7499C16.1599 17.1599 16.8299 17.1599 17.2399 16.7499C17.6499 16.3399 17.6499 15.6699 17.2399 15.2599L12.9999 10.9999ZM6.99989 10.9999C4.50989 10.9999 2.49989 8.98989 2.49989 6.49989C2.49989 4.00989 4.50989 1.99989 6.99989 1.99989C9.48989 1.99989 11.4999 4.00989 11.4999 6.49989C11.4999 8.98989 9.48989 10.9999 6.99989 10.9999Z",fill:"#5A5A5A",color:t})});var $t=o.div`
704
704
  position: relative;
705
705
  margin-bottom: 24px;
706
706
  z-index: 200;
707
- `,$t=o(c.Body)`
707
+ `,Ot=o(c.Body)`
708
708
  margin-bottom: 5px;
709
709
  font-weight: bold;
710
- `,Ot=o(c.Body)`
710
+ `,Vt=o(c.Body)`
711
711
  margin-bottom: 12px;
712
- `,Vt=o.div`
712
+ `,Ht=o.div`
713
713
  position: relative;
714
714
  padding: 15px 23px;
715
715
  margin-top: 8px;
@@ -726,7 +726,7 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
726
726
  left: 25px;
727
727
  top: 17px;
728
728
  }
729
- `,Ht=o(animated.div)`
729
+ `,Et=o(animated.div)`
730
730
  position: absolute;
731
731
  background: #fff;
732
732
  border-radius: 8px;
@@ -746,7 +746,7 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
746
746
  background: #3f937c;
747
747
  }
748
748
  }
749
- `,Et=o.input`
749
+ `,Rt=o.input`
750
750
  outline: none;
751
751
  border: none;
752
752
  background: none;
@@ -758,7 +758,7 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
758
758
  width: 100%;
759
759
  height: 100%;
760
760
  padding-left: 10px;
761
- `,Rt=o.div`
761
+ `,Zt=o.div`
762
762
  height: 32px;
763
763
  border-radius: 32px;
764
764
  margin-right: 10px;
@@ -769,7 +769,7 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
769
769
  align-items: center;
770
770
  display: flex;
771
771
  margin-top: 8px;
772
- `,Zt=o.div`
772
+ `,Tt=o.div`
773
773
  display: flex;
774
774
  align-items: center;
775
775
  justify-content: center;
@@ -783,8 +783,8 @@ var d2=(i=>(i.XL="xl",i.LG="lg",i.MD="md",i.SM="sm",i.XS="xs",i))(d2||{});var d1
783
783
  border: 0.766898px solid;
784
784
  border-color: ${t=>t.isCurrent?"#285E50 !important":"#3f937c"};
785
785
  background: ${t=>t.isCurrent?"#285E50 !important":"#FFF"};
786
- `,Tt=({label:t="",name:e,details:r="",options:n=[]})=>{let s=useRef(),i=useFormContext(),[l,d]=useState(!1),[a,m]=useState(""),[u,v]=useState(i.getValues(e)||[]),x=useRef({search:a,keywords:u});useEffect(()=>{x.current={search:a,keywords:u};},[a,u]);let[h,S]=useState(n),$=useSpring(l?{opacity:1,transform:"translate(0px, 0px)",display:"block",config:{duration:150}}:{opacity:0,transform:"translate(0px, -2px)",display:"none",config:{duration:150}}),O=n.find(p=>p===i.getValues(e)),V=p=>{let g=[...x.current.keywords,p];m(""),v(g),i.setValue(e,g),d(!1);},f=p=>p?p.charAt(0).toUpperCase()+p.slice(1).toLowerCase():"",y=()=>{if(!x.current.search)return;let p=f(x.current.search);V(p);};useEffect(()=>{let p=g=>{l&&s.current&&!s.current.contains(g.target)&&(y(),d(!1));};return document.addEventListener("mousedown",g=>p(g)),()=>{document.removeEventListener("mousedown",g=>p(g));}},[l]);let C=p=>{p.code==="Enter"&&(y(),p.preventDefault());},b=p=>{let g=u.filter(j=>j!==p);v(g),m(""),i.setValue(e,g);};return useEffect(()=>{if(d(!!a),a){let p=n.filter(g=>g.toLowerCase().match(a.toLowerCase()));S(p);}else S(n);},[a]),useEffect(()=>{let p=n.filter(g=>!u.includes(g));S(p);},[u]),jsxs(Dt,{children:[jsx($t,{size:"lg",children:t}),r&&jsx(Ot,{children:r}),jsxs(Vt,{onClick:()=>d(!l),children:[jsx(n1,{}),O,jsx(Et,{onKeyDown:C,value:a,onChange:p=>m(p.target.value),type:"text",style:{marginLeft:"45px",width:"calc(100% - 80px)"}}),jsxs(Ht,{style:$,ref:s,children:[h.map(p=>{let g=p===O;return jsxs(s1,{onClick:()=>V(p),children:[jsx(c.Body,{size:"lg",children:p}),jsx(Zt,{isCurrent:g,children:jsx(H.Check,{color:"#fff"})})]},p)}),!h.length&&jsx(s1,{onClick:()=>y(),children:jsx(c.Body,{size:"lg",children:"Add Option"})},"add")]})]}),jsx("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap"},children:u.map(p=>jsxs(Rt,{onClick:()=>b(p),children:[p,jsx(N,{})]},p))})]})},a1=Tt;var At={Container:N2,Checkbox:U,CheckboxGroup:I2,TextInput:E,Radio:Y,RadioGroup:_2,Select:X2,Signature:K2,Submit:Y2,LocationSelect:o1,Keyword:a1,Toggle:a2};
786
+ `,Ft=({label:t="",name:e,details:r="",options:n=[]})=>{let s=useRef(),i=useFormContext(),[l,d]=useState(!1),[a,m]=useState(""),[u,v]=useState(i.getValues(e)||[]),y=useRef({search:a,keywords:u});useEffect(()=>{y.current={search:a,keywords:u};},[a,u]);let[x,S]=useState(n),$=useSpring(l?{opacity:1,transform:"translate(0px, 0px)",display:"block",config:{duration:150}}:{opacity:0,transform:"translate(0px, -2px)",display:"none",config:{duration:150}}),O=n.find(p=>p===i.getValues(e)),V=p=>{let g=[...y.current.keywords,p];m(""),v(g),i.setValue(e,g),d(!1);},f=p=>p?p.charAt(0).toUpperCase()+p.slice(1).toLowerCase():"",h=()=>{if(!y.current.search)return;let p=f(y.current.search);V(p);};useEffect(()=>{let p=g=>{l&&s.current&&!s.current.contains(g.target)&&(h(),d(!1));};return document.addEventListener("mousedown",g=>p(g)),()=>{document.removeEventListener("mousedown",g=>p(g));}},[l]);let C=p=>{p.code==="Enter"&&(h(),p.preventDefault());},b=p=>{let g=u.filter(j=>j!==p);v(g),m(""),i.setValue(e,g);};return useEffect(()=>{if(d(!!a),a){let p=n.filter(g=>g.toLowerCase().match(a.toLowerCase()));S(p);}else S(n);},[a]),useEffect(()=>{let p=n.filter(g=>!u.includes(g));S(p);},[u]),jsxs($t,{children:[jsx(Ot,{size:"lg",children:t}),r&&jsx(Vt,{children:r}),jsxs(Ht,{onClick:()=>d(!l),children:[jsx(n1,{}),O,jsx(Rt,{onKeyDown:C,value:a,onChange:p=>m(p.target.value),type:"text",style:{marginLeft:"45px",width:"calc(100% - 80px)"}}),jsxs(Et,{style:$,ref:s,children:[x.map(p=>{let g=p===O;return jsxs(s1,{onClick:()=>V(p),children:[jsx(c.Body,{size:"lg",children:p}),jsx(Tt,{isCurrent:g,children:jsx(H.Check,{color:"#fff"})})]},p)}),!x.length&&jsx(s1,{onClick:()=>h(),children:jsx(c.Body,{size:"lg",children:"Add Option"})},"add")]})]}),jsx("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap"},children:u.map(p=>jsxs(Zt,{onClick:()=>b(p),children:[p,jsx(N,{})]},p))})]})},a1=Ft;var It={Container:N2,Checkbox:U,CheckboxGroup:I2,TextInput:R,Radio:Y,RadioGroup:_2,Select:X2,Signature:K2,Submit:Y2,LocationSelect:o1,Keyword:a1,Toggle:a2};
787
787
 
788
- export { t2 as Button, K as Contentful, k1 as ContentfulLottieFileSlug, At as Form, H as Icons, M as LoadingSpinner, $1 as LottieAnimation, R1 as Modal, d2 as Size, Z1 as SolaceLogo, G1 as SolaceThemeProvider, a2 as Toggle, U1 as Tooltip, c as Typography };
788
+ export { t2 as Button, K as Contentful, k1 as ContentfulLottieFileSlug, It as Form, H as Icons, M as LoadingSpinner, $1 as LottieAnimation, R1 as Modal, d2 as Size, Z1 as SolaceLogo, G1 as SolaceThemeProvider, a2 as Toggle, U1 as Tooltip, c as Typography };
789
789
  //# sourceMappingURL=out.js.map
790
790
  //# sourceMappingURL=index.js.map