@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.cjs +13 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/package.json +9 -2
package/dist/index.cjs
CHANGED
|
@@ -666,9 +666,12 @@ var i2=(s=>(s.XL="xl",s.LG="lg",s.MD="md",s.SM="sm",s.XS="xs",s))(i2||{});var a1
|
|
|
666
666
|
font-family: ${({theme:t})=>t.typography.family.body};
|
|
667
667
|
font-weight: ${({theme:t})=>t.typography.weight.normal};
|
|
668
668
|
font-style: normal;
|
|
669
|
-
left:
|
|
669
|
+
left: 0;
|
|
670
|
+
right: 0;
|
|
671
|
+
padding: 0 20px;
|
|
670
672
|
width: 100%;
|
|
671
|
-
|
|
673
|
+
height: 100%;
|
|
674
|
+
`,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 jsxRuntime.jsx(a3,{isCurrent:i,onClick:()=>t(s),children:jsxRuntime.jsx(c.Body,{size:"lg",children:s})})},c3=({label:t="",details:e="",required:r=!0})=>{let n=react.useRef(),[i,s]=react.useState(!1),[p,d]=react.useState(!1),a=reactHookForm.useFormContext();a.register("city",{required:r});let u=web.useSpring(i?{opacity:1,transform:"translate(0px, 0px)",display:"block",config:{duration:150}}:{opacity:0,transform:"translate(0px, -2px)",display:"none",config:{duration:150}});react.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__default.default({requestOptions:{types:["locality","postal_code"],componentRestrictions:{country:"us"}}});react.useEffect(()=>{if(h){d(h);return}setTimeout(()=>{d(h);},2e3);},[h]);let D=web.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)&&q5.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 jsxRuntime.jsxs(e3,{children:[jsxRuntime.jsx(o3,{size:"lg",children:t}),e&&jsxRuntime.jsx(r3,{children:e}),jsxRuntime.jsxs(n3,{children:[jsxRuntime.jsx(l3,{onKeyDown:x,value:v||m,onChange:f=>$(f),type:"text"}),y.length>0&&jsxRuntime.jsx(i3,{style:u,ref:n,children:y.map(f=>jsxRuntime.jsx(d3,{handleSelect:C,option:f,value:v},f.description))}),jsxRuntime.jsx(s3,{style:D,children:jsxRuntime.jsx(V,{size:"sm"})})]})]})},Q2=t=>{let{isLoaded:e}=api.useLoadScript({googleMapsApiKey:t.api_key||process.env.GOOGLE_MAPS_API_KEY||"",libraries:["places"]});return e?jsxRuntime.jsx(c3,{...t}):null};var j2=({color:t="#FFFFFF"})=>jsxRuntime.jsxs("svg",{width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M11.75 6.75L7.25 11.25",stroke:"#EEEEEE",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:t}),jsxRuntime.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"})=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.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__default.default.div`
|
|
672
675
|
position: relative;
|
|
673
676
|
margin-bottom: 24px;
|
|
674
677
|
z-index: 200;
|
|
@@ -719,7 +722,13 @@ var i2=(s=>(s.XL="xl",s.LG="lg",s.MD="md",s.SM="sm",s.XS="xs",s))(i2||{});var a1
|
|
|
719
722
|
border: none;
|
|
720
723
|
background: none;
|
|
721
724
|
position: absolute;
|
|
722
|
-
|
|
725
|
+
top: -1px;
|
|
726
|
+
left: 0;
|
|
727
|
+
right: 0;
|
|
728
|
+
bottom: 0;
|
|
729
|
+
width: 100%;
|
|
730
|
+
height: 100%;
|
|
731
|
+
padding-left: 10px;
|
|
723
732
|
`,v3=o__default.default.div`
|
|
724
733
|
height: 32px;
|
|
725
734
|
border-radius: 32px;
|
|
@@ -745,7 +754,7 @@ var i2=(s=>(s.XL="xl",s.LG="lg",s.MD="md",s.SM="sm",s.XS="xs",s))(i2||{});var a1
|
|
|
745
754
|
border: 0.766898px solid;
|
|
746
755
|
border-color: ${t=>t.isCurrent?"#285E50 !important":"#3f937c"};
|
|
747
756
|
background: ${t=>t.isCurrent?"#285E50 !important":"#FFF"};
|
|
748
|
-
`,k3=({label:t="",name:e,details:r="",options:n=[]})=>{let i=react.useRef(),s=reactHookForm.useFormContext(),[p,d]=react.useState(!1),[a,u]=react.useState(""),[m,v]=react.useState(s.getValues(e)||[]),y=react.useRef({search:a,keywords:m});react.useEffect(()=>{y.current={search:a,keywords:m};},[a,m]);let[h,M]=react.useState(n),B=web.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);};react.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 react.useEffect(()=>{if(d(!!a),a){let l=n.filter(g=>g.toLowerCase().match(a.toLowerCase()));M(l);}else M(n);},[a]),react.useEffect(()=>{let l=n.filter(g=>!m.includes(g));M(l);},[m]),jsxRuntime.jsxs(u3,{children:[jsxRuntime.jsx(h3,{size:"lg",children:t}),r&&jsxRuntime.jsx(x3,{children:r}),jsxRuntime.jsxs(y3,{onClick:()=>d(!p),children:[jsxRuntime.jsx(e1,{}),D,jsxRuntime.jsx(L3,{onKeyDown:f,value:a,onChange:l=>u(l.target.value),type:"text",style:{marginLeft:"
|
|
757
|
+
`,k3=({label:t="",name:e,details:r="",options:n=[]})=>{let i=react.useRef(),s=reactHookForm.useFormContext(),[p,d]=react.useState(!1),[a,u]=react.useState(""),[m,v]=react.useState(s.getValues(e)||[]),y=react.useRef({search:a,keywords:m});react.useEffect(()=>{y.current={search:a,keywords:m};},[a,m]);let[h,M]=react.useState(n),B=web.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);};react.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 react.useEffect(()=>{if(d(!!a),a){let l=n.filter(g=>g.toLowerCase().match(a.toLowerCase()));M(l);}else M(n);},[a]),react.useEffect(()=>{let l=n.filter(g=>!m.includes(g));M(l);},[m]),jsxRuntime.jsxs(u3,{children:[jsxRuntime.jsx(h3,{size:"lg",children:t}),r&&jsxRuntime.jsx(x3,{children:r}),jsxRuntime.jsxs(y3,{onClick:()=>d(!p),children:[jsxRuntime.jsx(e1,{}),D,jsxRuntime.jsx(L3,{onKeyDown:f,value:a,onChange:l=>u(l.target.value),type:"text",style:{marginLeft:"45px",width:"calc(100% - 80px)"}}),jsxRuntime.jsxs(b3,{style:B,ref:i,children:[h.map(l=>{let g=l===D;return jsxRuntime.jsxs(r1,{onClick:()=>$(l),children:[jsxRuntime.jsx(c.Body,{size:"lg",children:l}),jsxRuntime.jsx(w3,{isCurrent:g,children:jsxRuntime.jsx(O.Check,{color:"#fff"})})]},l)}),!h.length&&jsxRuntime.jsx(r1,{onClick:()=>x(),children:jsxRuntime.jsx(c.Body,{size:"lg",children:"Add Option"})},"add")]})]}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap"},children:m.map(l=>jsxRuntime.jsxs(v3,{onClick:()=>b(l),children:[l,jsxRuntime.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};
|
|
749
758
|
|
|
750
759
|
Object.defineProperty(exports, 'styled', {
|
|
751
760
|
enumerable: true,
|