@leafygreen-ui/combobox 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/Chip.d.ts.map +1 -1
- package/dist/Combobox.d.ts.map +1 -1
- package/dist/ComboboxTestUtils.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/src/Chip.tsx +3 -3
- package/src/Combobox.spec.tsx +3 -1
- package/src/Combobox.story.tsx +2 -2
- package/src/Combobox.tsx +6 -1
- package/src/ComboboxTestUtils.tsx +3 -2
- package/tsconfig.tsbuildinfo +1 -1
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("@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","@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.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){"use strict";function w(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var C=w(n),S=w(t),j=w(r),N=w(o),M=w(a),O=w(l),E=w(i),z=w(u),I=w(d),D=w(h),A=w(y),P=w(m),q=w(k);function F(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 L(e){return L="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},L(e)}function R(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function T(){return T=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},T.apply(this,arguments)}function H(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 W(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}function G(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)||K(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 U(e){return function(e){if(Array.isArray(e))return V(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||K(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 K(e,n){if(e){if("string"==typeof e)return V(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)?V(e,n):void 0}}function V(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 B="dark",X="light",Z="Input",_="ClearButton",Y="FirstChip",$="LastChip",J="MiddleChip",Q="Combobox",ee="Menu",ne="default",te="large",re="expand-y",oe="expand-x",ae="scroll-x",le="error",ie="none";var 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,qe,Fe,Le,Re,Te,He,We=function(e,n,t){if(n&&t){var r=new RegExp(n,"gi"),o=e.matchAll(r);if(o){for(var a=e.split(""),l=0,i=Array.from(o);l<i.length;l++){var s,c=i[l],u=null!==(s=c.index)&&void 0!==s?s:-1,d=c[0],p=d.length,f=u+d+p,b=new Array(p).fill("");b[0]=E.default.createElement(t,{key:f},d),a.splice.apply(a,[u,p].concat(U(b)))}return g.jsx(E.default.Fragment,null,a)}return g.jsx(E.default.Fragment,null,e)}return g.jsx(E.default.Fragment,null,e)},Ge=function(e){var n,t=e.value,r=e.displayName;return{value:null!=t?t:D.default(r),displayName:null!==(n=null!=r?r:t)&&void 0!==n?n:""}},Ue=function(e,n){if(e)return n.find((function(n){return n.value===e}))},Ke=function(e,n){var t,r;return e?null!==(t=null===(r=Ue(e,n))||void 0===r?void 0:r.displayName)&&void 0!==t?t:e:""},Ve=function e(n){return E.default.Children.toArray(n).reduce((function(n,t){if(b.isComponentType(t,"ComboboxOption")){var r=Ge(t.props),o=r.value,a=r.displayName,l=t.props,i=l.glyph,s=l.disabled;return[].concat(U(n),[{value:o,displayName:a,isDisabled:!!s,hasGlyph:!!i}])}if(b.isComponentType(t,"ComboboxGroup")){var c=t.props.children;if(c)return[].concat(U(n),U(e(c)))}}),[])},Be=i.createContext({multiselect:!1,darkMode:!1,size:ne,withIcons:!1,disabled:!1,isOpen:!1,state:ie,searchState:"unset"}),Xe=function(e){return e?B:X},Ze=(R(ue={},X,p.css(se||(se=W(["\n padding-top: 8px;\n "])))),R(ue,B,p.css(ce||(ce=W(["\n padding-top: 8px;\n "])))),ue),_e=p.css(de||(de=W(["\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"]))),Ye=(R(be={},X,p.css(pe||(pe=W(["\n color: ",";\n "])),f.palette.gray.dark1)),R(be,B,p.css(fe||(fe=W(["\n color: ",";\n "])),f.palette.gray.light1)),be);function $e(e){var n=e.label,t=e.className,r=e.children,o=i.useContext(Be).darkMode,a=Xe(o),l=c.useIdAllocator({prefix:"combobox-group"});return E.default.Children.count(r)>0?g.jsx("div",{className:p.cx(Ze[a],t)},g.jsx("div",{className:p.cx(_e,Ye[a]),id:l},n),g.jsx("div",{role:"group","aria-labelledby":l},r)):g.jsx(E.default.Fragment,null)}function Je(e){throw Error("`ComboboxGroup` must be a child of a `Combobox` instance")}Je.displayName="ComboboxGroup";var Qe=(R(ge={},ne,{x:12,y:8}),R(ge,te,{x:12,y:8}),ge),en=(R(he={},ne,x.typeScales.body1.lineHeight+2*Qe[ne].y),R(he,te,x.typeScales.body2.lineHeight+2*Qe[te].y),he),nn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:384;return p.css(ye||(ye=W(["\n width: ","px;\n overflow: hidden;\n border-radius: 12px;\n border: 1px solid;\n"])),e)},tn=(R(me={},X,p.css(xe||(xe=W(["\n box-shadow: 0px 4px 7px ",";\n border-color: ",";\n "])),v.transparentize(.85,f.palette.black),f.palette.gray.light2)),R(me,B,p.css(ve||(ve=W(["\n box-shadow: 0px 4px 7px ",";\n border-color: ",";\n "])),v.transparentize(.85,f.palette.black),f.palette.gray.dark3)),me),rn=p.css(ke||(ke=W(["\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"])),x.spacing[2],x.fontFamilies.default),on=(R(Se={},X,p.css(we||(we=W(["\n color: ",";\n background-color: ",";\n "])),f.palette.black,f.palette.white)),R(Se,B,p.css(Ce||(Ce=W(["\n color: ",";\n background-color: ",";\n "])),f.palette.gray.light1,f.palette.gray.dark3)),Se);R(Me={},ne,p.css(je||(je=W(["\n min-height: ","px;\n "])),en[ne])),R(Me,te,p.css(Ne||(Ne=W(["\n min-height: ","px;\n "])),en[te]));var an=p.css(Oe||(Oe=W(["\n position: relative;\n margin: 0;\n padding: 0;\n"]))),ln=p.css(Ee||(Ee=W(["\n font-family: inherit;\n display: inline-flex;\n align-items: center;\n gap: 8px;\n"]))),sn=(R(De={},X,p.css(ze||(ze=W(["\n color: ",";\n "])),f.palette.gray.dark3)),R(De,B,p.css(Ie||(Ie=W(["\n color: ",";\n "])),f.palette.gray.light3)),De),cn=(R(qe={},ne,p.css(Ae||(Ae=W(["\n font-size: ","px;\n line-height: ","px;\n padding: ","px\n ","px;\n "])),x.typeScales.body1.fontSize,x.typeScales.body1.lineHeight,Qe[ne].y,Qe[ne].x)),R(qe,te,p.css(Pe||(Pe=W(["\n font-size: ","px;\n line-height: ","px;\n padding: ","px\n ","px;\n "])),x.typeScales.body2.fontSize,x.typeScales.body2.lineHeight,Qe[te].y,Qe[te].x)),qe);R(Re={},ne,p.css(Fe||(Fe=W(["\n height: ","px;\n width: ","px;\n "])),x.typeScales.body1.fontSize,x.typeScales.body1.fontSize)),R(Re,te,p.css(Le||(Le=W(["\n height: ","px;\n width: ","px;\n "])),x.typeScales.body2.fontSize,x.typeScales.body2.fontSize));var 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,qn,Fn,Ln,Rn,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,kt,wt=p.keyframes(Te||(Te=W(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"]))),Ct=p.css(He||(He=W(["\n animation: "," 1.5s linear infinite;\n"])),wt),St=p.css(un||(un=W(["\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"])),x.fontFamilies.default),jt=(R(fn={},X,p.css(dn||(dn=W(["\n &:hover {\n outline: none;\n background-color: ",";\n }\n "])),f.palette.gray.light2)),R(fn,B,p.css(pn||(pn=W(["\n &:hover {\n outline: none;\n background-color: ",";\n }\n "])),f.palette.gray.dark4)),fn),Nt=(R(hn={},ne,p.css(bn||(bn=W(["\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 "])),x.typeScales.body1.fontSize,x.typeScales.body1.lineHeight,en[ne],Qe[ne].y,Qe[ne].x,x.spacing[1],en[ne])),R(hn,te,p.css(gn||(gn=W(["\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 "])),x.typeScales.body2.fontSize,x.typeScales.body2.lineHeight,en[te],Qe[te].y,Qe[te].x,x.spacing[2],en[te])),hn),Mt=p.css(yn||(yn=W(["\n outline: none;\n\n &:before {\n transform: scaleY(1);\n }\n"]))),Ot=(R(mn={},X,p.css(xn||(xn=W(["\n ",";\n background-color: ",";\n\n &:before {\n background-color: ",";\n }\n "])),Mt,f.palette.blue.light3,f.palette.blue.base)),R(mn,B,p.css(vn||(vn=W(["\n ",";\n background-color: ",";\n\n &:before {\n background-color: ",";\n }\n "])),Mt,f.palette.blue.dark3,f.palette.blue.light1)),mn),Et=p.css(kn||(kn=W(["\n cursor: not-allowed;\n\n &:hover {\n background-color: inherit;\n }\n\n &:before {\n content: unset;\n }\n"]))),zt=(R(Sn={},X,p.css(wn||(wn=W(["\n ",";\n color: ",";\n "])),Et,f.palette.gray.light1)),R(Sn,B,p.css(Cn||(Cn=W(["\n ",";\n color: ",";\n "])),Et,f.palette.gray.dark1)),Sn),It=(R(Mn={},ne,p.css(jn||(jn=W(["\n min-width: ","px;\n "])),x.spacing[3])),R(Mn,te,p.css(Nn||(Nn=W(["\n min-width: ","px;\n "])),x.spacing[4])),Mn),Dt=p.css(On||(On=W(["\n display: inline-flex;\n gap: 8px;\n justify-content: start;\n align-items: inherit;\n overflow-wrap: anywhere;\n"]))),At=p.css(En||(En=W(["\n pointer-events: none;\n"]))),Pt=function(e){return p.css(zn||(zn=W(["\n font-weight: ",";\n"])),e?"bold":"normal")},qt=E.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,h=e.className,y=i.useContext(Be),x=y.multiselect,v=y.darkMode,m=y.withIcons,k=y.inputValue,w=y.size,C=Xe(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=g.jsx(A.default,{"aria-labelledby":S,checked:a,tabIndex:-1,disabled:s,darkMode:v,className:p.css(In||(In=W(["\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 g.jsx(E.default.Fragment,null,g.jsx("span",{className:p.cx(Dt,At)},m?M:e,g.jsx("span",{id:S,className:Pt(a)},We(r,k,"strong"))),m&&e)}return g.jsx(E.default.Fragment,null,g.jsx("span",{className:p.cx(Dt,At)},M,g.jsx("span",{className:Pt(a)},We(r,k,"strong"))),a&&g.jsx(z.default,{glyph:"Checkmark",className:It[w],color:v?f.palette.blue.light1:f.palette.blue.base}))}),[x,M,a,r,k,w,v,S,s,m]);return g.jsx("li",{ref:j,role:"option","aria-selected":l,"aria-label":r,tabIndex:-1,className:p.cx(St,Nt[w],jt[C],(t={},R(t,Ot[C],l),R(t,zt[C],s),t),h),onClick:N,onKeyDown:N},O)}));function Ft(e){throw Error("`ComboboxOption` must be a child of a `Combobox` instance")}qt.displayName="ComboboxOption",Ft.displayName="ComboboxOption";var Lt,Rt,Tt,Ht,Wt,Gt,Ut,Kt,Vt,Bt,Xt,Zt,_t,Yt,$t,Jt,Qt,er,nr,tr,rr,or=(R(Dn={},ne,x.typeScales.body1.fontSize),R(Dn,te,x.typeScales.body2.fontSize),Dn),ar=(R(An={},ne,2),R(An,te,4),An),lr=(R(Pn={},ne,x.typeScales.body1.lineHeight+2*ar[ne]),R(Pn,te,x.typeScales.body2.lineHeight+2*ar[te]),Pn),ir=(R(qn={},ne,{y:(36-lr[ne]-2)/2,x:x.spacing[2]-1}),R(qn,te,{y:(48-lr[te]-2)/2,x:x.spacing[2]-1}),qn),sr=x.spacing[3],cr=(R(Fn={},ne,or[ne]+2*ir[ne].x+sr+2),R(Fn,te,or[te]+2*ir[te].x+sr+2),Fn),ur=b.createUniqueClassName("combobox-chip"),dr=function(e,n){return p.cx(p.css(Ln||(Ln=W(["\n font-family: ",";\n width: 100%;\n min-width: ","px;\n "])),x.fontFamilies.default,cr[e]),R({},p.css(Rn||(Rn=W(["\n width: unset;\n "]))),n===oe))},pr=p.css(Tn||(Tn=W(["\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"]))),fr=(R(Gn={},X,p.css(Hn||(Hn=W(["\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,x.hoverRing[X].gray)),R(Gn,B,p.css(Wn||(Wn=W(["\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,x.hoverRing[B].gray)),Gn),br=function(e){return p.css(Un||(Un=W(["\n padding: ","px ","px;\n"])),ir[e].y,ir[e].x)},gr=(R(Bn={},X,p.css(Kn||(Kn=W(["\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)),R(Bn,B,p.css(Vn||(Vn=W(["\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),hr=(R(_n={},X,p.css(Xn||(Xn=W(["\n border-color: ",";\n "])),f.palette.red.base)),R(_n,B,p.css(Zn||(Zn=W(["\n border-color: ",";\n "])),f.palette.red.light1)),_n),yr=(R(Jn={},X,p.css(Yn||(Yn=W(["\n &:focus-within {\n border-color: transparent;\n background-color: ",";\n box-shadow: ",";\n }\n "])),f.palette.white,x.focusRing[X].input)),R(Jn,B,p.css($n||($n=W(["\n &:focus-within {\n border-color: transparent;\n background-color: ",";\n box-shadow: ",";\n }\n "])),f.palette.gray.dark4,x.focusRing[B].input)),Jn),xr=function(e){var n=e.overflow,t=e.size,r=p.css(Qn||(Qn=W(["\n flex-grow: 1;\n width: inherit;\n "])));switch(n){case ae:return p.css(et||(et=W(["\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,lr[t],ir[t].x,ur);case oe:return p.css(nt||(nt=W(["\n ","\n display: flex;\n gap: 4px;\n flex-wrap: nowrap;\n white-space: nowrap;\n height: ","px;\n "])),r,lr[t]);case re:return p.css(tt||(tt=W(["\n ","\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n overflow-x: visible;\n min-height: ","px;\n "])),r,lr[t])}},vr=p.css(rt||(rt=W(["\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"])),x.fontFamilies.default),mr=(R(lt={},X,p.css(ot||(ot=W(["\n &::placeholder {\n color: ",";\n }\n "])),f.palette.gray.dark1)),R(lt,B,p.css(at||(at=W(["\n &::placeholder {\n color: ",";\n }\n "])),f.palette.gray.light1)),lt),kr=(R(ct={},ne,p.css(it||(it=W(["\n height: ","px;\n font-size: ","px;\n line-height: ","px;\n min-width: ","px;\n padding-left: 4px;\n "])),lr[ne],x.typeScales.body1.fontSize,x.typeScales.body1.lineHeight,or[ne])),R(ct,te,p.css(st||(st=W(["\n height: ","px;\n font-size: ","px;\n line-height: ","px;\n min-width: ","px;\n padding-left: 6px;\n "])),lr[te],x.typeScales.body2.fontSize,x.typeScales.body2.lineHeight,or[te])),ct),wr=function(e,n){return p.cx(R({},p.css(ut||(ut=W(["\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!==oe))},Cr=function(e,n){var t,r=null!==(t=null==n?void 0:n.length)&&void 0!==t?t:0;return p.css(dt||(dt=W(["\n max-width: 100%;\n width: ","px;\n // TODO: This doesn't quite work. Fix this\n max-width: calc(100% - ","px);\n "])),r*or[e],2*sr)},Sr=function(e){return"object"===L(e)&&!N.default(e)&&e.length>0?p.css(pt||(pt=W(["\n padding-left: 0px;\n "]))):""},jr=p.css(ft||(ft=W(["\n // Add a negative margin so the button takes up the same space as the regular icons\n margin-block: calc(","px - 100%);\n"])),sr/2),Nr=function(e){return p.css(bt||(bt=W(["\n height: ","px;\n width: ","px;\n margin-inline-end: calc(","px / 2);\n"])),sr,sr,ir[e].x)},Mr=(R(yt={},X,p.css(gt||(gt=W(["\n color: ",";\n "])),f.palette.red.base)),R(yt,B,p.css(ht||(ht=W(["\n color: ",";\n "])),f.palette.red.light1)),yt),Or=(R(mt={},ne,p.css(xt||(xt=W(["\n font-size: ","px;\n line-height: ","px;\n padding-top: ","px;\n "])),x.typeScales.body1.fontSize,x.typeScales.body1.lineHeight,ir[ne].y)),R(mt,te,p.css(vt||(vt=W(["\n font-size: ","px;\n line-height: ","px;\n padding-top: ","px;\n "])),x.typeScales.body2.fontSize,x.typeScales.body2.lineHeight,ir[te].y)),mt),Er=p.css(kt||(kt=W(["\n margin-bottom: 2px;\n"]))),zr=p.css(Lt||(Lt=W(["\n display: inline-flex;\n align-items: center;\n overflow: hidden;\n white-space: nowrap;\n box-sizing: border-box;\n"]))),Ir=(R(Ht={},ne,p.css(Rt||(Rt=W(["\n font-size: ","px;\n line-height: ","px;\n border-radius: 4px;\n "])),x.typeScales.body1.fontSize,x.typeScales.body1.lineHeight)),R(Ht,te,p.css(Tt||(Tt=W(["\n font-size: ","px;\n line-height: ","px;\n border-radius: 4px;\n "])),x.typeScales.body2.fontSize,x.typeScales.body2.lineHeight)),Ht),Dr=(R(Ut={},X,p.css(Wt||(Wt=W(["\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)),R(Ut,B,p.css(Gt||(Gt=W(["\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)),Ut),Ar=(R(Bt={},X,p.css(Kt||(Kt=W(["\n cursor: not-allowed;\n color: ",";\n background-color: ",";\n "])),f.palette.gray.base,f.palette.gray.light3)),R(Bt,B,p.css(Vt||(Vt=W(["\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)),Bt),Pr=(R(_t={},ne,p.css(Xt||(Xt=W(["\n padding-inline: 6px;\n padding-block: ","px;\n "])),ar[ne])),R(_t,te,p.css(Zt||(Zt=W(["\n padding-inline: 10px;\n padding-block: ","px;\n "])),ar[te])),_t),qr=p.css(Yt||(Yt=W(["\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"]))),Fr=(R(Qt={},X,p.css($t||($t=W(["\n color: ",";\n\n &:hover {\n color: ",";\n background-color: ",";\n }\n "])),f.palette.gray.dark2,f.palette.black,f.palette.gray.light1)),R(Qt,B,p.css(Jt||(Jt=W(["\n color: ",";\n\n &:hover {\n color: ",";\n background-color: ",";\n }\n "])),f.palette.gray.light1,f.palette.gray.light3,f.palette.gray.dark1)),Qt),Lr=(R(tr={},X,p.css(er||(er=W(["\n cursor: not-allowed;\n color: ",";\n &:hover {\n color: inherit;\n background-color: unset;\n }\n "])),f.palette.gray.dark2)),R(tr,B,p.css(nr||(nr=W(["\n cursor: not-allowed;\n color: ",";\n &:hover {\n color: inherit;\n background-color: unset;\n }\n "])),f.palette.gray.dark2)),tr),Rr=E.default.forwardRef((function(e,n){var t=e.displayName,r=e.isFocused,o=e.onRemove,a=e.onFocus,l=i.useContext(Be),s=l.darkMode,c=l.size,u=l.disabled,d=l.chipTruncationLocation,f=void 0===d?"end":d,h=l.chipCharacterLimit,y=void 0===h?12:h,x=Xe(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 g.jsx("span",{role:"option","aria-selected":r,"data-testid":"lg-combobox-chip",ref:n,className:p.cx(ur,zr,Dr[x],Ir[c],R({},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},g.jsx("span",{className:p.cx(Pr[c])},k?g.jsx(P.default,{darkMode:s,definition:t,align:"bottom"},k):t),g.jsx("button",{"aria-label":"Deselect ".concat(t),"aria-disabled":u,disabled:u,ref:m,className:p.cx(qr,Fr[x],R({},Lr[x],u)),onClick:function(){u||o()}},g.jsx(z.default,{glyph:"X"})))}));Rr.displayName="Chip";var Tr=["children","id","refEl","labelId","menuWidth","searchLoadingMessage","searchErrorMessage","searchEmptyMessage"],Hr=E.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=H(e,Tr),h=i.useContext(Be),y=h.disabled,x=h.darkMode,v=h.size,m=h.isOpen,k=h.searchState,w=c.useForwardedRef(n,null),C=Xe(x),S=c.useAvailableSpace(o),j=O.default(S)?"unset":"".concat(Math.min(S,256),"px"),N=i.useMemo((function(){var e=p.cx(ln,sn[C],cn[v]);switch(k){case"loading":return g.jsx("span",{className:e},g.jsx(z.default,{glyph:"Refresh",color:x?f.palette.blue.light1:f.palette.blue.base,className:Ct}),s);case"error":return g.jsx("span",{className:e},g.jsx(z.default,{glyph:"Warning",color:x?f.palette.red.light1:f.palette.red.base}),u);default:return t&&"object"===L(t)&&"length"in t&&t.length>0?g.jsx("ul",{className:an},t):g.jsx("span",{className:e},d)}}),[C,v,k,x,s,u,t,d]);return g.jsx(q.default,T({active:m&&!y,spacing:4,align:"bottom",justify:"middle",refEl:o,adjustOnMutation:!0,className:p.cx(nn(l),tn[C])},b),g.jsx("div",{ref:w,id:r,role:"listbox","aria-labelledby":a,"aria-expanded":m,className:p.cx(rn,on[C],p.css(rr||(rr=W(["\n max-height: ",";\n "])),j)),onMouseDownCapture:function(e){return e.preventDefault()}},N))}));Hr.displayName="ComboboxMenu";var Wr=["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,r=e.children,o=e.label,a=e.description,l=e.placeholder,u=void 0===l?"Select":l,d=e["aria-label"],h=e.disabled,y=void 0!==h&&h,x=e.size,v=void 0===x?ne:x,m=e.darkMode,k=void 0!==m&&m,w=e.state,D=void 0===w?"none":w,A=e.errorMessage,P=e.searchState,q=void 0===P?"unset":P,W=e.searchEmptyMessage,U=void 0===W?"No results found":W,K=e.searchErrorMessage,V=void 0===K?"Could not get results!":K,B=e.searchLoadingMessage,X=void 0===B?"Loading results...":B,te=e.filteredOptions,re=e.onFilter,oe=e.clearable,ae=void 0===oe||oe,ie=e.onClear,se=e.overflow,ce=void 0===se?"expand-y":se,ue=e.multiselect,de=void 0!==ue&&ue,pe=e.initialValue,fe=e.onChange,be=e.value,ge=e.chipTruncationLocation,he=e.chipCharacterLimit,ye=void 0===he?12:he,xe=e.className,ve=e.usePortal,me=void 0===ve||ve,ke=e.portalClassName,we=e.portalContainer,Ce=e.scrollContainer,Se=e.popoverZIndex,je=H(e,Wr),Ne=Xe(k),Me=c.useDynamicRefs({prefix:"option"}),Oe=c.useDynamicRefs({prefix:"chip"}),Ee=c.useIdAllocator({prefix:"combobox-input"}),ze=c.useIdAllocator({prefix:"combobox-label"}),Ie=c.useIdAllocator({prefix:"combobox-menu"}),De=i.useRef(null),Ae=i.useRef(null),Pe=i.useRef(null),qe=i.useRef(null),Fe=i.useRef(null),Le=G(i.useState(!1),2),Re=Le[0],Te=Le[1],He=c.usePrevious(Re),We=G(i.useState(null),2),Ze=We[0],_e=We[1],Ye=G(i.useState(null),2),Je=Ye[0],Qe=Ye[1],en=c.usePrevious(Je),nn=G(i.useState(""),2),tn=nn[0],rn=nn[1],on=c.usePrevious(tn),an=G(i.useState(null),2),ln=an[0],sn=an[1],cn=!N.default(Je)&&(S.default(Je)&&Je.length>0||M.default(Je)),un=de&&S.default(Je)&&Je.length>0?void 0:u,dn=function(){return Te(!1)},pn=function(){return Te(!0)},fn=i.useMemo((function(){return Ve(r)}),[r]),bn=i.useCallback((function(e){return!de||"string"!=typeof e&&"number"!=typeof e?!de&&S.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(L(e),' value: "').concat(e,'"')),de&&S.default(e)}),[de]),gn=i.useCallback((function(e){!y&&qe&&qe.current&&(qe.current.focus(),O.default(e)||qe.current.setSelectionRange(e,e))}),[y]),hn=i.useCallback((function(e){if(bn(Je)){var n=C.default(Je);N.default(e)?n.length=0:Je.includes(e)?n.splice(n.indexOf(e),1):(n.push(e),rn("")),Qe(n),null==fe||fe(n)}else{var t=e;Qe(t),null==fe||fe(t)}}),[bn,fe,Je]),yn=i.useCallback((function(e){return bn(Je)?Je.includes(e):e===Je}),[bn,Je]),xn=i.useCallback((function(e){var n,t,r,o,a=(t=fn,(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 yn(a)}),[fn,yn]),vn=i.useCallback((function(e){var n="string"==typeof e?e:e.value;return te&&te.length>0?te.includes(n):!!xn(tn)||("string"==typeof e?Ke(n,fn):e.displayName).toLowerCase().includes(tn.toLowerCase())}),[te,xn,tn,fn]),mn=i.useMemo((function(){return fn.filter(vn)}),[fn,vn]),kn=i.useCallback((function(e){return!!e&&!!fn.find((function(n){return n.value===e}))}),[fn]),wn=i.useCallback((function(e){return mn?mn.findIndex((function(n){return n.value===e})):-1}),[mn]),Cn=i.useCallback((function(e){if(mn&&mn.length>=e){var n=mn[e];return n?n.value:void 0}}),[mn]),Sn=i.useCallback((function(){return bn(Je)?Je.findIndex((function(e){var n,t;return null===(n=Oe(e))||void 0===n||null===(t=n.current)||void 0===t?void 0:t.contains(document.activeElement)})):-1}),[Oe,bn,Je]),jn=G(i.useState(),2),Nn=jn[0],Mn=jn[1],On=i.useCallback((function(e){var n,t=null!==(n=null==mn?void 0:mn.length)&&void 0!==n?n:0,r=t-1>0?t-1:0,o=wn(Ze);switch(e&&Re&&(sn(null),gn()),e){case"next":var a=Cn(o+1<t?o+1:0);_e(null!=a?a:null);break;case"prev":var l=Cn(o-1>=0?o-1:r);_e(null!=l?l:null);break;case"last":var i=Cn(r);_e(null!=i?i:null);break;default:var s=Cn(0);_e(null!=s?s:null)}}),[Ze,wn,Cn,Re,gn,null==mn?void 0:mn.length]),En=i.useCallback((function(e,n){if(bn(Je))switch(e){case"next":var t=null!=n?n:Sn(),r=t+1<Je.length?t+1:Je.length-1,o=Je[r];sn(o);break;case"prev":var a=null!=n?n:Sn(),l=a>0?a-1:a<0?Je.length-1:0,i=Je[l];sn(i);break;case"first":var s=Je[0];sn(s);break;case"last":var c=Je[Je.length-1];sn(c);break;default:sn(null)}}),[Sn,bn,Je]),zn=i.useCallback((function(e,n){switch(e&&_e(null),e){case"right":switch(Nn){case Z:var t,r,o;if((null===(t=qe.current)||void 0===t?void 0:t.selectionEnd)===(null===(r=qe.current)||void 0===r?void 0:r.value.length))null===(o=Ae.current)||void 0===o||o.focus();break;case Y:case J:case $:if(Nn===$||1===(null==Je?void 0:Je.length)){gn(0),En(null),n.preventDefault();break}En("next")}break;case"left":switch(Nn){case _:var a;n.preventDefault(),gn(null==qe||null===(a=qe.current)||void 0===a?void 0:a.value.length);break;case Z:case J:case $:if(bn(Je)){var l;if(Nn===Z&&0!==(null===(l=qe.current)||void 0===l?void 0:l.selectionStart))break;En("prev")}}break;default:En(null)}}),[Nn,bn,Je,gn,En]);i.useEffect((function(){tn!==on&&On("first")}),[tn,Re,on,On]),i.useEffect((function(){if(Ze){var e=Me(Ze);if(e&&e.current&&Fe.current){var n=e.current.offsetTop,t=Fe.current,r=t.scrollTop;(n>t.offsetHeight||n<r)&&(Fe.current.scrollTop=n)}}}),[Ze,Me]);var In=i.useCallback((function(e){if(b.isComponentType(e,"ComboboxOption")){var n=Ge(e.props),t=n.value,r=n.displayName;if(vn(t)){var o=e.props,a=o.className,l=o.glyph,i=o.disabled,s=fn.findIndex((function(e){return e.value===t})),c=Ze===t,u=bn(Je)?Je.includes(t):Je===t,d=Me(t);return g.jsx(qt,{value:t,displayName:r,isFocused:c,isSelected:u,disabled:i,setSelected:function(){_e(t),hn(t),gn(),t===Je&&dn()},glyph:l,className:a,index:s,ref:d})}}else if(b.isComponentType(e,"ComboboxGroup")){var p=E.default.Children.map(e.props.children,In);if(p&&(null==p?void 0:p.length)>0)return g.jsx($e,{label:e.props.label,className:e.props.className},E.default.Children.map(p,In))}}),[fn,Me,Ze,bn,Je,gn,vn,hn]),Dn=i.useMemo((function(){return E.default.Children.map(r,In)}),[r,In]),An=i.useMemo((function(){if(bn(Je))return Je.filter(kn).map((function(e,n){var t=Ke(e,fn),r=ln===e,o=Oe(e),a=n>=Je.length-1;return g.jsx(Rr,{key:e,displayName:t,isFocused:r,onRemove:function(){a?(gn(),En(null)):En("next",n),hn(e)},onFocus:function(){sn(e)},ref:o})}))}),[bn,Je,kn,fn,ln,Oe,hn,gn,En]),Pn=i.useMemo((function(){return g.jsx(E.default.Fragment,null,ae&&cn&&g.jsx(I.default,{"aria-label":"Clear selection","aria-disabled":y,disabled:y,ref:Ae,onClick:function(e){y||(hn(null),null==ie||ie(e),null==re||re(""),Re||pn())},onFocus:Wn,className:p.cx(jr),darkMode:k},g.jsx(z.default,{glyph:"XWithCircle"})),"error"===D?g.jsx(z.default,{glyph:"Warning",color:k?f.palette.red.light1:f.palette.red.base,className:Nr(v)}):g.jsx(z.default,{glyph:"CaretDown",className:Nr(v)}))}),[ae,cn,y,D,k,v,hn,ie,re,Re]),qn=i.useMemo((function(){return fn.some((function(e){return e.hasGlyph}))}),[fn]),Fn=i.useCallback((function(){if(!bn(Je)&&Je===en){var e=mn.find((function(e){return e.displayName===tn||e.value===tn}));if(e&&!be)Qe(e.value);else{var n,t=null!==(n=Ke(Je,fn))&&void 0!==n?n:"";rn(t)}}}),[fn,tn,bn,en,Je,be,mn]),Ln=i.useCallback((function(){if(cn){if(bn(Je))Vn();else if(!bn(Je)){var e,n=null!==(e=Ke(Je,fn))&&void 0!==e?e:"";rn(n),dn()}}else rn("")}),[cn,fn,bn,Je]);i.useEffect((function(){if(pe)if(S.default(pe)){var e,n=null!==(e=pe.filter((function(e){return kn(e)})))&&void 0!==e?e:[];Qe(n)}else kn(pe)&&Qe(pe);else Qe(function(e){return e?[]:null}(de))}),[]),i.useEffect((function(){if(!O.default(be)&&be!==on)if(N.default(be))Qe(null);else if(bn(be)){var e=be.filter(kn);Qe(e)}else Qe(kn(be)?be:null)}),[bn,kn,on,be]),i.useEffect((function(){j.default(Je,en)||Ln()}),[Ln,en,Je]),i.useEffect((function(){!Re&&He&&Fn()}),[Re,He,Fn]);var Rn=G(i.useState(0),2),Tn=Rn[0],Hn=Rn[1];i.useEffect((function(){var e,n;Hn(null!==(e=null===(n=De.current)||void 0===n?void 0:n.clientWidth)&&void 0!==e?e:0)}),[De,Re,Ze,Je]);var Wn=function(){_e(null)};c.useEventListener("mousedown",(function(e){Kn(e)||(e.preventDefault(),e.stopPropagation())}),{enabled:Re}),c.useEventListener("click",(function(e){Kn(e)||(e.stopPropagation(),dn())}),{options:{capture:!0},enabled:Re});var Gn,Un=function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?F(Object(t),!0).forEach((function(n){R(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):F(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({popoverZIndex:Se},me?{usePortal:me,portalClassName:ke,portalContainer:we,scrollContainer:Ce}:{usePortal:me});return g.jsx(Be.Provider,{value:{multiselect:de,darkMode:k,size:v,withIcons:qn,disabled:y,isOpen:Re,state:D,searchState:q,chipTruncationLocation:ge,chipCharacterLimit:ye,inputValue:tn}},g.jsx("div",T({className:p.cx(dr(v,ce),xe)},je),g.jsx("div",{className:Er},o&&g.jsx(s.Label,{id:ze,htmlFor:Ee,darkMode:k},o),a&&g.jsx(s.Description,{darkMode:k},a)),g.jsx("div",{ref:De,role:"combobox","aria-expanded":Re,"aria-controls":Ie,"aria-owns":Ie,tabIndex:-1,onMouseDown:function(e){y&&e.preventDefault()},onClick:function(e){if(e.target!==qe.current){var n=0;if(qe.current)n=e.nativeEvent.offsetX>qe.current.offsetLeft+qe.current.clientWidth?tn.length:0;gn(n)}},onFocus:function(e){Vn(),pn(),Mn(function(e){var n,t,r,o;if(!e)return;if(null!==(n=qe.current)&&void 0!==n&&n.contains(e))return Z;if(null!==(t=Ae.current)&&void 0!==t&&t.contains(e))return _;var a=bn(Je)?Je.findIndex((function(n){var t,r;return null===(t=Oe(n))||void 0===t||null===(r=t.current)||void 0===r?void 0:r.contains(e)})):-1;if(bn(Je)){if(0===a)return Y;if(a===Je.length-1)return $;if(a>0)return J}if(null!==(r=Fe.current)&&void 0!==r&&r.contains(e))return ee;if(null!==(o=De.current)&&void 0!==o&&o.contains(e))return Q}(e.target))},onKeyDown:function(e){var n,t,r=null===(n=Fe.current)||void 0===n?void 0:n.contains(document.activeElement);if((null===(t=De.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(Nn){case"Input":cn||(dn(),On("first"),En(null));break;case"LastChip":En(null)}break;case b.keyMap.Escape:dn(),On("first");break;case b.keyMap.Enter:!Re||Nn!==Z||N.default(Ze)||function(e){if("string"==typeof e){var n=Ue(e,fn);return!(null==n||!n.isDisabled)}return!!e.isDisabled}(Ze)?Nn===_&&(hn(null),gn()):hn(Ze);break;case b.keyMap.Backspace:var o;if(bn(Je))"Input"===Nn&&0===(null===(o=qe.current)||void 0===o?void 0:o.selectionStart)&&En("last");pn();break;case b.keyMap.ArrowDown:Re?(e.preventDefault(),On("next")):pn();break;case b.keyMap.ArrowUp:Re?(e.preventDefault(),On("prev")):pn();break;case b.keyMap.ArrowRight:zn("right",e);break;case b.keyMap.ArrowLeft:zn("left",e);break;default:Re||pn()}}},onTransitionEnd:function(){var e,n;Hn(null!==(e=null===(n=De.current)||void 0===n?void 0:n.clientWidth)&&void 0!==e?e:0)},className:p.cx(pr,fr[Ne],br(v),(n={},R(n,gr[Ne],y),R(n,hr[Ne],D===le),R(n,yr[Ne],(Gn=Z,Gn===Nn)),n))},g.jsx("div",{ref:Pe,className:xr({size:v,overflow:ce})},An,g.jsx("input",{"aria-label":null!=d?d:o,"aria-autocomplete":"list","aria-controls":Ie,"aria-labelledby":ze,ref:qe,id:Ee,className:p.cx(vr,kr[v],mr[Ne],wr(Re,ce),(t={},R(t,Cr(v,tn),bn(Je)),R(t,Sr(Je),bn(Je)),t)),placeholder:un,disabled:null!=y?y:void 0,onChange:function(e){var n=e.target.value;rn(n),null==re||re(n)},value:tn,autoComplete:"off"})),Pn),"error"===D&&A&&g.jsx("div",{className:p.cx(Mr[Ne],Or[v])},A),g.jsx(Hr,T({id:Ie,labelId:ze,refEl:De,ref:Fe,menuWidth:Tn,searchLoadingMessage:X,searchErrorMessage:V,searchEmptyMessage:U},Un),Dn)));function Kn(e){var n,t,r=e.target;return(null===(n=Fe.current)||void 0===n?void 0:n.contains(r))||(null===(t=De.current)||void 0===t?void 0:t.contains(r))||!1}function Vn(){Pe&&Pe.current&&(Pe.current.scrollLeft=Pe.current.scrollWidth)}},e.ComboboxGroup=Je,e.ComboboxOption=Ft,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=index.js.map
|