@hellobetterdigitalnz/betterui 0.0.3-308 → 0.0.3-309

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.js CHANGED
@@ -6,7 +6,7 @@
6
6
  ${w2.dropdownItem}
7
7
  dropdownItem
8
8
  ${o?`${w2.active} dropdownItemActive `:""}
9
- ${l?`${w2.selected} dropdownItemSelected`:""}`,"data-value":r,"aria-label":t,onClick:a=>{i&&i(a,r)},onMouseEnter:n,children:t})},$3=e=>{const{placeholder:t,value:r=[],onChange:n,onClick:i,options:l=[],onSearch:o,creatable:s=!1,onCreateNew:a,loading:c,disabled:h,extraClass:w,error:f}=e,[d,v]=u.useState(!1),[g,L]=u.useState(0),[p,_]=u.useState(""),[M,b]=u.useState(l),H=u.useRef(null),B=u.useRef(null),N=u.useRef(null),[k,$]=u.useState(!1),[P,A]=u.useState({}),Y=u.useRef(null),F=T=>r.some(x=>x.value===T.value),z=T=>{F(T)?n(r.filter(x=>x.value!==T.value)):n([...r,T])};u.useEffect(()=>{d&&L(0)},[d]),u.useEffect(()=>{d||_("")},[d]),u.useEffect(()=>{const T=x=>{const V=x.target;H.current&&!H.current.contains(V)&&Y.current&&!Y.current.contains(V)&&v(!1)};return document.addEventListener("mousedown",T),()=>{document.removeEventListener("mousedown",T)}},[]);const E=()=>{if(!d||!B.current||!Y.current)return;const T=B.current.getBoundingClientRect(),x=Y.current.offsetHeight,V=window.visualViewport,m=window.scrollY||document.documentElement.scrollTop,S=window.scrollX||document.documentElement.scrollLeft,y=(V==null?void 0:V.pageTop)??0,W=((V==null?void 0:V.height)??window.innerHeight)-T.bottom<x?T.top+m+y-x:T.bottom+m+y;A({top:`${W}px`,left:`${T.left+S}px`,width:`${T.width}px`,position:"absolute",zIndex:99999})};u.useEffect(()=>{if(!B.current)return;let T=B.current.getBoundingClientRect();const x=()=>{if(E(),!B.current)return;const V=B.current.getBoundingClientRect();(T.top!==V.top||T.left!==V.left)&&v(!1)};return d&&(window.addEventListener("resize",x),window.addEventListener("scroll",x,!0)),()=>{window.removeEventListener("resize",x),window.removeEventListener("scroll",x,!0)}},[d]),u.useEffect(()=>{E()},[d]),u.useEffect(()=>{const T=()=>{E()};return window.addEventListener("resize",T),window.addEventListener("scroll",T,!0),()=>{window.removeEventListener("resize",T),window.removeEventListener("scroll",T,!0)}},[]),u.useEffect(()=>{var x,V;if(!d)return;const T=()=>{requestAnimationFrame(()=>{setTimeout(()=>{E()},50)})};return(x=window.visualViewport)==null||x.addEventListener("resize",T),(V=window.visualViewport)==null||V.addEventListener("scroll",T),T(),()=>{var m,S;(m=window.visualViewport)==null||m.removeEventListener("resize",T),(S=window.visualViewport)==null||S.removeEventListener("scroll",T)}},[d]),u.useEffect(()=>{if(!B.current)return;let T=B.current.getBoundingClientRect();const x=new ResizeObserver(()=>{const V=B.current.getBoundingClientRect();(T.y!==V.y||T.x!==V.x||T.top!==V.top||T.left!==V.left)&&v(!1),T=V});return x.observe(B.current),()=>{x.disconnect()}},[B,d]),u.useEffect(()=>{var x;const T=V=>{if(V.target!==B.current&&V.target!==N.current)return;const m=M.filter(S=>S.label.toLowerCase().includes(p.toLowerCase()));switch(V.code){case"Enter":if(V.target===N.current&&(v(S=>!S),d&&m.length>0&&(z(m[g]),N.current&&N.current.blur()),d&&m.length>=0&&N.current&&N.current.blur()),s&&p.trim()!==""){const S={label:p.trim(),value:p.trim().replace(/\s/g,"-")};l.some(y=>y.value===S.value)||(b(y=>[...y,S]),z(S),a&&a(S,V)),_(""),v(!1)}break;case"ArrowUp":V.preventDefault(),d?L(S=>S>0?S-1:m.length-1):v(!0);break;case"ArrowDown":V.preventDefault(),d?L(S=>S<m.length-1?S+1:0):v(!0);break;case"Escape":v(!1),_("");break}};return(x=B.current)==null||x.addEventListener("keydown",T),()=>{var V;(V=B.current)==null||V.removeEventListener("keydown",T)}},[d,g,l,p,z,s,a]);const I=l.filter(T=>T.label.toLowerCase().includes(p.toLowerCase())),j=T=>{v(x=>!x),$(!k),!d&&N.current?N.current.focus():N.current.blur(),i&&i(T)};u.useEffect(()=>{o&&o(p)},[p,o]);const O=["multiSelectField",w2.dropdown];return f&&O.push(w2.error),h&&O.push(w2.disabled),w&&O.push(w),C.jsxs("div",{ref:H,className:K(O),children:[c&&C.jsx(L2,{}),C.jsxs("div",{className:w2.control,ref:B,onClick:j,tabIndex:0,children:[!d&&r.length===0&&C.jsx("span",{className:w2.placeholder,children:t}),C.jsxs("div",{className:w2.tagHolder,children:[r.map(T=>C.jsx($5,{label:T.label,onRemove:x=>{x.stopPropagation(),z(T)}},T.value)),C.jsx("div",{className:w2.input,children:C.jsx("input",{type:"text",ref:N,value:p,onChange:T=>_(T.target.value),onFocus:()=>setTimeout(E,100),onBlur:()=>setTimeout(E,100)})})]}),C.jsx("div",{className:w2.chevron,children:d?C.jsx(B2,{}):C.jsx(y2,{})})]}),s?C.jsx(C.Fragment,{children:!!d&&j1.createPortal(C.jsxs("div",{ref:Y,style:{...P},className:`${w2.dropdownMenu} dropdownMenu`,children:[s&&I.length===0&&C.jsx("div",{className:w2.createOptionMessage,children:"Press Enter to create new"}),I.length>0&&I.map((T,x)=>C.jsx(b1,{id:`${x}`,onMouseEnter:()=>L(x),label:T.label,value:T.value,handleSelect:V=>{V.stopPropagation(),z(T)},isSelected:F(T),isHighlighted:x===g},T.value))]}),document.body)}):C.jsx(C.Fragment,{children:!!d&&I.length>0&&j1.createPortal(C.jsx("div",{ref:Y,style:{...P},className:`${w2.dropdownMenu} dropdownMenu`,children:I.length>0&&I.map((T,x)=>C.jsx(b1,{id:`${x}`,onMouseEnter:()=>L(x),label:T.label,value:T.value,handleSelect:V=>{V.stopPropagation(),z(T)},isSelected:F(T),isHighlighted:x===g},T.value))}),document.body)})]})},I3="_dropdown_1uggp_1",D3="_readonly_1uggp_4",P3="_disabled_1uggp_7",O3="_textField_1uggp_11",R3="_textFieldIcon_1uggp_17",A3="_error_1uggp_30",F3="_control_1uggp_30",W3="_label_1uggp_66",z3="_placeholder_1uggp_73",q3="_chevron_1uggp_84",Y3="_customLoader_1uggp_99",U3="_dropdownSelector_1uggp_116",G3="_dropdownItem_1uggp_143",K3="_active_1uggp_147",J3="_createOptionMessage_1uggp_151",Q3="_chevronArrow_1uggp_157",g2={dropdown:I3,readonly:D3,disabled:P3,textField:O3,textFieldIcon:R3,error:A3,control:F3,label:W3,placeholder:z3,chevron:q3,customLoader:Y3,"rotate-ring":"_rotate-ring_1uggp_1",dropdownSelector:U3,dropdownItem:G3,active:K3,createOptionMessage:J3,chevronArrow:Q3},B1=u.forwardRef((e,t)=>{const r=[g2.dropdownSelector];return C.jsx("div",{ref:t,style:e.style,className:K(r),children:e.children})}),y1=e=>{const{label:t,value:r,handleSelect:n}=e;return C.jsx("div",{className:g2.dropdownItem,"data-value":r,"aria-label":t,onClick:i=>{n&&n(i,r,t)},children:t})},X3=e=>{const{name:t,id:r,value:n,icon:i,options:l,placeholder:o,extraClass:s,disabled:a,error:c,ariaLabel:h,required:w,readonly:f,onChange:d,onClick:v,autoComplete:g,creatable:L,onCreateNew:p,onSearch:_,isLoading:M,skeletonLoading:b,...H}=e,[B,N]=u.useState(!1),[k,$]=u.useState(""),[P,A]=u.useState([]),[Y,F]=u.useState({}),z=u.useRef(null),E=u.useRef(null),I=u.useRef(null);u.useEffect(()=>{const m=S=>{z.current&&!z.current.contains(S.target)&&N(!1)};return document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m)}},[]);const j=()=>{if(B&&I.current&&E.current){const m=I.current.getBoundingClientRect(),S=E.current.offsetHeight,R=window.innerHeight-m.bottom<S?m.top-S:m.bottom;F({top:`${R}px`,left:`${m.left}px`,width:`${m.width}px`,position:"fixed",zIndex:100})}};u.useEffect(()=>{if(!I.current)return;let m=I.current.getBoundingClientRect();const S=()=>{if(j(),!I.current)return;const y=I.current.getBoundingClientRect();(m.top!==y.top||m.left!==y.left)&&N(!1)};return B&&(window.addEventListener("resize",S),window.addEventListener("scroll",S,!0)),()=>{window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[B]),u.useEffect(()=>{j()},[B]),u.useEffect(()=>{const m=()=>{j()};return window.addEventListener("resize",m),window.addEventListener("scroll",m,!0),()=>{window.removeEventListener("resize",m),window.removeEventListener("scroll",m,!0)}},[]),u.useEffect(()=>{if(!I.current)return;let m=I.current.getBoundingClientRect();const S=new ResizeObserver(()=>{const y=I.current.getBoundingClientRect();(m.y!==y.y||m.x!==y.x||m.top!==y.top||m.left!==y.left)&&N(!1),m=y});return S.observe(I.current),()=>{S.disconnect()}},[I,B]);const O=[g2.dropdown];c&&O.push(g2.error),s&&O.push(s),a&&O.push(g2.disabled),f&&O.push(g2.readonly);const T=m=>{N(!B),v&&v(m)},x=(m,S,y)=>{$(y),N(!1),d&&d(m,S)};u.useEffect(()=>{A(l)},[l]),u.useEffect(()=>{if(_)_(k);else{let m=[];k?l.map(S=>{typeof S=="string"?S.toLowerCase().indexOf(k.toString().toLowerCase())>=0&&m.push(S):S.label&&S.label.toLowerCase().indexOf(k.toString().toLowerCase())>=0&&m.push(S)}):m=[...l],A(m)}},[k]),u.useEffect(()=>{n&&$(n)},[n]);const V=m=>{p&&p(k,m)};return C.jsxs("div",{ref:z,className:K(O),children:[b&&C.jsx(L2,{}),C.jsxs("div",{ref:I,className:`${g2.control} control ${i?g2.textField:""}`,children:[!!i&&C.jsx("div",{className:g2.textFieldIcon,children:i}),C.jsx("input",{className:`${g2.input} input`,type:"text",value:k,placeholder:o,onChange:m=>{$(m.target.value)},onClick:T,onKeyUp:m=>{L&&m.key==="Enter"&&(m.preventDefault(),N(!1),V(m))},readOnly:f,required:w,autoComplete:g?"on":"off","aria-label":h||t,"aria-required":w?"true":"false","aria-invalid":c?"true":"false","aria-disabled":a?"true":"false","aria-readonly":f?"true":"false","aria-autocomplete":g?"list":"none",...H}),M?C.jsx("div",{onClick:m=>m.stopPropagation(),className:g2.chevron,children:C.jsx("div",{className:g2.customLoader})}):C.jsxs("div",{className:`${g2.chevron} ${g2.chevronArrow}`,children:[!B&&C.jsx(y2,{}),!!B&&C.jsx(B2,{})]})]}),L?C.jsx(C.Fragment,{children:!!B&&C.jsxs(B1,{ref:E,style:{...Y},children:[L&&P.length===0&&C.jsx("div",{onClick:m=>{N(!1),V(m)},className:g2.createOptionMessage,children:"Press Enter or click here to create new"}),P.map((m,S)=>C.jsx(y1,{handleSelect:x,label:typeof m=="object"?m.label:m,value:typeof m=="object"?m.value:m},S))]})}):C.jsx(C.Fragment,{children:!!B&&P.length>0&&C.jsxs(B1,{ref:E,style:{...Y},children:[L&&P.length===0&&C.jsxs("div",{className:g2.createOptionMessage,children:['Press Enter to create "',k,'"']}),P.map((m,S)=>C.jsx(y1,{handleSelect:x,label:typeof m=="object"?m.label:m,value:typeof m=="object"?m.value:m},S))]})})]})},C0=e=>{const{name:t,id:r,value:n,placeholder:i,extraClass:l,disabled:o,error:s,ariaLabel:a,required:c,readonly:h,autoComplete:w,loading:f,...d}=e,[v,g]=u.useState("password"),L=()=>{g(v==="password"?"text":"password")},p=[U.input];return s&&p.push(U.error),l&&p.push(l),C.jsxs("div",{className:U.passwordCon,children:[f&&C.jsx(L2,{}),C.jsx("input",{className:K(p),id:r,name:t,type:v,value:n,placeholder:i,disabled:o,readOnly:h,required:c,autoComplete:w?"on":"off","aria-label":a||t,"aria-required":c?"true":"false","aria-invalid":s?"true":"false","aria-disabled":o?"true":"false","aria-readonly":h?"true":"false","aria-autocomplete":w?"list":"none",...d}),C.jsx("span",{onClick:L,className:U.eyeicon,children:v=="password"?C.jsx(B5,{type:"regular"}):C.jsx(y5,{type:"regular"})})]})},e0="_radioSet_wfwz3_1",t0="_container_wfwz3_6",r0="_radioHolder_wfwz3_10",n0="_error_wfwz3_22",i0="_disabled_wfwz3_25",l0="_radio_wfwz3_1",o0="_circle_wfwz3_56",b2={radioSet:e0,container:t0,radioHolder:r0,error:n0,disabled:i0,radio:l0,circle:o0},s0=e=>{const{label:t,name:r,checked:n,id:i,value:l,placeholder:o,extraClass:s,disabled:a,error:c,ariaLabel:h,required:w,readonly:f,onChange:d,...v}=e,[g,L]=u.useState(!1),p=["radio",b2.radio],_=["radioHolder",b2.radioHolder];s&&p.push(s),a&&_.push(b2.disabled),c&&(p.push(b2.error),_.push(b2.error)),u.useEffect(()=>{L(n||!1)},[n]);const M=b=>{!f&&!a&&(L(b.target.checked),d&&d(b,b.target.checked))};return C.jsxs("div",{className:K(_),children:[C.jsxs("div",{className:K(p),children:[C.jsx("input",{id:i,name:r,checked:g,type:"radio",value:l,placeholder:o,disabled:a,readOnly:f,required:w,"aria-label":h||r,"aria-required":w?"true":"false","aria-invalid":c?"true":"false","aria-disabled":a?"true":"false","aria-readonly":f?"true":"false",onChange:M,...v}),C.jsx("div",{className:b2.circle})]}),!!t&&C.jsx("label",{htmlFor:i,children:t})]})},a0=e=>{const{children:t,columns:r,extraClass:n}=e;return C.jsx("div",{className:`${b2.radioSet} ${n} ${r?b2.container:""}`,children:t})},c0="_holder_g9r15_1",h0="_hidden_g9r15_7",z1={holder:c0,hidden:h0};var i1={exports:{}},l1={exports:{}},e2={};/** @license React v16.13.1
9
+ ${l?`${w2.selected} dropdownItemSelected`:""}`,"data-value":r,"aria-label":t,onClick:a=>{i&&i(a,r)},onMouseEnter:n,children:t})},$3=e=>{const{placeholder:t,value:r=[],onChange:n,onClick:i,options:l=[],onSearch:o,creatable:s=!1,onCreateNew:a,loading:c,disabled:h,extraClass:w,error:f}=e,[d,v]=u.useState(!1),[g,L]=u.useState(0),[p,_]=u.useState(""),[M,b]=u.useState(l),H=u.useRef(null),B=u.useRef(null),N=u.useRef(null),[k,$]=u.useState(!1),[P,A]=u.useState({}),Y=u.useRef(null),F=T=>r.some(x=>x.value===T.value),z=T=>{F(T)?n(r.filter(x=>x.value!==T.value)):n([...r,T])};u.useEffect(()=>{d&&L(0)},[d]),u.useEffect(()=>{d||_("")},[d]),u.useEffect(()=>{const T=x=>{const V=x.target;H.current&&!H.current.contains(V)&&Y.current&&!Y.current.contains(V)&&v(!1)};return document.addEventListener("mousedown",T),()=>{document.removeEventListener("mousedown",T)}},[]);const E=()=>{if(!d||!B.current||!Y.current)return;const T=B.current.getBoundingClientRect(),x=Y.current.offsetHeight,V=window.visualViewport,m=window.scrollY||document.documentElement.scrollTop,S=window.scrollX||document.documentElement.scrollLeft,y=(V==null?void 0:V.offsetTop)??0,W=((V==null?void 0:V.height)??window.innerHeight)-T.bottom<x?T.top+m+y-x:T.bottom+m+y;A({top:`${W}px`,left:`${T.left+S}px`,width:`${T.width}px`,position:"absolute",zIndex:99999})};u.useEffect(()=>{if(!B.current)return;let T=B.current.getBoundingClientRect();const x=()=>{if(E(),!B.current)return;const V=B.current.getBoundingClientRect();(T.top!==V.top||T.left!==V.left)&&v(!1)};return d&&(window.addEventListener("resize",x),window.addEventListener("scroll",x,!0)),()=>{window.removeEventListener("resize",x),window.removeEventListener("scroll",x,!0)}},[d]),u.useEffect(()=>{E()},[d]),u.useEffect(()=>{const T=()=>{E()};return window.addEventListener("resize",T),window.addEventListener("scroll",T,!0),()=>{window.removeEventListener("resize",T),window.removeEventListener("scroll",T,!0)}},[]),u.useEffect(()=>{var x,V;if(!d)return;const T=()=>E();return(x=window.visualViewport)==null||x.addEventListener("resize",T),(V=window.visualViewport)==null||V.addEventListener("scroll",T),()=>{var m,S;(m=window.visualViewport)==null||m.removeEventListener("resize",T),(S=window.visualViewport)==null||S.removeEventListener("scroll",T)}},[d]),u.useEffect(()=>{if(!B.current)return;let T=B.current.getBoundingClientRect();const x=new ResizeObserver(()=>{const V=B.current.getBoundingClientRect();(T.y!==V.y||T.x!==V.x||T.top!==V.top||T.left!==V.left)&&v(!1),T=V});return x.observe(B.current),()=>{x.disconnect()}},[B,d]),u.useEffect(()=>{var x;const T=V=>{if(V.target!==B.current&&V.target!==N.current)return;const m=M.filter(S=>S.label.toLowerCase().includes(p.toLowerCase()));switch(V.code){case"Enter":if(V.target===N.current&&(v(S=>!S),d&&m.length>0&&(z(m[g]),N.current&&N.current.blur()),d&&m.length>=0&&N.current&&N.current.blur()),s&&p.trim()!==""){const S={label:p.trim(),value:p.trim().replace(/\s/g,"-")};l.some(y=>y.value===S.value)||(b(y=>[...y,S]),z(S),a&&a(S,V)),_(""),v(!1)}break;case"ArrowUp":V.preventDefault(),d?L(S=>S>0?S-1:m.length-1):v(!0);break;case"ArrowDown":V.preventDefault(),d?L(S=>S<m.length-1?S+1:0):v(!0);break;case"Escape":v(!1),_("");break}};return(x=B.current)==null||x.addEventListener("keydown",T),()=>{var V;(V=B.current)==null||V.removeEventListener("keydown",T)}},[d,g,l,p,z,s,a]);const I=l.filter(T=>T.label.toLowerCase().includes(p.toLowerCase())),j=T=>{v(x=>!x),$(!k),!d&&N.current?N.current.focus():N.current.blur(),i&&i(T)};u.useEffect(()=>{o&&o(p)},[p,o]);const O=["multiSelectField",w2.dropdown];return f&&O.push(w2.error),h&&O.push(w2.disabled),w&&O.push(w),C.jsxs("div",{ref:H,className:K(O),children:[c&&C.jsx(L2,{}),C.jsxs("div",{className:w2.control,ref:B,onClick:j,tabIndex:0,children:[!d&&r.length===0&&C.jsx("span",{className:w2.placeholder,children:t}),C.jsxs("div",{className:w2.tagHolder,children:[r.map(T=>C.jsx($5,{label:T.label,onRemove:x=>{x.stopPropagation(),z(T)}},T.value)),C.jsx("div",{className:w2.input,children:C.jsx("input",{type:"text",ref:N,value:p,onChange:T=>_(T.target.value),onFocus:()=>setTimeout(E,100),onBlur:()=>setTimeout(E,100)})})]}),C.jsx("div",{className:w2.chevron,children:d?C.jsx(B2,{}):C.jsx(y2,{})})]}),s?C.jsx(C.Fragment,{children:!!d&&j1.createPortal(C.jsxs("div",{ref:Y,style:{...P},className:`${w2.dropdownMenu} dropdownMenu`,children:[s&&I.length===0&&C.jsx("div",{className:w2.createOptionMessage,children:"Press Enter to create new"}),I.length>0&&I.map((T,x)=>C.jsx(b1,{id:`${x}`,onMouseEnter:()=>L(x),label:T.label,value:T.value,handleSelect:V=>{V.stopPropagation(),z(T)},isSelected:F(T),isHighlighted:x===g},T.value))]}),document.body)}):C.jsx(C.Fragment,{children:!!d&&I.length>0&&j1.createPortal(C.jsx("div",{ref:Y,style:{...P},className:`${w2.dropdownMenu} dropdownMenu`,children:I.length>0&&I.map((T,x)=>C.jsx(b1,{id:`${x}`,onMouseEnter:()=>L(x),label:T.label,value:T.value,handleSelect:V=>{V.stopPropagation(),z(T)},isSelected:F(T),isHighlighted:x===g},T.value))}),document.body)})]})},I3="_dropdown_1uggp_1",D3="_readonly_1uggp_4",P3="_disabled_1uggp_7",O3="_textField_1uggp_11",R3="_textFieldIcon_1uggp_17",A3="_error_1uggp_30",F3="_control_1uggp_30",W3="_label_1uggp_66",z3="_placeholder_1uggp_73",q3="_chevron_1uggp_84",Y3="_customLoader_1uggp_99",U3="_dropdownSelector_1uggp_116",G3="_dropdownItem_1uggp_143",K3="_active_1uggp_147",J3="_createOptionMessage_1uggp_151",Q3="_chevronArrow_1uggp_157",g2={dropdown:I3,readonly:D3,disabled:P3,textField:O3,textFieldIcon:R3,error:A3,control:F3,label:W3,placeholder:z3,chevron:q3,customLoader:Y3,"rotate-ring":"_rotate-ring_1uggp_1",dropdownSelector:U3,dropdownItem:G3,active:K3,createOptionMessage:J3,chevronArrow:Q3},B1=u.forwardRef((e,t)=>{const r=[g2.dropdownSelector];return C.jsx("div",{ref:t,style:e.style,className:K(r),children:e.children})}),y1=e=>{const{label:t,value:r,handleSelect:n}=e;return C.jsx("div",{className:g2.dropdownItem,"data-value":r,"aria-label":t,onClick:i=>{n&&n(i,r,t)},children:t})},X3=e=>{const{name:t,id:r,value:n,icon:i,options:l,placeholder:o,extraClass:s,disabled:a,error:c,ariaLabel:h,required:w,readonly:f,onChange:d,onClick:v,autoComplete:g,creatable:L,onCreateNew:p,onSearch:_,isLoading:M,skeletonLoading:b,...H}=e,[B,N]=u.useState(!1),[k,$]=u.useState(""),[P,A]=u.useState([]),[Y,F]=u.useState({}),z=u.useRef(null),E=u.useRef(null),I=u.useRef(null);u.useEffect(()=>{const m=S=>{z.current&&!z.current.contains(S.target)&&N(!1)};return document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m)}},[]);const j=()=>{if(B&&I.current&&E.current){const m=I.current.getBoundingClientRect(),S=E.current.offsetHeight,R=window.innerHeight-m.bottom<S?m.top-S:m.bottom;F({top:`${R}px`,left:`${m.left}px`,width:`${m.width}px`,position:"fixed",zIndex:100})}};u.useEffect(()=>{if(!I.current)return;let m=I.current.getBoundingClientRect();const S=()=>{if(j(),!I.current)return;const y=I.current.getBoundingClientRect();(m.top!==y.top||m.left!==y.left)&&N(!1)};return B&&(window.addEventListener("resize",S),window.addEventListener("scroll",S,!0)),()=>{window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[B]),u.useEffect(()=>{j()},[B]),u.useEffect(()=>{const m=()=>{j()};return window.addEventListener("resize",m),window.addEventListener("scroll",m,!0),()=>{window.removeEventListener("resize",m),window.removeEventListener("scroll",m,!0)}},[]),u.useEffect(()=>{if(!I.current)return;let m=I.current.getBoundingClientRect();const S=new ResizeObserver(()=>{const y=I.current.getBoundingClientRect();(m.y!==y.y||m.x!==y.x||m.top!==y.top||m.left!==y.left)&&N(!1),m=y});return S.observe(I.current),()=>{S.disconnect()}},[I,B]);const O=[g2.dropdown];c&&O.push(g2.error),s&&O.push(s),a&&O.push(g2.disabled),f&&O.push(g2.readonly);const T=m=>{N(!B),v&&v(m)},x=(m,S,y)=>{$(y),N(!1),d&&d(m,S)};u.useEffect(()=>{A(l)},[l]),u.useEffect(()=>{if(_)_(k);else{let m=[];k?l.map(S=>{typeof S=="string"?S.toLowerCase().indexOf(k.toString().toLowerCase())>=0&&m.push(S):S.label&&S.label.toLowerCase().indexOf(k.toString().toLowerCase())>=0&&m.push(S)}):m=[...l],A(m)}},[k]),u.useEffect(()=>{n&&$(n)},[n]);const V=m=>{p&&p(k,m)};return C.jsxs("div",{ref:z,className:K(O),children:[b&&C.jsx(L2,{}),C.jsxs("div",{ref:I,className:`${g2.control} control ${i?g2.textField:""}`,children:[!!i&&C.jsx("div",{className:g2.textFieldIcon,children:i}),C.jsx("input",{className:`${g2.input} input`,type:"text",value:k,placeholder:o,onChange:m=>{$(m.target.value)},onClick:T,onKeyUp:m=>{L&&m.key==="Enter"&&(m.preventDefault(),N(!1),V(m))},readOnly:f,required:w,autoComplete:g?"on":"off","aria-label":h||t,"aria-required":w?"true":"false","aria-invalid":c?"true":"false","aria-disabled":a?"true":"false","aria-readonly":f?"true":"false","aria-autocomplete":g?"list":"none",...H}),M?C.jsx("div",{onClick:m=>m.stopPropagation(),className:g2.chevron,children:C.jsx("div",{className:g2.customLoader})}):C.jsxs("div",{className:`${g2.chevron} ${g2.chevronArrow}`,children:[!B&&C.jsx(y2,{}),!!B&&C.jsx(B2,{})]})]}),L?C.jsx(C.Fragment,{children:!!B&&C.jsxs(B1,{ref:E,style:{...Y},children:[L&&P.length===0&&C.jsx("div",{onClick:m=>{N(!1),V(m)},className:g2.createOptionMessage,children:"Press Enter or click here to create new"}),P.map((m,S)=>C.jsx(y1,{handleSelect:x,label:typeof m=="object"?m.label:m,value:typeof m=="object"?m.value:m},S))]})}):C.jsx(C.Fragment,{children:!!B&&P.length>0&&C.jsxs(B1,{ref:E,style:{...Y},children:[L&&P.length===0&&C.jsxs("div",{className:g2.createOptionMessage,children:['Press Enter to create "',k,'"']}),P.map((m,S)=>C.jsx(y1,{handleSelect:x,label:typeof m=="object"?m.label:m,value:typeof m=="object"?m.value:m},S))]})})]})},C0=e=>{const{name:t,id:r,value:n,placeholder:i,extraClass:l,disabled:o,error:s,ariaLabel:a,required:c,readonly:h,autoComplete:w,loading:f,...d}=e,[v,g]=u.useState("password"),L=()=>{g(v==="password"?"text":"password")},p=[U.input];return s&&p.push(U.error),l&&p.push(l),C.jsxs("div",{className:U.passwordCon,children:[f&&C.jsx(L2,{}),C.jsx("input",{className:K(p),id:r,name:t,type:v,value:n,placeholder:i,disabled:o,readOnly:h,required:c,autoComplete:w?"on":"off","aria-label":a||t,"aria-required":c?"true":"false","aria-invalid":s?"true":"false","aria-disabled":o?"true":"false","aria-readonly":h?"true":"false","aria-autocomplete":w?"list":"none",...d}),C.jsx("span",{onClick:L,className:U.eyeicon,children:v=="password"?C.jsx(B5,{type:"regular"}):C.jsx(y5,{type:"regular"})})]})},e0="_radioSet_wfwz3_1",t0="_container_wfwz3_6",r0="_radioHolder_wfwz3_10",n0="_error_wfwz3_22",i0="_disabled_wfwz3_25",l0="_radio_wfwz3_1",o0="_circle_wfwz3_56",b2={radioSet:e0,container:t0,radioHolder:r0,error:n0,disabled:i0,radio:l0,circle:o0},s0=e=>{const{label:t,name:r,checked:n,id:i,value:l,placeholder:o,extraClass:s,disabled:a,error:c,ariaLabel:h,required:w,readonly:f,onChange:d,...v}=e,[g,L]=u.useState(!1),p=["radio",b2.radio],_=["radioHolder",b2.radioHolder];s&&p.push(s),a&&_.push(b2.disabled),c&&(p.push(b2.error),_.push(b2.error)),u.useEffect(()=>{L(n||!1)},[n]);const M=b=>{!f&&!a&&(L(b.target.checked),d&&d(b,b.target.checked))};return C.jsxs("div",{className:K(_),children:[C.jsxs("div",{className:K(p),children:[C.jsx("input",{id:i,name:r,checked:g,type:"radio",value:l,placeholder:o,disabled:a,readOnly:f,required:w,"aria-label":h||r,"aria-required":w?"true":"false","aria-invalid":c?"true":"false","aria-disabled":a?"true":"false","aria-readonly":f?"true":"false",onChange:M,...v}),C.jsx("div",{className:b2.circle})]}),!!t&&C.jsx("label",{htmlFor:i,children:t})]})},a0=e=>{const{children:t,columns:r,extraClass:n}=e;return C.jsx("div",{className:`${b2.radioSet} ${n} ${r?b2.container:""}`,children:t})},c0="_holder_g9r15_1",h0="_hidden_g9r15_7",z1={holder:c0,hidden:h0};var i1={exports:{}},l1={exports:{}},e2={};/** @license React v16.13.1
10
10
  * react-is.production.min.js
11
11
  *
12
12
  * Copyright (c) Facebook, Inc. and its affiliates.