@leafygreen-ui/search-input
Advanced tools
Comparing version 2.0.8 to 2.0.9
# @leafygreen-ui/search-input | ||
## 2.0.9 | ||
### Patch Changes | ||
- 215268ff: Updates build tooling. No functional changes | ||
- Updated dependencies [215268ff] | ||
- @leafygreen-ui/leafygreen-provider@3.1.4 | ||
- @leafygreen-ui/input-option@1.0.6 | ||
- @leafygreen-ui/icon-button@15.0.14 | ||
- @leafygreen-ui/polymorphic@1.3.3 | ||
- @leafygreen-ui/typography@16.5.2 | ||
- @leafygreen-ui/emotion@4.0.5 | ||
- @leafygreen-ui/palette@4.0.5 | ||
- @leafygreen-ui/popover@11.0.13 | ||
- @leafygreen-ui/tokens@2.1.2 | ||
- @leafygreen-ui/hooks@7.7.6 | ||
- @leafygreen-ui/a11y@1.4.5 | ||
- @leafygreen-ui/icon@11.20.1 | ||
- @leafygreen-ui/lib@10.4.1 | ||
## 2.0.8 | ||
@@ -4,0 +24,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("lodash/isUndefined"),require("@leafygreen-ui/emotion"),require("@leafygreen-ui/hooks"),require("@leafygreen-ui/icon/dist/MagnifyingGlass"),require("@leafygreen-ui/icon/dist/XWithCircle"),require("@leafygreen-ui/icon-button"),require("@leafygreen-ui/leafygreen-provider"),require("@leafygreen-ui/lib"),require("@leafygreen-ui/popover"),require("@leafygreen-ui/tokens"),require("@leafygreen-ui/input-option"),require("@leafygreen-ui/palette"),require("@leafygreen-ui/icon/dist/Refresh"),require("polished"),require("@leafygreen-ui/polymorphic"),require("@leafygreen-ui/typography")):"function"==typeof define&&define.amd?define(["exports","react","lodash/isUndefined","@leafygreen-ui/emotion","@leafygreen-ui/hooks","@leafygreen-ui/icon/dist/MagnifyingGlass","@leafygreen-ui/icon/dist/XWithCircle","@leafygreen-ui/icon-button","@leafygreen-ui/leafygreen-provider","@leafygreen-ui/lib","@leafygreen-ui/popover","@leafygreen-ui/tokens","@leafygreen-ui/input-option","@leafygreen-ui/palette","@leafygreen-ui/icon/dist/Refresh","polished","@leafygreen-ui/polymorphic","@leafygreen-ui/typography"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["@leafygreen-ui/search-input"]={},e.React,e.isUndefined,e["@leafygreen-ui/emotion"],e["@leafygreen-ui/hooks"],e.MagnifyingGlass,e.XWithCircle,e["@leafygreen-ui/icon-button"],e["@leafygreen-ui/leafygreen-provider"],e["@leafygreen-ui/lib"],e["@leafygreen-ui/popover"],e["@leafygreen-ui/tokens"],e["@leafygreen-ui/input-option"],e["@leafygreen-ui/palette"],e.Refresh,e.polished,e["@leafygreen-ui/polymorphic"],e["@leafygreen-ui/typography"])}(this,(function(e,n,t,r,a,l,i,o,s,c,u,d,f,p,h,g,b,y){"use strict";function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v=m(n),k=m(t),x=m(l),w=m(i),S=m(o),O=m(s),E=m(u),D=m(h);function j(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 C(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?j(Object(t),!0).forEach((function(n){T(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):j(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function T(e,n,t){return(n=function(e){var n=function(e,n){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==typeof n?n:String(n)}(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function R(){return R=Object.assign?Object.assign.bind():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},R.apply(this,arguments)}function N(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)t=l[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)t=l[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function M(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}function P(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){var r,a,l,i,o=[],s=!0,c=!1;try{if(l=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;s=!1}else for(;!(s=(r=l.call(t)).done)&&(o.push(r.value),o.length!==n);s=!0);}catch(e){c=!0,a=e}finally{try{if(!s&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(c)throw a}}return o}}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return q(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return q(e,n)}(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 q(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 L,z,I,A,U=["children"],W=n.createContext({});function G(e){var n=e.children,t=N(e,U);return v.default.createElement(W.Provider,{value:t},n)}var F,X,H,_,B,K,V,$,J,Q,Y=r.css(L||(L=M(["\n display: flex;\n align-items: center;\n gap: ","px;\n font-style: italic;\n font-weight: 300;\n padding-block: ","px;\n"])),d.spacing[2],d.spacing[1]),Z=(T(A={},c.Theme.Light,r.css(z||(z=M(["\n color: ",";\n "])),p.palette.gray.dark1)),T(A,c.Theme.Dark,r.css(I||(I=M(["\n color: ",";\n "])),p.palette.gray.light1)),A),ee=function(){var e=s.useDarkMode().theme;return v.default.createElement(f.InputOption,{"aria-label":"No results found",isInteractive:!1,className:r.cx(Y,Z[e])},v.default.createElement("span",null,"No results found"))},ne=r.css(F||(F=M(["\n display: flex;\n align-items: center;\n gap: ","px;\n padding-block: ","px;\n"])),d.spacing[2],d.spacing[1]),te=r.keyframes(X||(X=M(["\n from {\n transform: rotate(0deg);\n } \n to {\n transform: rotate(360deg);\n }\n"]))),re=r.css(H||(H=M(["\n height: 16px;\n width: 16px;\n animation: "," 1.5s linear infinite;\n"])),te),ae=function(){var e=s.useDarkMode().darkMode;return v.default.createElement(f.InputOption,{"data-testid":"lg-search-input-loading-option","aria-label":"Loading results",isInteractive:!1,className:ne},v.default.createElement(D.default,{color:e?p.palette.blue.light1:p.palette.blue.base,className:re}),v.default.createElement("span",null,"Loading results"))},le=r.css(_||(_=M(["\n box-shadow: 0px 4px 7px ",";\n padding: 12px 0;\n border-radius: 12px;\n"])),g.transparentize(.75,"#000000")),ie=(T(V={},c.Theme.Light,r.css(B||(B=M(["\n background-color: ",";\n "])),p.palette.white)),T(V,c.Theme.Dark,r.css(K||(K=M(["\n background-color: ",";\n "])),p.palette.gray.dark3)),V),oe=r.css($||($=M(["\n padding: 0;\n margin: 0;\n border-radius: inherit;\n overflow-y: auto;\n scroll-behavior: smooth;\n"]))),se=v.default.forwardRef((function(e,t){var l=e.children,i=e.open,o=void 0!==i&&i,c=e.refEl,u=s.useDarkMode().theme,f=n.useContext(W).state,p=n.useMemo((function(){var e,n;return null!==(e=null===(n=c.current)||void 0===n?void 0:n.clientWidth)&&void 0!==e?e:0}),[c,o]),h=a.useAvailableSpace(c),g=k.default(h)?"unset":"".concat(Math.min(h,256),"px");return v.default.createElement(E.default,{"data-testid":"lg-search-input-popover",spacing:d.spacing[2],active:o,align:"bottom",justify:"start",className:r.cx(le,ie[u],r.css(J||(J=M(["\n width: ","px;\n min-width: ","px;\n "])),p,p)),refEl:c},"loading"===f?v.default.createElement(ae,null):v.default.createElement("ul",{role:"listbox","aria-live":"polite","aria-relevant":"additions removals","aria-expanded":o,ref:t,className:r.cx(oe,r.css(Q||(Q=M(["\n max-height: ",";\n "])),g))},v.default.Children.count(l)?l:v.default.createElement(ee,null)))}));se.displayName="SearchResultsMenu";var ce,ue,de,fe,pe,he,ge,be,ye,me,ve,ke,xe,we,Se,Oe,Ee,De,je,Ce,Te,Re,Ne,Me,Pe,qe,Le,ze,Ie,Ae,Ue,We,Ge,Fe,Xe,He,_e,Be={Unset:"unset",Loading:"loading"},Ke={Small:"small",Default:"default",Large:"large"},Ve=function(e){return"0 0 0 100px ".concat(e," inset")},$e=r.css(ce||(ce=M(["\n outline: none;\n"]))),Je=r.css(ue||(ue=M(["\n position: relative;\n display: grid;\n grid-auto-flow: column;\n align-items: center;\n justify-items: center;\n border: 1px solid;\n border-radius: 6px;\n z-index: 0;\n transition: ","ms ease-in-out;\n transition-property: border-color, box-shadow;\n"])),d.transitionDuration.default),Qe=(T(he={},Ke.Small,r.css(de||(de=M(["\n font-size: ","px;\n line-height: ","px;\n height: 28px;\n grid-template-columns: 28px 1fr;\n grid-auto-columns: 28px;\n "])),d.typeScales.body1.fontSize,d.typeScales.body1.lineHeight)),T(he,Ke.Default,r.css(fe||(fe=M(["\n font-size: ","px;\n line-height: ","px;\n height: 36px;\n grid-template-columns: 36px 1fr;\n grid-auto-columns: 36px;\n "])),d.typeScales.body1.fontSize,d.typeScales.body1.lineHeight)),T(he,Ke.Large,r.css(pe||(pe=M(["\n font-size: 18px;\n line-height: 32px;\n height: 48px;\n grid-template-columns: 48px 1fr;\n grid-auto-columns: 48px;\n "])))),he),Ye=(T(ye={},c.Theme.Light,r.css(ge||(ge=M(["\n color: ",";\n background: ",";\n border-color: ",";\n "])),p.palette.black,p.palette.white,p.palette.gray.base)),T(ye,c.Theme.Dark,r.css(be||(be=M(["\n color: ",";\n background-color: ",";\n border-color: ",";\n "])),p.palette.gray.light2,p.palette.gray.dark4,p.palette.gray.base)),ye),Ze=(T(ke={},c.Theme.Light,r.css(me||(me=M(["\n &:hover,\n &:active {\n &:not(:disabled):not(:focus-within) {\n box-shadow: ",";\n }\n }\n "])),d.hoverRing.light.gray)),T(ke,c.Theme.Dark,r.css(ve||(ve=M(["\n &:hover,\n &:active {\n &:not(:disabled):not(:focus-within) {\n box-shadow: ",";\n }\n }\n "])),d.hoverRing.dark.gray)),ke),en=(T(Se={},c.Theme.Light,r.css(xe||(xe=M(["\n &:not(:disabled):focus-within {\n box-shadow: ",";\n border-color: ",";\n }\n "])),d.focusRing.light.input,p.palette.white)),T(Se,c.Theme.Dark,r.css(we||(we=M(["\n &:not(:disabled):focus-within {\n box-shadow: ",";\n border-color: ",";\n }\n "])),d.focusRing.dark.input,p.palette.gray.dark4)),Se),nn=(T(De={},c.Theme.Light,r.css(Oe||(Oe=M(["\n cursor: not-allowed;\n color: ",";\n background-color: ",";\n border-color: ",";\n "])),p.palette.gray.base,p.palette.gray.light2,p.palette.gray.light1)),T(De,c.Theme.Dark,r.css(Ee||(Ee=M(["\n cursor: not-allowed;\n color: ",";\n background-color: ",";\n border-color: ",";\n "])),p.palette.gray.dark2,p.palette.gray.dark3,p.palette.gray.dark2)),De),tn=r.css(je||(je=M(["\n font-size: inherit;\n line-height: inherit;\n color: inherit;\n background-color: inherit;\n font-family: ",";\n width: 100%;\n height: 1.5em;\n font-weight: ",";\n z-index: 1;\n outline: none;\n border: none;\n padding: 0;\n\n &:disabled {\n cursor: not-allowed;\n\n &:hover,\n &:active {\n box-shadow: none;\n }\n }\n\n &::placeholder {\n font-size: inherit;\n line-height: inherit;\n }\n &::-ms-clear,\n &::-ms-reveal {\n display: none;\n width: 0;\n height: 0;\n }\n &::-webkit-search-decoration,\n &::-webkit-search-cancel-button,\n &::-webkit-search-results-button,\n &::-webkit-search-results-decoration {\n display: none;\n }\n"])),d.fontFamilies.default,d.fontWeights.regular),rn=(T(Re={},c.Theme.Light,r.css(Ce||(Ce=M(["\n &:-webkit-autofill {\n color: inherit;\n background: transparent;\n border: none;\n -webkit-text-fill-color: inherit;\n\n &:not(:disabled) {\n box-shadow: ",";\n\n &:focus {\n box-shadow: ",",\n ",";\n }\n\n &:hover:not(:focus) {\n box-shadow: ",",\n ",";\n }\n }\n }\n\n &::placeholder {\n color: ",";\n font-weight: ",";\n }\n\n &:disabled {\n &::placeholder {\n color: ",";\n }\n\n &:-webkit-autofill {\n &,\n &:hover,\n &:focus {\n appearance: none;\n border: 1px solid ",";\n -webkit-text-fill-color: ",";\n box-shadow: ",";\n }\n }\n }\n "])),Ve(p.palette.white),Ve(p.palette.white),d.focusRing.light.input,Ve(p.palette.white),d.hoverRing.light.gray,p.palette.gray.base,d.fontWeights.regular,p.palette.gray.base,p.palette.gray.base,p.palette.gray.base,Ve(p.palette.gray.light2))),T(Re,c.Theme.Dark,r.css(Te||(Te=M(["\n &:-webkit-autofill {\n color: inherit;\n background: transparent;\n border: none;\n -webkit-text-fill-color: ",";\n &:not(:disabled) {\n box-shadow: ",";\n\n &:focus {\n box-shadow: ",",\n ",";\n border-color: ",";\n }\n\n &:hover:not(:focus) {\n box-shadow: ",",\n ",";\n }\n }\n }\n\n &::placeholder {\n color: ",";\n font-weight: ",";\n }\n\n &:disabled {\n &::placeholder {\n color: ",";\n }\n\n &:-webkit-autofill {\n &,\n &:hover,\n &:focus {\n appearance: none;\n border: 1px solid ",";\n -webkit-text-fill-color: ",";\n box-shadow: ",";\n }\n }\n }\n "])),p.palette.gray.light3,Ve(p.palette.gray.dark4),Ve(p.palette.gray.dark4),d.focusRing.dark.input,p.palette.blue.light1,Ve(p.palette.gray.dark4),d.hoverRing.dark.gray,p.palette.gray.base,d.fontWeights.regular,p.palette.gray.base,p.palette.gray.dark1,p.palette.gray.dark1,Ve(p.palette.gray.dark2))),Re),an=(T(Pe={},c.Theme.Light,r.css(Ne||(Ne=M(["\n color: ",";\n "])),p.palette.gray.dark1)),T(Pe,c.Theme.Dark,r.css(Me||(Me=M(["\n color: ",";\n "])),p.palette.gray.light1)),Pe),ln=(T(Ie={},Ke.Small,r.css(qe||(qe=M(["\n left: 10px;\n "])))),T(Ie,Ke.Default,r.css(Le||(Le=M(["\n left: 12px;\n "])))),T(Ie,Ke.Large,r.css(ze||(ze=M(["\n left: 16px;\n "])))),Ie),on=(T(We={},c.Theme.Light,r.css(Ae||(Ae=M(["\n color: ",";\n "])),p.palette.gray.base)),T(We,c.Theme.Dark,r.css(Ue||(Ue=M(["\n color: ",";\n "])),p.palette.gray.dark1)),We);r.css(Ge||(Ge=M([""])));var sn,cn,un,dn,fn,pn,hn,gn,bn=(T(_e={},Ke.Small,r.css(Fe||(Fe=M(["\n height: 26px;\n width: 26px;\n "])))),T(_e,Ke.Default,r.css(Xe||(Xe=M(["\n height: 28px;\n width: 28px;\n "])))),T(_e,Ke.Large,r.css(He||(He=M(["\n height: 28px;\n width: 28px;\n "])))),_e),yn=["placeholder","className","darkMode","size","disabled","children","state","value","onChange","onSubmit","aria-label","aria-labelledby"],mn=v.default.forwardRef((function(e,t){var l,i=e.placeholder,o=void 0===i?"Search":i,u=e.className,d=e.darkMode,f=e.size,p=void 0===f?Ke.Default:f,h=e.disabled,g=e.children,b=e.state,y=void 0===b?Be.Unset:b,m=e.value,E=e.onChange,D=e.onSubmit,j=e["aria-label"],M=e["aria-labelledby"],q=N(e,yn),L=s.useDarkMode(d),z=L.theme,I=L.darkMode,A=P(n.useState(!1),2),U=A[0],W=A[1],F=P(n.useState(0),2),X=F[0],H=F[1],_=function(){return W(!1)},B=function(){return W(!0)},K=n.useRef(null),V=n.useRef(null),$=n.useRef(null),J=a.useForwardedRef(t,null),Q=n.useRef(null),Y=a.useDynamicRefs({prefix:"result"}),Z=P(n.useState(),2),ee=Z[0],ne=Z[1],te=Y("".concat(X)),re=!k.default(g),ae=a.useControlledValue(m,E),le=ae.value,ie=ae.handleChange,oe=n.useCallback((function(e){J.current&&(J.current.value=e,ie(c.createSyntheticEvent(new Event("change",{cancelable:!0,bubbles:!0}),J.current)))}),[ie,J]),ce=n.useCallback((function(){var e=0,n=v.default.Children.map(g,(function n(t){if(c.isComponentType(t,"SearchResult")){var r,a=(e+=1)-1,l=c.getNodeTextContent(t);return v.default.cloneElement(t,C(C({},t.props),{},{id:"result-".concat(a),key:"result-".concat(a),ref:null!==(r=t.props.ref)&&void 0!==r?r:null==Y?void 0:Y("".concat(a)),highlighted:a===X,onClick:function(e){var n,r;if(null===(n=(r=t.props).onClick)||void 0===n||n.call(r,e),oe(l),e.detail>=1&&K.current&&J.current){var a,i=new Event("submit",{cancelable:!0,bubbles:!0});null===(a=K.current)||void 0===a||a.dispatchEvent(i)}}}))}if(c.isComponentType(t,"SearchResultGroup")){var i=v.default.Children.map(t.props.children,n);if(i&&i.length>0)return v.default.cloneElement(t,C(C({},t.props),{},{children:i}))}}));return{resultsCount:e,updatedChildren:n}}),[g,X,J,Y,oe]),ue=n.useMemo((function(){return ce()}),[ce]),de=ue.updatedChildren,fe=ue.resultsCount,pe=function(e){switch(e){case"first":H(0);break;case"last":H(fe);break;case"next":var n=!k.default(X)&&X+1<fe?X+1:0;H(n);break;case"prev":var t=!k.default(X)&&X-1>=0?X-1:fe-1;H(t)}};return a.useAutoScroll(te,$,12),a.useBackdropClick((function(){_()}),[V,$],U&&re),v.default.createElement(O.default,{darkMode:I},v.default.createElement(G,{state:y,highlight:X,resultDynamicRefs:Y},v.default.createElement("form",R({role:"search",ref:K,className:r.cx($e,u),onSubmit:function(e){e.preventDefault(),null==D||D(e),re&&(_(),oe(""))}},q),v.default.createElement("div",{ref:V,role:"searchbox",tabIndex:-1,onMouseDown:function(e){h&&e.preventDefault()},onClick:function(e){!function(e){h?(e.preventDefault(),e.stopPropagation()):B()}(e)},onFocus:function(e){var n,t=e.target,r=t===Q.current?Q.current:null!==(n=J.current)&&void 0!==n?n:t;r.focus(),ne(r)},onKeyDown:function(e){var n,t,r=null===(n=$.current)||void 0===n?void 0:n.contains(document.activeElement);if((null===(t=V.current)||void 0===t?void 0:t.contains(document.activeElement))||r)switch(e.keyCode){case c.keyMap.Enter:var a;null==te||null===(a=te.current)||void 0===a||a.click();break;case c.keyMap.Escape:var l;_(),null===(l=J.current)||void 0===l||l.focus();break;case c.keyMap.ArrowDown:var i;if(re)null===(i=J.current)||void 0===i||i.focus(),B(),e.preventDefault(),pe("next");break;case c.keyMap.ArrowUp:var o;if(re)null===(o=J.current)||void 0===o||o.focus(),B(),e.preventDefault(),pe("prev");break;case c.keyMap.Tab:U&&_();break;default:re&&B()}},className:r.cx(Je,Qe[p],Ye[z],(l={},T(l,en[z],ee===J.current),T(l,nn[z],h),T(l,Ze[z],!h),l)),"aria-label":j,"aria-labelledby":M},v.default.createElement(x.default,{className:r.cx(an[z],ln[p],T({},on[z],h)),role:"presentation"}),v.default.createElement("input",{type:"search",className:r.cx(tn,rn[z]),value:le,onChange:function(e){null==ie||ie(e)},placeholder:o,ref:J,readOnly:h}),le&&v.default.createElement(S.default,{ref:Q,type:"button","aria-label":"Clear search",onClick:function(e){var n;e.stopPropagation(),oe(""),null==J||null===(n=J.current)||void 0===n||n.focus()},className:bn[p],tabIndex:h?-1:0,disabled:h},v.default.createElement(w.default,null))),re&&v.default.createElement(se,{open:U,refEl:V,ref:$},de))))}));mn.displayName="SearchInput";var vn,kn,xn,wn,Sn=c.createUniqueClassName("search-result-title"),On=c.createUniqueClassName("search-result-description"),En=r.css(sn||(sn=M(["\n display: block;\n font-family: ",";\n font-size: ","px;\n line-height: ","px;\n padding: ","px ","px;\n\n & ."," {\n font-weight: ",";\n }\n"])),d.fontFamilies.default,d.typeScales.body1.fontSize,d.spacing[3],d.spacing[1],d.spacing[3],Sn,d.fontWeights.bold),Dn=(T(dn={},c.Theme.Light,r.css(cn||(cn=M(["\n & ."," {\n color: ",";\n }\n & ."," {\n color: ",";\n }\n "])),Sn,p.palette.black,On,p.palette.gray.dark1)),T(dn,c.Theme.Dark,r.css(un||(un=M(["\n & ."," {\n color: ",";\n }\n & ."," {\n color: ",";\n }\n "])),Sn,p.palette.gray.light2,On,p.palette.gray.light1)),dn),jn=(T(hn={},c.Theme.Light,r.css(fn||(fn=M(["\n & ."," {\n color: ",";\n }\n & ."," {\n color: ",";\n }\n "])),Sn,p.palette.gray.light1,On,p.palette.gray.light1)),T(hn,c.Theme.Dark,r.css(pn||(pn=M(["\n & ."," {\n color: ",";\n }\n & ."," {\n color: ",";\n }\n "])),Sn,p.palette.gray.dark1,On,p.palette.gray.dark1)),hn),Cn=r.css(gn||(gn=M(["\n max-height: ","px;\n overflow: hidden;\n text-overflow: ellipsis;\n"])),3*d.spacing[3]),Tn=["as","children","description","disabled","className","darkMode"],Rn=b.InferredPolymorphic((function(e,n){var t,a=e.as,l=void 0===a?"li":a,i=e.children,o=e.description,u=e.disabled,d=e.className,p=e.darkMode,h=N(e,Tn),g=s.useDarkMode(p).theme,b=c.getNodeTextContent(i),y=null!==(t=h["aria-label"])&&void 0!==t?t:h["aria-labelledby"]?"":b;return v.default.createElement(f.InputOption,R({},h,{as:l,ref:n,className:r.cx(En,Dn[g],T({},jn[g],u),d),disabled:u,"aria-labelledby":h["aria-labelledby"],"aria-label":y}),v.default.createElement("div",{className:Sn},i),o&&v.default.createElement("div",{className:r.cx(On,Cn)},o))}),"SearchResult");Rn.displayName="SearchResult";var Nn=r.css(vn||(vn=M(["\n padding-top: 12px;\n padding-bottom: 0;\n"]))),Mn=(T(wn={},c.Theme.Light,r.css(kn||(kn=M(["\n color: ",";\n "])),p.palette.gray.dark1)),T(wn,c.Theme.Dark,r.css(xn||(xn=M(["\n color: ",";\n "])),p.palette.gray.base)),wn),Pn=["children","label"],qn=function(e){var n=e.children,t=e.label,r=N(e,Pn),a=c.validateChildren(n,["SearchResult","SearchResultGroup"]),l=s.useDarkMode().theme;return v.default.createElement("div",null,v.default.createElement(f.InputOption,R({"aria-label":t,isInteractive:!1,className:Nn},r),v.default.createElement(y.Overline,{className:Mn[l]},t)),a)};qn.displayName="SearchResultGroup",e.SearchInput=mn,e.SearchResult=Rn,e.SearchResultGroup=qn,e.Size=Ke,e.State=Be,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("lodash/isUndefined"),require("@leafygreen-ui/emotion"),require("@leafygreen-ui/hooks"),require("@leafygreen-ui/icon/dist/MagnifyingGlass"),require("@leafygreen-ui/icon/dist/XWithCircle"),require("@leafygreen-ui/icon-button"),require("@leafygreen-ui/leafygreen-provider"),require("@leafygreen-ui/lib"),require("@leafygreen-ui/popover"),require("@leafygreen-ui/tokens"),require("@leafygreen-ui/input-option"),require("@leafygreen-ui/palette"),require("@leafygreen-ui/icon/dist/Refresh"),require("polished"),require("@leafygreen-ui/polymorphic"),require("@leafygreen-ui/typography")):"function"==typeof define&&define.amd?define(["exports","react","lodash/isUndefined","@leafygreen-ui/emotion","@leafygreen-ui/hooks","@leafygreen-ui/icon/dist/MagnifyingGlass","@leafygreen-ui/icon/dist/XWithCircle","@leafygreen-ui/icon-button","@leafygreen-ui/leafygreen-provider","@leafygreen-ui/lib","@leafygreen-ui/popover","@leafygreen-ui/tokens","@leafygreen-ui/input-option","@leafygreen-ui/palette","@leafygreen-ui/icon/dist/Refresh","polished","@leafygreen-ui/polymorphic","@leafygreen-ui/typography"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["@leafygreen-ui/search-input"]={},e.React,e.isUndefined,e["@leafygreen-ui/emotion"],e["@leafygreen-ui/hooks"],e.MagnifyingGlass,e.XWithCircle,e["@leafygreen-ui/icon-button"],e["@leafygreen-ui/leafygreen-provider"],e["@leafygreen-ui/lib"],e["@leafygreen-ui/popover"],e["@leafygreen-ui/tokens"],e["@leafygreen-ui/input-option"],e["@leafygreen-ui/palette"],e.Refresh,e.polished,e["@leafygreen-ui/polymorphic"],e["@leafygreen-ui/typography"])}(this,(function(e,n,t,r,a,l,i,o,s,c,u,d,f,p,h,g,b,y){"use strict";function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v=m(n),k=m(t),x=m(l),w=m(i),S=m(o),E=m(s),O=m(u),D=m(h);function C(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 j(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?C(Object(t),!0).forEach((function(n){T(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):C(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function T(e,n,t){return(n=function(e){var n=function(e,n){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==typeof n?n:String(n)}(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function R(){return R=Object.assign?Object.assign.bind():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},R.apply(this,arguments)}function N(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)t=l[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)t=l[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function M(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}function q(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){var r,a,l,i,o=[],s=!0,c=!1;try{if(l=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;s=!1}else for(;!(s=(r=l.call(t)).done)&&(o.push(r.value),o.length!==n);s=!0);}catch(e){c=!0,a=e}finally{try{if(!s&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(c)throw a}}return o}}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return L(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return L(e,n)}(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,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 P,z,I,A,U=["children"],W=n.createContext({});function G(e){var n=e.children,t=N(e,U);return v.default.createElement(W.Provider,{value:t},n)}var F,X,H,B,K,V,$,J,Q,Y,Z=r.css(P||(P=M(["\n display: flex;\n align-items: center;\n gap: ","px;\n font-style: italic;\n font-weight: 300;\n padding-block: ","px;\n"])),d.spacing[2],d.spacing[1]),_=(T(A={},c.Theme.Light,r.css(z||(z=M(["\n color: ",";\n "])),p.palette.gray.dark1)),T(A,c.Theme.Dark,r.css(I||(I=M(["\n color: ",";\n "])),p.palette.gray.light1)),A),ee=function(){var e=s.useDarkMode().theme;return v.default.createElement(f.InputOption,{"aria-label":"No results found",isInteractive:!1,className:r.cx(Z,_[e])},v.default.createElement("span",null,"No results found"))},ne=r.css(F||(F=M(["\n display: flex;\n align-items: center;\n gap: ","px;\n padding-block: ","px;\n"])),d.spacing[2],d.spacing[1]),te=r.keyframes(X||(X=M(["\n from {\n transform: rotate(0deg);\n } \n to {\n transform: rotate(360deg);\n }\n"]))),re=r.css(H||(H=M(["\n height: 16px;\n width: 16px;\n animation: "," 1.5s linear infinite;\n"])),te),ae=function(){var e=s.useDarkMode().darkMode;return v.default.createElement(f.InputOption,{"data-testid":"lg-search-input-loading-option","aria-label":"Loading results",isInteractive:!1,className:ne},v.default.createElement(D.default,{color:e?p.palette.blue.light1:p.palette.blue.base,className:re}),v.default.createElement("span",null,"Loading results"))},le=r.css(B||(B=M(["\n box-shadow: 0px 4px 7px ",";\n padding: 12px 0;\n border-radius: 12px;\n"])),g.transparentize(.75,"#000000")),ie=(T($={},c.Theme.Light,r.css(K||(K=M(["\n background-color: ",";\n "])),p.palette.white)),T($,c.Theme.Dark,r.css(V||(V=M(["\n background-color: ",";\n "])),p.palette.gray.dark3)),$),oe=r.css(J||(J=M(["\n padding: 0;\n margin: 0;\n border-radius: inherit;\n overflow-y: auto;\n scroll-behavior: smooth;\n"]))),se=v.default.forwardRef((function(e,t){var l=e.children,i=e.open,o=void 0!==i&&i,c=e.refEl,u=s.useDarkMode().theme,f=n.useContext(W).state,p=n.useMemo((function(){var e,n;return null!==(e=null===(n=c.current)||void 0===n?void 0:n.clientWidth)&&void 0!==e?e:0}),[c,o]),h=a.useAvailableSpace(c),g=k.default(h)?"unset":"".concat(Math.min(h,256),"px");return v.default.createElement(O.default,{"data-testid":"lg-search-input-popover",spacing:d.spacing[2],active:o,align:"bottom",justify:"start",className:r.cx(le,ie[u],r.css(Q||(Q=M(["\n width: ","px;\n min-width: ","px;\n "])),p,p)),refEl:c},"loading"===f?v.default.createElement(ae,null):v.default.createElement("ul",{role:"listbox","aria-live":"polite","aria-relevant":"additions removals","aria-expanded":o,ref:t,className:r.cx(oe,r.css(Y||(Y=M(["\n max-height: ",";\n "])),g))},v.default.Children.count(l)?l:v.default.createElement(ee,null)))}));se.displayName="SearchResultsMenu";var ce,ue,de,fe,pe,he,ge,be,ye,me,ve,ke,xe,we,Se,Ee,Oe,De,Ce,je,Te,Re,Ne,Me,qe,Le,Pe,ze,Ie,Ae,Ue,We,Ge,Fe,Xe,He,Be,Ke={Unset:"unset",Loading:"loading"},Ve={Small:"small",Default:"default",Large:"large"},$e=function(e){return"0 0 0 100px ".concat(e," inset")},Je=r.css(ce||(ce=M(["\n outline: none;\n"]))),Qe=r.css(ue||(ue=M(["\n position: relative;\n display: grid;\n grid-auto-flow: column;\n align-items: center;\n justify-items: center;\n border: 1px solid;\n border-radius: 6px;\n z-index: 0;\n transition: ","ms ease-in-out;\n transition-property: border-color, box-shadow;\n"])),d.transitionDuration.default),Ye=(T(he={},Ve.Small,r.css(de||(de=M(["\n font-size: ","px;\n line-height: ","px;\n height: 28px;\n grid-template-columns: 28px 1fr;\n grid-auto-columns: 28px;\n "])),d.typeScales.body1.fontSize,d.typeScales.body1.lineHeight)),T(he,Ve.Default,r.css(fe||(fe=M(["\n font-size: ","px;\n line-height: ","px;\n height: 36px;\n grid-template-columns: 36px 1fr;\n grid-auto-columns: 36px;\n "])),d.typeScales.body1.fontSize,d.typeScales.body1.lineHeight)),T(he,Ve.Large,r.css(pe||(pe=M(["\n font-size: 18px;\n line-height: 32px;\n height: 48px;\n grid-template-columns: 48px 1fr;\n grid-auto-columns: 48px;\n "])))),he),Ze=(T(ye={},c.Theme.Light,r.css(ge||(ge=M(["\n color: ",";\n background: ",";\n border-color: ",";\n "])),p.palette.black,p.palette.white,p.palette.gray.base)),T(ye,c.Theme.Dark,r.css(be||(be=M(["\n color: ",";\n background-color: ",";\n border-color: ",";\n "])),p.palette.gray.light2,p.palette.gray.dark4,p.palette.gray.base)),ye),_e=(T(ke={},c.Theme.Light,r.css(me||(me=M(["\n &:hover,\n &:active {\n &:not(:disabled):not(:focus-within) {\n box-shadow: ",";\n }\n }\n "])),d.hoverRing.light.gray)),T(ke,c.Theme.Dark,r.css(ve||(ve=M(["\n &:hover,\n &:active {\n &:not(:disabled):not(:focus-within) {\n box-shadow: ",";\n }\n }\n "])),d.hoverRing.dark.gray)),ke),en=(T(Se={},c.Theme.Light,r.css(xe||(xe=M(["\n &:not(:disabled):focus-within {\n box-shadow: ",";\n border-color: ",";\n }\n "])),d.focusRing.light.input,p.palette.white)),T(Se,c.Theme.Dark,r.css(we||(we=M(["\n &:not(:disabled):focus-within {\n box-shadow: ",";\n border-color: ",";\n }\n "])),d.focusRing.dark.input,p.palette.gray.dark4)),Se),nn=(T(De={},c.Theme.Light,r.css(Ee||(Ee=M(["\n cursor: not-allowed;\n color: ",";\n background-color: ",";\n border-color: ",";\n "])),p.palette.gray.base,p.palette.gray.light2,p.palette.gray.light1)),T(De,c.Theme.Dark,r.css(Oe||(Oe=M(["\n cursor: not-allowed;\n color: ",";\n background-color: ",";\n border-color: ",";\n "])),p.palette.gray.dark2,p.palette.gray.dark3,p.palette.gray.dark2)),De),tn=r.css(Ce||(Ce=M(["\n font-size: inherit;\n line-height: inherit;\n color: inherit;\n background-color: inherit;\n font-family: ",";\n width: 100%;\n height: 1.5em;\n font-weight: ",";\n z-index: 1;\n outline: none;\n border: none;\n padding: 0;\n\n &:disabled {\n cursor: not-allowed;\n\n &:hover,\n &:active {\n box-shadow: none;\n }\n }\n\n &::placeholder {\n font-size: inherit;\n line-height: inherit;\n }\n &::-ms-clear,\n &::-ms-reveal {\n display: none;\n width: 0;\n height: 0;\n }\n &::-webkit-search-decoration,\n &::-webkit-search-cancel-button,\n &::-webkit-search-results-button,\n &::-webkit-search-results-decoration {\n display: none;\n }\n"])),d.fontFamilies.default,d.fontWeights.regular),rn=(T(Re={},c.Theme.Light,r.css(je||(je=M(["\n &:-webkit-autofill {\n color: inherit;\n background: transparent;\n border: none;\n -webkit-text-fill-color: inherit;\n\n &:not(:disabled) {\n box-shadow: ",";\n\n &:focus {\n box-shadow: ",",\n ",";\n }\n\n &:hover:not(:focus) {\n box-shadow: ",",\n ",";\n }\n }\n }\n\n &::placeholder {\n color: ",";\n font-weight: ",";\n }\n\n &:disabled {\n &::placeholder {\n color: ",";\n }\n\n &:-webkit-autofill {\n &,\n &:hover,\n &:focus {\n appearance: none;\n border: 1px solid ",";\n -webkit-text-fill-color: ",";\n box-shadow: ",";\n }\n }\n }\n "])),$e(p.palette.white),$e(p.palette.white),d.focusRing.light.input,$e(p.palette.white),d.hoverRing.light.gray,p.palette.gray.base,d.fontWeights.regular,p.palette.gray.base,p.palette.gray.base,p.palette.gray.base,$e(p.palette.gray.light2))),T(Re,c.Theme.Dark,r.css(Te||(Te=M(["\n &:-webkit-autofill {\n color: inherit;\n background: transparent;\n border: none;\n -webkit-text-fill-color: ",";\n &:not(:disabled) {\n box-shadow: ",";\n\n &:focus {\n box-shadow: ",",\n ",";\n border-color: ",";\n }\n\n &:hover:not(:focus) {\n box-shadow: ",",\n ",";\n }\n }\n }\n\n &::placeholder {\n color: ",";\n font-weight: ",";\n }\n\n &:disabled {\n &::placeholder {\n color: ",";\n }\n\n &:-webkit-autofill {\n &,\n &:hover,\n &:focus {\n appearance: none;\n border: 1px solid ",";\n -webkit-text-fill-color: ",";\n box-shadow: ",";\n }\n }\n }\n "])),p.palette.gray.light3,$e(p.palette.gray.dark4),$e(p.palette.gray.dark4),d.focusRing.dark.input,p.palette.blue.light1,$e(p.palette.gray.dark4),d.hoverRing.dark.gray,p.palette.gray.base,d.fontWeights.regular,p.palette.gray.base,p.palette.gray.dark1,p.palette.gray.dark1,$e(p.palette.gray.dark2))),Re),an=(T(qe={},c.Theme.Light,r.css(Ne||(Ne=M(["\n color: ",";\n "])),p.palette.gray.dark1)),T(qe,c.Theme.Dark,r.css(Me||(Me=M(["\n color: ",";\n "])),p.palette.gray.light1)),qe),ln=(T(Ie={},Ve.Small,r.css(Le||(Le=M(["\n left: 10px;\n "])))),T(Ie,Ve.Default,r.css(Pe||(Pe=M(["\n left: 12px;\n "])))),T(Ie,Ve.Large,r.css(ze||(ze=M(["\n left: 16px;\n "])))),Ie),on=(T(We={},c.Theme.Light,r.css(Ae||(Ae=M(["\n color: ",";\n "])),p.palette.gray.base)),T(We,c.Theme.Dark,r.css(Ue||(Ue=M(["\n color: ",";\n "])),p.palette.gray.dark1)),We);r.css(Ge||(Ge=M([""])));var sn,cn,un,dn,fn,pn,hn,gn,bn=(T(Be={},Ve.Small,r.css(Fe||(Fe=M(["\n height: 26px;\n width: 26px;\n "])))),T(Be,Ve.Default,r.css(Xe||(Xe=M(["\n height: 28px;\n width: 28px;\n "])))),T(Be,Ve.Large,r.css(He||(He=M(["\n height: 28px;\n width: 28px;\n "])))),Be),yn=["placeholder","className","darkMode","size","disabled","children","state","value","onChange","onSubmit","aria-label","aria-labelledby"],mn=v.default.forwardRef((function(e,t){var l,i=e.placeholder,o=void 0===i?"Search":i,u=e.className,d=e.darkMode,f=e.size,p=void 0===f?Ve.Default:f,h=e.disabled,g=e.children,b=e.state,y=void 0===b?Ke.Unset:b,m=e.value,O=e.onChange,D=e.onSubmit,C=e["aria-label"],M=e["aria-labelledby"],L=N(e,yn),P=s.useDarkMode(d),z=P.theme,I=P.darkMode,A=q(n.useState(!1),2),U=A[0],W=A[1],F=q(n.useState(0),2),X=F[0],H=F[1],B=function(){return W(!1)},K=function(){return W(!0)},V=n.useRef(null),$=n.useRef(null),J=n.useRef(null),Q=a.useForwardedRef(t,null),Y=n.useRef(null),Z=a.useDynamicRefs({prefix:"result"}),_=q(n.useState(),2),ee=_[0],ne=_[1],te=Z("".concat(X)),re=!k.default(g),ae=a.useControlledValue(m,O),le=ae.value,ie=ae.handleChange,oe=n.useCallback((function(e){Q.current&&(Q.current.value=e,ie(c.createSyntheticEvent(new Event("change",{cancelable:!0,bubbles:!0}),Q.current)))}),[ie,Q]),ce=n.useCallback((function(){var e=0,n=v.default.Children.map(g,(function n(t){if(c.isComponentType(t,"SearchResult")){var r,a=(e+=1)-1,l=c.getNodeTextContent(t);return v.default.cloneElement(t,j(j({},t.props),{},{id:"result-".concat(a),key:"result-".concat(a),ref:null!==(r=t.props.ref)&&void 0!==r?r:null==Z?void 0:Z("".concat(a)),highlighted:a===X,onClick:function(e){var n,r;if(null===(n=(r=t.props).onClick)||void 0===n||n.call(r,e),oe(l),e.detail>=1&&V.current&&Q.current){var a,i=new Event("submit",{cancelable:!0,bubbles:!0});null===(a=V.current)||void 0===a||a.dispatchEvent(i)}}}))}if(c.isComponentType(t,"SearchResultGroup")){var i=v.default.Children.map(t.props.children,n);if(i&&i.length>0)return v.default.cloneElement(t,j(j({},t.props),{},{children:i}))}}));return{resultsCount:e,updatedChildren:n}}),[g,X,Q,Z,oe]),ue=n.useMemo((function(){return ce()}),[ce]),de=ue.updatedChildren,fe=ue.resultsCount,pe=function(e){switch(e){case"first":H(0);break;case"last":H(fe);break;case"next":var n=!k.default(X)&&X+1<fe?X+1:0;H(n);break;case"prev":var t=!k.default(X)&&X-1>=0?X-1:fe-1;H(t)}};return a.useAutoScroll(te,J,12),a.useBackdropClick((function(){B()}),[$,J],U&&re),v.default.createElement(E.default,{darkMode:I},v.default.createElement(G,{state:y,highlight:X,resultDynamicRefs:Z},v.default.createElement("form",R({role:"search",ref:V,className:r.cx(Je,u),onSubmit:function(e){e.preventDefault(),null==D||D(e),re&&(B(),oe(""))}},L),v.default.createElement("div",{ref:$,role:"searchbox",tabIndex:-1,onMouseDown:function(e){h&&e.preventDefault()},onClick:function(e){!function(e){h?(e.preventDefault(),e.stopPropagation()):K()}(e)},onFocus:function(e){var n,t=e.target,r=t===Y.current?Y.current:null!==(n=Q.current)&&void 0!==n?n:t;r.focus(),ne(r)},onKeyDown:function(e){var n,t,r=null===(n=J.current)||void 0===n?void 0:n.contains(document.activeElement);if((null===(t=$.current)||void 0===t?void 0:t.contains(document.activeElement))||r)switch(e.keyCode){case c.keyMap.Enter:var a;null==te||null===(a=te.current)||void 0===a||a.click();break;case c.keyMap.Escape:var l;B(),null===(l=Q.current)||void 0===l||l.focus();break;case c.keyMap.ArrowDown:var i;if(re)null===(i=Q.current)||void 0===i||i.focus(),K(),e.preventDefault(),pe("next");break;case c.keyMap.ArrowUp:var o;if(re)null===(o=Q.current)||void 0===o||o.focus(),K(),e.preventDefault(),pe("prev");break;case c.keyMap.Tab:U&&B();break;default:re&&K()}},className:r.cx(Qe,Ye[p],Ze[z],(l={},T(l,en[z],ee===Q.current),T(l,nn[z],h),T(l,_e[z],!h),l)),"aria-label":C,"aria-labelledby":M},v.default.createElement(x.default,{className:r.cx(an[z],ln[p],T({},on[z],h)),role:"presentation"}),v.default.createElement("input",{type:"search",className:r.cx(tn,rn[z]),value:le,onChange:function(e){null==ie||ie(e)},placeholder:o,ref:Q,readOnly:h}),le&&v.default.createElement(S.default,{ref:Y,type:"button","aria-label":"Clear search",onClick:function(e){var n;e.stopPropagation(),oe(""),null==Q||null===(n=Q.current)||void 0===n||n.focus()},className:bn[p],tabIndex:h?-1:0,disabled:h},v.default.createElement(w.default,null))),re&&v.default.createElement(se,{open:U,refEl:$,ref:J},de))))}));mn.displayName="SearchInput";var vn,kn,xn,wn,Sn=c.createUniqueClassName("search-result-title"),En=c.createUniqueClassName("search-result-description"),On=r.css(sn||(sn=M(["\n display: block;\n font-family: ",";\n font-size: ","px;\n line-height: ","px;\n padding: ","px ","px;\n\n & ."," {\n font-weight: ",";\n }\n"])),d.fontFamilies.default,d.typeScales.body1.fontSize,d.spacing[3],d.spacing[1],d.spacing[3],Sn,d.fontWeights.bold),Dn=(T(dn={},c.Theme.Light,r.css(cn||(cn=M(["\n & ."," {\n color: ",";\n }\n & ."," {\n color: ",";\n }\n "])),Sn,p.palette.black,En,p.palette.gray.dark1)),T(dn,c.Theme.Dark,r.css(un||(un=M(["\n & ."," {\n color: ",";\n }\n & ."," {\n color: ",";\n }\n "])),Sn,p.palette.gray.light2,En,p.palette.gray.light1)),dn),Cn=(T(hn={},c.Theme.Light,r.css(fn||(fn=M(["\n & ."," {\n color: ",";\n }\n & ."," {\n color: ",";\n }\n "])),Sn,p.palette.gray.light1,En,p.palette.gray.light1)),T(hn,c.Theme.Dark,r.css(pn||(pn=M(["\n & ."," {\n color: ",";\n }\n & ."," {\n color: ",";\n }\n "])),Sn,p.palette.gray.dark1,En,p.palette.gray.dark1)),hn),jn=r.css(gn||(gn=M(["\n max-height: ","px;\n overflow: hidden;\n text-overflow: ellipsis;\n"])),3*d.spacing[3]),Tn=["as","children","description","disabled","className","darkMode"],Rn=b.InferredPolymorphic((function(e,n){var t,a=e.as,l=void 0===a?"li":a,i=e.children,o=e.description,u=e.disabled,d=e.className,p=e.darkMode,h=N(e,Tn),g=s.useDarkMode(p).theme,b=c.getNodeTextContent(i),y=null!==(t=h["aria-label"])&&void 0!==t?t:h["aria-labelledby"]?"":b;return v.default.createElement(f.InputOption,R({},h,{as:l,ref:n,className:r.cx(On,Dn[g],T({},Cn[g],u),d),disabled:u,"aria-labelledby":h["aria-labelledby"],"aria-label":y}),v.default.createElement("div",{className:Sn},i),o&&v.default.createElement("div",{className:r.cx(En,jn)},o))}),"SearchResult");Rn.displayName="SearchResult";var Nn=r.css(vn||(vn=M(["\n padding-top: 12px;\n padding-bottom: 0;\n"]))),Mn=(T(wn={},c.Theme.Light,r.css(kn||(kn=M(["\n color: ",";\n "])),p.palette.gray.dark1)),T(wn,c.Theme.Dark,r.css(xn||(xn=M(["\n color: ",";\n "])),p.palette.gray.base)),wn),qn=["children","label"],Ln=function(e){var n=e.children,t=e.label,r=N(e,qn),a=c.validateChildren(n,["SearchResult","SearchResultGroup"]),l=s.useDarkMode().theme;return v.default.createElement("div",null,v.default.createElement(f.InputOption,R({"aria-label":t,isInteractive:!1,className:Nn},r),v.default.createElement(y.Overline,{className:Mn[l]},t)),a)};Ln.displayName="SearchResultGroup",e.SearchInput=mn,e.SearchResult=Rn,e.SearchResultGroup=Ln,e.Size=Ve,e.State=Ke})); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@leafygreen-ui/search-input", | ||
"version": "2.0.8", | ||
"version": "2.0.9", | ||
"description": "leafyGreen UI Kit Search Input", | ||
@@ -16,3 +16,5 @@ "main": "./dist/index.js", | ||
"scripts": { | ||
"build": "../../node_modules/.bin/rollup --config ../../rollup.config.js" | ||
"build": "lg build-package", | ||
"tsc": "lg build-ts", | ||
"docs": "lg build-tsdoc" | ||
}, | ||
@@ -32,14 +34,14 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@leafygreen-ui/a11y": "^1.4.3", | ||
"@leafygreen-ui/emotion": "^4.0.4", | ||
"@leafygreen-ui/hooks": "^7.7.5", | ||
"@leafygreen-ui/icon": "^11.17.0", | ||
"@leafygreen-ui/icon-button": "^15.0.12", | ||
"@leafygreen-ui/input-option": "^1.0.5", | ||
"@leafygreen-ui/lib": "^10.4.0", | ||
"@leafygreen-ui/palette": "^4.0.4", | ||
"@leafygreen-ui/polymorphic": "^1.3.2", | ||
"@leafygreen-ui/popover": "^11.0.12", | ||
"@leafygreen-ui/tokens": "^2.1.1", | ||
"@leafygreen-ui/typography": "^16.5.1", | ||
"@leafygreen-ui/a11y": "^1.4.5", | ||
"@leafygreen-ui/emotion": "^4.0.5", | ||
"@leafygreen-ui/hooks": "^7.7.6", | ||
"@leafygreen-ui/icon": "^11.20.1", | ||
"@leafygreen-ui/icon-button": "^15.0.14", | ||
"@leafygreen-ui/input-option": "^1.0.6", | ||
"@leafygreen-ui/lib": "^10.4.1", | ||
"@leafygreen-ui/palette": "^4.0.5", | ||
"@leafygreen-ui/polymorphic": "^1.3.3", | ||
"@leafygreen-ui/popover": "^11.0.13", | ||
"@leafygreen-ui/tokens": "^2.1.2", | ||
"@leafygreen-ui/typography": "^16.5.2", | ||
"lodash": "^4.17.21", | ||
@@ -49,4 +51,5 @@ "polished": "^4.2.2" | ||
"peerDependencies": { | ||
"@leafygreen-ui/leafygreen-provider": "^3.1.3" | ||
} | ||
"@leafygreen-ui/leafygreen-provider": "^3.1.4" | ||
}, | ||
"devDependencies": {} | ||
} |
{ | ||
"extends": "../../package.tsconfig.json", | ||
"compilerOptions": { | ||
"extends": "@lg-tools/build/config/package.tsconfig.json", | ||
"compilerOptions": { | ||
"declarationDir": "dist", | ||
"outDir": "dist", | ||
"rootDir": "src" | ||
"rootDir": "src", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@leafygreen-ui/icon/dist/*": ["../icon/src/generated/*"], | ||
"@leafygreen-ui/*": ["../*/src"] | ||
} | ||
}, | ||
@@ -11,2 +16,3 @@ "include": [ | ||
], | ||
"exclude": ["**/*.spec.*", "**/*.story.*"], | ||
"references": [ | ||
@@ -13,0 +19,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
410460
94
3782
Updated@leafygreen-ui/a11y@^1.4.5
Updated@leafygreen-ui/hooks@^7.7.6
Updated@leafygreen-ui/icon@^11.20.1
Updated@leafygreen-ui/lib@^10.4.1
Updated@leafygreen-ui/tokens@^2.1.2