@solace-health/ui 0.3.19 → 0.3.21
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 +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -323,7 +323,7 @@ var C2=(s=>(s.XL="xl",s.LG="lg",s.MD="md",s.SM="sm",s.XS="xs",s))(C2||{});var b1
|
|
|
323
323
|
font-weight: 500;
|
|
324
324
|
line-height: 30px;
|
|
325
325
|
}
|
|
326
|
-
`,M5=({defaultState:e=!1,name:t,label:r={active:"YES",inactive:"NO"},handleEvent:n=null,value:i})=>{let s=useFormContext(),[l,a]=useState(e);return useEffect(()=>{s&&e&&s.setValue(t,i);},[]),useEffect(()=>{a(e);},[e]),jsxs(w5,{htmlFor:t,children:[jsx(v5,{type:"checkbox",checked:l,onClick:p=>{a(
|
|
326
|
+
`,M5=({defaultState:e=!1,name:t,label:r={active:"YES",inactive:"NO"},handleEvent:n=null,value:i})=>{let s=useFormContext(),[l,a]=useState(e);return useEffect(()=>{s&&e&&s.setValue(t,i);},[]),useEffect(()=>{a(e);},[e]),jsxs(w5,{htmlFor:t,children:[jsx(v5,{type:"checkbox",checked:l,onClick:p=>{let h=!l;a(h),s&&s.setValue(t,h?p.target.value:null),n&&n(p.target.value);},id:t,name:t,value:i}),jsx(k5,{children:jsx(c.Body,{color:"#fff",children:l?r.active:r.inactive})})]})},p2=M5;var B5=o(c.Body)`
|
|
327
327
|
margin-bottom: 5px;
|
|
328
328
|
font-weight: ${({isLabelBold:e})=>e?"bold":"regular"};
|
|
329
329
|
text-align: start;
|
|
@@ -374,7 +374,7 @@ var C2=(s=>(s.XL="xl",s.LG="lg",s.MD="md",s.SM="sm",s.XS="xs",s))(C2||{});var b1
|
|
|
374
374
|
}
|
|
375
375
|
`,J2=o(c.Body)`
|
|
376
376
|
margin-bottom: 24px;
|
|
377
|
-
`,$5=({name:e,label:t=null,details:r=null,type:n="text",options:i={},previewOnly:s=!1,textArea:l=!1,marginBottom:a="24px",isLabelBold:C=!0,format:p=String,errorMessage:
|
|
377
|
+
`,$5=({name:e,label:t=null,details:r=null,type:n="text",options:i={},previewOnly:s=!1,textArea:l=!1,marginBottom:a="24px",isLabelBold:C=!0,format:p=String,errorMessage:h="This field is required",...f})=>{let{register:S,control:L,getValues:x,formState:{errors:w}}=useFormContext();return jsxs(Fragment,{children:[t&&jsx(B5,{size:"lg",isLabelBold:C,children:t}),r&&jsx(V5,{children:r}),l?jsx("div",{children:s?jsx(J2,{size:"md",children:x(e)||"N/A"}):jsx(O5,{...f,...S(e,i),marginBottom:a})}):jsx("div",{style:{width:"100%"},children:s?jsx(J2,{size:"md",children:x(e)||"N/A"}):jsxs("div",{style:{marginBottom:w?.[e]?"6px":a,display:"flex",flexDirection:"column"},children:[jsx(Controller,{render:b=>jsx(D5,{...f,unmask:!1,mask:p,name:b.field.name,onBlur:b.field.onBlur,defaultValue:i.value||b.field.value,onAccept:B=>b.field.onChange({target:{value:B}}),marginBottom:a,type:n}),name:e,rules:i,control:L}),w?.[e]&&jsx(U,{children:h})]})})]})},R=$5;var T5=o.div`
|
|
378
378
|
margin-bottom: 32px;
|
|
379
379
|
`,A5=o.div`
|
|
380
380
|
display: ${({inline:e})=>e?"flex":"block"};
|
|
@@ -641,7 +641,7 @@ var C2=(s=>(s.XL="xl",s.LG="lg",s.MD="md",s.SM="sm",s.XS="xs",s))(C2||{});var b1
|
|
|
641
641
|
left: 20px;
|
|
642
642
|
`,u3=o(c.Body)`
|
|
643
643
|
margin-bottom: 24px;
|
|
644
|
-
`,h3=({label:e="",name:t,details:r="",options:n=[],allowInput:i=!1,previewOnly:s=!1,formOptions:l={}})=>{let a=useRef(),C=useFormContext();C.register(t,l);let[p,
|
|
644
|
+
`,h3=({label:e="",name:t,details:r="",options:n=[],allowInput:i=!1,previewOnly:s=!1,formOptions:l={}})=>{let a=useRef(),C=useFormContext();C.register(t,l);let[p,h]=useState(!1),[f,S]=useState(""),[L,x]=useState(n),w=useSpring(p?{opacity:1,transform:"translate(0px, 0px)",display:"block",config:{duration:150}}:{opacity:0,transform:"translate(0px, -2px)",display:"none",config:{duration:150}});useEffect(()=>{let g=y=>{p&&a.current&&!a.current.contains(y.target)&&h(!1);};return document.addEventListener("mousedown",y=>g(y)),()=>{document.removeEventListener("mousedown",y=>g(y));}},[p]);let b=n.find(g=>g.value===C.getValues(t))?.label,B=g=>{S(""),C.setValue(t,g.value),C.trigger(t),h(!1);};useEffect(()=>{if(h(!!f),f){let g=n.filter(y=>y.value.match(f.toLowerCase()));x(g),C.setValue(t,f);}else x(n);},[f,n.length]);let $=g=>{g.code==="Enter"&&g.preventDefault();};return jsxs(l3,{children:[jsx(p3,{size:"lg",children:e}),r&&jsx(d3,{children:r}),s?jsx(u3,{size:"md",children:b||"N/A"}):jsxs(c3,{onClick:()=>h(!p),children:[b,i&&jsx(m3,{onKeyDown:$,value:f,onChange:g=>S(g.target.value),type:"text"}),jsx(E.Caret,{direction:p?"up":"down"}),jsx(C3,{style:w,ref:a,children:L.map(g=>{let{label:y}=g,m=g.label===b;return jsxs(g3,{onClick:()=>B(g),children:[jsx(c.Body,{size:"lg",children:y}),jsx(f3,{isCurrent:m,children:jsx(E.Check,{color:"#fff"})})]},g.value)})})]})]})},n1=h3;var L3=({label:e="Submit",isSubmitting:t=!1,hideWhenInvalid:r=!1,...n})=>{let i=useFormContext(),{isValid:s}=i.formState,a=useSpring((r?s:!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:a,...n,children:jsx(o2.Primary,{type:"submit",isSubmitting:t,...n,children:e})})},s1=L3;var z3=o.div`
|
|
645
645
|
position: relative;
|
|
646
646
|
margin-bottom: 24px;
|
|
647
647
|
z-index: 20;
|
|
@@ -711,7 +711,7 @@ var C2=(s=>(s.XL="xl",s.LG="lg",s.MD="md",s.SM="sm",s.XS="xs",s))(C2||{});var b1
|
|
|
711
711
|
height: 100%;
|
|
712
712
|
`,$3=o(c.Body)`
|
|
713
713
|
margin-bottom: 24px;
|
|
714
|
-
`,E3=e=>{let t="",r="";e.address_components.forEach(s=>{let l=s.types.some(C=>C==="locality"),a=s.types.some(C=>C==="administrative_area_level_1");l?t=s.short_name:a&&(r=s.short_name);});let n=e.geometry.location.lat(),i=e.geometry.location.lng();return {city:t,state:r,lat:n,long:i}},R3=({handleSelect:e,option:t,value:r})=>{let{description:n}=t,i=n===r,s=n.replace(", USA","");return jsx(D3,{isCurrent:i,onClick:()=>e(s),children:jsx(c.Body,{size:"lg",children:s})})},T3=({label:e="",details:t="",required:r=!0,previewOnly:n=!1})=>{let i=useRef(),[s,l]=useState(!1),[a,C]=useState(!1),p=useFormContext();p.register("city",{required:r});let
|
|
714
|
+
`,E3=e=>{let t="",r="";e.address_components.forEach(s=>{let l=s.types.some(C=>C==="locality"),a=s.types.some(C=>C==="administrative_area_level_1");l?t=s.short_name:a&&(r=s.short_name);});let n=e.geometry.location.lat(),i=e.geometry.location.lng();return {city:t,state:r,lat:n,long:i}},R3=({handleSelect:e,option:t,value:r})=>{let{description:n}=t,i=n===r,s=n.replace(", USA","");return jsx(D3,{isCurrent:i,onClick:()=>e(s),children:jsx(c.Body,{size:"lg",children:s})})},T3=({label:e="",details:t="",required:r=!0,previewOnly:n=!1})=>{let i=useRef(),[s,l]=useState(!1),[a,C]=useState(!1),p=useFormContext();p.register("city",{required:r});let h=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 m=v=>{s&&i.current&&!i.current.contains(v.target)&&l(!1);};return document.addEventListener("mousedown",v=>m(v)),()=>{document.removeEventListener("mousedown",v=>m(v));}},[s]);let f=p.getValues("city")?`${p.getValues("city")}, ${p.getValues("state")}`:"",{value:S,suggestions:{data:L,loading:x},setValue:w,clearSuggestions:b}=k3({requestOptions:{types:["locality","postal_code"],componentRestrictions:{country:"us"}}});useEffect(()=>{if(x){C(x);return}setTimeout(()=>{C(x);},2e3);},[x]);let B=useSpring(a?{opacity:1,transform:"translate(0px, 0px)",config:{duration:400}}:{opacity:0,transform:"translate(5px, 0px)",config:{duration:200}}),$=m=>{w(m.target.value),p.setValue("city",null),p.setValue("state",null),p.trigger("city"),m.target.value.length>=3&&l(!0);},g=m=>{w(m,!1),b(),!(m.length<=2)&&getGeocode({address:m}).then(v=>{let{city:d,state:u,lat:t2,long:y1}=E3(v[0]);p.setValue("city",d),p.setValue("state",u),p.setValue("lat",t2),p.setValue("long",y1),p.trigger("city");}).catch(v=>console.error(`Google Maps API error: ${v}`));},y=m=>{m.code==="Enter"&&m.preventDefault();};return jsxs(z3,{children:[jsx(H3,{size:"lg",children:e}),t&&jsx(P3,{children:t}),n?jsx($3,{size:"md",children:f||"N/A"}):jsxs(B3,{children:[jsx(O3,{onKeyDown:y,value:S||f,onChange:m=>$(m),type:"text"}),L.length>0&&jsx(V3,{style:h,ref:i,children:L.map(m=>jsx(R3,{handleSelect:g,option:m,value:S},m.description))}),jsx(Z3,{style:B,children:jsx(V,{size:"sm"})})]})]})},C1=e=>{let{isLoaded:t}=useLoadScript({googleMapsApiKey:e.api_key||process.env.GOOGLE_MAPS_API_KEY||"",libraries:["places"]});return t?jsx(T3,{...e}):null};var f1=({color:e="#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:e})});var G3=o.div`
|
|
715
715
|
position: relative;
|
|
716
716
|
margin-bottom: 24px;
|
|
717
717
|
z-index: 20;
|
|
@@ -794,7 +794,7 @@ var C2=(s=>(s.XL="xl",s.LG="lg",s.MD="md",s.SM="sm",s.XS="xs",s))(C2||{});var b1
|
|
|
794
794
|
border: 0.766898px solid;
|
|
795
795
|
border-color: ${e=>e.isCurrent?"#285E50 !important":"#3f937c"};
|
|
796
796
|
background: ${e=>e.isCurrent?"#285E50 !important":"#FFF"};
|
|
797
|
-
`,Y3=({label:e="",name:t,details:r="",options:n=[],previewOnly:i=!1})=>{let s=useRef(),l=useFormContext(),[a,C]=useState(!1),[p,
|
|
797
|
+
`,Y3=({label:e="",name:t,details:r="",options:n=[],previewOnly:i=!1})=>{let s=useRef(),l=useFormContext(),[a,C]=useState(!1),[p,h]=useState(""),[f,S]=useState(l.getValues(t)||[]),L=useRef({search:p,keywords:f});useEffect(()=>{L.current={search:p,keywords:f};},[p,f]);let[x,w]=useState(n),b=useSpring(a?{opacity:1,transform:"translate(0px, 0px)",display:"block",config:{duration:150}}:{opacity:0,transform:"translate(0px, -2px)",display:"none",config:{duration:150}}),B=n.find(d=>d===l.getValues(t)),$=d=>{let u=[...L.current.keywords,d];h(""),S(u),l.setValue(t,u),C(!1);},g=d=>d?d.charAt(0).toUpperCase()+d.slice(1).toLowerCase():"",y=()=>{if(!L.current.search)return;let d=g(L.current.search);$(d);};useEffect(()=>{let d=u=>{a&&s.current&&!s.current.contains(u.target)&&(y(),C(!1));};return document.addEventListener("mousedown",u=>d(u)),()=>{document.removeEventListener("mousedown",u=>d(u));}},[a]);let m=d=>{d.code==="Enter"&&(y(),d.preventDefault());},v=d=>{let u=f.filter(t2=>t2!==d);S(u),h(""),l.setValue(t,u);};return useEffect(()=>{if(C(!!p),p){let d=n.filter(u=>u.toLowerCase().match(p.toLowerCase()));w(d);}else w(n);},[p]),useEffect(()=>{let d=n.filter(u=>!f.includes(u));w(d);},[f]),jsxs(G3,{children:[jsx(N3,{size:"lg",children:e}),r&&jsx(W3,{children:r}),!i&&jsxs(K3,{onClick:()=>C(!a),children:[jsx(f1,{}),B,jsx(U3,{onKeyDown:m,value:p,onChange:d=>h(d.target.value),type:"text",style:{marginLeft:"45px",width:"calc(100% - 80px)"}}),jsxs(_3,{style:b,ref:s,children:[x.map(d=>{let u=d===B;return jsxs(u1,{onClick:()=>$(d),children:[jsx(c.Body,{size:"lg",children:d}),jsx(J3,{isCurrent:u,children:jsx(E.Check,{color:"#fff"})})]},d)}),!x.length&&jsx(u1,{onClick:()=>y(),children:jsx(c.Body,{size:"lg",children:"Add Option"})},"add")]})]}),jsxs("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap"},children:[i&&f.length===0&&"N/A",f.map(d=>jsxs(X3,{onClick:()=>v(d),children:[d,!i&&jsx(W,{})]},d))]})]})},h1=Y3;var Q3={Container:j2,Checkbox:J,CheckboxGroup:q2,TextInput:R,Radio:Q,RadioGroup:o1,Select:n1,Signature:t1,Submit:s1,LocationSelect:C1,Keyword:h1,Toggle:p2};
|
|
798
798
|
|
|
799
799
|
export { o2 as Button, _ as Contentful, O1 as ContentfulLottieFileSlug, Q3 as Form, E as Icons, V as LoadingSpinner, I1 as LottieAnimation, _1 as Modal, C2 as Size, U1 as SolaceLogo, Q1 as SolaceThemeProvider, p2 as Toggle, r5 as Tooltip, c as Typography };
|
|
800
800
|
//# sourceMappingURL=out.js.map
|