"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("../tslib.es6-C4EgNkz1.js"),T=require("classnames"),e=require("react"),j=require("../icons/ebay-icon-chevron-down-12/index.js"),A=o=>{var{children:v,selected:u,defaultSelected:h=!1,expanded:p,defaultExpanded:x=!1,variant:t="default",icon:b,image:E,a11ySelectedText:C="Filter Applied",href:f,className:S,onClick:s,disabled:i}=o,_=R.__rest(o,["children","selected","defaultSelected","expanded","defaultExpanded","variant","icon","image","a11ySelectedText","href","className","onClick","disabled"]);const[y,N]=e.useState(h),[g,k]=e.useState(x),m=e.useRef(null),a=u!==void 0?u:y,c=p!==void 0?p:g,n=!!f&&t!=="menu";e.useLayoutEffect(()=>{var d,l;(l=(d=m.current)===null||d===void 0?void 0:d.classList)===null||l===void 0||l.add("filter-chip--animated")},[]);const q=d=>{if(!i){let l=c,r=a;t==="menu"?(l=!c,k(l)):(r=!a,N(r)),s?.(d,{expanded:l,selected:r})}},w=T("filter-chip",{"filter-chip--expressive":t==="expressive","filter-chip--selected":n&&a},S),F=n?"a":"button";return e.createElement(F,Object.assign({},_,{ref:m,className:w,onClick:q,href:i?void 0:f,type:n?void 0:"button","aria-pressed":n?void 0:a?"true":"false","aria-expanded":t==="menu"?c?"true":"false":void 0,disabled:n?void 0:i}),t==="expressive"?e.createElement("span",{className:"filter-chip__media"},E):null,t==="default"?b:null,e.createElement("span",{className:"filter-chip__text"},v,a&&n?e.createElement("span",{className:"clipped"},"- ",C):null),t==="menu"?e.createElement(j.EbayIconChevronDown12,{className:"filter-chip__trailing"}):null)};exports.EbayFilterChip=A;
