@leafygreen-ui/combobox 2.0.0 → 3.0.0

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
@@ -1,2 +1,2 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("lodash"),require("@leafygreen-ui/typography"),require("@leafygreen-ui/hooks"),require("@leafygreen-ui/icon"),require("@leafygreen-ui/icon-button"),require("@leafygreen-ui/emotion"),require("@leafygreen-ui/palette"),require("@leafygreen-ui/lib"),require("@emotion/react"),require("lodash/kebabCase"),require("@leafygreen-ui/checkbox"),require("@leafygreen-ui/tokens"),require("polished"),require("@leafygreen-ui/inline-definition"),require("lodash/isNull"),require("@leafygreen-ui/popover"),require("lodash/isUndefined")):"function"==typeof define&&define.amd?define(["exports","react","lodash","@leafygreen-ui/typography","@leafygreen-ui/hooks","@leafygreen-ui/icon","@leafygreen-ui/icon-button","@leafygreen-ui/emotion","@leafygreen-ui/palette","@leafygreen-ui/lib","@emotion/react","lodash/kebabCase","@leafygreen-ui/checkbox","@leafygreen-ui/tokens","polished","@leafygreen-ui/inline-definition","lodash/isNull","@leafygreen-ui/popover","lodash/isUndefined"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["@leafygreen-ui/combobox"]={},e.React,e._,e["@leafygreen-ui/typography"],e["@leafygreen-ui/hooks"],e["@leafygreen-ui/icon"],e["@leafygreen-ui/icon-button"],e["@leafygreen-ui/emotion"],e["@leafygreen-ui/palette"],e["@leafygreen-ui/lib"],e.react,e.kebabCase,e["@leafygreen-ui/checkbox"],e["@leafygreen-ui/tokens"],e.polished,e["@leafygreen-ui/inline-definition"],e.isNull,e["@leafygreen-ui/popover"],e.isUndefined)}(this,(function(e,n,t,r,o,a,i,l,s,c,u,d,p,f,b,g,h,y,x){"use strict";function v(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=v(n),k=v(a),w=v(i),C=v(d),S=v(p),j=v(g),N=v(h),M=v(y),O=v(x);function E(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function z(e){return z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},z(e)}function I(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function D(){return D=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},D.apply(this,arguments)}function A(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function P(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}function F(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==t)return;var r,o,a=[],i=!0,l=!1;try{for(t=t.call(e);!(i=(r=t.next()).done)&&(a.push(r.value),!n||a.length!==n);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==t.return||t.return()}finally{if(l)throw o}}return a}(e,n)||R(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(e){return function(e){if(Array.isArray(e))return T(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||R(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(e,n){if(e){if("string"==typeof e)return T(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?T(e,n):void 0}}function T(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var q="dark",H="light",W="Input",U="ClearButton",G="FirstChip",K="LastChip",V="MiddleChip",B="Combobox",X="Menu",Z="default",_="large",Y="expand-y",$="expand-x",J="scroll-x",Q="error",ee="none";var ne,te,re,oe,ae,ie,le,se,ce,ue,de,pe,fe,be,ge,he,ye,xe,ve,me,ke,we,Ce,Se,je,Ne,Me,Oe,Ee,ze,Ie,De,Ae,Pe=function(e,n,t){if(n&&t){var r=new RegExp(n,"gi"),o=e.matchAll(r);if(o){for(var a=e.split(""),i=0,l=Array.from(o);i<l.length;i++){var s,c=l[i],d=null!==(s=c.index)&&void 0!==s?s:-1,p=c[0],f=p.length,b=d+p+f,g=new Array(f).fill("");g[0]=m.default.createElement(t,{key:b},p),a.splice.apply(a,[d,f].concat(L(g)))}return u.jsx(m.default.Fragment,null,a)}return u.jsx(m.default.Fragment,null,e)}return u.jsx(m.default.Fragment,null,e)},Fe=function(e){var n,t=e.value,r=e.displayName;return{value:null!=t?t:C.default(r),displayName:null!==(n=null!=r?r:t)&&void 0!==n?n:""}},Le=function(e,n){if(e)return n.find((function(n){return n.value===e}))},Re=function(e,n){var t,r;return e?null!==(t=null===(r=Le(e,n))||void 0===r?void 0:r.displayName)&&void 0!==t?t:e:""},Te=function e(n){return m.default.Children.toArray(n).reduce((function(n,t){if(c.isComponentType(t,"ComboboxOption")){var r=Fe(t.props),o=r.value,a=r.displayName,i=t.props,l=i.glyph,s=i.disabled;return[].concat(L(n),[{value:o,displayName:a,isDisabled:!!s,hasGlyph:!!l}])}if(c.isComponentType(t,"ComboboxGroup")){var u=t.props.children;if(u)return[].concat(L(n),L(e(u)))}}),[])},qe=n.createContext({multiselect:!1,darkMode:!1,size:Z,withIcons:!1,disabled:!1,isOpen:!1,state:ee,searchState:"unset"}),He=function(e){return e?q:H},We=(I(re={},H,l.css(ne||(ne=P(["\n padding-top: 8px;\n "])))),I(re,q,l.css(te||(te=P(["\n padding-top: 8px;\n "])))),re),Ue=l.css(oe||(oe=P(["\n cursor: default;\n width: 100%;\n padding: 0 12px 2px;\n outline: none;\n overflow-wrap: anywhere;\n font-size: 12px;\n line-height: 16px;\n font-weight: bold;\n text-transform: uppercase;\n letter-spacing: 0.4px;\n"]))),Ge=(I(le={},H,l.css(ae||(ae=P(["\n color: ",";\n "])),s.palette.gray.dark1)),I(le,q,l.css(ie||(ie=P(["\n color: ",";\n "])),s.palette.gray.light1)),le);function Ke(e){var t=e.label,r=e.className,a=e.children,i=n.useContext(qe).darkMode,s=He(i),c=o.useIdAllocator({prefix:"combobox-group"});return m.default.Children.count(a)>0?u.jsx("div",{className:l.cx(We[s],r)},u.jsx("div",{className:l.cx(Ue,Ge[s]),id:c},t),u.jsx("div",{role:"group","aria-labelledby":c},a)):u.jsx(m.default.Fragment,null)}function Ve(e){throw Error("`ComboboxGroup` must be a child of a `Combobox` instance")}Ve.displayName="ComboboxGroup";var Be=(I(se={},Z,{x:12,y:8}),I(se,_,{x:12,y:8}),se),Xe=(I(ce={},Z,f.typeScales.body1.lineHeight+2*Be[Z].y),I(ce,_,f.typeScales.body2.lineHeight+2*Be[_].y),ce),Ze=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:384;return l.css(ue||(ue=P(["\n width: ","px;\n overflow: hidden;\n border-radius: 12px;\n border: 1px solid;\n"])),e)},_e=(I(fe={},H,l.css(de||(de=P(["\n box-shadow: 0px 4px 7px ",";\n border-color: ",";\n "])),b.transparentize(.85,s.palette.black),s.palette.gray.light2)),I(fe,q,l.css(pe||(pe=P(["\n box-shadow: 0px 4px 7px ",";\n border-color: ",";\n "])),b.transparentize(.85,s.palette.black),s.palette.gray.dark3)),fe),Ye=l.css(be||(be=P(["\n position: relative;\n width: 100%;\n margin: 0;\n padding: ","px 0;\n font-family: ",";\n border-radius: inherit;\n overflow-y: auto;\n scroll-behavior: smooth;\n"])),f.spacing[2],f.fontFamilies.default),$e=(I(ye={},H,l.css(ge||(ge=P(["\n color: ",";\n background-color: ",";\n "])),s.palette.black,s.palette.white)),I(ye,q,l.css(he||(he=P(["\n color: ",";\n background-color: ",";\n "])),s.palette.gray.light1,s.palette.gray.dark3)),ye);I(me={},Z,l.css(xe||(xe=P(["\n min-height: ","px;\n "])),Xe[Z])),I(me,_,l.css(ve||(ve=P(["\n min-height: ","px;\n "])),Xe[_]));var Je=l.css(ke||(ke=P(["\n position: relative;\n margin: 0;\n padding: 0;\n"]))),Qe=l.css(we||(we=P(["\n font-family: inherit;\n display: inline-flex;\n align-items: center;\n gap: 8px;\n"]))),en=(I(je={},H,l.css(Ce||(Ce=P(["\n color: ",";\n "])),s.palette.gray.dark3)),I(je,q,l.css(Se||(Se=P(["\n color: ",";\n "])),s.palette.gray.light3)),je),nn=(I(Oe={},Z,l.css(Ne||(Ne=P(["\n font-size: ","px;\n line-height: ","px;\n padding: ","px\n ","px;\n "])),f.typeScales.body1.fontSize,f.typeScales.body1.lineHeight,Be[Z].y,Be[Z].x)),I(Oe,_,l.css(Me||(Me=P(["\n font-size: ","px;\n line-height: ","px;\n padding: ","px\n ","px;\n "])),f.typeScales.body2.fontSize,f.typeScales.body2.lineHeight,Be[_].y,Be[_].x)),Oe);I(Ie={},Z,l.css(Ee||(Ee=P(["\n height: ","px;\n width: ","px;\n "])),f.typeScales.body1.fontSize,f.typeScales.body1.fontSize)),I(Ie,_,l.css(ze||(ze=P(["\n height: ","px;\n width: ","px;\n "])),f.typeScales.body2.fontSize,f.typeScales.body2.fontSize));var tn,rn,on,an,ln,sn,cn,un,dn,pn,fn,bn,gn,hn,yn,xn,vn,mn,kn,wn,Cn,Sn,jn,Nn,Mn,On,En,zn,In,Dn,An,Pn,Fn,Ln,Rn,Tn,qn,Hn,Wn,Un,Gn,Kn,Vn,Bn,Xn,Zn,_n,Yn,$n,Jn,Qn,et,nt,tt,rt,ot,at,it,lt,st,ct,ut,dt,pt,ft,bt,gt=l.keyframes(De||(De=P(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"]))),ht=l.css(Ae||(Ae=P(["\n animation: "," 1.5s linear infinite;\n"])),gt),yt=l.css(tn||(tn=P(["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: space-between;\n list-style: none;\n color: inherit;\n cursor: pointer;\n overflow: hidden;\n font-family: ",";\n\n // Left wedge\n &:before {\n content: '';\n position: absolute;\n left: 0;\n width: 4px;\n height: calc(100% - 14px);\n background-color: rgba(255, 255, 255, 0);\n border-radius: 0 6px 6px 0;\n transform: scale3d(0, 0.3, 0);\n transition: 200ms ease-in-out;\n transition-property: transform, background-color;\n }\n"])),f.fontFamilies.default),xt=(I(an={},H,l.css(rn||(rn=P(["\n &:hover {\n outline: none;\n background-color: ",";\n }\n "])),s.palette.gray.light2)),I(an,q,l.css(on||(on=P(["\n &:hover {\n outline: none;\n background-color: ",";\n }\n "])),s.palette.gray.dark4)),an),vt=(I(cn={},Z,l.css(ln||(ln=P(["\n font-size: ","px;\n line-height: ","px;\n min-height: ","px;\n padding: ","px\n ","px;\n gap: ","px;\n\n &:before {\n max-height: ","px;\n }\n "])),f.typeScales.body1.fontSize,f.typeScales.body1.lineHeight,Xe[Z],Be[Z].y,Be[Z].x,f.spacing[1],Xe[Z])),I(cn,_,l.css(sn||(sn=P(["\n font-size: ","px;\n line-height: ","px;\n min-height: ","px;\n padding: ","px\n ","px;\n gap: ","px;\n\n &:before {\n max-height: ","px;\n }\n "])),f.typeScales.body2.fontSize,f.typeScales.body2.lineHeight,Xe[_],Be[_].y,Be[_].x,f.spacing[2],Xe[_])),cn),mt=l.css(un||(un=P(["\n outline: none;\n\n &:before {\n transform: scaleY(1);\n }\n"]))),kt=(I(fn={},H,l.css(dn||(dn=P(["\n ",";\n background-color: ",";\n\n &:before {\n background-color: ",";\n }\n "])),mt,s.palette.blue.light3,s.palette.blue.base)),I(fn,q,l.css(pn||(pn=P(["\n ",";\n background-color: ",";\n\n &:before {\n background-color: ",";\n }\n "])),mt,s.palette.blue.dark3,s.palette.blue.light1)),fn),wt=l.css(bn||(bn=P(["\n cursor: not-allowed;\n\n &:hover {\n background-color: inherit;\n }\n\n &:before {\n content: unset;\n }\n"]))),Ct=(I(yn={},H,l.css(gn||(gn=P(["\n ",";\n color: ",";\n "])),wt,s.palette.gray.light1)),I(yn,q,l.css(hn||(hn=P(["\n ",";\n color: ",";\n "])),wt,s.palette.gray.dark1)),yn),St=(I(mn={},Z,l.css(xn||(xn=P(["\n min-width: ","px;\n "])),f.spacing[3])),I(mn,_,l.css(vn||(vn=P(["\n min-width: ","px;\n "])),f.spacing[4])),mn),jt=l.css(kn||(kn=P(["\n display: inline-flex;\n gap: 8px;\n justify-content: start;\n align-items: inherit;\n overflow-wrap: anywhere;\n"]))),Nt=l.css(wn||(wn=P(["\n pointer-events: none;\n"]))),Mt=function(e){return l.css(Cn||(Cn=P(["\n font-weight: ",";\n"])),e?"bold":"normal")},Ot=m.default.forwardRef((function(e,t){var r,i=e.displayName,d=e.glyph,p=e.isSelected,f=e.isFocused,b=e.disabled,g=e.setSelected,h=e.className,y=n.useContext(qe),x=y.multiselect,v=y.darkMode,w=y.withIcons,C=y.inputValue,j=y.size,N=He(v),M=o.useIdAllocator({prefix:"combobox-option-text"}),O=o.useForwardedRef(t,null),E=n.useCallback((function(e){e.stopPropagation(),b||e.target!==O.current&&"INPUT"!==e.target.tagName||g()}),[b,O,g]),z=n.useMemo((function(){if(d){if(a.isComponentGlyph(d)||c.isComponentType(d,"Icon"))return d;console.error("`ComboboxOption` instance did not render icon because it is not a known glyph element.",d)}}),[d]),D=n.useMemo((function(){if(x){var e=u.jsx(S.default,{"aria-labelledby":M,checked:p,tabIndex:-1,disabled:b,darkMode:v,className:l.css(Sn||(Sn=P(["\n // TODO: Remove when this is resolved:\n // https://jira.mongodb.org/browse/PD-2171\n & > label > div {\n margin-top: 0;\n }\n "])))});return u.jsx(m.default.Fragment,null,u.jsx("span",{className:l.cx(jt,Nt)},w?z:e,u.jsx("span",{id:M,className:Mt(p)},Pe(i,C,"strong"))),w&&e)}return u.jsx(m.default.Fragment,null,u.jsx("span",{className:l.cx(jt,Nt)},z,u.jsx("span",{className:Mt(p)},Pe(i,C,"strong"))),p&&u.jsx(k.default,{glyph:"Checkmark",className:St[j],color:v?s.palette.blue.light1:s.palette.blue.base}))}),[x,z,p,i,C,j,v,M,b,w]);return u.jsx("li",{ref:O,role:"option","aria-selected":f,"aria-label":i,tabIndex:-1,className:l.cx(yt,vt[j],xt[N],(r={},I(r,kt[N],f),I(r,Ct[N],b),r),h),onClick:E,onKeyDown:E},D)}));function Et(e){throw Error("`ComboboxOption` must be a child of a `Combobox` instance")}Ot.displayName="ComboboxOption",Et.displayName="ComboboxOption";var zt,It,Dt,At,Pt,Ft,Lt,Rt,Tt,qt,Ht,Wt,Ut,Gt,Kt,Vt,Bt,Xt,Zt,_t,Yt,$t=(I(jn={},Z,f.typeScales.body1.fontSize),I(jn,_,f.typeScales.body2.fontSize),jn),Jt=(I(Nn={},Z,2),I(Nn,_,4),Nn),Qt=(I(Mn={},Z,f.typeScales.body1.lineHeight+2*Jt[Z]),I(Mn,_,f.typeScales.body2.lineHeight+2*Jt[_]),Mn),er=(I(On={},Z,{y:(36-Qt[Z]-2)/2,x:f.spacing[2]-1}),I(On,_,{y:(48-Qt[_]-2)/2,x:f.spacing[2]-1}),On),nr=f.spacing[3],tr=(I(En={},Z,$t[Z]+2*er[Z].x+nr+2),I(En,_,$t[_]+2*er[_].x+nr+2),En),rr=c.createUniqueClassName("combobox-chip"),or=function(e,n){return l.cx(l.css(zn||(zn=P(["\n font-family: ",";\n width: 100%;\n min-width: ","px;\n "])),f.fontFamilies.default,tr[e]),I({},l.css(In||(In=P(["\n width: unset;\n "]))),n===$))},ar=l.css(Dn||(Dn=P(["\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n cursor: text;\n transition: 150ms ease-in-out;\n transition-property: background-color, box-shadow, border-color;\n border: 1px solid;\n width: inherit;\n border-radius: 6px;\n"]))),ir=(I(Fn={},H,l.css(An||(An=P(["\n color: ",";\n background-color: ",";\n border-color: ",";\n\n &:hover {\n box-shadow: ",";\n }\n "])),s.palette.gray.dark3,s.palette.white,s.palette.gray.base,f.hoverRing[H].gray)),I(Fn,q,l.css(Pn||(Pn=P(["\n color: ",";\n background-color: ",";\n border-color: ",";\n\n &:hover {\n box-shadow: ",";\n }\n "])),s.palette.gray.light2,s.palette.gray.dark4,s.palette.gray.base,f.hoverRing[q].gray)),Fn),lr=function(e){return l.css(Ln||(Ln=P(["\n padding: ","px ","px;\n"])),er[e].y,er[e].x)},sr=(I(qn={},H,l.css(Rn||(Rn=P(["\n cursor: not-allowed;\n color: ",";\n background-color: ",";\n border-color: ",";\n "])),s.palette.gray.dark1,s.palette.gray.light2,s.palette.gray.light1)),I(qn,q,l.css(Tn||(Tn=P(["\n cursor: not-allowed;\n color: ",";\n background-color: ",";\n border-color: ",";\n "])),s.palette.gray.dark1,s.palette.gray.dark3,s.palette.gray.dark2)),qn),cr=(I(Un={},H,l.css(Hn||(Hn=P(["\n border-color: ",";\n "])),s.palette.red.base)),I(Un,q,l.css(Wn||(Wn=P(["\n border-color: ",";\n "])),s.palette.red.light1)),Un),ur=(I(Vn={},H,l.css(Gn||(Gn=P(["\n &:focus-within {\n border-color: transparent;\n background-color: ",";\n box-shadow: ",";\n }\n "])),s.palette.white,f.focusRing[H].input)),I(Vn,q,l.css(Kn||(Kn=P(["\n &:focus-within {\n border-color: transparent;\n background-color: ",";\n box-shadow: ",";\n }\n "])),s.palette.gray.dark4,f.focusRing[q].input)),Vn),dr=function(e){var n=e.overflow,t=e.size,r=l.css(Bn||(Bn=P(["\n flex-grow: 1;\n width: inherit;\n "])));switch(n){case J:return l.css(Xn||(Xn=P(["\n ","\n display: block;\n height: ","px;\n padding-left: ","px;\n white-space: nowrap;\n overflow-x: scroll;\n scroll-behavior: smooth;\n scrollbar-width: none;\n\n &::-webkit-scrollbar {\n display: none;\n }\n\n & > ."," {\n margin-inline: 2px;\n\n &:first-child {\n margin-inline-start: 0;\n }\n\n &:last-child {\n margin-inline-end: 0;\n }\n }\n "])),r,Qt[t],er[t].x,rr);case $:return l.css(Zn||(Zn=P(["\n ","\n display: flex;\n gap: 4px;\n flex-wrap: nowrap;\n white-space: nowrap;\n height: ","px;\n "])),r,Qt[t]);case Y:return l.css(_n||(_n=P(["\n ","\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n overflow-x: visible;\n min-height: ","px;\n "])),r,Qt[t])}},pr=l.css(Yn||(Yn=P(["\n font-family: ",";\n width: 100%;\n border: none;\n cursor: inherit;\n background-color: inherit;\n color: inherit;\n box-sizing: content-box;\n padding: 0;\n margin: 0;\n text-overflow: ellipsis;\n\n &:placeholder-shown {\n min-width: 100%;\n }\n &:focus {\n outline: none;\n }\n"])),f.fontFamilies.default),fr=(I(Qn={},H,l.css($n||($n=P(["\n &::placeholder {\n color: ",";\n }\n "])),s.palette.gray.dark1)),I(Qn,q,l.css(Jn||(Jn=P(["\n &::placeholder {\n color: ",";\n }\n "])),s.palette.gray.light1)),Qn),br=(I(tt={},Z,l.css(et||(et=P(["\n height: ","px;\n font-size: ","px;\n line-height: ","px;\n min-width: ","px;\n padding-left: 4px;\n "])),Qt[Z],f.typeScales.body1.fontSize,f.typeScales.body1.lineHeight,$t[Z])),I(tt,_,l.css(nt||(nt=P(["\n height: ","px;\n font-size: ","px;\n line-height: ","px;\n min-width: ","px;\n padding-left: 6px;\n "])),Qt[_],f.typeScales.body2.fontSize,f.typeScales.body2.lineHeight,$t[_])),tt),gr=function(e,n){return l.cx(I({},l.css(rt||(rt=P(["\n /*\n * Immediate transition in, slow transition out. \n * '-in' transition is handled by `scroll-behavior` \n */\n transition: width ease-in-out ",";\n "],["\n /*\n * Immediate transition in, slow transition out. \n * '-in' transition is handled by \\`scroll-behavior\\` \n */\n transition: width ease-in-out ",";\n "])),e?"0s":"100ms"),n!==$))},hr=function(e,n){var t,r=null!==(t=null==n?void 0:n.length)&&void 0!==t?t:0;return l.css(ot||(ot=P(["\n max-width: 100%;\n width: ","px;\n // TODO: This doesn't quite work. Fix this\n max-width: calc(100% - ","px);\n "])),r*$t[e],2*nr)},yr=function(e){return"object"===z(e)&&!N.default(e)&&e.length>0?l.css(at||(at=P(["\n padding-left: 0px;\n "]))):""},xr=l.css(it||(it=P(["\n // Add a negative margin so the button takes up the same space as the regular icons\n margin-block: calc(","px - 100%);\n"])),nr/2),vr=function(e){return l.css(lt||(lt=P(["\n height: ","px;\n width: ","px;\n margin-inline-end: calc(","px / 2);\n"])),nr,nr,er[e].x)},mr=(I(ut={},H,l.css(st||(st=P(["\n color: ",";\n "])),s.palette.red.base)),I(ut,q,l.css(ct||(ct=P(["\n color: ",";\n "])),s.palette.red.light1)),ut),kr=(I(ft={},Z,l.css(dt||(dt=P(["\n font-size: ","px;\n line-height: ","px;\n padding-top: ","px;\n "])),f.typeScales.body1.fontSize,f.typeScales.body1.lineHeight,er[Z].y)),I(ft,_,l.css(pt||(pt=P(["\n font-size: ","px;\n line-height: ","px;\n padding-top: ","px;\n "])),f.typeScales.body2.fontSize,f.typeScales.body2.lineHeight,er[_].y)),ft),wr=l.css(bt||(bt=P(["\n margin-bottom: 2px;\n"]))),Cr=l.css(zt||(zt=P(["\n display: inline-flex;\n align-items: center;\n overflow: hidden;\n white-space: nowrap;\n box-sizing: border-box;\n"]))),Sr=(I(At={},Z,l.css(It||(It=P(["\n font-size: ","px;\n line-height: ","px;\n border-radius: 4px;\n "])),f.typeScales.body1.fontSize,f.typeScales.body1.lineHeight)),I(At,_,l.css(Dt||(Dt=P(["\n font-size: ","px;\n line-height: ","px;\n border-radius: 4px;\n "])),f.typeScales.body2.fontSize,f.typeScales.body2.lineHeight)),At),jr=(I(Lt={},H,l.css(Pt||(Pt=P(["\n color: ",";\n background-color: ",";\n\n // TODO: - refine these styles with Design\n &:focus-within {\n background-color: ",";\n }\n "])),s.palette.black,s.palette.gray.light2,s.palette.blue.light2)),I(Lt,q,l.css(Ft||(Ft=P(["\n color: ",";\n background-color: ",";\n\n &:focus-within {\n background-color: ",";\n }\n "])),s.palette.gray.light2,s.palette.gray.dark2,s.palette.blue.dark2)),Lt),Nr=(I(qt={},H,l.css(Rt||(Rt=P(["\n cursor: not-allowed;\n color: ",";\n background-color: ",";\n "])),s.palette.gray.base,s.palette.gray.light3)),I(qt,q,l.css(Tt||(Tt=P(["\n cursor: not-allowed;\n color: ",";\n background-color: ",";\n box-shadow: inset 0 0 1px 1px ","; ;\n "])),s.palette.gray.dark2,s.palette.gray.dark4,s.palette.gray.dark2)),qt),Mr=(I(Ut={},Z,l.css(Ht||(Ht=P(["\n padding-inline: 6px;\n padding-block: ","px;\n "])),Jt[Z])),I(Ut,_,l.css(Wt||(Wt=P(["\n padding-inline: 10px;\n padding-block: ","px;\n "])),Jt[_])),Ut),Or=l.css(Gt||(Gt=P(["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n outline: none;\n border: none;\n background-color: transparent;\n cursor: pointer;\n transition: background-color 100ms ease-in-out;\n"]))),Er=(I(Bt={},H,l.css(Kt||(Kt=P(["\n color: ",";\n\n &:hover {\n color: ",";\n background-color: ",";\n }\n "])),s.palette.gray.dark2,s.palette.black,s.palette.gray.light1)),I(Bt,q,l.css(Vt||(Vt=P(["\n color: ",";\n\n &:hover {\n color: ",";\n background-color: ",";\n }\n "])),s.palette.gray.light1,s.palette.gray.light3,s.palette.gray.dark1)),Bt),zr=(I(_t={},H,l.css(Xt||(Xt=P(["\n cursor: not-allowed;\n color: ",";\n &:hover {\n color: inherit;\n background-color: unset;\n }\n "])),s.palette.gray.dark2)),I(_t,q,l.css(Zt||(Zt=P(["\n cursor: not-allowed;\n color: ",";\n &:hover {\n color: inherit;\n background-color: unset;\n }\n "])),s.palette.gray.dark2)),_t),Ir=m.default.forwardRef((function(e,t){var r=e.displayName,o=e.isFocused,a=e.onRemove,i=e.onFocus,s=n.useContext(qe),d=s.darkMode,p=s.size,f=s.disabled,b=s.chipTruncationLocation,g=void 0===b?"end":b,h=s.chipCharacterLimit,y=void 0===h?12:h,x=He(d),v=!!y&&!!g&&"none"!==g&&r.length>y,m=n.useRef(null),w=n.useMemo((function(){if(v){var e=y-3;switch(g){case"start":return"…"+r.substring(r.length-e).trim();case"middle":return r.substring(0,e/2).trim()+"…"+r.substring(r.length-e/2).trim();case"end":return r.substring(0,e).trim()+"…";default:return r}}return!1}),[y,g,r,v]);n.useEffect((function(){var e;o&&!f&&(null==m||null===(e=m.current)||void 0===e||e.focus())}),[f,t,o]);return u.jsx("span",{role:"option","aria-selected":o,"data-testid":"lg-combobox-chip",ref:t,className:l.cx(rr,Cr,jr[x],Sr[p],I({},Nr[x],f)),onClick:function(e){var n;null!==(n=m.current)&&void 0!==n&&n.contains(e.target)||i()},onKeyDown:function(e){f||e.keyCode!==c.keyMap.Delete&&e.keyCode!==c.keyMap.Backspace&&e.keyCode!==c.keyMap.Enter&&e.keyCode!==c.keyMap.Space||a()},tabIndex:-1},u.jsx("span",{className:l.cx(Mr[p])},w?u.jsx(j.default,{darkMode:d,definition:r,align:"bottom"},w):r),u.jsx("button",{"aria-label":"Deselect ".concat(r),"aria-disabled":f,disabled:f,ref:m,className:l.cx(Or,Er[x],I({},zr[x],f)),onClick:function(){f||a()}},u.jsx(k.default,{glyph:"X"})))}));Ir.displayName="Chip";var Dr=["children","id","refEl","labelId","menuWidth","searchLoadingMessage","searchErrorMessage","searchEmptyMessage"],Ar=m.default.forwardRef((function(e,t){var r=e.children,a=e.id,i=e.refEl,c=e.labelId,d=e.menuWidth,p=e.searchLoadingMessage,f=e.searchErrorMessage,b=e.searchEmptyMessage,g=A(e,Dr),h=n.useContext(qe),y=h.disabled,x=h.darkMode,v=h.size,m=h.isOpen,w=h.searchState,C=o.useForwardedRef(t,null),S=He(x),j=o.useAvailableSpace(i),N=O.default(j)?"unset":"".concat(Math.min(j,256),"px"),E=n.useMemo((function(){var e=l.cx(Qe,en[S],nn[v]);switch(w){case"loading":return u.jsx("span",{className:e},u.jsx(k.default,{glyph:"Refresh",color:x?s.palette.blue.light1:s.palette.blue.base,className:ht}),p);case"error":return u.jsx("span",{className:e},u.jsx(k.default,{glyph:"Warning",color:x?s.palette.red.light1:s.palette.red.base}),f);default:return r&&"object"===z(r)&&"length"in r&&r.length>0?u.jsx("ul",{className:Je},r):u.jsx("span",{className:e},b)}}),[S,v,w,x,p,f,r,b]);return u.jsx(M.default,D({active:m&&!y,spacing:4,align:"bottom",justify:"middle",refEl:i,adjustOnMutation:!0,className:l.cx(Ze(d),_e[S])},g),u.jsx("div",{ref:C,id:a,role:"listbox","aria-labelledby":c,"aria-expanded":m,className:l.cx(Ye,$e[S],l.css(Yt||(Yt=P(["\n max-height: ",";\n "])),N)),onMouseDownCapture:function(e){return e.preventDefault()}},E))}));Ar.displayName="ComboboxMenu";var Pr=["children","label","description","placeholder","aria-label","disabled","size","darkMode","state","errorMessage","searchState","searchEmptyMessage","searchErrorMessage","searchLoadingMessage","filteredOptions","onFilter","clearable","onClear","overflow","multiselect","initialValue","onChange","value","chipTruncationLocation","chipCharacterLimit","className","usePortal","portalClassName","portalContainer","scrollContainer","popoverZIndex"];e.Combobox=function(e){var a,i,d=e.children,p=e.label,f=e.description,b=e.placeholder,g=void 0===b?"Select":b,h=e["aria-label"],y=e.disabled,x=void 0!==y&&y,v=e.size,C=void 0===v?Z:v,S=e.darkMode,j=void 0!==S&&S,N=e.state,M=void 0===N?"none":N,O=e.errorMessage,P=e.searchState,L=void 0===P?"unset":P,R=e.searchEmptyMessage,T=void 0===R?"No results found":R,q=e.searchErrorMessage,H=void 0===q?"Could not get results!":q,_=e.searchLoadingMessage,Y=void 0===_?"Loading results...":_,$=e.filteredOptions,J=e.onFilter,ee=e.clearable,ne=void 0===ee||ee,te=e.onClear,re=e.overflow,oe=void 0===re?"expand-y":re,ae=e.multiselect,ie=void 0!==ae&&ae,le=e.initialValue,se=e.onChange,ce=e.value,ue=e.chipTruncationLocation,de=e.chipCharacterLimit,pe=void 0===de?12:de,fe=e.className,be=e.usePortal,ge=void 0===be||be,he=e.portalClassName,ye=e.portalContainer,xe=e.scrollContainer,ve=e.popoverZIndex,me=A(e,Pr),ke=He(j),we=o.useDynamicRefs({prefix:"option"}),Ce=o.useDynamicRefs({prefix:"chip"}),Se=o.useIdAllocator({prefix:"combobox-input"}),je=o.useIdAllocator({prefix:"combobox-label"}),Ne=o.useIdAllocator({prefix:"combobox-menu"}),Me=n.useRef(null),Oe=n.useRef(null),Ee=n.useRef(null),ze=n.useRef(null),Ie=n.useRef(null),De=F(n.useState(!1),2),Ae=De[0],Pe=De[1],We=o.usePrevious(Ae),Ue=F(n.useState(null),2),Ge=Ue[0],Ve=Ue[1],Be=F(n.useState(null),2),Xe=Be[0],Ze=Be[1],_e=o.usePrevious(Xe),Ye=F(n.useState(""),2),$e=Ye[0],Je=Ye[1],Qe=o.usePrevious($e),en=F(n.useState(null),2),nn=en[0],tn=en[1],rn=!t.isNull(Xe)&&(t.isArray(Xe)&&Xe.length>0||t.isString(Xe)),on=ie&&t.isArray(Xe)&&Xe.length>0?void 0:g,an=function(){return Pe(!1)},ln=function(){return Pe(!0)},sn=n.useMemo((function(){return Te(d)}),[d]),cn=n.useCallback((function(e){return!ie||"string"!=typeof e&&"number"!=typeof e?!ie&&t.isArray(e)&&c.consoleOnce.error("Error in Combobox: multiselect is set to `false`, but recieved an Array value"):c.consoleOnce.error("Error in Combobox: multiselect is set to `true`, but recieved a ".concat(z(e),' value: "').concat(e,'"')),ie&&t.isArray(e)}),[ie]),un=n.useCallback((function(e){!x&&ze&&ze.current&&(ze.current.focus(),t.isUndefined(e)||ze.current.setSelectionRange(e,e))}),[x]),dn=n.useCallback((function(e){if(cn(Xe)){var n=t.clone(Xe);t.isNull(e)?n.length=0:Xe.includes(e)?n.splice(n.indexOf(e),1):(n.push(e),Je("")),Ze(n),null==se||se(n)}else{var r=e;Ze(r),null==se||se(r)}}),[cn,se,Xe]),pn=n.useCallback((function(e){return cn(Xe)?Xe.includes(e):e===Xe}),[cn,Xe]),fn=n.useCallback((function(e){var n,t,r,o,a=(t=sn,(n=e)?null!==(r=null===(o=t.find((function(e){return e.displayName===n})))||void 0===o?void 0:o.value)&&void 0!==r?r:n:"");return pn(a)}),[sn,pn]),bn=n.useCallback((function(e){var n="string"==typeof e?e:e.value;return $&&$.length>0?$.includes(n):!!fn($e)||("string"==typeof e?Re(n,sn):e.displayName).toLowerCase().includes($e.toLowerCase())}),[$,fn,$e,sn]),gn=n.useMemo((function(){return sn.filter(bn)}),[sn,bn]),hn=n.useCallback((function(e){return!!e&&!!sn.find((function(n){return n.value===e}))}),[sn]),yn=n.useCallback((function(e){return gn?gn.findIndex((function(n){return n.value===e})):-1}),[gn]),xn=n.useCallback((function(e){if(gn&&gn.length>=e){var n=gn[e];return n?n.value:void 0}}),[gn]),vn=n.useCallback((function(){return cn(Xe)?Xe.findIndex((function(e){var n,t;return null===(n=Ce(e))||void 0===n||null===(t=n.current)||void 0===t?void 0:t.contains(document.activeElement)})):-1}),[Ce,cn,Xe]),mn=F(n.useState(),2),kn=mn[0],wn=mn[1],Cn=n.useCallback((function(e){var n,t=null!==(n=null==gn?void 0:gn.length)&&void 0!==n?n:0,r=t-1>0?t-1:0,o=yn(Ge);switch(e&&Ae&&(tn(null),un()),e){case"next":var a=xn(o+1<t?o+1:0);Ve(null!=a?a:null);break;case"prev":var i=xn(o-1>=0?o-1:r);Ve(null!=i?i:null);break;case"last":var l=xn(r);Ve(null!=l?l:null);break;default:var s=xn(0);Ve(null!=s?s:null)}}),[Ge,yn,xn,Ae,un,null==gn?void 0:gn.length]),Sn=n.useCallback((function(e,n){if(cn(Xe))switch(e){case"next":var t=null!=n?n:vn(),r=t+1<Xe.length?t+1:Xe.length-1,o=Xe[r];tn(o);break;case"prev":var a=null!=n?n:vn(),i=a>0?a-1:a<0?Xe.length-1:0,l=Xe[i];tn(l);break;case"first":var s=Xe[0];tn(s);break;case"last":var c=Xe[Xe.length-1];tn(c);break;default:tn(null)}}),[vn,cn,Xe]),jn=n.useCallback((function(e,n){switch(e&&Ve(null),e){case"right":switch(kn){case W:var t,r,o;if((null===(t=ze.current)||void 0===t?void 0:t.selectionEnd)===(null===(r=ze.current)||void 0===r?void 0:r.value.length))null===(o=Oe.current)||void 0===o||o.focus();break;case G:case V:case K:if(kn===K||1===(null==Xe?void 0:Xe.length)){un(0),Sn(null),n.preventDefault();break}Sn("next")}break;case"left":switch(kn){case U:var a;n.preventDefault(),un(null==ze||null===(a=ze.current)||void 0===a?void 0:a.value.length);break;case W:case V:case K:if(cn(Xe)){var i;if(kn===W&&0!==(null===(i=ze.current)||void 0===i?void 0:i.selectionStart))break;Sn("prev")}}break;default:Sn(null)}}),[kn,cn,Xe,un,Sn]);n.useEffect((function(){$e!==Qe&&Cn("first")}),[$e,Ae,Qe,Cn]),n.useEffect((function(){if(Ge){var e=we(Ge);if(e&&e.current&&Ie.current){var n=e.current.offsetTop,t=Ie.current,r=t.scrollTop;(n>t.offsetHeight||n<r)&&(Ie.current.scrollTop=n)}}}),[Ge,we]);var Nn=n.useCallback((function(e){if(c.isComponentType(e,"ComboboxOption")){var n=Fe(e.props),t=n.value,r=n.displayName;if(bn(t)){var o=e.props,a=o.className,i=o.glyph,l=o.disabled,s=sn.findIndex((function(e){return e.value===t})),d=Ge===t,p=cn(Xe)?Xe.includes(t):Xe===t,f=we(t);return u.jsx(Ot,{value:t,displayName:r,isFocused:d,isSelected:p,disabled:l,setSelected:function(){Ve(t),dn(t),un(),t===Xe&&an()},glyph:i,className:a,index:s,ref:f})}}else if(c.isComponentType(e,"ComboboxGroup")){var b=m.default.Children.map(e.props.children,Nn);if(b&&(null==b?void 0:b.length)>0)return u.jsx(Ke,{label:e.props.label,className:e.props.className},m.default.Children.map(b,Nn))}}),[sn,we,Ge,cn,Xe,un,bn,dn]),Mn=n.useMemo((function(){return m.default.Children.map(d,Nn)}),[d,Nn]),On=n.useMemo((function(){if(cn(Xe))return Xe.filter(hn).map((function(e,n){var t=Re(e,sn),r=nn===e,o=Ce(e),a=n>=Xe.length-1;return u.jsx(Ir,{key:e,displayName:t,isFocused:r,onRemove:function(){a?(un(),Sn(null)):Sn("next",n),dn(e)},onFocus:function(){tn(e)},ref:o})}))}),[cn,Xe,hn,sn,nn,Ce,dn,un,Sn]),En=n.useMemo((function(){return u.jsx(m.default.Fragment,null,ne&&rn&&u.jsx(w.default,{"aria-label":"Clear selection","aria-disabled":x,disabled:x,ref:Oe,onClick:function(e){x||(dn(null),null==te||te(e),null==J||J(""),Ae||ln())},onFocus:Ln,className:l.cx(xr),darkMode:j},u.jsx(k.default,{glyph:"XWithCircle"})),"error"===M?u.jsx(k.default,{glyph:"Warning",color:j?s.palette.red.light1:s.palette.red.base,className:vr(C)}):u.jsx(k.default,{glyph:"CaretDown",className:vr(C)}))}),[ne,rn,x,M,j,C,dn,te,J,Ae]),zn=n.useMemo((function(){return sn.some((function(e){return e.hasGlyph}))}),[sn]),In=n.useCallback((function(){if(!cn(Xe)&&Xe===_e){var e=gn.find((function(e){return e.displayName===$e||e.value===$e}));if(e&&!ce)Ze(e.value);else{var n,t=null!==(n=Re(Xe,sn))&&void 0!==n?n:"";Je(t)}}}),[sn,$e,cn,_e,Xe,ce,gn]),Dn=n.useCallback((function(){if(rn){if(cn(Xe))Hn();else if(!cn(Xe)){var e,n=null!==(e=Re(Xe,sn))&&void 0!==e?e:"";Je(n),an()}}else Je("")}),[rn,sn,cn,Xe]);n.useEffect((function(){if(le)if(t.isArray(le)){var e,n=null!==(e=le.filter((function(e){return hn(e)})))&&void 0!==e?e:[];Ze(n)}else hn(le)&&Ze(le);else Ze(function(e){return e?[]:null}(ie))}),[]),n.useEffect((function(){if(!t.isUndefined(ce)&&ce!==Qe)if(t.isNull(ce))Ze(null);else if(cn(ce)){var e=ce.filter(hn);Ze(e)}else Ze(hn(ce)?ce:null)}),[cn,hn,Qe,ce]),n.useEffect((function(){t.isEqual(Xe,_e)||Dn()}),[Dn,_e,Xe]),n.useEffect((function(){!Ae&&We&&In()}),[Ae,We,In]);var An=F(n.useState(0),2),Pn=An[0],Fn=An[1];n.useEffect((function(){var e,n;Fn(null!==(e=null===(n=Me.current)||void 0===n?void 0:n.clientWidth)&&void 0!==e?e:0)}),[Me,Ae,Ge,Xe]);var Ln=function(){Ve(null)};o.useEventListener("mousedown",(function(e){qn(e)||(e.preventDefault(),e.stopPropagation())}),{enabled:Ae}),o.useEventListener("click",(function(e){qn(e)||(e.stopPropagation(),an())}),{options:{capture:!0},enabled:Ae});var Rn,Tn=function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?E(Object(t),!0).forEach((function(n){I(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):E(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({popoverZIndex:ve},ge?{usePortal:ge,portalClassName:he,portalContainer:ye,scrollContainer:xe}:{usePortal:ge});return u.jsx(qe.Provider,{value:{multiselect:ie,darkMode:j,size:C,withIcons:zn,disabled:x,isOpen:Ae,state:M,searchState:L,chipTruncationLocation:ue,chipCharacterLimit:pe,inputValue:$e}},u.jsx("div",D({className:l.cx(or(C,oe),fe)},me),u.jsx("div",{className:wr},p&&u.jsx(r.Label,{id:je,htmlFor:Se,darkMode:j},p),f&&u.jsx(r.Description,{darkMode:j},f)),u.jsx("div",{ref:Me,role:"combobox","aria-expanded":Ae,"aria-controls":Ne,"aria-owns":Ne,tabIndex:-1,onMouseDown:function(e){x&&e.preventDefault()},onClick:function(e){if(e.target!==ze.current){var n=0;if(ze.current)n=e.nativeEvent.offsetX>ze.current.offsetLeft+ze.current.clientWidth?$e.length:0;un(n)}},onFocus:function(e){Hn(),ln(),wn(function(e){var n,t,r,o;if(!e)return;if(null!==(n=ze.current)&&void 0!==n&&n.contains(e))return W;if(null!==(t=Oe.current)&&void 0!==t&&t.contains(e))return U;var a=cn(Xe)?Xe.findIndex((function(n){var t,r;return null===(t=Ce(n))||void 0===t||null===(r=t.current)||void 0===r?void 0:r.contains(e)})):-1;if(cn(Xe)){if(0===a)return G;if(a===Xe.length-1)return K;if(a>0)return V}if(null!==(r=Ie.current)&&void 0!==r&&r.contains(e))return X;if(null!==(o=Me.current)&&void 0!==o&&o.contains(e))return B}(e.target))},onKeyDown:function(e){var n,r,o=null===(n=Ie.current)||void 0===n?void 0:n.contains(document.activeElement);if((null===(r=Me.current)||void 0===r?void 0:r.contains(document.activeElement))||o){if(e.ctrlKey||e.shiftKey||e.altKey)return;switch(e.keyCode){case c.keyMap.Tab:switch(kn){case"Input":rn||(an(),Cn("first"),Sn(null));break;case"LastChip":Sn(null)}break;case c.keyMap.Escape:an(),Cn("first");break;case c.keyMap.Enter:!Ae||kn!==W||t.isNull(Ge)||function(e){if("string"==typeof e){var n=Le(e,sn);return!(null==n||!n.isDisabled)}return!!e.isDisabled}(Ge)?kn===U&&(dn(null),un()):dn(Ge);break;case c.keyMap.Backspace:var a;if(cn(Xe))"Input"===kn&&0===(null===(a=ze.current)||void 0===a?void 0:a.selectionStart)&&Sn("last");ln();break;case c.keyMap.ArrowDown:Ae?(e.preventDefault(),Cn("next")):ln();break;case c.keyMap.ArrowUp:Ae?(e.preventDefault(),Cn("prev")):ln();break;case c.keyMap.ArrowRight:jn("right",e);break;case c.keyMap.ArrowLeft:jn("left",e);break;default:Ae||ln()}}},onTransitionEnd:function(){var e,n;Fn(null!==(e=null===(n=Me.current)||void 0===n?void 0:n.clientWidth)&&void 0!==e?e:0)},className:l.cx(ar,ir[ke],lr(C),(a={},I(a,sr[ke],x),I(a,cr[ke],M===Q),I(a,ur[ke],(Rn=W,Rn===kn)),a))},u.jsx("div",{ref:Ee,className:dr({size:C,overflow:oe})},On,u.jsx("input",{"aria-label":null!=h?h:p,"aria-autocomplete":"list","aria-controls":Ne,"aria-labelledby":je,ref:ze,id:Se,className:l.cx(pr,br[C],fr[ke],gr(Ae,oe),(i={},I(i,hr(C,$e),cn(Xe)),I(i,yr(Xe),cn(Xe)),i)),placeholder:on,disabled:null!=x?x:void 0,onChange:function(e){var n=e.target.value;Je(n),null==J||J(n)},value:$e,autoComplete:"off"})),En),"error"===M&&O&&u.jsx("div",{className:l.cx(mr[ke],kr[C])},O),u.jsx(Ar,D({id:Ne,labelId:je,refEl:Me,ref:Ie,menuWidth:Pn,searchLoadingMessage:Y,searchErrorMessage:H,searchEmptyMessage:T},Tn),Mn)));function qn(e){var n,t,r=e.target;return(null===(n=Ie.current)||void 0===n?void 0:n.contains(r))||(null===(t=Me.current)||void 0===t?void 0:t.contains(r))||!1}function Hn(){Ee&&Ee.current&&(Ee.current.scrollLeft=Ee.current.scrollWidth)}},e.ComboboxGroup=Ve,e.ComboboxOption=Et,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("lodash/clone"),require("lodash/isArray"),require("lodash/isEqual"),require("lodash/isNull"),require("lodash/isString"),require("lodash/isUndefined"),require("react"),require("@leafygreen-ui/typography"),require("@leafygreen-ui/hooks"),require("@leafygreen-ui/icon"),require("@leafygreen-ui/icon-button"),require("@leafygreen-ui/emotion"),require("@leafygreen-ui/palette"),require("@leafygreen-ui/lib"),require("lodash/escapeRegExp"),require("@emotion/react"),require("lodash/kebabCase"),require("@leafygreen-ui/checkbox"),require("@leafygreen-ui/tokens"),require("polished"),require("@leafygreen-ui/inline-definition"),require("@leafygreen-ui/popover")):"function"==typeof define&&define.amd?define(["exports","lodash/clone","lodash/isArray","lodash/isEqual","lodash/isNull","lodash/isString","lodash/isUndefined","react","@leafygreen-ui/typography","@leafygreen-ui/hooks","@leafygreen-ui/icon","@leafygreen-ui/icon-button","@leafygreen-ui/emotion","@leafygreen-ui/palette","@leafygreen-ui/lib","lodash/escapeRegExp","@emotion/react","lodash/kebabCase","@leafygreen-ui/checkbox","@leafygreen-ui/tokens","polished","@leafygreen-ui/inline-definition","@leafygreen-ui/popover"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["@leafygreen-ui/combobox"]={},e.clone,e.isArray,e.isEqual,e.isNull,e.isString,e.isUndefined,e.React,e["@leafygreen-ui/typography"],e["@leafygreen-ui/hooks"],e["@leafygreen-ui/icon"],e["@leafygreen-ui/icon-button"],e["@leafygreen-ui/emotion"],e["@leafygreen-ui/palette"],e["@leafygreen-ui/lib"],e.escapeRegExp,e.react,e.kebabCase,e["@leafygreen-ui/checkbox"],e["@leafygreen-ui/tokens"],e.polished,e["@leafygreen-ui/inline-definition"],e["@leafygreen-ui/popover"])}(this,(function(e,n,t,r,o,a,l,i,s,c,u,d,p,f,b,g,h,y,x,v,m,k,w){"use strict";function C(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var S=C(n),j=C(t),N=C(r),M=C(o),O=C(a),E=C(l),z=C(i),I=C(u),D=C(d),A=C(g),R=C(y),q=C(x),P=C(k),F=C(w);function L(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function H(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function W(){return W=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},W.apply(this,arguments)}function G(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function U(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}function K(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==t)return;var r,o,a=[],l=!0,i=!1;try{for(t=t.call(e);!(l=(r=t.next()).done)&&(a.push(r.value),!n||a.length!==n);l=!0);}catch(e){i=!0,o=e}finally{try{l||null==t.return||t.return()}finally{if(i)throw o}}return a}(e,n)||B(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function V(e){return function(e){if(Array.isArray(e))return X(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||B(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(e,n){if(e){if("string"==typeof e)return X(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?X(e,n):void 0}}function X(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var Z="dark",_="light",Y="Input",$="ClearButton",J="FirstChip",Q="LastChip",ee="MiddleChip",ne="Combobox",te="Menu",re="default",oe="large",ae="expand-y",le="scroll-x",ie="error",se="none";var ce,ue,de,pe,fe,be,ge,he,ye,xe,ve,me,ke,we,Ce,Se,je,Ne,Me,Oe,Ee,ze,Ie,De,Ae,Re,qe,Pe,Fe,Le,Te,He,We,Ge=function(e,n,t){if(n&&t){var r=A.default(n),o=new RegExp(r,"gi"),a=e.matchAll(o);if(a){for(var l=e.split(""),i=0,s=Array.from(a);i<s.length;i++){var c,u=s[i],d=null!==(c=u.index)&&void 0!==c?c:-1,p=u[0],f=p.length,b=d+p+f,g=new Array(f).fill("");g[0]=z.default.createElement(t,{key:b},p),l.splice.apply(l,[d,f].concat(V(g)))}return h.jsx(z.default.Fragment,null,l)}return h.jsx(z.default.Fragment,null,e)}return h.jsx(z.default.Fragment,null,e)},Ue=function(e){var n,t=e.value,r=e.displayName;return{value:null!=t?t:R.default(r),displayName:null!==(n=null!=r?r:t)&&void 0!==n?n:""}},Ke=function(e,n){if(e)return n.find((function(n){return n.value===e}))},Ve=function(e,n){var t,r;return e?null!==(t=null===(r=Ke(e,n))||void 0===r?void 0:r.displayName)&&void 0!==t?t:e:""},Be=function e(n){return z.default.Children.toArray(n).reduce((function(n,t){if(b.isComponentType(t,"ComboboxOption")){var r=Ue(t.props),o=r.value,a=r.displayName,l=t.props,i=l.glyph,s=l.disabled;return[].concat(V(n),[{value:o,displayName:a,isDisabled:!!s,hasGlyph:!!i}])}if(b.isComponentType(t,"ComboboxGroup")){var c=t.props.children;if(c)return[].concat(V(n),V(e(c)))}}),[])},Xe=i.createContext({multiselect:!1,darkMode:!1,size:re,withIcons:!1,disabled:!1,isOpen:!1,state:se,searchState:"unset"}),Ze=function(e){return e?Z:_},_e=(H(de={},_,p.css(ce||(ce=U(["\n padding-top: 8px;\n "])))),H(de,Z,p.css(ue||(ue=U(["\n padding-top: 8px;\n "])))),de),Ye=p.css(pe||(pe=U(["\n cursor: default;\n width: 100%;\n padding: 0 12px 2px;\n outline: none;\n overflow-wrap: anywhere;\n font-size: 12px;\n line-height: 16px;\n font-weight: bold;\n text-transform: uppercase;\n letter-spacing: 0.4px;\n"]))),$e=(H(ge={},_,p.css(fe||(fe=U(["\n color: ",";\n "])),f.palette.gray.dark1)),H(ge,Z,p.css(be||(be=U(["\n color: ",";\n "])),f.palette.gray.light1)),ge);function Je(e){var n=e.label,t=e.className,r=e.children,o=i.useContext(Xe).darkMode,a=Ze(o),l=c.useIdAllocator({prefix:"combobox-group"});return z.default.Children.count(r)>0?h.jsx("div",{className:p.cx(_e[a],t)},h.jsx("div",{className:p.cx(Ye,$e[a]),id:l},n),h.jsx("div",{role:"group","aria-labelledby":l},r)):h.jsx(z.default.Fragment,null)}function Qe(e){throw Error("`ComboboxGroup` must be a child of a `Combobox` instance")}Qe.displayName="ComboboxGroup";var en=(H(he={},re,{x:12,y:8}),H(he,oe,{x:12,y:8}),he),nn=(H(ye={},re,v.typeScales.body1.lineHeight+2*en[re].y),H(ye,oe,v.typeScales.body2.lineHeight+2*en[oe].y),ye),tn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:384;return p.css(xe||(xe=U(["\n width: ","px;\n overflow: hidden;\n border-radius: 12px;\n border: 1px solid;\n"])),e)},rn=(H(ke={},_,p.css(ve||(ve=U(["\n box-shadow: 0px 4px 7px ",";\n border-color: ",";\n "])),m.transparentize(.85,f.palette.black),f.palette.gray.light2)),H(ke,Z,p.css(me||(me=U(["\n box-shadow: 0px 4px 7px ",";\n border-color: ",";\n "])),m.transparentize(.85,f.palette.black),f.palette.gray.dark3)),ke),on=p.css(we||(we=U(["\n position: relative;\n width: 100%;\n margin: 0;\n padding: ","px 0;\n font-family: ",";\n border-radius: inherit;\n overflow-y: auto;\n scroll-behavior: smooth;\n"])),v.spacing[2],v.fontFamilies.default),an=(H(je={},_,p.css(Ce||(Ce=U(["\n color: ",";\n background-color: ",";\n "])),f.palette.black,f.palette.white)),H(je,Z,p.css(Se||(Se=U(["\n color: ",";\n background-color: ",";\n "])),f.palette.gray.light1,f.palette.gray.dark3)),je);H(Oe={},re,p.css(Ne||(Ne=U(["\n min-height: ","px;\n "])),nn[re])),H(Oe,oe,p.css(Me||(Me=U(["\n min-height: ","px;\n "])),nn[oe]));var ln=p.css(Ee||(Ee=U(["\n position: relative;\n margin: 0;\n padding: 0;\n"]))),sn=p.css(ze||(ze=U(["\n font-family: inherit;\n display: inline-flex;\n align-items: center;\n gap: 8px;\n"]))),cn=(H(Ae={},_,p.css(Ie||(Ie=U(["\n color: ",";\n "])),f.palette.gray.dark3)),H(Ae,Z,p.css(De||(De=U(["\n color: ",";\n "])),f.palette.gray.light3)),Ae),un=(H(Pe={},re,p.css(Re||(Re=U(["\n font-size: ","px;\n line-height: ","px;\n padding: ","px\n ","px;\n "])),v.typeScales.body1.fontSize,v.typeScales.body1.lineHeight,en[re].y,en[re].x)),H(Pe,oe,p.css(qe||(qe=U(["\n font-size: ","px;\n line-height: ","px;\n padding: ","px\n ","px;\n "])),v.typeScales.body2.fontSize,v.typeScales.body2.lineHeight,en[oe].y,en[oe].x)),Pe);H(Te={},re,p.css(Fe||(Fe=U(["\n height: ","px;\n width: ","px;\n "])),v.typeScales.body1.fontSize,v.typeScales.body1.fontSize)),H(Te,oe,p.css(Le||(Le=U(["\n height: ","px;\n width: ","px;\n "])),v.typeScales.body2.fontSize,v.typeScales.body2.fontSize));var dn,pn,fn,bn,gn,hn,yn,xn,vn,mn,kn,wn,Cn,Sn,jn,Nn,Mn,On,En,zn,In,Dn,An,Rn,qn,Pn,Fn,Ln,Tn,Hn,Wn,Gn,Un,Kn,Vn,Bn,Xn,Zn,_n,Yn,$n,Jn,Qn,et,nt,tt,rt,ot,at,lt,it,st,ct,ut,dt,pt,ft,bt,gt,ht,yt,xt,vt,mt=p.keyframes(He||(He=U(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"]))),kt=p.css(We||(We=U(["\n animation: "," 1.5s linear infinite;\n"])),mt),wt=p.css(dn||(dn=U(["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: space-between;\n list-style: none;\n color: inherit;\n cursor: pointer;\n overflow: hidden;\n font-family: ",";\n\n // Left wedge\n &:before {\n content: '';\n position: absolute;\n left: 0;\n width: 4px;\n height: calc(100% - 14px);\n background-color: rgba(255, 255, 255, 0);\n border-radius: 0 6px 6px 0;\n transform: scale3d(0, 0.3, 0);\n transition: 200ms ease-in-out;\n transition-property: transform, background-color;\n }\n"])),v.fontFamilies.default),Ct=(H(bn={},_,p.css(pn||(pn=U(["\n &:hover {\n outline: none;\n background-color: ",";\n }\n "])),f.palette.gray.light2)),H(bn,Z,p.css(fn||(fn=U(["\n &:hover {\n outline: none;\n background-color: ",";\n }\n "])),f.palette.gray.dark4)),bn),St=(H(yn={},re,p.css(gn||(gn=U(["\n font-size: ","px;\n line-height: ","px;\n min-height: ","px;\n padding: ","px\n ","px;\n gap: ","px;\n\n &:before {\n max-height: ","px;\n }\n "])),v.typeScales.body1.fontSize,v.typeScales.body1.lineHeight,nn[re],en[re].y,en[re].x,v.spacing[1],nn[re])),H(yn,oe,p.css(hn||(hn=U(["\n font-size: ","px;\n line-height: ","px;\n min-height: ","px;\n padding: ","px\n ","px;\n gap: ","px;\n\n &:before {\n max-height: ","px;\n }\n "])),v.typeScales.body2.fontSize,v.typeScales.body2.lineHeight,nn[oe],en[oe].y,en[oe].x,v.spacing[2],nn[oe])),yn),jt=p.css(xn||(xn=U(["\n outline: none;\n\n &:before {\n transform: scaleY(1);\n }\n"]))),Nt=(H(kn={},_,p.css(vn||(vn=U(["\n ",";\n background-color: ",";\n\n &:before {\n background-color: ",";\n }\n "])),jt,f.palette.blue.light3,f.palette.blue.base)),H(kn,Z,p.css(mn||(mn=U(["\n ",";\n background-color: ",";\n\n &:before {\n background-color: ",";\n }\n "])),jt,f.palette.blue.dark3,f.palette.blue.light1)),kn),Mt=p.css(wn||(wn=U(["\n cursor: not-allowed;\n\n &:hover {\n background-color: inherit;\n }\n\n &:before {\n content: unset;\n }\n"]))),Ot=(H(jn={},_,p.css(Cn||(Cn=U(["\n ",";\n color: ",";\n "])),Mt,f.palette.gray.light1)),H(jn,Z,p.css(Sn||(Sn=U(["\n ",";\n color: ",";\n "])),Mt,f.palette.gray.dark1)),jn),Et=(H(On={},re,p.css(Nn||(Nn=U(["\n min-width: ","px;\n "])),v.spacing[3])),H(On,oe,p.css(Mn||(Mn=U(["\n min-width: ","px;\n "])),v.spacing[4])),On),zt=p.css(En||(En=U(["\n display: inline-flex;\n gap: 8px;\n justify-content: start;\n align-items: inherit;\n overflow-wrap: anywhere;\n"]))),It=p.css(zn||(zn=U(["\n pointer-events: none;\n"]))),Dt=function(e){return p.css(In||(In=U(["\n font-weight: ",";\n"])),e?"bold":"normal")},At=z.default.forwardRef((function(e,n){var t,r=e.displayName,o=e.glyph,a=e.isSelected,l=e.isFocused,s=e.disabled,d=e.setSelected,g=e.className,y=i.useContext(Xe),x=y.multiselect,v=y.darkMode,m=y.withIcons,k=y.inputValue,w=y.size,C=Ze(v),S=c.useIdAllocator({prefix:"combobox-option-text"}),j=c.useForwardedRef(n,null),N=i.useCallback((function(e){e.stopPropagation(),s||e.target!==j.current&&"INPUT"!==e.target.tagName||d()}),[s,j,d]),M=i.useMemo((function(){if(o){if(u.isComponentGlyph(o)||b.isComponentType(o,"Icon"))return o;console.error("`ComboboxOption` instance did not render icon because it is not a known glyph element.",o)}}),[o]),O=i.useMemo((function(){if(x){var e=h.jsx(q.default,{"aria-labelledby":S,checked:a,tabIndex:-1,disabled:s,darkMode:v,className:p.css(Dn||(Dn=U(["\n // TODO: Remove when this is resolved:\n // https://jira.mongodb.org/browse/PD-2171\n & > label > div {\n margin-top: 0;\n }\n "])))});return h.jsx(z.default.Fragment,null,h.jsx("span",{className:p.cx(zt,It)},m?M:e,h.jsx("span",{id:S,className:Dt(a)},Ge(r,k,"strong"))),m&&e)}return h.jsx(z.default.Fragment,null,h.jsx("span",{className:p.cx(zt,It)},M,h.jsx("span",{className:Dt(a)},Ge(r,k,"strong"))),a&&h.jsx(I.default,{glyph:"Checkmark",className:Et[w],color:v?f.palette.blue.light1:f.palette.blue.base}))}),[x,M,a,r,k,w,v,S,s,m]);return h.jsx("li",{ref:j,role:"option","aria-selected":l,"aria-label":r,tabIndex:-1,className:p.cx(wt,St[w],Ct[C],(t={},H(t,Nt[C],l),H(t,Ot[C],s),t),g),onClick:N,onKeyDown:N},O)}));function Rt(e){throw Error("`ComboboxOption` must be a child of a `Combobox` instance")}At.displayName="ComboboxOption",Rt.displayName="ComboboxOption";var qt,Pt,Ft,Lt,Tt,Ht,Wt,Gt,Ut,Kt,Vt,Bt,Xt,Zt,_t,Yt,$t,Jt,Qt,er,nr,tr,rr,or,ar=(H(An={},re,v.typeScales.body1.fontSize),H(An,oe,v.typeScales.body2.fontSize),An),lr=(H(Rn={},re,2),H(Rn,oe,4),Rn),ir=(H(qn={},re,v.typeScales.body1.lineHeight+2*lr[re]),H(qn,oe,v.typeScales.body2.lineHeight+2*lr[oe]),qn),sr=(H(Pn={},re,{y:(36-ir[re]-2)/2,x:v.spacing[2]-1}),H(Pn,oe,{y:(48-ir[oe]-2)/2,x:v.spacing[2]-1}),Pn),cr=v.spacing[3],ur=(H(Fn={},re,ar[re]+2*sr[re].x+cr+2),H(Fn,oe,ar[oe]+2*sr[oe].x+cr+2),Fn),dr=b.createUniqueClassName("combobox-chip"),pr=function(e){return p.css(Ln||(Ln=U(["\n font-family: ",";\n width: 100%;\n min-width: ","px;\n "])),v.fontFamilies.default,ur[e])},fr=p.css(Tn||(Tn=U(["\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n cursor: text;\n transition: 150ms ease-in-out;\n transition-property: background-color, box-shadow, border-color;\n border: 1px solid;\n width: inherit;\n border-radius: 6px;\n"]))),br=(H(Gn={},_,p.css(Hn||(Hn=U(["\n color: ",";\n background-color: ",";\n border-color: ",";\n\n &:hover {\n box-shadow: ",";\n }\n "])),f.palette.gray.dark3,f.palette.white,f.palette.gray.base,v.hoverRing[_].gray)),H(Gn,Z,p.css(Wn||(Wn=U(["\n color: ",";\n background-color: ",";\n border-color: ",";\n\n &:hover {\n box-shadow: ",";\n }\n "])),f.palette.gray.light2,f.palette.gray.dark4,f.palette.gray.base,v.hoverRing[Z].gray)),Gn),gr=function(e){return p.css(Un||(Un=U(["\n padding: ","px ","px;\n"])),sr[e].y,sr[e].x)},hr=(H(Bn={},_,p.css(Kn||(Kn=U(["\n cursor: not-allowed;\n color: ",";\n background-color: ",";\n border-color: ",";\n "])),f.palette.gray.dark1,f.palette.gray.light2,f.palette.gray.light1)),H(Bn,Z,p.css(Vn||(Vn=U(["\n cursor: not-allowed;\n color: ",";\n background-color: ",";\n border-color: ",";\n "])),f.palette.gray.dark1,f.palette.gray.dark3,f.palette.gray.dark2)),Bn),yr=(H(_n={},_,p.css(Xn||(Xn=U(["\n border-color: ",";\n "])),f.palette.red.base)),H(_n,Z,p.css(Zn||(Zn=U(["\n border-color: ",";\n "])),f.palette.red.light1)),_n),xr=(H(Jn={},_,p.css(Yn||(Yn=U(["\n &:focus-within {\n border-color: transparent;\n background-color: ",";\n box-shadow: ",";\n }\n "])),f.palette.white,v.focusRing[_].input)),H(Jn,Z,p.css($n||($n=U(["\n &:focus-within {\n border-color: transparent;\n background-color: ",";\n box-shadow: ",";\n }\n "])),f.palette.gray.dark4,v.focusRing[Z].input)),Jn),vr=function(e){var n=e.overflow,t=e.size,r=p.css(Qn||(Qn=U(["\n flex-grow: 1;\n width: inherit;\n "])));switch(n){case le:return p.css(et||(et=U(["\n ","\n display: block;\n height: ","px;\n white-space: nowrap;\n overflow-x: scroll;\n scroll-behavior: smooth;\n scrollbar-width: none;\n\n &::-webkit-scrollbar {\n display: none;\n }\n\n & > ."," {\n margin-inline: 2px;\n\n &:first-child {\n margin-inline-start: 0;\n }\n\n &:last-child {\n margin-inline-end: 0;\n }\n }\n "])),r,ir[t],dr);case ae:return p.css(nt||(nt=U(["\n ","\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n overflow-x: visible;\n min-height: ","px;\n "])),r,ir[t])}},mr=p.css(tt||(tt=U(["\n font-family: ",";\n width: 100%;\n border: none;\n cursor: inherit;\n background-color: inherit;\n color: inherit;\n box-sizing: content-box;\n padding: 0;\n margin: 0;\n text-overflow: ellipsis;\n\n &:placeholder-shown {\n min-width: 100%;\n }\n &:focus {\n outline: none;\n }\n"])),v.fontFamilies.default),kr=(H(at={},_,p.css(rt||(rt=U(["\n &::placeholder {\n color: ",";\n }\n "])),f.palette.gray.dark1)),H(at,Z,p.css(ot||(ot=U(["\n &::placeholder {\n color: ",";\n }\n "])),f.palette.gray.light1)),at),wr=(H(st={},re,p.css(lt||(lt=U(["\n height: ","px;\n font-size: ","px;\n line-height: ","px;\n min-width: ","px;\n // Only add padding if there are chips\n &:not(:first-child) {\n padding-left: 4px;\n }\n "])),ir[re],v.typeScales.body1.fontSize,v.typeScales.body1.lineHeight,ar[re])),H(st,oe,p.css(it||(it=U(["\n height: ","px;\n font-size: ","px;\n line-height: ","px;\n min-width: ","px;\n &:not(:first-child) {\n padding-left: 6px;\n }\n "])),ir[oe],v.typeScales.body2.fontSize,v.typeScales.body2.lineHeight,ar[oe])),st),Cr=function(e){return p.css(ct||(ct=U(["\n /*\n * Immediate transition in, slow transition out. \n * '-in' transition is handled by `scroll-behavior` \n */\n transition: width ease-in-out ",";\n"],["\n /*\n * Immediate transition in, slow transition out. \n * '-in' transition is handled by \\`scroll-behavior\\` \n */\n transition: width ease-in-out ",";\n"])),e?"0s":"100ms")},Sr=function(e,n){var t,r=null!==(t=null==n?void 0:n.length)&&void 0!==t?t:0;return p.css(ut||(ut=U(["\n max-width: 100%;\n width: ","px;\n // TODO: This doesn't quite work. Fix this\n max-width: calc(100% - ","px);\n "])),r*ar[e],2*cr)},jr=p.css(dt||(dt=U(["\n // Add a negative margin so the button takes up the same space as the regular icons\n margin-block: calc(","px - 100%);\n"])),cr/2),Nr=function(e){return p.css(pt||(pt=U(["\n height: ","px;\n width: ","px;\n margin-inline-end: calc(","px / 2);\n"])),cr,cr,sr[e].x)},Mr=(H(gt={},_,p.css(ft||(ft=U(["\n color: ",";\n "])),f.palette.red.base)),H(gt,Z,p.css(bt||(bt=U(["\n color: ",";\n "])),f.palette.red.light1)),gt),Or=(H(xt={},re,p.css(ht||(ht=U(["\n font-size: ","px;\n line-height: ","px;\n padding-top: ","px;\n "])),v.typeScales.body1.fontSize,v.typeScales.body1.lineHeight,sr[re].y)),H(xt,oe,p.css(yt||(yt=U(["\n font-size: ","px;\n line-height: ","px;\n padding-top: ","px;\n "])),v.typeScales.body2.fontSize,v.typeScales.body2.lineHeight,sr[oe].y)),xt),Er=p.css(vt||(vt=U(["\n margin-bottom: 2px;\n"]))),zr=p.css(qt||(qt=U(["\n display: inline-flex;\n align-items: center;\n overflow: hidden;\n white-space: nowrap;\n box-sizing: border-box;\n"]))),Ir=(H(Lt={},re,p.css(Pt||(Pt=U(["\n font-size: ","px;\n line-height: ","px;\n border-radius: 4px;\n "])),v.typeScales.body1.fontSize,v.typeScales.body1.lineHeight)),H(Lt,oe,p.css(Ft||(Ft=U(["\n font-size: ","px;\n line-height: ","px;\n border-radius: 4px;\n "])),v.typeScales.body2.fontSize,v.typeScales.body2.lineHeight)),Lt),Dr=(H(Wt={},_,p.css(Tt||(Tt=U(["\n color: ",";\n background-color: ",";\n\n // TODO: - refine these styles with Design\n &:focus-within {\n background-color: ",";\n }\n "])),f.palette.black,f.palette.gray.light2,f.palette.blue.light2)),H(Wt,Z,p.css(Ht||(Ht=U(["\n color: ",";\n background-color: ",";\n\n &:focus-within {\n background-color: ",";\n }\n "])),f.palette.gray.light2,f.palette.gray.dark2,f.palette.blue.dark2)),Wt),Ar=(H(Kt={},_,p.css(Gt||(Gt=U(["\n cursor: not-allowed;\n color: ",";\n background-color: ",";\n "])),f.palette.gray.base,f.palette.gray.light3)),H(Kt,Z,p.css(Ut||(Ut=U(["\n cursor: not-allowed;\n color: ",";\n background-color: ",";\n box-shadow: inset 0 0 1px 1px ","; ;\n "])),f.palette.gray.dark2,f.palette.gray.dark4,f.palette.gray.dark2)),Kt),Rr=(H(Xt={},re,p.css(Vt||(Vt=U(["\n padding-inline: 6px;\n padding-block: ","px;\n "])),lr[re])),H(Xt,oe,p.css(Bt||(Bt=U(["\n padding-inline: 10px;\n padding-block: ","px;\n "])),lr[oe])),Xt),qr=p.css(Zt||(Zt=U(["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n outline: none;\n border: none;\n background-color: transparent;\n cursor: pointer;\n transition: background-color 100ms ease-in-out;\n"]))),Pr=(H($t={},re,p.css(_t||(_t=U(["\n height: ","px;\n "])),ir[re])),H($t,oe,p.css(Yt||(Yt=U(["\n height: ","px;\n "])),ir[oe])),$t),Fr=(H(er={},_,p.css(Jt||(Jt=U(["\n color: ",";\n\n &:hover {\n color: ",";\n background-color: ",";\n }\n "])),f.palette.gray.dark2,f.palette.black,f.palette.gray.light1)),H(er,Z,p.css(Qt||(Qt=U(["\n color: ",";\n\n &:hover {\n color: ",";\n background-color: ",";\n }\n "])),f.palette.gray.light1,f.palette.gray.light3,f.palette.gray.dark1)),er),Lr=(H(rr={},_,p.css(nr||(nr=U(["\n cursor: not-allowed;\n color: ",";\n &:hover {\n color: inherit;\n background-color: unset;\n }\n "])),f.palette.gray.dark2)),H(rr,Z,p.css(tr||(tr=U(["\n cursor: not-allowed;\n color: ",";\n &:hover {\n color: inherit;\n background-color: unset;\n }\n "])),f.palette.gray.dark2)),rr),Tr=z.default.forwardRef((function(e,n){var t=e.displayName,r=e.isFocused,o=e.onRemove,a=e.onFocus,l=i.useContext(Xe),s=l.darkMode,c=l.size,u=l.disabled,d=l.chipTruncationLocation,f=void 0===d?"end":d,g=l.chipCharacterLimit,y=void 0===g?12:g,x=Ze(s),v=!!y&&!!f&&"none"!==f&&t.length>y,m=i.useRef(null),k=i.useMemo((function(){if(v){var e=y-3;switch(f){case"start":return"…"+t.substring(t.length-e).trim();case"middle":return t.substring(0,e/2).trim()+"…"+t.substring(t.length-e/2).trim();case"end":return t.substring(0,e).trim()+"…";default:return t}}return!1}),[y,f,t,v]);i.useEffect((function(){var e;r&&!u&&(null==m||null===(e=m.current)||void 0===e||e.focus())}),[u,n,r]);return h.jsx("span",{role:"option","aria-selected":r,"data-testid":"lg-combobox-chip",ref:n,className:p.cx(dr,zr,Dr[x],Ir[c],H({},Ar[x],u)),onClick:function(e){var n;null!==(n=m.current)&&void 0!==n&&n.contains(e.target)||a()},onKeyDown:function(e){u||e.keyCode!==b.keyMap.Delete&&e.keyCode!==b.keyMap.Backspace&&e.keyCode!==b.keyMap.Enter&&e.keyCode!==b.keyMap.Space||o()},tabIndex:-1},h.jsx("span",{className:p.cx(Rr[c])},k?h.jsx(P.default,{darkMode:s,definition:t,align:"bottom"},k):t),h.jsx("button",{"aria-label":"Deselect ".concat(t),"aria-disabled":u,disabled:u,ref:m,className:p.cx(qr,Fr[x],Pr[c],H({},Lr[x],u)),onClick:function(){u||o()}},h.jsx(I.default,{glyph:"X"})))}));Tr.displayName="Chip";var Hr=["children","id","refEl","labelId","menuWidth","searchLoadingMessage","searchErrorMessage","searchEmptyMessage"],Wr=z.default.forwardRef((function(e,n){var t=e.children,r=e.id,o=e.refEl,a=e.labelId,l=e.menuWidth,s=e.searchLoadingMessage,u=e.searchErrorMessage,d=e.searchEmptyMessage,b=G(e,Hr),g=i.useContext(Xe),y=g.disabled,x=g.darkMode,v=g.size,m=g.isOpen,k=g.searchState,w=c.useForwardedRef(n,null),C=Ze(x),S=c.useAvailableSpace(o),j=E.default(S)?"unset":"".concat(Math.min(S,256),"px"),N=i.useMemo((function(){var e=p.cx(sn,cn[C],un[v]);switch(k){case"loading":return h.jsx("span",{className:e},h.jsx(I.default,{glyph:"Refresh",color:x?f.palette.blue.light1:f.palette.blue.base,className:kt}),s);case"error":return h.jsx("span",{className:e},h.jsx(I.default,{glyph:"Warning",color:x?f.palette.red.light1:f.palette.red.base}),u);default:return t&&"object"===T(t)&&"length"in t&&t.length>0?h.jsx("ul",{className:ln},t):h.jsx("span",{className:e},d)}}),[C,v,k,x,s,u,t,d]);return h.jsx(F.default,W({active:m&&!y,spacing:4,align:"bottom",justify:"middle",refEl:o,adjustOnMutation:!0,className:p.cx(tn(l),rn[C])},b),h.jsx("div",{ref:w,id:r,role:"listbox","aria-labelledby":a,"aria-expanded":m,className:p.cx(on,an[C],p.css(or||(or=U(["\n max-height: ",";\n "])),j)),onMouseDownCapture:function(e){return e.preventDefault()}},N))}));Wr.displayName="ComboboxMenu";var Gr=["children","label","description","placeholder","aria-label","disabled","size","darkMode","state","errorMessage","searchState","searchEmptyMessage","searchErrorMessage","searchLoadingMessage","filteredOptions","onFilter","clearable","onClear","overflow","multiselect","initialValue","onChange","value","chipTruncationLocation","chipCharacterLimit","className","usePortal","portalClassName","portalContainer","scrollContainer","popoverZIndex"];e.Combobox=function(e){var n,t=e.children,r=e.label,o=e.description,a=e.placeholder,l=void 0===a?"Select":a,u=e["aria-label"],d=e.disabled,g=void 0!==d&&d,y=e.size,x=void 0===y?re:y,v=e.darkMode,m=void 0!==v&&v,k=e.state,w=void 0===k?"none":k,C=e.errorMessage,A=e.searchState,R=void 0===A?"unset":A,q=e.searchEmptyMessage,P=void 0===q?"No results found":q,F=e.searchErrorMessage,U=void 0===F?"Could not get results!":F,V=e.searchLoadingMessage,B=void 0===V?"Loading results...":V,X=e.filteredOptions,Z=e.onFilter,_=e.clearable,oe=void 0===_||_,ae=e.onClear,le=e.overflow,se=void 0===le?"expand-y":le,ce=e.multiselect,ue=void 0!==ce&&ce,de=e.initialValue,pe=e.onChange,fe=e.value,be=e.chipTruncationLocation,ge=e.chipCharacterLimit,he=void 0===ge?12:ge,ye=e.className,xe=e.usePortal,ve=void 0===xe||xe,me=e.portalClassName,ke=e.portalContainer,we=e.scrollContainer,Ce=e.popoverZIndex,Se=G(e,Gr),je=Ze(m),Ne=c.useDynamicRefs({prefix:"option"}),Me=c.useDynamicRefs({prefix:"chip"}),Oe=c.useIdAllocator({prefix:"combobox-input"}),Ee=c.useIdAllocator({prefix:"combobox-label"}),ze=c.useIdAllocator({prefix:"combobox-menu"}),Ie=i.useRef(null),De=i.useRef(null),Ae=i.useRef(null),Re=i.useRef(null),qe=i.useRef(null),Pe=K(i.useState(!1),2),Fe=Pe[0],Le=Pe[1],Te=c.usePrevious(Fe),He=K(i.useState(null),2),We=He[0],Ge=He[1],_e=K(i.useState(null),2),Ye=_e[0],$e=_e[1],Qe=c.usePrevious(Ye),en=K(i.useState(""),2),nn=en[0],tn=en[1],rn=c.usePrevious(nn),on=K(i.useState(null),2),an=on[0],ln=on[1],sn=!M.default(Ye)&&(j.default(Ye)&&Ye.length>0||O.default(Ye)),cn=ue&&j.default(Ye)&&Ye.length>0?void 0:l,un=function(){return Le(!1)},dn=function(){return Le(!0)},pn=i.useMemo((function(){return Be(t)}),[t]),fn=i.useCallback((function(e){return!ue||"string"!=typeof e&&"number"!=typeof e?!ue&&j.default(e)&&b.consoleOnce.error("Error in Combobox: multiselect is set to `false`, but recieved an Array value"):b.consoleOnce.error("Error in Combobox: multiselect is set to `true`, but recieved a ".concat(T(e),' value: "').concat(e,'"')),ue&&j.default(e)}),[ue]),bn=i.useCallback((function(e){!g&&Re&&Re.current&&(Re.current.focus(),E.default(e)||Re.current.setSelectionRange(e,e))}),[g]),gn=i.useCallback((function(e){if(fn(Ye)){var n=S.default(Ye);M.default(e)?n.length=0:Ye.includes(e)?n.splice(n.indexOf(e),1):(n.push(e),tn("")),$e(n),null==pe||pe(n)}else{var t=e;$e(t),null==pe||pe(t)}}),[fn,pe,Ye]),hn=i.useCallback((function(e){return fn(Ye)?Ye.includes(e):e===Ye}),[fn,Ye]),yn=i.useCallback((function(e){var n,t,r,o,a=(t=pn,(n=e)?null!==(r=null===(o=t.find((function(e){return e.displayName===n})))||void 0===o?void 0:o.value)&&void 0!==r?r:n:"");return hn(a)}),[pn,hn]),xn=i.useCallback((function(e){var n="string"==typeof e?e:e.value;return X&&X.length>0?X.includes(n):!!yn(nn)||("string"==typeof e?Ve(n,pn):e.displayName).toLowerCase().includes(nn.toLowerCase())}),[X,yn,nn,pn]),vn=i.useMemo((function(){return pn.filter(xn)}),[pn,xn]),mn=i.useCallback((function(e){return!!e&&!!pn.find((function(n){return n.value===e}))}),[pn]),kn=i.useCallback((function(e){return vn?vn.findIndex((function(n){return n.value===e})):-1}),[vn]),wn=i.useCallback((function(e){if(vn&&vn.length>=e){var n=vn[e];return n?n.value:void 0}}),[vn]),Cn=i.useCallback((function(){return fn(Ye)?Ye.findIndex((function(e){var n,t;return null===(n=Me(e))||void 0===n||null===(t=n.current)||void 0===t?void 0:t.contains(document.activeElement)})):-1}),[Me,fn,Ye]),Sn=K(i.useState(),2),jn=Sn[0],Nn=Sn[1],Mn=i.useCallback((function(e){var n,t=null!==(n=null==vn?void 0:vn.length)&&void 0!==n?n:0,r=t-1>0?t-1:0,o=kn(We);switch(e&&Fe&&(ln(null),bn()),e){case"next":var a=wn(o+1<t?o+1:0);Ge(null!=a?a:null);break;case"prev":var l=wn(o-1>=0?o-1:r);Ge(null!=l?l:null);break;case"last":var i=wn(r);Ge(null!=i?i:null);break;default:var s=wn(0);Ge(null!=s?s:null)}}),[We,kn,wn,Fe,bn,null==vn?void 0:vn.length]),On=i.useCallback((function(e,n){if(fn(Ye))switch(e){case"next":var t=null!=n?n:Cn(),r=t+1<Ye.length?t+1:Ye.length-1,o=Ye[r];ln(o);break;case"prev":var a=null!=n?n:Cn(),l=a>0?a-1:a<0?Ye.length-1:0,i=Ye[l];ln(i);break;case"first":var s=Ye[0];ln(s);break;case"last":var c=Ye[Ye.length-1];ln(c);break;default:ln(null)}}),[Cn,fn,Ye]),En=i.useCallback((function(e,n){switch(e&&Ge(null),e){case"right":switch(jn){case Y:var t,r,o;if((null===(t=Re.current)||void 0===t?void 0:t.selectionEnd)===(null===(r=Re.current)||void 0===r?void 0:r.value.length))null===(o=De.current)||void 0===o||o.focus();break;case J:case ee:case Q:if(jn===Q||1===(null==Ye?void 0:Ye.length)){bn(0),On(null),n.preventDefault();break}On("next")}break;case"left":switch(jn){case $:var a;n.preventDefault(),bn(null==Re||null===(a=Re.current)||void 0===a?void 0:a.value.length);break;case Y:case ee:case Q:if(fn(Ye)){var l;if(jn===Y&&0!==(null===(l=Re.current)||void 0===l?void 0:l.selectionStart))break;On("prev")}}break;default:On(null)}}),[jn,fn,Ye,bn,On]);i.useEffect((function(){nn!==rn&&Mn("first")}),[nn,Fe,rn,Mn]),i.useEffect((function(){if(We){var e=Ne(We);if(e&&e.current&&qe.current){var n=e.current.offsetTop,t=qe.current,r=t.scrollTop;(n>t.offsetHeight||n<r)&&(qe.current.scrollTop=n)}}}),[We,Ne]);var zn=i.useCallback((function(e){if(b.isComponentType(e,"ComboboxOption")){var n=Ue(e.props),t=n.value,r=n.displayName;if(xn(t)){var o=e.props,a=o.className,l=o.glyph,i=o.disabled,s=pn.findIndex((function(e){return e.value===t})),c=We===t,u=fn(Ye)?Ye.includes(t):Ye===t,d=Ne(t);return h.jsx(At,{value:t,displayName:r,isFocused:c,isSelected:u,disabled:i,setSelected:function(){Ge(t),gn(t),bn(),t===Ye&&un()},glyph:l,className:a,index:s,ref:d})}}else if(b.isComponentType(e,"ComboboxGroup")){var p=z.default.Children.map(e.props.children,zn);if(p&&(null==p?void 0:p.length)>0)return h.jsx(Je,{label:e.props.label,className:e.props.className},z.default.Children.map(p,zn))}}),[pn,Ne,We,fn,Ye,bn,xn,gn]),In=i.useMemo((function(){return z.default.Children.map(t,zn)}),[t,zn]),Dn=i.useMemo((function(){if(fn(Ye))return Ye.filter(mn).map((function(e,n){var t=Ve(e,pn),r=an===e,o=Me(e),a=n>=Ye.length-1;return h.jsx(Tr,{key:e,displayName:t,isFocused:r,onRemove:function(){a?(bn(),On(null)):On("next",n),gn(e)},onFocus:function(){ln(e)},ref:o})}))}),[fn,Ye,mn,pn,an,Me,gn,bn,On]),An=i.useMemo((function(){return h.jsx(z.default.Fragment,null,oe&&sn&&h.jsx(D.default,{"aria-label":"Clear selection","aria-disabled":g,disabled:g,ref:De,onClick:function(e){g||(gn(null),null==ae||ae(e),null==Z||Z(""),Fe||dn())},onFocus:Hn,className:p.cx(jr),darkMode:m},h.jsx(I.default,{glyph:"XWithCircle"})),"error"===w?h.jsx(I.default,{glyph:"Warning",color:m?f.palette.red.light1:f.palette.red.base,className:Nr(x)}):h.jsx(I.default,{glyph:"CaretDown",className:Nr(x)}))}),[oe,sn,g,w,m,x,gn,ae,Z,Fe]),Rn=i.useMemo((function(){return pn.some((function(e){return e.hasGlyph}))}),[pn]),qn=i.useCallback((function(){if(!fn(Ye)&&Ye===Qe){var e=vn.find((function(e){return e.displayName===nn||e.value===nn}));if(e&&!fe)$e(e.value);else{var n,t=null!==(n=Ve(Ye,pn))&&void 0!==n?n:"";tn(t)}}}),[pn,nn,fn,Qe,Ye,fe,vn]),Pn=i.useCallback((function(){if(sn){if(fn(Ye))Kn();else if(!fn(Ye)){var e,n=null!==(e=Ve(Ye,pn))&&void 0!==e?e:"";tn(n),un()}}else tn("")}),[sn,pn,fn,Ye]);i.useEffect((function(){if(de)if(j.default(de)){var e,n=null!==(e=de.filter((function(e){return mn(e)})))&&void 0!==e?e:[];$e(n)}else mn(de)&&$e(de);else $e(function(e){return e?[]:null}(ue))}),[]),i.useEffect((function(){if(!E.default(fe)&&fe!==rn)if(M.default(fe))$e(null);else if(fn(fe)){var e=fe.filter(mn);$e(e)}else $e(mn(fe)?fe:null)}),[fn,mn,rn,fe]),i.useEffect((function(){N.default(Ye,Qe)||Pn()}),[Pn,Qe,Ye]),i.useEffect((function(){!Fe&&Te&&qn()}),[Fe,Te,qn]);var Fn=K(i.useState(0),2),Ln=Fn[0],Tn=Fn[1];i.useEffect((function(){var e,n;Tn(null!==(e=null===(n=Ie.current)||void 0===n?void 0:n.clientWidth)&&void 0!==e?e:0)}),[Ie,Fe,We,Ye]);var Hn=function(){Ge(null)};c.useEventListener("mousedown",(function(e){Un(e)||(e.preventDefault(),e.stopPropagation())}),{enabled:Fe}),c.useEventListener("click",(function(e){Un(e)||(e.stopPropagation(),un())}),{options:{capture:!0},enabled:Fe});var Wn,Gn=function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?L(Object(t),!0).forEach((function(n){H(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):L(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({popoverZIndex:Ce},ve?{usePortal:ve,portalClassName:me,portalContainer:ke,scrollContainer:we}:{usePortal:ve});return h.jsx(Xe.Provider,{value:{multiselect:ue,darkMode:m,size:x,withIcons:Rn,disabled:g,isOpen:Fe,state:w,searchState:R,chipTruncationLocation:be,chipCharacterLimit:he,inputValue:nn}},h.jsx("div",W({className:p.cx(pr(x),ye)},Se),h.jsx("div",{className:Er},r&&h.jsx(s.Label,{id:Ee,htmlFor:Oe,darkMode:m},r),o&&h.jsx(s.Description,{darkMode:m},o)),h.jsx("div",{ref:Ie,role:"combobox","aria-expanded":Fe,"aria-controls":ze,"aria-owns":ze,tabIndex:-1,onMouseDown:function(e){g&&e.preventDefault()},onClick:function(e){if(e.target!==Re.current){var n=0;if(Re.current)n=e.nativeEvent.offsetX>Re.current.offsetLeft+Re.current.clientWidth?nn.length:0;bn(n)}},onFocus:function(e){Kn(),dn(),Nn(function(e){var n,t,r,o;if(!e)return;if(null!==(n=Re.current)&&void 0!==n&&n.contains(e))return Y;if(null!==(t=De.current)&&void 0!==t&&t.contains(e))return $;var a=fn(Ye)?Ye.findIndex((function(n){var t,r;return null===(t=Me(n))||void 0===t||null===(r=t.current)||void 0===r?void 0:r.contains(e)})):-1;if(fn(Ye)){if(0===a)return J;if(a===Ye.length-1)return Q;if(a>0)return ee}if(null!==(r=qe.current)&&void 0!==r&&r.contains(e))return te;if(null!==(o=Ie.current)&&void 0!==o&&o.contains(e))return ne}(e.target))},onKeyDown:function(e){var n,t,r=null===(n=qe.current)||void 0===n?void 0:n.contains(document.activeElement);if((null===(t=Ie.current)||void 0===t?void 0:t.contains(document.activeElement))||r){if(e.ctrlKey||e.shiftKey||e.altKey)return;switch(e.keyCode){case b.keyMap.Tab:switch(jn){case"Input":sn||(un(),Mn("first"),On(null));break;case"LastChip":On(null)}break;case b.keyMap.Escape:un(),Mn("first");break;case b.keyMap.Enter:!Fe||jn!==Y||M.default(We)||function(e){if("string"==typeof e){var n=Ke(e,pn);return!(null==n||!n.isDisabled)}return!!e.isDisabled}(We)?jn===$&&(gn(null),bn()):gn(We);break;case b.keyMap.Backspace:var o;if(fn(Ye))"Input"===jn&&0===(null===(o=Re.current)||void 0===o?void 0:o.selectionStart)&&On("last");dn();break;case b.keyMap.ArrowDown:Fe?(e.preventDefault(),Mn("next")):dn();break;case b.keyMap.ArrowUp:Fe?(e.preventDefault(),Mn("prev")):dn();break;case b.keyMap.ArrowRight:En("right",e);break;case b.keyMap.ArrowLeft:En("left",e);break;default:Fe||dn()}}},onTransitionEnd:function(){var e,n;Tn(null!==(e=null===(n=Ie.current)||void 0===n?void 0:n.clientWidth)&&void 0!==e?e:0)},className:p.cx(fr,br[je],gr(x),(n={},H(n,hr[je],g),H(n,yr[je],w===ie),H(n,xr[je],(Wn=Y,Wn===jn)),n))},h.jsx("div",{ref:Ae,className:vr({size:x,overflow:se})},Dn,h.jsx("input",{"aria-label":null!=u?u:r,"aria-autocomplete":"list","aria-controls":ze,"aria-labelledby":Ee,ref:Re,id:Oe,className:p.cx(mr,wr[x],kr[je],Cr(Fe),H({},Sr(x,nn),fn(Ye))),placeholder:cn,disabled:null!=g?g:void 0,onChange:function(e){var n=e.target.value;tn(n),null==Z||Z(n)},value:nn,autoComplete:"off"})),An),"error"===w&&C&&h.jsx("div",{className:p.cx(Mr[je],Or[x])},C),h.jsx(Wr,W({id:ze,labelId:Ee,refEl:Ie,ref:qe,menuWidth:Ln,searchLoadingMessage:B,searchErrorMessage:U,searchEmptyMessage:P},Gn),In)));function Un(e){var n,t,r=e.target;return(null===(n=qe.current)||void 0===n?void 0:n.contains(r))||(null===(t=Ie.current)||void 0===t?void 0:t.contains(r))||!1}function Kn(){Ae&&Ae.current&&(Ae.current.scrollLeft=Ae.current.scrollWidth)}},e.ComboboxGroup=Qe,e.ComboboxOption=Rt,Object.defineProperty(e,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=index.js.map