@fluid-topics/ft-search-bar 0.3.43 → 0.3.46

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.
@@ -135,10 +135,11 @@ export const searchBarCss = css `
135
135
  .ft-search-bar > ft-button,
136
136
  .ft-search-bar--actions ft-button {
137
137
  flex-shrink: 0;
138
+ ${setVariable(FtButtonCssVariables.backgroundColor, "transparent")};
138
139
  }
139
140
 
140
141
  .ft-search-bar--left-action {
141
- ${setVariable(FtButtonCssVariables.borderRadius, css `calc(${FtSearchBarCssVariables.borderRadius} - 1px) 0 0 calc(${FtSearchBarCssVariables.borderRadius} - 1px)`)};
142
+ ${setVariable(FtButtonCssVariables.borderRadius, `calc(${FtSearchBarCssVariables.borderRadius} - 1px) 0 0 calc(${FtSearchBarCssVariables.borderRadius} - 1px)`)};
142
143
  border-right: 1px solid ${FtSearchBarCssVariables.colorOutline};
143
144
  height: 100%;
144
145
  }
@@ -148,7 +149,7 @@ export const searchBarCss = css `
148
149
  }
149
150
 
150
151
  .ft-search-bar--floating-panel-open .ft-search-bar--left-action {
151
- ${setVariable(FtButtonCssVariables.borderRadius, css `calc(${FtSearchBarCssVariables.borderRadius} - 1px) 0 0 0`)};
152
+ ${setVariable(FtButtonCssVariables.borderRadius, `calc(${FtSearchBarCssVariables.borderRadius} - 1px) 0 0 0`)};
152
153
  }
153
154
 
154
155
  .ft-search-bar .ft-search-bar--launch-search,
@@ -163,7 +164,7 @@ export const searchBarCss = css `
163
164
 
164
165
  .ft-search-bar--left-action.ft-search-bar--content-locale {
165
166
  ${setVariable(FtInputLabelCssVariables.borderColor, "transparent")};
166
- ${setVariable(FtInputLabelCssVariables.borderRadiusS, css `calc(${FtSearchBarCssVariables.borderRadius} - 1px)`)};
167
+ ${setVariable(FtInputLabelCssVariables.borderRadiusS, `calc(${FtSearchBarCssVariables.borderRadius} - 1px)`)};
167
168
  ${setVariable(FtSelectCssVariables.selectedOptionColor, FtSearchBarCssVariables.buttonColor)};
168
169
  }
169
170
 
@@ -232,6 +233,7 @@ export const facetsCss = css `
232
233
  gap: 16px;
233
234
  align-items: center;
234
235
  justify-content: space-evenly;
236
+ flex-wrap: wrap;
235
237
  }
236
238
 
237
239
  .ft-search-bar--mobile .ft-search-bar--facets-actions > * {
@@ -305,20 +307,26 @@ export const facetsCss = css `
305
307
  display: flex;
306
308
  justify-content: space-between;
307
309
  align-items: baseline;
310
+ flex-wrap: wrap;
308
311
  gap: 8px;
309
312
  }
310
313
 
311
314
  .ft-search-bar--filter-label > * {
312
- white-space: nowrap;
315
+ display: -webkit-box;
316
+ -webkit-line-clamp: 2;
317
+ -webkit-box-orient: vertical;
318
+ word-break: break-all;
319
+ word-break: break-word;
320
+ hyphens: auto;
313
321
  overflow: hidden;
314
- text-overflow: ellipsis;
315
- }
316
-
317
- .ft-search-bar--filter-label > :first-child {
318
- flex-shrink: 0;
322
+ min-width: 75px;
323
+ max-width: 100%;
324
+ flex-grow: 1;
325
+ flex-shrink: 1;
319
326
  }
320
327
 
321
- .ft-search-bar--filter-label > :last-child {
328
+ .ft-search-bar--filter-label-values {
329
+ flex-grow: 0;
322
330
  flex-shrink: 1;
323
331
  color: ${FtSearchBarCssVariables.colorOnSurfaceMedium};
324
332
  }
@@ -91,7 +91,7 @@ export class FtSearchBar extends FtLitElement {
91
91
  this.suggestManager = new SuggestManager(this);
92
92
  this.selectedFacetsManager = new FacetsChipsManager(this);
93
93
  this.desktopSearchBarManager = new DesktopSearchBarManager(this);
94
- this.mobileSearchBarManager = new MobileSearchBarManager(this);
94
+ this.mobileSearchBarManager = new MobileSearchBarManager(this, this.selectedFacetsManager, this.suggestManager);
95
95
  this.stateChangeEventDebouncer = new Debouncer(10);
96
96
  this.initDataDebouncer = new Debouncer(10);
97
97
  this.facetsLoaded = false;
@@ -195,7 +195,6 @@ export class FtSearchBar extends FtLitElement {
195
195
  `;
196
196
  }
197
197
  renderMobileFacets() {
198
- var _a;
199
198
  const currentLocale = this.availableContentLocales.filter(l => l.lang === this.contentLocale).pop();
200
199
  return html `
201
200
  <ft-accordion class="ft-search-bar--filters-container">
@@ -204,9 +203,11 @@ export class FtSearchBar extends FtLitElement {
204
203
  <div class="ft-search-bar--filter-label" slot="toggle">
205
204
  <ft-typography variant="button">${this.labelResolver.resolve("contentLocaleSelector")}
206
205
  </ft-typography>
207
- <ft-typography variant="body2">
208
- ${(_a = currentLocale === null || currentLocale === void 0 ? void 0 : currentLocale.label) !== null && _a !== void 0 ? _a : ""}
209
- </ft-typography>
206
+ ${(currentLocale === null || currentLocale === void 0 ? void 0 : currentLocale.label) ? html `
207
+ <ft-typography class="ft-search-bar--filter-label-values" variant="body2">
208
+ ${currentLocale === null || currentLocale === void 0 ? void 0 : currentLocale.label}
209
+ </ft-typography>
210
+ ` : nothing}
210
211
  </div>
211
212
  <ft-filter
212
213
  id="ft:locale"
@@ -222,13 +223,16 @@ export class FtSearchBar extends FtLitElement {
222
223
  ${repeat(this.facets, facet => facet.key, facet => {
223
224
  const filter = facetToFilter(facet);
224
225
  const keyWithNoColumn = facet.key.replace(":", "-");
226
+ const values = selectedValues(filter);
225
227
  return facet.rootNodes.length > 0 ? html `
226
228
  <ft-accordion-item data-facet-key="${facet.key}">
227
229
  <div class="ft-search-bar--filter-label" slot="toggle">
228
230
  <ft-typography variant="button">${facet.label}</ft-typography>
229
- <ft-typography variant="body2">
230
- ${selectedValues(filter).join(", ")}
231
- </ft-typography>
231
+ ${values.length > 0 ? html `
232
+ <ft-typography class="ft-search-bar--filter-label-values" variant="body2">
233
+ ${values.join(", ")}
234
+ </ft-typography>
235
+ ` : nothing}
232
236
  </div>
233
237
  <ft-filter
234
238
  part="filters filter filter-${keyWithNoColumn}"
@@ -422,6 +426,7 @@ export class FtSearchBar extends FtLitElement {
422
426
  }
423
427
  initSearchData() {
424
428
  this.availableContentLocalesInitialized = false;
429
+ this.facetsLoaded = false;
425
430
  this.facetsInitialized = false;
426
431
  this.initDataDebouncer.run(() => {
427
432
  var _a;
@@ -430,7 +435,10 @@ export class FtSearchBar extends FtLitElement {
430
435
  this.availableContentLocalesInitialized = true;
431
436
  });
432
437
  this.retrieveFacetsFromSearch()
433
- .then(() => this.facetsInitialized = true);
438
+ .then(() => {
439
+ this.facetsLoaded = true;
440
+ this.facetsInitialized = true;
441
+ });
434
442
  });
435
443
  }
436
444
  contentAvailableCallback(props) {
@@ -714,4 +722,7 @@ __decorate([
714
722
  __decorate([
715
723
  state()
716
724
  ], FtSearchBar.prototype, "api", void 0);
725
+ __decorate([
726
+ state()
727
+ ], FtSearchBar.prototype, "facetsLoaded", void 0);
717
728
  //# sourceMappingURL=ft-search-bar.js.map
@@ -1920,10 +1920,11 @@ const q=Symbol.for(""),W=t=>{if((null==t?void 0:t.r)===q)return null==t?void 0:t
1920
1920
  .ft-search-bar > ft-button,
1921
1921
  .ft-search-bar--actions ft-button {
1922
1922
  flex-shrink: 0;
1923
+ ${e.setVariable(Le.backgroundColor,"transparent")};
1923
1924
  }
1924
1925
 
1925
1926
  .ft-search-bar--left-action {
1926
- ${e.setVariable(Le.borderRadius,i.css`calc(${oo.borderRadius} - 1px) 0 0 calc(${oo.borderRadius} - 1px)`)};
1927
+ ${e.setVariable(Le.borderRadius,`calc(${oo.borderRadius} - 1px) 0 0 calc(${oo.borderRadius} - 1px)`)};
1927
1928
  border-right: 1px solid ${oo.colorOutline};
1928
1929
  height: 100%;
1929
1930
  }
@@ -1933,7 +1934,7 @@ const q=Symbol.for(""),W=t=>{if((null==t?void 0:t.r)===q)return null==t?void 0:t
1933
1934
  }
1934
1935
 
1935
1936
  .ft-search-bar--floating-panel-open .ft-search-bar--left-action {
1936
- ${e.setVariable(Le.borderRadius,i.css`calc(${oo.borderRadius} - 1px) 0 0 0`)};
1937
+ ${e.setVariable(Le.borderRadius,`calc(${oo.borderRadius} - 1px) 0 0 0`)};
1937
1938
  }
1938
1939
 
1939
1940
  .ft-search-bar .ft-search-bar--launch-search,
@@ -1948,7 +1949,7 @@ const q=Symbol.for(""),W=t=>{if((null==t?void 0:t.r)===q)return null==t?void 0:t
1948
1949
 
1949
1950
  .ft-search-bar--left-action.ft-search-bar--content-locale {
1950
1951
  ${e.setVariable(Ki.borderColor,"transparent")};
1951
- ${e.setVariable(Ki.borderRadiusS,i.css`calc(${oo.borderRadius} - 1px)`)};
1952
+ ${e.setVariable(Ki.borderRadiusS,`calc(${oo.borderRadius} - 1px)`)};
1952
1953
  ${e.setVariable(Xi.selectedOptionColor,oo.buttonColor)};
1953
1954
  }
1954
1955
 
@@ -2015,6 +2016,7 @@ const q=Symbol.for(""),W=t=>{if((null==t?void 0:t.r)===q)return null==t?void 0:t
2015
2016
  gap: 16px;
2016
2017
  align-items: center;
2017
2018
  justify-content: space-evenly;
2019
+ flex-wrap: wrap;
2018
2020
  }
2019
2021
 
2020
2022
  .ft-search-bar--mobile .ft-search-bar--facets-actions > * {
@@ -2088,20 +2090,26 @@ const q=Symbol.for(""),W=t=>{if((null==t?void 0:t.r)===q)return null==t?void 0:t
2088
2090
  display: flex;
2089
2091
  justify-content: space-between;
2090
2092
  align-items: baseline;
2093
+ flex-wrap: wrap;
2091
2094
  gap: 8px;
2092
2095
  }
2093
2096
 
2094
2097
  .ft-search-bar--filter-label > * {
2095
- white-space: nowrap;
2098
+ display: -webkit-box;
2099
+ -webkit-line-clamp: 2;
2100
+ -webkit-box-orient: vertical;
2101
+ word-break: break-all;
2102
+ word-break: break-word;
2103
+ hyphens: auto;
2096
2104
  overflow: hidden;
2097
- text-overflow: ellipsis;
2098
- }
2099
-
2100
- .ft-search-bar--filter-label > :first-child {
2101
- flex-shrink: 0;
2105
+ min-width: 75px;
2106
+ max-width: 100%;
2107
+ flex-grow: 1;
2108
+ flex-shrink: 1;
2102
2109
  }
2103
2110
 
2104
- .ft-search-bar--filter-label > :last-child {
2111
+ .ft-search-bar--filter-label-values {
2112
+ flex-grow: 0;
2105
2113
  flex-shrink: 1;
2106
2114
  color: ${oo.colorOnSurfaceMedium};
2107
2115
  }
@@ -2432,22 +2440,24 @@ const q=Symbol.for(""),W=t=>{if((null==t?void 0:t.r)===q)return null==t?void 0:t
2432
2440
  </div>
2433
2441
  `}onSearchBarKeyDown(t){var e;switch(t.key){case"Escape":this.searchBar.mobileMenuOpen=!1,null===(e=this.searchBar.input)||void 0===e||e.blur();break;case"ArrowDown":t.stopPropagation(),t.preventDefault(),this.suggestManager.focusFirstSuggestion()}}onSearchBarKeyUp(t){const e=t.composedPath()[0];this.searchBar.query=e.value,"Enter"===t.key&&this.searchBar.launchSearch()}}ho.styles=i.css`
2434
2442
 
2435
- `;var po=function(t,e,i,o){for(var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,l=t.length-1;l>=0;l--)(s=t[l])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};null==window.fluidtopics&&console.warn("Fluid Topics public API was not found. You can find it here: https://www.npmjs.com/package/@fluid-topics/public-api");const fo={filtersButton:"Filters",inputPlaceHolder:"Search",filterInputPlaceHolder:"Filter {0}",clearInputButton:"Clear",clearFilterButton:"Clear",displayMoreFilterValuesButton:"More",noFilterValuesAvailable:"No values available",searchButton:"Search",clearFilters:"Clear filters",contentLocaleSelector:"Lang",presetsSelector:"Quick filters",removeRecentSearch:"Remove",back:"Back"};class uo extends CustomEvent{constructor(t){super("launch-search",{detail:t,bubbles:!0,composed:!0})}}class bo extends CustomEvent{constructor(t){super("change",{detail:t})}}const vo=()=>{};class go extends e.FtLitElement{constructor(){super(...arguments),this.dense=!1,this.mode="auto",this.forceMobileMenuOpen=!1,this.forceMenuOpen=!1,this.baseUrl="",this.apiIntegrationIdentifier="ft-search-bar",this.availableContentLocales=[],this.availableContentLocalesInitialized=!1,this.labels={},this.labelResolver=new e.ParametrizedLabelResolver(fo,{}),this.displayedFilters=[],this.presets=[],this.priors=[],this.searchRequestSerializer=t=>function(t,e){var i;const o=new URLSearchParams({"content-lang":null!==(i=e.contentLocale)&&void 0!==i?i:"all",query:e.query});if(e.filters.length>0){const t=e.filters.map((t=>{const e=t.values.map((t=>t.replace(/_/g,"\\\\\\\\_").replace(/~/g,"\\\\~").replace(/\*/g,"\\*"))).map((t=>encodeURIComponent(function(t){return`"${t}"`}(t)))).join("_");return`${t.key}~${e}`})).join("*");o.append("filters",t)}return new URL(`${t}/search/all?${o.toString()}`).href}(this.baseUrl,t),this.searchFilters=[],this.sizeCategory=l.M,this.displayFacets=!1,this.mobileMenuOpen=!1,this.facets=[],this.facetsInitialized=!1,this.knownFacetLabels=new Map,this.query="",this.suggestions=[],this.recentSearches=[],this.suggestManager=new lo(this),this.selectedFacetsManager=new ao(this),this.desktopSearchBarManager=new ho(this),this.mobileSearchBarManager=new co(this),this.stateChangeEventDebouncer=new e.Debouncer(10),this.initDataDebouncer=new e.Debouncer(10),this.facetsLoaded=!1,this.updateFacetsDebouncer=new e.Debouncer(500),this.closeFloatingContainer=t=>{this.isMobile()||(this.displayFacets=this.displayFacets&&t.composedPath().some((t=>t===this.floatingContainer)))},this.compareFilters=(t,e)=>t.key===e.key&&t.negative==e.negative&&t.values.length===e.values.length&&t.values.every((t=>e.values.includes(t))),this.compareRequests=(t,e)=>(null==t.contentLocale||null==e.contentLocale||t.contentLocale===e.contentLocale)&&t.filters.length===e.filters.length&&t.filters.every((t=>e.filters.some((e=>this.compareFilters(t,e)))))}isMobileMenuOpen(){return this.isMobile()&&(this.forceMobileMenuOpen||this.forceMenuOpen||this.mobileMenuOpen)}get request(){return{uiLocale:this.uiLocale,contentLocale:this.contentLocale,query:this.query,facets:this.facetsRequest,priors:this.hasPriors?this.priors:void 0,filters:this.searchFilters,paging:{perPage:0,page:1},sort:[]}}get facetsRequest(){const t=this.searchFilters.filter((t=>t.values.length>0&&!this.displayedFilters.includes(t.key))).map((t=>({id:t.key})));return[...this.displayedFilters.map((t=>({id:t}))),...t]}get suggestRequest(){return{contentLocale:this.contentLocale,input:this.query,filters:this.searchFilters,sort:[]}}isMobile(){switch(this.mode){case"mobile":return!0;case"desktop":return!1;default:return this.sizeCategory===l.S}}hasFacets(){return this.facetsRequest.length>0}get hasPresets(){return null!=this.presets&&this.presets.length>0}get hasPriors(){return null!=this.priors&&this.priors.length>0}hasLocaleSelector(){return this.availableContentLocales.length>1}focus(){var t;null===(t=this.container)||void 0===t||t.focus()}focusInput(){this.input?this.input.focus():setTimeout((()=>this.focusInput()),50)}clear(){this.query="",this.searchFilters=[],this.input&&(this.input.value=""),this.mobileMenuOpen=!1,this.displayFacets=!1}render(){return i.html`
2443
+ `;var po=function(t,e,i,o){for(var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,l=t.length-1;l>=0;l--)(s=t[l])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};null==window.fluidtopics&&console.warn("Fluid Topics public API was not found. You can find it here: https://www.npmjs.com/package/@fluid-topics/public-api");const fo={filtersButton:"Filters",inputPlaceHolder:"Search",filterInputPlaceHolder:"Filter {0}",clearInputButton:"Clear",clearFilterButton:"Clear",displayMoreFilterValuesButton:"More",noFilterValuesAvailable:"No values available",searchButton:"Search",clearFilters:"Clear filters",contentLocaleSelector:"Lang",presetsSelector:"Quick filters",removeRecentSearch:"Remove",back:"Back"};class uo extends CustomEvent{constructor(t){super("launch-search",{detail:t,bubbles:!0,composed:!0})}}class bo extends CustomEvent{constructor(t){super("change",{detail:t})}}const vo=()=>{};class go extends e.FtLitElement{constructor(){super(...arguments),this.dense=!1,this.mode="auto",this.forceMobileMenuOpen=!1,this.forceMenuOpen=!1,this.baseUrl="",this.apiIntegrationIdentifier="ft-search-bar",this.availableContentLocales=[],this.availableContentLocalesInitialized=!1,this.labels={},this.labelResolver=new e.ParametrizedLabelResolver(fo,{}),this.displayedFilters=[],this.presets=[],this.priors=[],this.searchRequestSerializer=t=>function(t,e){var i;const o=new URLSearchParams({"content-lang":null!==(i=e.contentLocale)&&void 0!==i?i:"all",query:e.query});if(e.filters.length>0){const t=e.filters.map((t=>{const e=t.values.map((t=>t.replace(/_/g,"\\\\\\\\_").replace(/~/g,"\\\\~").replace(/\*/g,"\\*"))).map((t=>encodeURIComponent(function(t){return`"${t}"`}(t)))).join("_");return`${t.key}~${e}`})).join("*");o.append("filters",t)}return new URL(`${t}/search/all?${o.toString()}`).href}(this.baseUrl,t),this.searchFilters=[],this.sizeCategory=l.M,this.displayFacets=!1,this.mobileMenuOpen=!1,this.facets=[],this.facetsInitialized=!1,this.knownFacetLabels=new Map,this.query="",this.suggestions=[],this.recentSearches=[],this.suggestManager=new lo(this),this.selectedFacetsManager=new ao(this),this.desktopSearchBarManager=new ho(this),this.mobileSearchBarManager=new co(this,this.selectedFacetsManager,this.suggestManager),this.stateChangeEventDebouncer=new e.Debouncer(10),this.initDataDebouncer=new e.Debouncer(10),this.facetsLoaded=!1,this.updateFacetsDebouncer=new e.Debouncer(500),this.closeFloatingContainer=t=>{this.isMobile()||(this.displayFacets=this.displayFacets&&t.composedPath().some((t=>t===this.floatingContainer)))},this.compareFilters=(t,e)=>t.key===e.key&&t.negative==e.negative&&t.values.length===e.values.length&&t.values.every((t=>e.values.includes(t))),this.compareRequests=(t,e)=>(null==t.contentLocale||null==e.contentLocale||t.contentLocale===e.contentLocale)&&t.filters.length===e.filters.length&&t.filters.every((t=>e.filters.some((e=>this.compareFilters(t,e)))))}isMobileMenuOpen(){return this.isMobile()&&(this.forceMobileMenuOpen||this.forceMenuOpen||this.mobileMenuOpen)}get request(){return{uiLocale:this.uiLocale,contentLocale:this.contentLocale,query:this.query,facets:this.facetsRequest,priors:this.hasPriors?this.priors:void 0,filters:this.searchFilters,paging:{perPage:0,page:1},sort:[]}}get facetsRequest(){const t=this.searchFilters.filter((t=>t.values.length>0&&!this.displayedFilters.includes(t.key))).map((t=>({id:t.key})));return[...this.displayedFilters.map((t=>({id:t}))),...t]}get suggestRequest(){return{contentLocale:this.contentLocale,input:this.query,filters:this.searchFilters,sort:[]}}isMobile(){switch(this.mode){case"mobile":return!0;case"desktop":return!1;default:return this.sizeCategory===l.S}}hasFacets(){return this.facetsRequest.length>0}get hasPresets(){return null!=this.presets&&this.presets.length>0}get hasPriors(){return null!=this.priors&&this.priors.length>0}hasLocaleSelector(){return this.availableContentLocales.length>1}focus(){var t;null===(t=this.container)||void 0===t||t.focus()}focusInput(){this.input?this.input.focus():setTimeout((()=>this.focusInput()),50)}clear(){this.query="",this.searchFilters=[],this.input&&(this.input.value=""),this.mobileMenuOpen=!1,this.displayFacets=!1}render(){return i.html`
2436
2444
  <ft-size-watcher @change=${this.updateSize}></ft-size-watcher>
2437
2445
  ${this.renderSearchBar()}
2438
2446
  `}renderSearchBar(){return this.facetsInitialized&&this.availableContentLocalesInitialized?this.isMobile()?this.mobileSearchBarManager.render():this.desktopSearchBarManager.render():i.html`
2439
2447
  <ft-skeleton class="ft-search-bar--container ft-search-bar--skeleton" part="loader"
2440
2448
  tabindex="-1"></ft-skeleton>
2441
- `}renderMobileFacets(){var t;const e=this.availableContentLocales.filter((t=>t.lang===this.contentLocale)).pop();return i.html`
2449
+ `}renderMobileFacets(){const t=this.availableContentLocales.filter((t=>t.lang===this.contentLocale)).pop();return i.html`
2442
2450
  <ft-accordion class="ft-search-bar--filters-container">
2443
2451
  ${this.hasLocaleSelector()?i.html`
2444
2452
  <ft-accordion-item data-facet-key="ft:locale">
2445
2453
  <div class="ft-search-bar--filter-label" slot="toggle">
2446
2454
  <ft-typography variant="button">${this.labelResolver.resolve("contentLocaleSelector")}
2447
2455
  </ft-typography>
2448
- <ft-typography variant="body2">
2449
- ${null!==(t=null==e?void 0:e.label)&&void 0!==t?t:""}
2450
- </ft-typography>
2456
+ ${(null==t?void 0:t.label)?i.html`
2457
+ <ft-typography class="ft-search-bar--filter-label-values" variant="body2">
2458
+ ${null==t?void 0:t.label}
2459
+ </ft-typography>
2460
+ `:i.nothing}
2451
2461
  </div>
2452
2462
  <ft-filter
2453
2463
  id="ft:locale"
@@ -2460,13 +2470,15 @@ const q=Symbol.for(""),W=t=>{if((null==t?void 0:t.r)===q)return null==t?void 0:t
2460
2470
  ></ft-filter>
2461
2471
  </ft-accordion-item>
2462
2472
  `:null}
2463
- ${s.repeat(this.facets,(t=>t.key),(t=>{const e=se(t),o=t.key.replace(":","-");return t.rootNodes.length>0?i.html`
2473
+ ${s.repeat(this.facets,(t=>t.key),(t=>{const e=se(t),o=t.key.replace(":","-"),s=function(t){return ee(t.options,(t=>{var e;return null!==(e=t.subOptions)&&void 0!==e?e:[]})).filter((t=>t.selected)).map((t=>t.label))}(e);return t.rootNodes.length>0?i.html`
2464
2474
  <ft-accordion-item data-facet-key="${t.key}">
2465
2475
  <div class="ft-search-bar--filter-label" slot="toggle">
2466
2476
  <ft-typography variant="button">${t.label}</ft-typography>
2467
- <ft-typography variant="body2">
2468
- ${function(t){return ee(t.options,(t=>{var e;return null!==(e=t.subOptions)&&void 0!==e?e:[]})).filter((t=>t.selected)).map((t=>t.label))}(e).join(", ")}
2469
- </ft-typography>
2477
+ ${s.length>0?i.html`
2478
+ <ft-typography class="ft-search-bar--filter-label-values" variant="body2">
2479
+ ${s.join(", ")}
2480
+ </ft-typography>
2481
+ `:i.nothing}
2470
2482
  </div>
2471
2483
  <ft-filter
2472
2484
  part="filters filter filter-${o}"
@@ -2561,10 +2573,10 @@ const q=Symbol.for(""),W=t=>{if((null==t?void 0:t.r)===q)return null==t?void 0:t
2561
2573
  ></ft-filter>
2562
2574
  `}))}
2563
2575
  </ft-snap-scroll>
2564
- `:i.nothing}async firstUpdated(t){super.firstUpdated(t),this.initApi(),window.addEventListener("storage",(t=>{t.key===this.recentSearchesStorageKey&&this.initRecentSearches()}))}update(t){var i,o,s,r,n;if(t.has("labels")&&(this.labelResolver=new e.ParametrizedLabelResolver(fo,this.labels)),t.has("sizeCategory")&&(this.mobileMenuOpen=!1,this.displayFacets=this.displayFacets&&!this.isMobile()),super.update(t),(t.has("availableContentLocales")||t.has("contentLocale"))&&this.availableContentLocales.length>0){const e=t=>this.availableContentLocales.some((e=>e.lang===t));e(this.contentLocale)||(this.contentLocale=t.has("contentLocale")&&e(t.get("contentLocale"))?t.get("contentLocale"):null===(i=this.availableContentLocales[0])||void 0===i?void 0:i.lang)}if(t.has("baseUrl")&&this.baseUrl&&(this.baseUrl.endsWith("/")&&(this.baseUrl=this.baseUrl.replace(/\/$/,"")),this.initRecentSearches()),t.has("presets")&&(null!==(o=this.presets)&&void 0!==o?o:[]).forEach((t=>t.filters.forEach((t=>t.values=t.values.map((t=>ie(t))))))),t.has("presets")||t.has("selectedPreset")){const t=(null!==(s=this.presets)&&void 0!==s?s:[]).find((t=>t.name===this.selectedPreset));t&&!this.compareRequests(this.request,t)&&this.setFiltersFromPreset(t)}t.has("contentLocale")&&null!=this.contentLocale&&(this.knownFacetLabels=new Map),["contentLocale","searchFilters"].some((e=>t.has(e)))&&(this.selectedPreset=null===(n=(null!==(r=this.presets)&&void 0!==r?r:[]).find((t=>this.compareRequests(t,this.request))))||void 0===n?void 0:n.name),["baseUrl","apiIntegrationIdentifier"].some((e=>t.has(e)))&&(this.api=void 0,this.initApi()),t.has("api")&&this.api&&this.initSearchData(),["uiLocale","contentLocale","searchFilters","displayedFilters"].some((e=>t.has(e)))&&this.updateFacets(),["query","uiLocale","contentLocale","searchFilters","displayedFilters","api"].some((e=>t.has(e)))&&this.suggestManager.update(),["query","uiLocale","contentLocale","searchFilters"].some((e=>t.has(e)))&&this.dispatchStateChangeEvent()}dispatchStateChangeEvent(){this.stateChangeEventDebouncer.run((()=>this.dispatchEvent(new bo(this.request))))}initSearchData(){this.availableContentLocalesInitialized=!1,this.facetsInitialized=!1,this.initDataDebouncer.run((()=>{var t;null===(t=this.api)||void 0===t||t.getAvailableSearchLocales().then((t=>t.contentLocales)).catch((()=>[])).then((t=>{this.availableContentLocales=t,this.availableContentLocalesInitialized=!0})),this.retrieveFacetsFromSearch().then((()=>this.facetsInitialized=!0))}))}contentAvailableCallback(t){var e,i,o;if(super.contentAvailableCallback(t),t.has("displayFacets")&&this.displayFacets&&(null===(e=this.floatingContainer)||void 0===e||e.focus()),null!=this.scrollToFacet&&this.facetsLoaded){null===(i=this.scrollingFiltersContainer)||void 0===i||i.scrollIndexIntoView(this.facets.findIndex((t=>t.key===this.scrollToFacet)));const t=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelector(`ft-accordion-item[data-facet-key="${this.scrollToFacet}"]`);t&&(t.active=!0),this.scrollToFacet=void 0}}initApi(){null==this.api&&(this.api=window.fluidtopics?new window.fluidtopics.FluidTopicsApi(this.baseUrl,this.apiIntegrationIdentifier,!0):void 0,setTimeout((()=>this.initApi()),10))}updateFacets(){this.api&&this.facetsInitialized&&(this.facetsRequest.length>0?(this.facetsLoaded=!1,this.updateFacetsDebouncer.run((async()=>{await this.retrieveFacetsFromSearch(),this.facetsLoaded=!0}))):this.facets=[])}async retrieveFacetsFromSearch(){var t;const e=new Map;await(null===(t=this.api)||void 0===t?void 0:t.search({...this.request,query:""}).then((t=>t.facets.forEach((t=>{this.knownFacetLabels.set(t.key,t.label),e.set(t.key,t)})))).catch(vo)),this.facets=[];for(let t of this.facetsRequest)e.has(t.id)?this.facets.push(e.get(t.id)):this.knownFacetLabels.has(t.id)&&this.facets.push({key:t.id,label:this.knownFacetLabels.get(t.id),rootNodes:[],multiSelectionable:!0,hierarchical:!1})}onFloatingContainerKeyUp(t){var e;"Escape"===t.key&&(this.displayFacets=!1,null===(e=this.filtersOpener)||void 0===e||e.focus())}setQuery(t){this.input&&(this.input.value=t),this.query=t}launchSearch(){if(this.query){let t=this.recentSearches.filter((t=>t.toLowerCase()!==this.query.toLowerCase())).filter(((t,e)=>e<20));this.recentSearches=[this.query,...t],this.saveRecentSearches()}this.dispatchEvent(new uo(this.request)),this.mobileMenuOpen=!1,this.displayFacets=!1,this.focus()}get recentSearchesStorageKey(){return this.baseUrl+":ft:recent-search-queries"}initRecentSearches(){var t;this.recentSearches=JSON.parse(null!==(t=window.localStorage.getItem(this.recentSearchesStorageKey))&&void 0!==t?t:"[]")}saveRecentSearches(){const t=JSON.stringify(this.recentSearches);window.localStorage.setItem(this.recentSearchesStorageKey,t),window.dispatchEvent(new StorageEvent("storage",{key:this.recentSearchesStorageKey,newValue:t,storageArea:window.localStorage,url:window.location.href}))}connectedCallback(){super.connectedCallback(),document.addEventListener("focusin",this.closeFloatingContainer),document.addEventListener("click",this.closeFloatingContainer)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("focusin",this.closeFloatingContainer),document.addEventListener("click",this.closeFloatingContainer)}updateSize(t){this.sizeCategory=t.detail.category}setFilter(t,e){let i=this.searchFilters.filter((e=>e.key!==t));this.facets.forEach((i=>{i.key===t&&ee(i.rootNodes,(t=>t.childNodes)).forEach((t=>t.selected=e.includes(t.value)))})),e.length&&i.push({key:t,negative:!1,values:e}),this.searchFilters=i,this.scrollToFacet=t}setFiltersFromPreset(t){null!=t&&(null!=t.contentLocale&&(this.contentLocale=t.contentLocale),this.searchFilters=t.filters)}clearFilters(){this.facets.forEach((t=>ee(t.rootNodes,(t=>t.childNodes)).forEach((t=>t.selected=!1)))),this.searchFilters=[];const t=this.facets[0];this.scrollToFacet=null==t?void 0:t.key}querySelector(t){return this.shadowRoot.querySelector(t)}querySelectorAll(t){return this.shadowRoot.querySelectorAll(t)}renderDesktopFloatingMenu(){return this.forceMenuOpen?i.nothing:i.html`
2576
+ `:i.nothing}async firstUpdated(t){super.firstUpdated(t),this.initApi(),window.addEventListener("storage",(t=>{t.key===this.recentSearchesStorageKey&&this.initRecentSearches()}))}update(t){var i,o,s,r,n;if(t.has("labels")&&(this.labelResolver=new e.ParametrizedLabelResolver(fo,this.labels)),t.has("sizeCategory")&&(this.mobileMenuOpen=!1,this.displayFacets=this.displayFacets&&!this.isMobile()),super.update(t),(t.has("availableContentLocales")||t.has("contentLocale"))&&this.availableContentLocales.length>0){const e=t=>this.availableContentLocales.some((e=>e.lang===t));e(this.contentLocale)||(this.contentLocale=t.has("contentLocale")&&e(t.get("contentLocale"))?t.get("contentLocale"):null===(i=this.availableContentLocales[0])||void 0===i?void 0:i.lang)}if(t.has("baseUrl")&&this.baseUrl&&(this.baseUrl.endsWith("/")&&(this.baseUrl=this.baseUrl.replace(/\/$/,"")),this.initRecentSearches()),t.has("presets")&&(null!==(o=this.presets)&&void 0!==o?o:[]).forEach((t=>t.filters.forEach((t=>t.values=t.values.map((t=>ie(t))))))),t.has("presets")||t.has("selectedPreset")){const t=(null!==(s=this.presets)&&void 0!==s?s:[]).find((t=>t.name===this.selectedPreset));t&&!this.compareRequests(this.request,t)&&this.setFiltersFromPreset(t)}t.has("contentLocale")&&null!=this.contentLocale&&(this.knownFacetLabels=new Map),["contentLocale","searchFilters"].some((e=>t.has(e)))&&(this.selectedPreset=null===(n=(null!==(r=this.presets)&&void 0!==r?r:[]).find((t=>this.compareRequests(t,this.request))))||void 0===n?void 0:n.name),["baseUrl","apiIntegrationIdentifier"].some((e=>t.has(e)))&&(this.api=void 0,this.initApi()),t.has("api")&&this.api&&this.initSearchData(),["uiLocale","contentLocale","searchFilters","displayedFilters"].some((e=>t.has(e)))&&this.updateFacets(),["query","uiLocale","contentLocale","searchFilters","displayedFilters","api"].some((e=>t.has(e)))&&this.suggestManager.update(),["query","uiLocale","contentLocale","searchFilters"].some((e=>t.has(e)))&&this.dispatchStateChangeEvent()}dispatchStateChangeEvent(){this.stateChangeEventDebouncer.run((()=>this.dispatchEvent(new bo(this.request))))}initSearchData(){this.availableContentLocalesInitialized=!1,this.facetsLoaded=!1,this.facetsInitialized=!1,this.initDataDebouncer.run((()=>{var t;null===(t=this.api)||void 0===t||t.getAvailableSearchLocales().then((t=>t.contentLocales)).catch((()=>[])).then((t=>{this.availableContentLocales=t,this.availableContentLocalesInitialized=!0})),this.retrieveFacetsFromSearch().then((()=>{this.facetsLoaded=!0,this.facetsInitialized=!0}))}))}contentAvailableCallback(t){var e,i,o;if(super.contentAvailableCallback(t),t.has("displayFacets")&&this.displayFacets&&(null===(e=this.floatingContainer)||void 0===e||e.focus()),null!=this.scrollToFacet&&this.facetsLoaded){null===(i=this.scrollingFiltersContainer)||void 0===i||i.scrollIndexIntoView(this.facets.findIndex((t=>t.key===this.scrollToFacet)));const t=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelector(`ft-accordion-item[data-facet-key="${this.scrollToFacet}"]`);t&&(t.active=!0),this.scrollToFacet=void 0}}initApi(){null==this.api&&(this.api=window.fluidtopics?new window.fluidtopics.FluidTopicsApi(this.baseUrl,this.apiIntegrationIdentifier,!0):void 0,setTimeout((()=>this.initApi()),10))}updateFacets(){this.api&&this.facetsInitialized&&(this.facetsRequest.length>0?(this.facetsLoaded=!1,this.updateFacetsDebouncer.run((async()=>{await this.retrieveFacetsFromSearch(),this.facetsLoaded=!0}))):this.facets=[])}async retrieveFacetsFromSearch(){var t;const e=new Map;await(null===(t=this.api)||void 0===t?void 0:t.search({...this.request,query:""}).then((t=>t.facets.forEach((t=>{this.knownFacetLabels.set(t.key,t.label),e.set(t.key,t)})))).catch(vo)),this.facets=[];for(let t of this.facetsRequest)e.has(t.id)?this.facets.push(e.get(t.id)):this.knownFacetLabels.has(t.id)&&this.facets.push({key:t.id,label:this.knownFacetLabels.get(t.id),rootNodes:[],multiSelectionable:!0,hierarchical:!1})}onFloatingContainerKeyUp(t){var e;"Escape"===t.key&&(this.displayFacets=!1,null===(e=this.filtersOpener)||void 0===e||e.focus())}setQuery(t){this.input&&(this.input.value=t),this.query=t}launchSearch(){if(this.query){let t=this.recentSearches.filter((t=>t.toLowerCase()!==this.query.toLowerCase())).filter(((t,e)=>e<20));this.recentSearches=[this.query,...t],this.saveRecentSearches()}this.dispatchEvent(new uo(this.request)),this.mobileMenuOpen=!1,this.displayFacets=!1,this.focus()}get recentSearchesStorageKey(){return this.baseUrl+":ft:recent-search-queries"}initRecentSearches(){var t;this.recentSearches=JSON.parse(null!==(t=window.localStorage.getItem(this.recentSearchesStorageKey))&&void 0!==t?t:"[]")}saveRecentSearches(){const t=JSON.stringify(this.recentSearches);window.localStorage.setItem(this.recentSearchesStorageKey,t),window.dispatchEvent(new StorageEvent("storage",{key:this.recentSearchesStorageKey,newValue:t,storageArea:window.localStorage,url:window.location.href}))}connectedCallback(){super.connectedCallback(),document.addEventListener("focusin",this.closeFloatingContainer),document.addEventListener("click",this.closeFloatingContainer)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("focusin",this.closeFloatingContainer),document.addEventListener("click",this.closeFloatingContainer)}updateSize(t){this.sizeCategory=t.detail.category}setFilter(t,e){let i=this.searchFilters.filter((e=>e.key!==t));this.facets.forEach((i=>{i.key===t&&ee(i.rootNodes,(t=>t.childNodes)).forEach((t=>t.selected=e.includes(t.value)))})),e.length&&i.push({key:t,negative:!1,values:e}),this.searchFilters=i,this.scrollToFacet=t}setFiltersFromPreset(t){null!=t&&(null!=t.contentLocale&&(this.contentLocale=t.contentLocale),this.searchFilters=t.filters)}clearFilters(){this.facets.forEach((t=>ee(t.rootNodes,(t=>t.childNodes)).forEach((t=>t.selected=!1)))),this.searchFilters=[];const t=this.facets[0];this.scrollToFacet=null==t?void 0:t.key}querySelector(t){return this.shadowRoot.querySelector(t)}querySelectorAll(t){return this.shadowRoot.querySelectorAll(t)}renderDesktopFloatingMenu(){return this.forceMenuOpen?i.nothing:i.html`
2565
2577
  <div class="ft-search-bar--floating-panel"
2566
2578
  @keyup=${this.onFloatingContainerKeyUp}
2567
2579
  part="floating-panel"
2568
2580
  tabindex="-1">
2569
2581
  ${this.renderDesktopMenu()}
2570
- </div>`}}go.elementDefinitions={"ft-accordion":Ei,"ft-accordion-item":Mi,"ft-button":Te,"ft-chip":Vi,"ft-filter":Si,"ft-filter-option":Oi,"ft-icon":De,"ft-ripple":be,"ft-select":to,"ft-select-option":Qi,"ft-size-watcher":f,"ft-skeleton":no,"ft-snap-scroll":di,"ft-tooltip":ye,"ft-typography":te},go.styles=[qt,so,ro,ao.styles,lo.styles],po([o.property({type:Boolean})],go.prototype,"dense",void 0),po([o.property()],go.prototype,"mode",void 0),po([o.property({type:Boolean})],go.prototype,"forceMobileMenuOpen",void 0),po([o.property({type:Boolean})],go.prototype,"forceMenuOpen",void 0),po([o.property()],go.prototype,"baseUrl",void 0),po([o.property()],go.prototype,"apiIntegrationIdentifier",void 0),po([o.property()],go.prototype,"contentLocale",void 0),po([o.state()],go.prototype,"availableContentLocales",void 0),po([o.state()],go.prototype,"availableContentLocalesInitialized",void 0),po([o.property()],go.prototype,"uiLocale",void 0),po([e.jsonProperty({})],go.prototype,"labels",void 0),po([e.jsonProperty([])],go.prototype,"displayedFilters",void 0),po([e.jsonProperty([])],go.prototype,"presets",void 0),po([o.property({type:String,reflect:!0})],go.prototype,"selectedPreset",void 0),po([e.jsonProperty([])],go.prototype,"priors",void 0),po([o.property()],go.prototype,"searchRequestSerializer",void 0),po([o.state()],go.prototype,"searchFilters",void 0),po([o.state()],go.prototype,"sizeCategory",void 0),po([o.state()],go.prototype,"displayFacets",void 0),po([o.state()],go.prototype,"mobileMenuOpen",void 0),po([o.state()],go.prototype,"facets",void 0),po([o.state()],go.prototype,"facetsInitialized",void 0),po([o.query(".ft-search-bar--container")],go.prototype,"container",void 0),po([o.query(".ft-search-bar--filters-opener")],go.prototype,"filtersOpener",void 0),po([o.query(".ft-search-bar--floating-panel")],go.prototype,"floatingContainer",void 0),po([o.query("ft-snap-scroll.ft-search-bar--filters-container")],go.prototype,"scrollingFiltersContainer",void 0),po([o.query(".ft-search-bar--input")],go.prototype,"input",void 0),po([o.state()],go.prototype,"query",void 0),po([o.state()],go.prototype,"suggestions",void 0),po([o.state()],go.prototype,"recentSearches",void 0),po([o.state()],go.prototype,"scrollToFacet",void 0),po([o.state()],go.prototype,"api",void 0),e.customElement("ft-search-bar")(go),t.DEFAULT_LABELS=fo,t.FtSearchBar=go,t.FtSearchBarCssVariables=oo,t.LaunchSearchEvent=uo,t.SearchStateChangeEvent=bo,t.facetsCss=ro,t.searchBarCss=so,Object.defineProperty(t,"t",{value:!0})}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litRepeat,ftGlobals.litClassMap,ftGlobals.litUnsafeHTML);
2582
+ </div>`}}go.elementDefinitions={"ft-accordion":Ei,"ft-accordion-item":Mi,"ft-button":Te,"ft-chip":Vi,"ft-filter":Si,"ft-filter-option":Oi,"ft-icon":De,"ft-ripple":be,"ft-select":to,"ft-select-option":Qi,"ft-size-watcher":f,"ft-skeleton":no,"ft-snap-scroll":di,"ft-tooltip":ye,"ft-typography":te},go.styles=[qt,so,ro,ao.styles,lo.styles],po([o.property({type:Boolean})],go.prototype,"dense",void 0),po([o.property()],go.prototype,"mode",void 0),po([o.property({type:Boolean})],go.prototype,"forceMobileMenuOpen",void 0),po([o.property({type:Boolean})],go.prototype,"forceMenuOpen",void 0),po([o.property()],go.prototype,"baseUrl",void 0),po([o.property()],go.prototype,"apiIntegrationIdentifier",void 0),po([o.property()],go.prototype,"contentLocale",void 0),po([o.state()],go.prototype,"availableContentLocales",void 0),po([o.state()],go.prototype,"availableContentLocalesInitialized",void 0),po([o.property()],go.prototype,"uiLocale",void 0),po([e.jsonProperty({})],go.prototype,"labels",void 0),po([e.jsonProperty([])],go.prototype,"displayedFilters",void 0),po([e.jsonProperty([])],go.prototype,"presets",void 0),po([o.property({type:String,reflect:!0})],go.prototype,"selectedPreset",void 0),po([e.jsonProperty([])],go.prototype,"priors",void 0),po([o.property()],go.prototype,"searchRequestSerializer",void 0),po([o.state()],go.prototype,"searchFilters",void 0),po([o.state()],go.prototype,"sizeCategory",void 0),po([o.state()],go.prototype,"displayFacets",void 0),po([o.state()],go.prototype,"mobileMenuOpen",void 0),po([o.state()],go.prototype,"facets",void 0),po([o.state()],go.prototype,"facetsInitialized",void 0),po([o.query(".ft-search-bar--container")],go.prototype,"container",void 0),po([o.query(".ft-search-bar--filters-opener")],go.prototype,"filtersOpener",void 0),po([o.query(".ft-search-bar--floating-panel")],go.prototype,"floatingContainer",void 0),po([o.query("ft-snap-scroll.ft-search-bar--filters-container")],go.prototype,"scrollingFiltersContainer",void 0),po([o.query(".ft-search-bar--input")],go.prototype,"input",void 0),po([o.state()],go.prototype,"query",void 0),po([o.state()],go.prototype,"suggestions",void 0),po([o.state()],go.prototype,"recentSearches",void 0),po([o.state()],go.prototype,"scrollToFacet",void 0),po([o.state()],go.prototype,"api",void 0),po([o.state()],go.prototype,"facetsLoaded",void 0),e.customElement("ft-search-bar")(go),t.DEFAULT_LABELS=fo,t.FtSearchBar=go,t.FtSearchBarCssVariables=oo,t.LaunchSearchEvent=uo,t.SearchStateChangeEvent=bo,t.facetsCss=ro,t.searchBarCss=so,Object.defineProperty(t,"t",{value:!0})}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litRepeat,ftGlobals.litClassMap,ftGlobals.litUnsafeHTML);
@@ -2052,10 +2052,11 @@ class Si extends Rt{constructor(t){if(super(t),this.it=Q,t.type!==Nt)throw Error
2052
2052
  .ft-search-bar > ft-button,
2053
2053
  .ft-search-bar--actions ft-button {
2054
2054
  flex-shrink: 0;
2055
+ ${yt(ji.backgroundColor,"transparent")};
2055
2056
  }
2056
2057
 
2057
2058
  .ft-search-bar--left-action {
2058
- ${yt(ji.borderRadius,y`calc(${ls.borderRadius} - 1px) 0 0 calc(${ls.borderRadius} - 1px)`)};
2059
+ ${yt(ji.borderRadius,`calc(${ls.borderRadius} - 1px) 0 0 calc(${ls.borderRadius} - 1px)`)};
2059
2060
  border-right: 1px solid ${ls.colorOutline};
2060
2061
  height: 100%;
2061
2062
  }
@@ -2065,7 +2066,7 @@ class Si extends Rt{constructor(t){if(super(t),this.it=Q,t.type!==Nt)throw Error
2065
2066
  }
2066
2067
 
2067
2068
  .ft-search-bar--floating-panel-open .ft-search-bar--left-action {
2068
- ${yt(ji.borderRadius,y`calc(${ls.borderRadius} - 1px) 0 0 0`)};
2069
+ ${yt(ji.borderRadius,`calc(${ls.borderRadius} - 1px) 0 0 0`)};
2069
2070
  }
2070
2071
 
2071
2072
  .ft-search-bar .ft-search-bar--launch-search,
@@ -2080,7 +2081,7 @@ class Si extends Rt{constructor(t){if(super(t),this.it=Q,t.type!==Nt)throw Error
2080
2081
 
2081
2082
  .ft-search-bar--left-action.ft-search-bar--content-locale {
2082
2083
  ${yt(Xo.borderColor,"transparent")};
2083
- ${yt(Xo.borderRadiusS,y`calc(${ls.borderRadius} - 1px)`)};
2084
+ ${yt(Xo.borderRadiusS,`calc(${ls.borderRadius} - 1px)`)};
2084
2085
  ${yt(ts.selectedOptionColor,ls.buttonColor)};
2085
2086
  }
2086
2087
 
@@ -2147,6 +2148,7 @@ class Si extends Rt{constructor(t){if(super(t),this.it=Q,t.type!==Nt)throw Error
2147
2148
  gap: 16px;
2148
2149
  align-items: center;
2149
2150
  justify-content: space-evenly;
2151
+ flex-wrap: wrap;
2150
2152
  }
2151
2153
 
2152
2154
  .ft-search-bar--mobile .ft-search-bar--facets-actions > * {
@@ -2220,20 +2222,26 @@ class Si extends Rt{constructor(t){if(super(t),this.it=Q,t.type!==Nt)throw Error
2220
2222
  display: flex;
2221
2223
  justify-content: space-between;
2222
2224
  align-items: baseline;
2225
+ flex-wrap: wrap;
2223
2226
  gap: 8px;
2224
2227
  }
2225
2228
 
2226
2229
  .ft-search-bar--filter-label > * {
2227
- white-space: nowrap;
2230
+ display: -webkit-box;
2231
+ -webkit-line-clamp: 2;
2232
+ -webkit-box-orient: vertical;
2233
+ word-break: break-all;
2234
+ word-break: break-word;
2235
+ hyphens: auto;
2228
2236
  overflow: hidden;
2229
- text-overflow: ellipsis;
2230
- }
2231
-
2232
- .ft-search-bar--filter-label > :first-child {
2233
- flex-shrink: 0;
2237
+ min-width: 75px;
2238
+ max-width: 100%;
2239
+ flex-grow: 1;
2240
+ flex-shrink: 1;
2234
2241
  }
2235
2242
 
2236
- .ft-search-bar--filter-label > :last-child {
2243
+ .ft-search-bar--filter-label-values {
2244
+ flex-grow: 0;
2237
2245
  flex-shrink: 1;
2238
2246
  color: ${ls.colorOnSurfaceMedium};
2239
2247
  }
@@ -2564,22 +2572,24 @@ class Si extends Rt{constructor(t){if(super(t),this.it=Q,t.type!==Nt)throw Error
2564
2572
  </div>
2565
2573
  `}onSearchBarKeyDown(t){var e;switch(t.key){case"Escape":this.searchBar.mobileMenuOpen=!1,null===(e=this.searchBar.input)||void 0===e||e.blur();break;case"ArrowDown":t.stopPropagation(),t.preventDefault(),this.suggestManager.focusFirstSuggestion()}}onSearchBarKeyUp(t){const e=t.composedPath()[0];this.searchBar.query=e.value,"Enter"===t.key&&this.searchBar.launchSearch()}}us.styles=y`
2566
2574
 
2567
- `;var bs=function(t,e,i,o){for(var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,l=t.length-1;l>=0;l--)(s=t[l])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};null==window.fluidtopics&&console.warn("Fluid Topics public API was not found. You can find it here: https://www.npmjs.com/package/@fluid-topics/public-api");const vs={filtersButton:"Filters",inputPlaceHolder:"Search",filterInputPlaceHolder:"Filter {0}",clearInputButton:"Clear",clearFilterButton:"Clear",displayMoreFilterValuesButton:"More",noFilterValuesAvailable:"No values available",searchButton:"Search",clearFilters:"Clear filters",contentLocaleSelector:"Lang",presetsSelector:"Quick filters",removeRecentSearch:"Remove",back:"Back"};class gs extends CustomEvent{constructor(t){super("launch-search",{detail:t,bubbles:!0,composed:!0})}}class xs extends CustomEvent{constructor(t){super("change",{detail:t})}}const ys=()=>{};class ms extends wt{constructor(){super(...arguments),this.dense=!1,this.mode="auto",this.forceMobileMenuOpen=!1,this.forceMenuOpen=!1,this.baseUrl="",this.apiIntegrationIdentifier="ft-search-bar",this.availableContentLocales=[],this.availableContentLocalesInitialized=!1,this.labels={},this.labelResolver=new Ot(vs,{}),this.displayedFilters=[],this.presets=[],this.priors=[],this.searchRequestSerializer=t=>function(t,e){var i;const o=new URLSearchParams({"content-lang":null!==(i=e.contentLocale)&&void 0!==i?i:"all",query:e.query});if(e.filters.length>0){const t=e.filters.map((t=>{const e=t.values.map((t=>t.replace(/_/g,"\\\\\\\\_").replace(/~/g,"\\\\~").replace(/\*/g,"\\*"))).map((t=>encodeURIComponent(function(t){return`"${t}"`}(t)))).join("_");return`${t.key}~${e}`})).join("*");o.append("filters",t)}return new URL(`${t}/search/all?${o.toString()}`).href}(this.baseUrl,t),this.searchFilters=[],this.sizeCategory=_t.M,this.displayFacets=!1,this.mobileMenuOpen=!1,this.facets=[],this.facetsInitialized=!1,this.knownFacetLabels=new Map,this.query="",this.suggestions=[],this.recentSearches=[],this.suggestManager=new ps(this),this.selectedFacetsManager=new ds(this),this.desktopSearchBarManager=new us(this),this.mobileSearchBarManager=new fs(this),this.stateChangeEventDebouncer=new e(10),this.initDataDebouncer=new e(10),this.facetsLoaded=!1,this.updateFacetsDebouncer=new e(500),this.closeFloatingContainer=t=>{this.isMobile()||(this.displayFacets=this.displayFacets&&t.composedPath().some((t=>t===this.floatingContainer)))},this.compareFilters=(t,e)=>t.key===e.key&&t.negative==e.negative&&t.values.length===e.values.length&&t.values.every((t=>e.values.includes(t))),this.compareRequests=(t,e)=>(null==t.contentLocale||null==e.contentLocale||t.contentLocale===e.contentLocale)&&t.filters.length===e.filters.length&&t.filters.every((t=>e.filters.some((e=>this.compareFilters(t,e)))))}isMobileMenuOpen(){return this.isMobile()&&(this.forceMobileMenuOpen||this.forceMenuOpen||this.mobileMenuOpen)}get request(){return{uiLocale:this.uiLocale,contentLocale:this.contentLocale,query:this.query,facets:this.facetsRequest,priors:this.hasPriors?this.priors:void 0,filters:this.searchFilters,paging:{perPage:0,page:1},sort:[]}}get facetsRequest(){const t=this.searchFilters.filter((t=>t.values.length>0&&!this.displayedFilters.includes(t.key))).map((t=>({id:t.key})));return[...this.displayedFilters.map((t=>({id:t}))),...t]}get suggestRequest(){return{contentLocale:this.contentLocale,input:this.query,filters:this.searchFilters,sort:[]}}isMobile(){switch(this.mode){case"mobile":return!0;case"desktop":return!1;default:return this.sizeCategory===_t.S}}hasFacets(){return this.facetsRequest.length>0}get hasPresets(){return null!=this.presets&&this.presets.length>0}get hasPriors(){return null!=this.priors&&this.priors.length>0}hasLocaleSelector(){return this.availableContentLocales.length>1}focus(){var t;null===(t=this.container)||void 0===t||t.focus()}focusInput(){this.input?this.input.focus():setTimeout((()=>this.focusInput()),50)}clear(){this.query="",this.searchFilters=[],this.input&&(this.input.value=""),this.mobileMenuOpen=!1,this.displayFacets=!1}render(){return X`
2575
+ `;var bs=function(t,e,i,o){for(var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,l=t.length-1;l>=0;l--)(s=t[l])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};null==window.fluidtopics&&console.warn("Fluid Topics public API was not found. You can find it here: https://www.npmjs.com/package/@fluid-topics/public-api");const vs={filtersButton:"Filters",inputPlaceHolder:"Search",filterInputPlaceHolder:"Filter {0}",clearInputButton:"Clear",clearFilterButton:"Clear",displayMoreFilterValuesButton:"More",noFilterValuesAvailable:"No values available",searchButton:"Search",clearFilters:"Clear filters",contentLocaleSelector:"Lang",presetsSelector:"Quick filters",removeRecentSearch:"Remove",back:"Back"};class gs extends CustomEvent{constructor(t){super("launch-search",{detail:t,bubbles:!0,composed:!0})}}class xs extends CustomEvent{constructor(t){super("change",{detail:t})}}const ys=()=>{};class ms extends wt{constructor(){super(...arguments),this.dense=!1,this.mode="auto",this.forceMobileMenuOpen=!1,this.forceMenuOpen=!1,this.baseUrl="",this.apiIntegrationIdentifier="ft-search-bar",this.availableContentLocales=[],this.availableContentLocalesInitialized=!1,this.labels={},this.labelResolver=new Ot(vs,{}),this.displayedFilters=[],this.presets=[],this.priors=[],this.searchRequestSerializer=t=>function(t,e){var i;const o=new URLSearchParams({"content-lang":null!==(i=e.contentLocale)&&void 0!==i?i:"all",query:e.query});if(e.filters.length>0){const t=e.filters.map((t=>{const e=t.values.map((t=>t.replace(/_/g,"\\\\\\\\_").replace(/~/g,"\\\\~").replace(/\*/g,"\\*"))).map((t=>encodeURIComponent(function(t){return`"${t}"`}(t)))).join("_");return`${t.key}~${e}`})).join("*");o.append("filters",t)}return new URL(`${t}/search/all?${o.toString()}`).href}(this.baseUrl,t),this.searchFilters=[],this.sizeCategory=_t.M,this.displayFacets=!1,this.mobileMenuOpen=!1,this.facets=[],this.facetsInitialized=!1,this.knownFacetLabels=new Map,this.query="",this.suggestions=[],this.recentSearches=[],this.suggestManager=new ps(this),this.selectedFacetsManager=new ds(this),this.desktopSearchBarManager=new us(this),this.mobileSearchBarManager=new fs(this,this.selectedFacetsManager,this.suggestManager),this.stateChangeEventDebouncer=new e(10),this.initDataDebouncer=new e(10),this.facetsLoaded=!1,this.updateFacetsDebouncer=new e(500),this.closeFloatingContainer=t=>{this.isMobile()||(this.displayFacets=this.displayFacets&&t.composedPath().some((t=>t===this.floatingContainer)))},this.compareFilters=(t,e)=>t.key===e.key&&t.negative==e.negative&&t.values.length===e.values.length&&t.values.every((t=>e.values.includes(t))),this.compareRequests=(t,e)=>(null==t.contentLocale||null==e.contentLocale||t.contentLocale===e.contentLocale)&&t.filters.length===e.filters.length&&t.filters.every((t=>e.filters.some((e=>this.compareFilters(t,e)))))}isMobileMenuOpen(){return this.isMobile()&&(this.forceMobileMenuOpen||this.forceMenuOpen||this.mobileMenuOpen)}get request(){return{uiLocale:this.uiLocale,contentLocale:this.contentLocale,query:this.query,facets:this.facetsRequest,priors:this.hasPriors?this.priors:void 0,filters:this.searchFilters,paging:{perPage:0,page:1},sort:[]}}get facetsRequest(){const t=this.searchFilters.filter((t=>t.values.length>0&&!this.displayedFilters.includes(t.key))).map((t=>({id:t.key})));return[...this.displayedFilters.map((t=>({id:t}))),...t]}get suggestRequest(){return{contentLocale:this.contentLocale,input:this.query,filters:this.searchFilters,sort:[]}}isMobile(){switch(this.mode){case"mobile":return!0;case"desktop":return!1;default:return this.sizeCategory===_t.S}}hasFacets(){return this.facetsRequest.length>0}get hasPresets(){return null!=this.presets&&this.presets.length>0}get hasPriors(){return null!=this.priors&&this.priors.length>0}hasLocaleSelector(){return this.availableContentLocales.length>1}focus(){var t;null===(t=this.container)||void 0===t||t.focus()}focusInput(){this.input?this.input.focus():setTimeout((()=>this.focusInput()),50)}clear(){this.query="",this.searchFilters=[],this.input&&(this.input.value=""),this.mobileMenuOpen=!1,this.displayFacets=!1}render(){return X`
2568
2576
  <ft-size-watcher @change=${this.updateSize}></ft-size-watcher>
2569
2577
  ${this.renderSearchBar()}
2570
2578
  `}renderSearchBar(){return this.facetsInitialized&&this.availableContentLocalesInitialized?this.isMobile()?this.mobileSearchBarManager.render():this.desktopSearchBarManager.render():X`
2571
2579
  <ft-skeleton class="ft-search-bar--container ft-search-bar--skeleton" part="loader"
2572
2580
  tabindex="-1"></ft-skeleton>
2573
- `}renderMobileFacets(){var t;const e=this.availableContentLocales.filter((t=>t.lang===this.contentLocale)).pop();return X`
2581
+ `}renderMobileFacets(){const t=this.availableContentLocales.filter((t=>t.lang===this.contentLocale)).pop();return X`
2574
2582
  <ft-accordion class="ft-search-bar--filters-container">
2575
2583
  ${this.hasLocaleSelector()?X`
2576
2584
  <ft-accordion-item data-facet-key="ft:locale">
2577
2585
  <div class="ft-search-bar--filter-label" slot="toggle">
2578
2586
  <ft-typography variant="button">${this.labelResolver.resolve("contentLocaleSelector")}
2579
2587
  </ft-typography>
2580
- <ft-typography variant="body2">
2581
- ${null!==(t=null==e?void 0:e.label)&&void 0!==t?t:""}
2582
- </ft-typography>
2588
+ ${(null==t?void 0:t.label)?X`
2589
+ <ft-typography class="ft-search-bar--filter-label-values" variant="body2">
2590
+ ${null==t?void 0:t.label}
2591
+ </ft-typography>
2592
+ `:Q}
2583
2593
  </div>
2584
2594
  <ft-filter
2585
2595
  id="ft:locale"
@@ -2592,13 +2602,15 @@ class Si extends Rt{constructor(t){if(super(t),this.it=Q,t.type!==Nt)throw Error
2592
2602
  ></ft-filter>
2593
2603
  </ft-accordion-item>
2594
2604
  `:null}
2595
- ${Tt(this.facets,(t=>t.key),(t=>{const e=si(t),i=t.key.replace(":","-");return t.rootNodes.length>0?X`
2605
+ ${Tt(this.facets,(t=>t.key),(t=>{const e=si(t),i=t.key.replace(":","-"),o=function(t){return ei(t.options,(t=>{var e;return null!==(e=t.subOptions)&&void 0!==e?e:[]})).filter((t=>t.selected)).map((t=>t.label))}(e);return t.rootNodes.length>0?X`
2596
2606
  <ft-accordion-item data-facet-key="${t.key}">
2597
2607
  <div class="ft-search-bar--filter-label" slot="toggle">
2598
2608
  <ft-typography variant="button">${t.label}</ft-typography>
2599
- <ft-typography variant="body2">
2600
- ${function(t){return ei(t.options,(t=>{var e;return null!==(e=t.subOptions)&&void 0!==e?e:[]})).filter((t=>t.selected)).map((t=>t.label))}(e).join(", ")}
2601
- </ft-typography>
2609
+ ${o.length>0?X`
2610
+ <ft-typography class="ft-search-bar--filter-label-values" variant="body2">
2611
+ ${o.join(", ")}
2612
+ </ft-typography>
2613
+ `:Q}
2602
2614
  </div>
2603
2615
  <ft-filter
2604
2616
  part="filters filter filter-${i}"
@@ -2693,10 +2705,10 @@ class Si extends Rt{constructor(t){if(super(t),this.it=Q,t.type!==Nt)throw Error
2693
2705
  ></ft-filter>
2694
2706
  `}))}
2695
2707
  </ft-snap-scroll>
2696
- `:Q}async firstUpdated(t){super.firstUpdated(t),this.initApi(),window.addEventListener("storage",(t=>{t.key===this.recentSearchesStorageKey&&this.initRecentSearches()}))}update(t){var e,i,o,s,r;if(t.has("labels")&&(this.labelResolver=new Ot(vs,this.labels)),t.has("sizeCategory")&&(this.mobileMenuOpen=!1,this.displayFacets=this.displayFacets&&!this.isMobile()),super.update(t),(t.has("availableContentLocales")||t.has("contentLocale"))&&this.availableContentLocales.length>0){const i=t=>this.availableContentLocales.some((e=>e.lang===t));i(this.contentLocale)||(this.contentLocale=t.has("contentLocale")&&i(t.get("contentLocale"))?t.get("contentLocale"):null===(e=this.availableContentLocales[0])||void 0===e?void 0:e.lang)}if(t.has("baseUrl")&&this.baseUrl&&(this.baseUrl.endsWith("/")&&(this.baseUrl=this.baseUrl.replace(/\/$/,"")),this.initRecentSearches()),t.has("presets")&&(null!==(i=this.presets)&&void 0!==i?i:[]).forEach((t=>t.filters.forEach((t=>t.values=t.values.map((t=>ii(t))))))),t.has("presets")||t.has("selectedPreset")){const t=(null!==(o=this.presets)&&void 0!==o?o:[]).find((t=>t.name===this.selectedPreset));t&&!this.compareRequests(this.request,t)&&this.setFiltersFromPreset(t)}t.has("contentLocale")&&null!=this.contentLocale&&(this.knownFacetLabels=new Map),["contentLocale","searchFilters"].some((e=>t.has(e)))&&(this.selectedPreset=null===(r=(null!==(s=this.presets)&&void 0!==s?s:[]).find((t=>this.compareRequests(t,this.request))))||void 0===r?void 0:r.name),["baseUrl","apiIntegrationIdentifier"].some((e=>t.has(e)))&&(this.api=void 0,this.initApi()),t.has("api")&&this.api&&this.initSearchData(),["uiLocale","contentLocale","searchFilters","displayedFilters"].some((e=>t.has(e)))&&this.updateFacets(),["query","uiLocale","contentLocale","searchFilters","displayedFilters","api"].some((e=>t.has(e)))&&this.suggestManager.update(),["query","uiLocale","contentLocale","searchFilters"].some((e=>t.has(e)))&&this.dispatchStateChangeEvent()}dispatchStateChangeEvent(){this.stateChangeEventDebouncer.run((()=>this.dispatchEvent(new xs(this.request))))}initSearchData(){this.availableContentLocalesInitialized=!1,this.facetsInitialized=!1,this.initDataDebouncer.run((()=>{var t;null===(t=this.api)||void 0===t||t.getAvailableSearchLocales().then((t=>t.contentLocales)).catch((()=>[])).then((t=>{this.availableContentLocales=t,this.availableContentLocalesInitialized=!0})),this.retrieveFacetsFromSearch().then((()=>this.facetsInitialized=!0))}))}contentAvailableCallback(t){var e,i,o;if(super.contentAvailableCallback(t),t.has("displayFacets")&&this.displayFacets&&(null===(e=this.floatingContainer)||void 0===e||e.focus()),null!=this.scrollToFacet&&this.facetsLoaded){null===(i=this.scrollingFiltersContainer)||void 0===i||i.scrollIndexIntoView(this.facets.findIndex((t=>t.key===this.scrollToFacet)));const t=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelector(`ft-accordion-item[data-facet-key="${this.scrollToFacet}"]`);t&&(t.active=!0),this.scrollToFacet=void 0}}initApi(){null==this.api&&(this.api=window.fluidtopics?new window.fluidtopics.FluidTopicsApi(this.baseUrl,this.apiIntegrationIdentifier,!0):void 0,setTimeout((()=>this.initApi()),10))}updateFacets(){this.api&&this.facetsInitialized&&(this.facetsRequest.length>0?(this.facetsLoaded=!1,this.updateFacetsDebouncer.run((async()=>{await this.retrieveFacetsFromSearch(),this.facetsLoaded=!0}))):this.facets=[])}async retrieveFacetsFromSearch(){var t;const e=new Map;await(null===(t=this.api)||void 0===t?void 0:t.search({...this.request,query:""}).then((t=>t.facets.forEach((t=>{this.knownFacetLabels.set(t.key,t.label),e.set(t.key,t)})))).catch(ys)),this.facets=[];for(let t of this.facetsRequest)e.has(t.id)?this.facets.push(e.get(t.id)):this.knownFacetLabels.has(t.id)&&this.facets.push({key:t.id,label:this.knownFacetLabels.get(t.id),rootNodes:[],multiSelectionable:!0,hierarchical:!1})}onFloatingContainerKeyUp(t){var e;"Escape"===t.key&&(this.displayFacets=!1,null===(e=this.filtersOpener)||void 0===e||e.focus())}setQuery(t){this.input&&(this.input.value=t),this.query=t}launchSearch(){if(this.query){let t=this.recentSearches.filter((t=>t.toLowerCase()!==this.query.toLowerCase())).filter(((t,e)=>e<20));this.recentSearches=[this.query,...t],this.saveRecentSearches()}this.dispatchEvent(new gs(this.request)),this.mobileMenuOpen=!1,this.displayFacets=!1,this.focus()}get recentSearchesStorageKey(){return this.baseUrl+":ft:recent-search-queries"}initRecentSearches(){var t;this.recentSearches=JSON.parse(null!==(t=window.localStorage.getItem(this.recentSearchesStorageKey))&&void 0!==t?t:"[]")}saveRecentSearches(){const t=JSON.stringify(this.recentSearches);window.localStorage.setItem(this.recentSearchesStorageKey,t),window.dispatchEvent(new StorageEvent("storage",{key:this.recentSearchesStorageKey,newValue:t,storageArea:window.localStorage,url:window.location.href}))}connectedCallback(){super.connectedCallback(),document.addEventListener("focusin",this.closeFloatingContainer),document.addEventListener("click",this.closeFloatingContainer)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("focusin",this.closeFloatingContainer),document.addEventListener("click",this.closeFloatingContainer)}updateSize(t){this.sizeCategory=t.detail.category}setFilter(t,e){let i=this.searchFilters.filter((e=>e.key!==t));this.facets.forEach((i=>{i.key===t&&ei(i.rootNodes,(t=>t.childNodes)).forEach((t=>t.selected=e.includes(t.value)))})),e.length&&i.push({key:t,negative:!1,values:e}),this.searchFilters=i,this.scrollToFacet=t}setFiltersFromPreset(t){null!=t&&(null!=t.contentLocale&&(this.contentLocale=t.contentLocale),this.searchFilters=t.filters)}clearFilters(){this.facets.forEach((t=>ei(t.rootNodes,(t=>t.childNodes)).forEach((t=>t.selected=!1)))),this.searchFilters=[];const t=this.facets[0];this.scrollToFacet=null==t?void 0:t.key}querySelector(t){return this.shadowRoot.querySelector(t)}querySelectorAll(t){return this.shadowRoot.querySelectorAll(t)}renderDesktopFloatingMenu(){return this.forceMenuOpen?Q:X`
2708
+ `:Q}async firstUpdated(t){super.firstUpdated(t),this.initApi(),window.addEventListener("storage",(t=>{t.key===this.recentSearchesStorageKey&&this.initRecentSearches()}))}update(t){var e,i,o,s,r;if(t.has("labels")&&(this.labelResolver=new Ot(vs,this.labels)),t.has("sizeCategory")&&(this.mobileMenuOpen=!1,this.displayFacets=this.displayFacets&&!this.isMobile()),super.update(t),(t.has("availableContentLocales")||t.has("contentLocale"))&&this.availableContentLocales.length>0){const i=t=>this.availableContentLocales.some((e=>e.lang===t));i(this.contentLocale)||(this.contentLocale=t.has("contentLocale")&&i(t.get("contentLocale"))?t.get("contentLocale"):null===(e=this.availableContentLocales[0])||void 0===e?void 0:e.lang)}if(t.has("baseUrl")&&this.baseUrl&&(this.baseUrl.endsWith("/")&&(this.baseUrl=this.baseUrl.replace(/\/$/,"")),this.initRecentSearches()),t.has("presets")&&(null!==(i=this.presets)&&void 0!==i?i:[]).forEach((t=>t.filters.forEach((t=>t.values=t.values.map((t=>ii(t))))))),t.has("presets")||t.has("selectedPreset")){const t=(null!==(o=this.presets)&&void 0!==o?o:[]).find((t=>t.name===this.selectedPreset));t&&!this.compareRequests(this.request,t)&&this.setFiltersFromPreset(t)}t.has("contentLocale")&&null!=this.contentLocale&&(this.knownFacetLabels=new Map),["contentLocale","searchFilters"].some((e=>t.has(e)))&&(this.selectedPreset=null===(r=(null!==(s=this.presets)&&void 0!==s?s:[]).find((t=>this.compareRequests(t,this.request))))||void 0===r?void 0:r.name),["baseUrl","apiIntegrationIdentifier"].some((e=>t.has(e)))&&(this.api=void 0,this.initApi()),t.has("api")&&this.api&&this.initSearchData(),["uiLocale","contentLocale","searchFilters","displayedFilters"].some((e=>t.has(e)))&&this.updateFacets(),["query","uiLocale","contentLocale","searchFilters","displayedFilters","api"].some((e=>t.has(e)))&&this.suggestManager.update(),["query","uiLocale","contentLocale","searchFilters"].some((e=>t.has(e)))&&this.dispatchStateChangeEvent()}dispatchStateChangeEvent(){this.stateChangeEventDebouncer.run((()=>this.dispatchEvent(new xs(this.request))))}initSearchData(){this.availableContentLocalesInitialized=!1,this.facetsLoaded=!1,this.facetsInitialized=!1,this.initDataDebouncer.run((()=>{var t;null===(t=this.api)||void 0===t||t.getAvailableSearchLocales().then((t=>t.contentLocales)).catch((()=>[])).then((t=>{this.availableContentLocales=t,this.availableContentLocalesInitialized=!0})),this.retrieveFacetsFromSearch().then((()=>{this.facetsLoaded=!0,this.facetsInitialized=!0}))}))}contentAvailableCallback(t){var e,i,o;if(super.contentAvailableCallback(t),t.has("displayFacets")&&this.displayFacets&&(null===(e=this.floatingContainer)||void 0===e||e.focus()),null!=this.scrollToFacet&&this.facetsLoaded){null===(i=this.scrollingFiltersContainer)||void 0===i||i.scrollIndexIntoView(this.facets.findIndex((t=>t.key===this.scrollToFacet)));const t=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelector(`ft-accordion-item[data-facet-key="${this.scrollToFacet}"]`);t&&(t.active=!0),this.scrollToFacet=void 0}}initApi(){null==this.api&&(this.api=window.fluidtopics?new window.fluidtopics.FluidTopicsApi(this.baseUrl,this.apiIntegrationIdentifier,!0):void 0,setTimeout((()=>this.initApi()),10))}updateFacets(){this.api&&this.facetsInitialized&&(this.facetsRequest.length>0?(this.facetsLoaded=!1,this.updateFacetsDebouncer.run((async()=>{await this.retrieveFacetsFromSearch(),this.facetsLoaded=!0}))):this.facets=[])}async retrieveFacetsFromSearch(){var t;const e=new Map;await(null===(t=this.api)||void 0===t?void 0:t.search({...this.request,query:""}).then((t=>t.facets.forEach((t=>{this.knownFacetLabels.set(t.key,t.label),e.set(t.key,t)})))).catch(ys)),this.facets=[];for(let t of this.facetsRequest)e.has(t.id)?this.facets.push(e.get(t.id)):this.knownFacetLabels.has(t.id)&&this.facets.push({key:t.id,label:this.knownFacetLabels.get(t.id),rootNodes:[],multiSelectionable:!0,hierarchical:!1})}onFloatingContainerKeyUp(t){var e;"Escape"===t.key&&(this.displayFacets=!1,null===(e=this.filtersOpener)||void 0===e||e.focus())}setQuery(t){this.input&&(this.input.value=t),this.query=t}launchSearch(){if(this.query){let t=this.recentSearches.filter((t=>t.toLowerCase()!==this.query.toLowerCase())).filter(((t,e)=>e<20));this.recentSearches=[this.query,...t],this.saveRecentSearches()}this.dispatchEvent(new gs(this.request)),this.mobileMenuOpen=!1,this.displayFacets=!1,this.focus()}get recentSearchesStorageKey(){return this.baseUrl+":ft:recent-search-queries"}initRecentSearches(){var t;this.recentSearches=JSON.parse(null!==(t=window.localStorage.getItem(this.recentSearchesStorageKey))&&void 0!==t?t:"[]")}saveRecentSearches(){const t=JSON.stringify(this.recentSearches);window.localStorage.setItem(this.recentSearchesStorageKey,t),window.dispatchEvent(new StorageEvent("storage",{key:this.recentSearchesStorageKey,newValue:t,storageArea:window.localStorage,url:window.location.href}))}connectedCallback(){super.connectedCallback(),document.addEventListener("focusin",this.closeFloatingContainer),document.addEventListener("click",this.closeFloatingContainer)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("focusin",this.closeFloatingContainer),document.addEventListener("click",this.closeFloatingContainer)}updateSize(t){this.sizeCategory=t.detail.category}setFilter(t,e){let i=this.searchFilters.filter((e=>e.key!==t));this.facets.forEach((i=>{i.key===t&&ei(i.rootNodes,(t=>t.childNodes)).forEach((t=>t.selected=e.includes(t.value)))})),e.length&&i.push({key:t,negative:!1,values:e}),this.searchFilters=i,this.scrollToFacet=t}setFiltersFromPreset(t){null!=t&&(null!=t.contentLocale&&(this.contentLocale=t.contentLocale),this.searchFilters=t.filters)}clearFilters(){this.facets.forEach((t=>ei(t.rootNodes,(t=>t.childNodes)).forEach((t=>t.selected=!1)))),this.searchFilters=[];const t=this.facets[0];this.scrollToFacet=null==t?void 0:t.key}querySelector(t){return this.shadowRoot.querySelector(t)}querySelectorAll(t){return this.shadowRoot.querySelectorAll(t)}renderDesktopFloatingMenu(){return this.forceMenuOpen?Q:X`
2697
2709
  <div class="ft-search-bar--floating-panel"
2698
2710
  @keyup=${this.onFloatingContainerKeyUp}
2699
2711
  part="floating-panel"
2700
2712
  tabindex="-1">
2701
2713
  ${this.renderDesktopMenu()}
2702
- </div>`}}ms.elementDefinitions={"ft-accordion":Ro,"ft-accordion-item":Po,"ft-button":_i,"ft-chip":Jo,"ft-filter":zo,"ft-filter-option":Mo,"ft-icon":Li,"ft-ripple":vi,"ft-select":ss,"ft-select-option":os,"ft-size-watcher":Wt,"ft-skeleton":hs,"ft-snap-scroll":go,"ft-tooltip":mi,"ft-typography":ti},ms.styles=[Ve,as,cs,ds.styles,ps.styles],bs([o({type:Boolean})],ms.prototype,"dense",void 0),bs([o()],ms.prototype,"mode",void 0),bs([o({type:Boolean})],ms.prototype,"forceMobileMenuOpen",void 0),bs([o({type:Boolean})],ms.prototype,"forceMenuOpen",void 0),bs([o()],ms.prototype,"baseUrl",void 0),bs([o()],ms.prototype,"apiIntegrationIdentifier",void 0),bs([o()],ms.prototype,"contentLocale",void 0),bs([s()],ms.prototype,"availableContentLocales",void 0),bs([s()],ms.prototype,"availableContentLocalesInitialized",void 0),bs([o()],ms.prototype,"uiLocale",void 0),bs([p({})],ms.prototype,"labels",void 0),bs([p([])],ms.prototype,"displayedFilters",void 0),bs([p([])],ms.prototype,"presets",void 0),bs([o({type:String,reflect:!0})],ms.prototype,"selectedPreset",void 0),bs([p([])],ms.prototype,"priors",void 0),bs([o()],ms.prototype,"searchRequestSerializer",void 0),bs([s()],ms.prototype,"searchFilters",void 0),bs([s()],ms.prototype,"sizeCategory",void 0),bs([s()],ms.prototype,"displayFacets",void 0),bs([s()],ms.prototype,"mobileMenuOpen",void 0),bs([s()],ms.prototype,"facets",void 0),bs([s()],ms.prototype,"facetsInitialized",void 0),bs([n(".ft-search-bar--container")],ms.prototype,"container",void 0),bs([n(".ft-search-bar--filters-opener")],ms.prototype,"filtersOpener",void 0),bs([n(".ft-search-bar--floating-panel")],ms.prototype,"floatingContainer",void 0),bs([n("ft-snap-scroll.ft-search-bar--filters-container")],ms.prototype,"scrollingFiltersContainer",void 0),bs([n(".ft-search-bar--input")],ms.prototype,"input",void 0),bs([s()],ms.prototype,"query",void 0),bs([s()],ms.prototype,"suggestions",void 0),bs([s()],ms.prototype,"recentSearches",void 0),bs([s()],ms.prototype,"scrollToFacet",void 0),bs([s()],ms.prototype,"api",void 0),h("ft-search-bar")(ms),t.DEFAULT_LABELS=vs,t.FtSearchBar=ms,t.FtSearchBarCssVariables=ls,t.LaunchSearchEvent=gs,t.SearchStateChangeEvent=xs,t.facetsCss=cs,t.searchBarCss=as,Object.defineProperty(t,"i",{value:!0})}({});
2714
+ </div>`}}ms.elementDefinitions={"ft-accordion":Ro,"ft-accordion-item":Po,"ft-button":_i,"ft-chip":Jo,"ft-filter":zo,"ft-filter-option":Mo,"ft-icon":Li,"ft-ripple":vi,"ft-select":ss,"ft-select-option":os,"ft-size-watcher":Wt,"ft-skeleton":hs,"ft-snap-scroll":go,"ft-tooltip":mi,"ft-typography":ti},ms.styles=[Ve,as,cs,ds.styles,ps.styles],bs([o({type:Boolean})],ms.prototype,"dense",void 0),bs([o()],ms.prototype,"mode",void 0),bs([o({type:Boolean})],ms.prototype,"forceMobileMenuOpen",void 0),bs([o({type:Boolean})],ms.prototype,"forceMenuOpen",void 0),bs([o()],ms.prototype,"baseUrl",void 0),bs([o()],ms.prototype,"apiIntegrationIdentifier",void 0),bs([o()],ms.prototype,"contentLocale",void 0),bs([s()],ms.prototype,"availableContentLocales",void 0),bs([s()],ms.prototype,"availableContentLocalesInitialized",void 0),bs([o()],ms.prototype,"uiLocale",void 0),bs([p({})],ms.prototype,"labels",void 0),bs([p([])],ms.prototype,"displayedFilters",void 0),bs([p([])],ms.prototype,"presets",void 0),bs([o({type:String,reflect:!0})],ms.prototype,"selectedPreset",void 0),bs([p([])],ms.prototype,"priors",void 0),bs([o()],ms.prototype,"searchRequestSerializer",void 0),bs([s()],ms.prototype,"searchFilters",void 0),bs([s()],ms.prototype,"sizeCategory",void 0),bs([s()],ms.prototype,"displayFacets",void 0),bs([s()],ms.prototype,"mobileMenuOpen",void 0),bs([s()],ms.prototype,"facets",void 0),bs([s()],ms.prototype,"facetsInitialized",void 0),bs([n(".ft-search-bar--container")],ms.prototype,"container",void 0),bs([n(".ft-search-bar--filters-opener")],ms.prototype,"filtersOpener",void 0),bs([n(".ft-search-bar--floating-panel")],ms.prototype,"floatingContainer",void 0),bs([n("ft-snap-scroll.ft-search-bar--filters-container")],ms.prototype,"scrollingFiltersContainer",void 0),bs([n(".ft-search-bar--input")],ms.prototype,"input",void 0),bs([s()],ms.prototype,"query",void 0),bs([s()],ms.prototype,"suggestions",void 0),bs([s()],ms.prototype,"recentSearches",void 0),bs([s()],ms.prototype,"scrollToFacet",void 0),bs([s()],ms.prototype,"api",void 0),bs([s()],ms.prototype,"facetsLoaded",void 0),h("ft-search-bar")(ms),t.DEFAULT_LABELS=vs,t.FtSearchBar=ms,t.FtSearchBarCssVariables=ls,t.LaunchSearchEvent=gs,t.SearchStateChangeEvent=xs,t.facetsCss=cs,t.searchBarCss=as,Object.defineProperty(t,"i",{value:!0})}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-search-bar",
3
- "version": "0.3.43",
3
+ "version": "0.3.46",
4
4
  "description": "Search bar component using Fluid Topics public API",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,25 +19,25 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-accordion": "0.3.43",
23
- "@fluid-topics/ft-button": "0.3.43",
24
- "@fluid-topics/ft-chip": "0.3.43",
25
- "@fluid-topics/ft-filter": "0.3.43",
26
- "@fluid-topics/ft-icon": "0.3.43",
27
- "@fluid-topics/ft-select": "0.3.43",
28
- "@fluid-topics/ft-size-watcher": "0.3.43",
29
- "@fluid-topics/ft-skeleton": "0.3.43",
30
- "@fluid-topics/ft-snap-scroll": "0.3.43",
31
- "@fluid-topics/ft-tooltip": "0.3.43",
32
- "@fluid-topics/ft-typography": "0.3.43",
33
- "@fluid-topics/ft-wc-utils": "0.3.43",
22
+ "@fluid-topics/ft-accordion": "0.3.46",
23
+ "@fluid-topics/ft-button": "0.3.46",
24
+ "@fluid-topics/ft-chip": "0.3.46",
25
+ "@fluid-topics/ft-filter": "0.3.46",
26
+ "@fluid-topics/ft-icon": "0.3.46",
27
+ "@fluid-topics/ft-select": "0.3.46",
28
+ "@fluid-topics/ft-size-watcher": "0.3.46",
29
+ "@fluid-topics/ft-skeleton": "0.3.46",
30
+ "@fluid-topics/ft-snap-scroll": "0.3.46",
31
+ "@fluid-topics/ft-tooltip": "0.3.46",
32
+ "@fluid-topics/ft-typography": "0.3.46",
33
+ "@fluid-topics/ft-wc-utils": "0.3.46",
34
34
  "lit": "2.2.8"
35
35
  },
36
36
  "devDependencies": {
37
- "@fluid-topics/public-api": "1.0.27"
37
+ "@fluid-topics/public-api": "1.0.28"
38
38
  },
39
39
  "peerDependencies": {
40
- "@fluid-topics/public-api": "1.0.27"
40
+ "@fluid-topics/public-api": "1.0.28"
41
41
  },
42
- "gitHead": "42962910ff06ebfa42e961d1567ee771c517ccb7"
42
+ "gitHead": "de9703e114f8104f705c56d7793f03bfb5faae06"
43
43
  }