@solace-health/ui 0.2.0 → 0.2.1

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
@@ -641,9 +641,12 @@ var i2=(s=>(s.XL="xl",s.LG="lg",s.MD="md",s.SM="sm",s.XS="xs",s))(i2||{});var a1
641
641
  font-family: ${({theme:t})=>t.typography.family.body};
642
642
  font-weight: ${({theme:t})=>t.typography.weight.normal};
643
643
  font-style: normal;
644
- left: 20px;
644
+ left: 0;
645
+ right: 0;
646
+ padding: 0 20px;
645
647
  width: 100%;
646
- `,p3=t=>{let e="",r="";t.address_components.forEach(s=>{let p=s.types.some(a=>a==="locality"),d=s.types.some(a=>a==="administrative_area_level_1");p?e=s.short_name:d&&(r=s.short_name);});let n=t.geometry.location.lat(),i=t.geometry.location.lng();return {city:e,state:r,lat:n,long:i}},d3=({handleSelect:t,option:e,value:r})=>{let{description:n}=e,i=n===r,s=n.replace(", USA","");return jsx(a3,{isCurrent:i,onClick:()=>t(s),children:jsx(c.Body,{size:"lg",children:s})})},c3=({label:t="",details:e="",required:r=!0})=>{let n=useRef(),[i,s]=useState(!1),[p,d]=useState(!1),a=useFormContext();a.register("city",{required:r});let u=useSpring(i?{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=b=>{i&&n.current&&!n.current.contains(b.target)&&s(!1);};return document.addEventListener("mousedown",b=>f(b)),()=>{document.removeEventListener("mousedown",b=>f(b));}},[i]);let m=a.getValues("city")?`${a.getValues("city")}, ${a.getValues("state")}`:"",{value:v,suggestions:{data:y,loading:h},setValue:M,clearSuggestions:B}=q5({requestOptions:{types:["locality","postal_code"],componentRestrictions:{country:"us"}}});useEffect(()=>{if(h){d(h);return}setTimeout(()=>{d(h);},2e3);},[h]);let D=useSpring(p?{opacity:1,transform:"translate(0px, 0px)",config:{duration:400}}:{opacity:0,transform:"translate(5px, 0px)",config:{duration:200}}),$=f=>{M(f.target.value),a.setValue("city",null),a.setValue("state",null),a.trigger("city"),f.target.value.length>=3&&s(!0);},C=f=>{M(f,!1),B(),!(f.length<=2)&&getGeocode({address:f}).then(b=>{let{city:l,state:g,lat:J,long:i1}=p3(b[0]);a.setValue("city",l),a.setValue("state",g),a.setValue("lat",J),a.setValue("long",i1),a.trigger("city");}).catch(b=>console.error(`Google Maps API error: ${b}`));},x=f=>{f.code==="Enter"&&f.preventDefault();};return jsxs(e3,{children:[jsx(o3,{size:"lg",children:t}),e&&jsx(r3,{children:e}),jsxs(n3,{children:[jsx(l3,{onKeyDown:x,value:v||m,onChange:f=>$(f),type:"text",style:{width:"calc(100% - 40px)"}}),y.length>0&&jsx(i3,{style:u,ref:n,children:y.map(f=>jsx(d3,{handleSelect:C,option:f,value:v},f.description))}),jsx(s3,{style:D,children:jsx(V,{size:"sm"})})]})]})},Q2=t=>{let{isLoaded:e}=useLoadScript({googleMapsApiKey:t.api_key||process.env.GOOGLE_MAPS_API_KEY||"",libraries:["places"]});return e?jsx(c3,{...t}):null};var j2=({color:t="#FFFFFF"})=>jsxs("svg",{width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M11.75 6.75L7.25 11.25",stroke:"#EEEEEE",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:t}),jsx("path",{d:"M7.25 6.75L11.75 11.25",stroke:"#EEEEEE",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:t})]});var e1=({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 u3=o.div`
648
+ height: 100%;
649
+ `,p3=t=>{let e="",r="";t.address_components.forEach(s=>{let p=s.types.some(a=>a==="locality"),d=s.types.some(a=>a==="administrative_area_level_1");p?e=s.short_name:d&&(r=s.short_name);});let n=t.geometry.location.lat(),i=t.geometry.location.lng();return {city:e,state:r,lat:n,long:i}},d3=({handleSelect:t,option:e,value:r})=>{let{description:n}=e,i=n===r,s=n.replace(", USA","");return jsx(a3,{isCurrent:i,onClick:()=>t(s),children:jsx(c.Body,{size:"lg",children:s})})},c3=({label:t="",details:e="",required:r=!0})=>{let n=useRef(),[i,s]=useState(!1),[p,d]=useState(!1),a=useFormContext();a.register("city",{required:r});let u=useSpring(i?{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=b=>{i&&n.current&&!n.current.contains(b.target)&&s(!1);};return document.addEventListener("mousedown",b=>f(b)),()=>{document.removeEventListener("mousedown",b=>f(b));}},[i]);let m=a.getValues("city")?`${a.getValues("city")}, ${a.getValues("state")}`:"",{value:v,suggestions:{data:y,loading:h},setValue:M,clearSuggestions:B}=q5({requestOptions:{types:["locality","postal_code"],componentRestrictions:{country:"us"}}});useEffect(()=>{if(h){d(h);return}setTimeout(()=>{d(h);},2e3);},[h]);let D=useSpring(p?{opacity:1,transform:"translate(0px, 0px)",config:{duration:400}}:{opacity:0,transform:"translate(5px, 0px)",config:{duration:200}}),$=f=>{M(f.target.value),a.setValue("city",null),a.setValue("state",null),a.trigger("city"),f.target.value.length>=3&&s(!0);},C=f=>{M(f,!1),B(),!(f.length<=2)&&getGeocode({address:f}).then(b=>{let{city:l,state:g,lat:J,long:i1}=p3(b[0]);a.setValue("city",l),a.setValue("state",g),a.setValue("lat",J),a.setValue("long",i1),a.trigger("city");}).catch(b=>console.error(`Google Maps API error: ${b}`));},x=f=>{f.code==="Enter"&&f.preventDefault();};return jsxs(e3,{children:[jsx(o3,{size:"lg",children:t}),e&&jsx(r3,{children:e}),jsxs(n3,{children:[jsx(l3,{onKeyDown:x,value:v||m,onChange:f=>$(f),type:"text"}),y.length>0&&jsx(i3,{style:u,ref:n,children:y.map(f=>jsx(d3,{handleSelect:C,option:f,value:v},f.description))}),jsx(s3,{style:D,children:jsx(V,{size:"sm"})})]})]})},Q2=t=>{let{isLoaded:e}=useLoadScript({googleMapsApiKey:t.api_key||process.env.GOOGLE_MAPS_API_KEY||"",libraries:["places"]});return e?jsx(c3,{...t}):null};var j2=({color:t="#FFFFFF"})=>jsxs("svg",{width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M11.75 6.75L7.25 11.25",stroke:"#EEEEEE",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:t}),jsx("path",{d:"M7.25 6.75L11.75 11.25",stroke:"#EEEEEE",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:t})]});var e1=({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 u3=o.div`
647
650
  position: relative;
648
651
  margin-bottom: 24px;
649
652
  z-index: 200;
@@ -694,7 +697,13 @@ var i2=(s=>(s.XL="xl",s.LG="lg",s.MD="md",s.SM="sm",s.XS="xs",s))(i2||{});var a1
694
697
  border: none;
695
698
  background: none;
696
699
  position: absolute;
697
- left: 20px;
700
+ top: -1px;
701
+ left: 0;
702
+ right: 0;
703
+ bottom: 0;
704
+ width: 100%;
705
+ height: 100%;
706
+ padding-left: 10px;
698
707
  `,v3=o.div`
699
708
  height: 32px;
700
709
  border-radius: 32px;
@@ -720,7 +729,7 @@ var i2=(s=>(s.XL="xl",s.LG="lg",s.MD="md",s.SM="sm",s.XS="xs",s))(i2||{});var a1
720
729
  border: 0.766898px solid;
721
730
  border-color: ${t=>t.isCurrent?"#285E50 !important":"#3f937c"};
722
731
  background: ${t=>t.isCurrent?"#285E50 !important":"#FFF"};
723
- `,k3=({label:t="",name:e,details:r="",options:n=[]})=>{let i=useRef(),s=useFormContext(),[p,d]=useState(!1),[a,u]=useState(""),[m,v]=useState(s.getValues(e)||[]),y=useRef({search:a,keywords:m});useEffect(()=>{y.current={search:a,keywords:m};},[a,m]);let[h,M]=useState(n),B=useSpring(p?{opacity:1,transform:"translate(0px, 0px)",display:"block",config:{duration:150}}:{opacity:0,transform:"translate(0px, -2px)",display:"none",config:{duration:150}}),D=n.find(l=>l===s.getValues(e)),$=l=>{let g=[...y.current.keywords,l];u(""),v(g),s.setValue(e,g),d(!1);},C=l=>l?l.charAt(0).toUpperCase()+l.slice(1).toLowerCase():"",x=()=>{if(!y.current.search)return;let l=C(y.current.search);$(l);};useEffect(()=>{let l=g=>{p&&i.current&&!i.current.contains(g.target)&&(x(),d(!1));};return document.addEventListener("mousedown",g=>l(g)),()=>{document.removeEventListener("mousedown",g=>l(g));}},[p]);let f=l=>{l.code==="Enter"&&(x(),l.preventDefault());},b=l=>{let g=m.filter(J=>J!==l);v(g),u(""),s.setValue(e,g);};return useEffect(()=>{if(d(!!a),a){let l=n.filter(g=>g.toLowerCase().match(a.toLowerCase()));M(l);}else M(n);},[a]),useEffect(()=>{let l=n.filter(g=>!m.includes(g));M(l);},[m]),jsxs(u3,{children:[jsx(h3,{size:"lg",children:t}),r&&jsx(x3,{children:r}),jsxs(y3,{onClick:()=>d(!p),children:[jsx(e1,{}),D,jsx(L3,{onKeyDown:f,value:a,onChange:l=>u(l.target.value),type:"text",style:{marginLeft:"40px",width:"calc(100% - 80px)"}}),jsxs(b3,{style:B,ref:i,children:[h.map(l=>{let g=l===D;return jsxs(r1,{onClick:()=>$(l),children:[jsx(c.Body,{size:"lg",children:l}),jsx(w3,{isCurrent:g,children:jsx(O.Check,{color:"#fff"})})]},l)}),!h.length&&jsx(r1,{onClick:()=>x(),children:jsx(c.Body,{size:"lg",children:"Add Option"})},"add")]})]}),jsx("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap"},children:m.map(l=>jsxs(v3,{onClick:()=>b(l),children:[l,jsx(j2,{})]},l))})]})},n1=k3;var S3={Container:F2,Checkbox:N,CheckboxGroup:R2,TextInput:H,Radio:_,RadioGroup:T2,Select:N2,Signature:I2,Submit:K2,LocationSelect:Q2,Keyword:n1};
732
+ `,k3=({label:t="",name:e,details:r="",options:n=[]})=>{let i=useRef(),s=useFormContext(),[p,d]=useState(!1),[a,u]=useState(""),[m,v]=useState(s.getValues(e)||[]),y=useRef({search:a,keywords:m});useEffect(()=>{y.current={search:a,keywords:m};},[a,m]);let[h,M]=useState(n),B=useSpring(p?{opacity:1,transform:"translate(0px, 0px)",display:"block",config:{duration:150}}:{opacity:0,transform:"translate(0px, -2px)",display:"none",config:{duration:150}}),D=n.find(l=>l===s.getValues(e)),$=l=>{let g=[...y.current.keywords,l];u(""),v(g),s.setValue(e,g),d(!1);},C=l=>l?l.charAt(0).toUpperCase()+l.slice(1).toLowerCase():"",x=()=>{if(!y.current.search)return;let l=C(y.current.search);$(l);};useEffect(()=>{let l=g=>{p&&i.current&&!i.current.contains(g.target)&&(x(),d(!1));};return document.addEventListener("mousedown",g=>l(g)),()=>{document.removeEventListener("mousedown",g=>l(g));}},[p]);let f=l=>{l.code==="Enter"&&(x(),l.preventDefault());},b=l=>{let g=m.filter(J=>J!==l);v(g),u(""),s.setValue(e,g);};return useEffect(()=>{if(d(!!a),a){let l=n.filter(g=>g.toLowerCase().match(a.toLowerCase()));M(l);}else M(n);},[a]),useEffect(()=>{let l=n.filter(g=>!m.includes(g));M(l);},[m]),jsxs(u3,{children:[jsx(h3,{size:"lg",children:t}),r&&jsx(x3,{children:r}),jsxs(y3,{onClick:()=>d(!p),children:[jsx(e1,{}),D,jsx(L3,{onKeyDown:f,value:a,onChange:l=>u(l.target.value),type:"text",style:{marginLeft:"45px",width:"calc(100% - 80px)"}}),jsxs(b3,{style:B,ref:i,children:[h.map(l=>{let g=l===D;return jsxs(r1,{onClick:()=>$(l),children:[jsx(c.Body,{size:"lg",children:l}),jsx(w3,{isCurrent:g,children:jsx(O.Check,{color:"#fff"})})]},l)}),!h.length&&jsx(r1,{onClick:()=>x(),children:jsx(c.Body,{size:"lg",children:"Add Option"})},"add")]})]}),jsx("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap"},children:m.map(l=>jsxs(v3,{onClick:()=>b(l),children:[l,jsx(j2,{})]},l))})]})},n1=k3;var S3={Container:F2,Checkbox:N,CheckboxGroup:R2,TextInput:H,Radio:_,RadioGroup:T2,Select:N2,Signature:I2,Submit:K2,LocationSelect:Q2,Keyword:n1};
724
733
 
725
734
  export { q as Button, T as Contentful, h1 as ContentfulLottieFileSlug, S3 as Form, O as Icons, V as LoadingSpinner, k1 as LottieAnimation, B1 as Modal, i2 as Size, D1 as SolaceLogo, E1 as SolaceThemeProvider, I1 as Tooltip, c as Typography };
726
735
  //# sourceMappingURL=out.js.map