@fluid-topics/ft-search-bar 0.2.15 → 0.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ft-search-bar.d.ts +2 -0
- package/build/ft-search-bar.inline-styles.js +28 -15
- package/build/ft-search-bar.js +33 -17
- package/build/ft-search-bar.light.js +161 -148
- package/build/ft-search-bar.min.js +28 -15
- package/package.json +14 -14
package/build/ft-search-bar.d.ts
CHANGED
|
@@ -144,5 +144,7 @@ export declare class FtSearchBar extends FtLitElement implements FtSearchBarProp
|
|
|
144
144
|
private clearFilters;
|
|
145
145
|
private removeRecentSearch;
|
|
146
146
|
private onSuggestKeyDown;
|
|
147
|
+
private getFilterExportParts;
|
|
148
|
+
private getFilterSubPartExportAttribute;
|
|
147
149
|
}
|
|
148
150
|
//# sourceMappingURL=ft-search-bar.d.ts.map
|
|
@@ -135,7 +135,7 @@ var ct,ht;null==at||at(Y,tt),(null!==(z=globalThis.litHtmlVersions)&&void 0!==z?
|
|
|
135
135
|
* Copyright 2020 Google LLC
|
|
136
136
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
137
137
|
*/
|
|
138
|
-
const Tt=Symbol.for(""),At=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===Tt)return null===(i=t)||void 0===i?void 0:i._$litStatic$},_t=t=>({_$litStatic$:t,r:Tt}),Ht=new Map,Zt=(t=>(e,...i)=>{const o=i.length;let s,n;const r=[],l=[];let a,c=0,h=!1;for(;c<o;){for(a=e[c];c<o&&void 0!==(n=i[c],s=At(n));)a+=s+e[++c],h=!0;l.push(n),r.push(a),c++}if(c===o&&r.push(e[o]),h){const t=r.join("$$lit$$");void 0===(e=Ht.get(t))&&(r.raw=r,Ht.set(t,e=r)),i=l}return t(e,...i)})(K);var Kt,Wt=function(t,e,i,o){for(var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};!function(t){t.title="title",t.title_dense="title-dense",t.subtitle1="subtitle1",t.subtitle2="subtitle2",t.body1="body1",t.body2="body2",t.caption="caption",t.breadcrumb="breadcrumb",t.overline="overline",t.button="button"}(Kt||(Kt={}));const Vt=ft.extend("--ft-typography-font-family",bt.titleFont),qt=ft.extend("--ft-typography-font-family",bt.contentFont),Jt={fontFamily:qt,fontSize:ft.create("--ft-typography-font-size","SIZE","16px"),fontWeight:ft.create("--ft-typography-font-weight","UNKNOWN","normal"),letterSpacing:ft.create("--ft-typography-letter-spacing","SIZE","0.496px"),lineHeight:ft.create("--ft-typography-line-height","
|
|
138
|
+
const Tt=Symbol.for(""),At=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===Tt)return null===(i=t)||void 0===i?void 0:i._$litStatic$},_t=t=>({_$litStatic$:t,r:Tt}),Ht=new Map,Zt=(t=>(e,...i)=>{const o=i.length;let s,n;const r=[],l=[];let a,c=0,h=!1;for(;c<o;){for(a=e[c];c<o&&void 0!==(n=i[c],s=At(n));)a+=s+e[++c],h=!0;l.push(n),r.push(a),c++}if(c===o&&r.push(e[o]),h){const t=r.join("$$lit$$");void 0===(e=Ht.get(t))&&(r.raw=r,Ht.set(t,e=r)),i=l}return t(e,...i)})(K);var Kt,Wt=function(t,e,i,o){for(var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};!function(t){t.title="title",t.title_dense="title-dense",t.subtitle1="subtitle1",t.subtitle2="subtitle2",t.body1="body1",t.body2="body2",t.caption="caption",t.breadcrumb="breadcrumb",t.overline="overline",t.button="button"}(Kt||(Kt={}));const Vt=ft.extend("--ft-typography-font-family",bt.titleFont),qt=ft.extend("--ft-typography-font-family",bt.contentFont),Jt={fontFamily:qt,fontSize:ft.create("--ft-typography-font-size","SIZE","16px"),fontWeight:ft.create("--ft-typography-font-weight","UNKNOWN","normal"),letterSpacing:ft.create("--ft-typography-letter-spacing","SIZE","0.496px"),lineHeight:ft.create("--ft-typography-line-height","NUMBER","1.5"),textTransform:ft.create("--ft-typography-text-transform","UNKNOWN","inherit")},Xt=ft.extend("--ft-typography-title-font-family",Vt),Yt=ft.extend("--ft-typography-title-font-size",Jt.fontSize,"20px"),Qt=ft.extend("--ft-typography-title-font-weight",Jt.fontWeight,"normal"),Gt=ft.extend("--ft-typography-title-letter-spacing",Jt.letterSpacing,"0.15px"),te=ft.extend("--ft-typography-title-line-height",Jt.lineHeight,"1.2"),ee=ft.extend("--ft-typography-title-text-transform",Jt.textTransform,"inherit"),ie=ft.extend("--ft-typography-title-dense-font-family",Vt),oe=ft.extend("--ft-typography-title-dense-font-size",Jt.fontSize,"14px"),se=ft.extend("--ft-typography-title-dense-font-weight",Jt.fontWeight,"normal"),ne=ft.extend("--ft-typography-title-dense-letter-spacing",Jt.letterSpacing,"0.105px"),re=ft.extend("--ft-typography-title-dense-line-height",Jt.lineHeight,"1.7"),le=ft.extend("--ft-typography-title-dense-text-transform",Jt.textTransform,"inherit"),ae=ft.extend("--ft-typography-subtitle1-font-family",qt),ce=ft.extend("--ft-typography-subtitle1-font-size",Jt.fontSize,"16px"),he=ft.extend("--ft-typography-subtitle1-font-weight",Jt.fontWeight,"600"),pe=ft.extend("--ft-typography-subtitle1-letter-spacing",Jt.letterSpacing,"0.144px"),de=ft.extend("--ft-typography-subtitle1-line-height",Jt.lineHeight,"1.5"),fe=ft.extend("--ft-typography-subtitle1-text-transform",Jt.textTransform,"inherit"),ue=ft.extend("--ft-typography-subtitle2-font-family",qt),be=ft.extend("--ft-typography-subtitle2-font-size",Jt.fontSize,"14px"),ve=ft.extend("--ft-typography-subtitle2-font-weight",Jt.fontWeight,"normal"),ge=ft.extend("--ft-typography-subtitle2-letter-spacing",Jt.letterSpacing,"0.098px"),xe=ft.extend("--ft-typography-subtitle2-line-height",Jt.lineHeight,"1.7"),ye=ft.extend("--ft-typography-subtitle2-text-transform",Jt.textTransform,"inherit"),me={fontFamily:ft.extend("--ft-typography-body1-font-family",qt),fontSize:ft.extend("--ft-typography-body1-font-size",Jt.fontSize,"16px"),fontWeight:ft.extend("--ft-typography-body1-font-weight",Jt.fontWeight,"normal"),letterSpacing:ft.extend("--ft-typography-body1-letter-spacing",Jt.letterSpacing,"0.496px"),lineHeight:ft.extend("--ft-typography-body1-line-height",Jt.lineHeight,"1.5"),textTransform:ft.extend("--ft-typography-body1-text-transform",Jt.textTransform,"inherit")},$e={fontFamily:ft.extend("--ft-typography-body2-font-family",qt),fontSize:ft.extend("--ft-typography-body2-font-size",Jt.fontSize,"14px"),fontWeight:ft.extend("--ft-typography-body2-font-weight",Jt.fontWeight,"normal"),letterSpacing:ft.extend("--ft-typography-body2-letter-spacing",Jt.letterSpacing,"0.252px"),lineHeight:ft.extend("--ft-typography-body2-line-height",Jt.lineHeight,"1.4"),textTransform:ft.extend("--ft-typography-body2-text-transform",Jt.textTransform,"inherit")},we={fontFamily:ft.extend("--ft-typography-caption-font-family",qt),fontSize:ft.extend("--ft-typography-caption-font-size",Jt.fontSize,"12px"),fontWeight:ft.extend("--ft-typography-caption-font-weight",Jt.fontWeight,"normal"),letterSpacing:ft.extend("--ft-typography-caption-letter-spacing",Jt.letterSpacing,"0.396px"),lineHeight:ft.extend("--ft-typography-caption-line-height",Jt.lineHeight,"1.33"),textTransform:ft.extend("--ft-typography-caption-text-transform",Jt.textTransform,"inherit")},ke=ft.extend("--ft-typography-breadcrumb-font-family",qt),Se=ft.extend("--ft-typography-breadcrumb-font-size",Jt.fontSize,"10px"),Oe=ft.extend("--ft-typography-breadcrumb-font-weight",Jt.fontWeight,"normal"),Ce=ft.extend("--ft-typography-breadcrumb-letter-spacing",Jt.letterSpacing,"0.33px"),ze=ft.extend("--ft-typography-breadcrumb-line-height",Jt.lineHeight,"1.6"),Ee=ft.extend("--ft-typography-breadcrumb-text-transform",Jt.textTransform,"inherit"),Be=ft.extend("--ft-typography-overline-font-family",qt),Me=ft.extend("--ft-typography-overline-font-size",Jt.fontSize,"10px"),Ne=ft.extend("--ft-typography-overline-font-weight",Jt.fontWeight,"normal"),Re=ft.extend("--ft-typography-overline-letter-spacing",Jt.letterSpacing,"1.5px"),Fe=ft.extend("--ft-typography-overline-line-height",Jt.lineHeight,"1.6"),Le=ft.extend("--ft-typography-overline-text-transform",Jt.textTransform,"uppercase"),De={fontFamily:ft.extend("--ft-typography-button-font-family",qt),fontSize:ft.extend("--ft-typography-button-font-size",Jt.fontSize,"14px"),fontWeight:ft.extend("--ft-typography-button-font-weight",Jt.fontWeight,"600"),letterSpacing:ft.extend("--ft-typography-button-letter-spacing",Jt.letterSpacing,"1.246px"),lineHeight:ft.extend("--ft-typography-button-line-height",Jt.lineHeight,"1.15"),textTransform:ft.extend("--ft-typography-button-text-transform",Jt.textTransform,"uppercase")},Ie=v`
|
|
139
139
|
.ft-typography--title {
|
|
140
140
|
font-family: ${Xt};
|
|
141
141
|
font-size: ${Yt};
|
|
@@ -478,8 +478,10 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
478
478
|
<slot @slotchange=${()=>this.requestUpdate()} ?hidden=${"material"!==this.variant}></slot>
|
|
479
479
|
</i>
|
|
480
480
|
`}get textContent(){var t,e;return null!==(e=null===(t=this.slottedContent)||void 0===t?void 0:t.assignedNodes().map((t=>t.textContent)).join("").trim())&&void 0!==e?e:""}getIcon(){var t,e;let i=this.textContent;return this.variant===wi.file_format?null!==(t=yi[i.toUpperCase()])&&void 0!==t?t:i:this.variant===wi.fluid_topics?null!==(e=xi[i.toUpperCase()])&&void 0!==e?e:i:V}}Oi.elementDefinitions={},Oi.styles=v`
|
|
481
|
-
:host
|
|
481
|
+
:host {
|
|
482
482
|
display: inline-block;
|
|
483
|
+
}
|
|
484
|
+
:host, i.ft-icon {
|
|
483
485
|
width: ${Si.size};
|
|
484
486
|
height: ${Si.size};
|
|
485
487
|
text-align: center;
|
|
@@ -549,6 +551,7 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
549
551
|
box-sizing: border-box;
|
|
550
552
|
border: none;
|
|
551
553
|
pointer-events: auto;
|
|
554
|
+
line-height: 0;
|
|
552
555
|
|
|
553
556
|
--ft-button-internal-font-size: ${Ei.fontSize};
|
|
554
557
|
--ft-button-internal-line-height: calc(var(--ft-button-internal-font-size) + 2px);
|
|
@@ -2294,7 +2297,8 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
2294
2297
|
${this.labelResolver.resolve("searchButton")}
|
|
2295
2298
|
</ft-button>
|
|
2296
2299
|
`:V}
|
|
2297
|
-
`}renderMobileSearchBarButtons(){
|
|
2300
|
+
`}renderMobileSearchBarButtons(){const t=this.query||this.isMobileMenuOpen&&!this.forceMobileMenuOpen;return K`
|
|
2301
|
+
${t?K`
|
|
2298
2302
|
<div class="ft-search-bar--actions"
|
|
2299
2303
|
part="search-bar-actions">
|
|
2300
2304
|
<ft-button class="ft-search-bar--clear-query"
|
|
@@ -2302,10 +2306,11 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
2302
2306
|
icon="close"
|
|
2303
2307
|
round
|
|
2304
2308
|
label="${this.labelResolver.resolve("clearInputButton")}"
|
|
2309
|
+
tooltipPosition="left"
|
|
2305
2310
|
@click=${()=>{this.setQuery(""),this.mobileMenuOpen=!1,this.displayFacets=!1}}
|
|
2306
2311
|
></ft-button>
|
|
2307
2312
|
</div>
|
|
2308
|
-
`:
|
|
2313
|
+
`:V}
|
|
2309
2314
|
<div class="ft-search-bar--actions"
|
|
2310
2315
|
part="search-bar-actions">
|
|
2311
2316
|
<ft-button class="ft-search-bar--launch-search"
|
|
@@ -2313,7 +2318,8 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
2313
2318
|
icon="search"
|
|
2314
2319
|
round
|
|
2315
2320
|
label="${this.labelResolver.resolve("searchButton")}"
|
|
2316
|
-
|
|
2321
|
+
tooltipPosition="left"
|
|
2322
|
+
@click=${()=>{var t;return this.isMobileMenuOpen?this.launchSearch():null===(t=this.input)||void 0===t?void 0:t.focus()}}
|
|
2317
2323
|
></ft-button>
|
|
2318
2324
|
</div>
|
|
2319
2325
|
`}renderMobileFacets(){var t;const e=this.availableContentLocales.filter((t=>t.lang===this.contentLocale)).pop();return K`
|
|
@@ -2328,7 +2334,8 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
2328
2334
|
</ft-typography>
|
|
2329
2335
|
</div>
|
|
2330
2336
|
<ft-filter
|
|
2331
|
-
part="filters"
|
|
2337
|
+
part="filters filter-ft-locale"
|
|
2338
|
+
exportparts=${this.getFilterExportParts("ft-locale")}
|
|
2332
2339
|
class="ft-search-bar--content-locale"
|
|
2333
2340
|
filterPlaceHolder="${this.labelResolver.resolve("filterInputPlaceHolder",this.labelResolver.resolve("contentLocaleSelector"))}"
|
|
2334
2341
|
.options=${this.contentLocalesAsFilterOptions()}
|
|
@@ -2336,7 +2343,7 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
2336
2343
|
></ft-filter>
|
|
2337
2344
|
</ft-accordion-item>
|
|
2338
2345
|
`:null}
|
|
2339
|
-
${Lt(this.facets,(t=>t.key),(t=>{const e=Xe(t);return K`
|
|
2346
|
+
${Lt(this.facets,(t=>t.key),(t=>{const e=Xe(t),i=t.key.replace(":","-");return K`
|
|
2340
2347
|
<ft-accordion-item data-facet-key="${t.key}">
|
|
2341
2348
|
<div class="ft-search-bar--filter-label" slot="toggle">
|
|
2342
2349
|
<ft-typography variant="button">${t.label}</ft-typography>
|
|
@@ -2345,7 +2352,8 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
2345
2352
|
</ft-typography>
|
|
2346
2353
|
</div>
|
|
2347
2354
|
<ft-filter
|
|
2348
|
-
part="filters"
|
|
2355
|
+
part="filters filter-${i}"
|
|
2356
|
+
exportparts=${this.getFilterExportParts(i)}
|
|
2349
2357
|
id="${e.id}"
|
|
2350
2358
|
filterPlaceHolder="${this.labelResolver.resolve("filterInputPlaceHolder",e.label)}"
|
|
2351
2359
|
clearButtonLabel="${this.labelResolver.resolve("clearFilterButton")}"
|
|
@@ -2460,20 +2468,23 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
2460
2468
|
`}renderDesktopFacets(){return this.hasFacets?K`
|
|
2461
2469
|
<ft-snap-scroll horizontal limitSize controls
|
|
2462
2470
|
class="ft-search-bar--filters-container"
|
|
2463
|
-
part="filters-container"
|
|
2471
|
+
part="filters-container"
|
|
2472
|
+
exportparts="controls:snap-scroll-controls">
|
|
2464
2473
|
${this.hasLocaleSelector?K`
|
|
2465
|
-
<ft-filter
|
|
2466
|
-
|
|
2474
|
+
<ft-filter class="ft-search-bar--content-locale"
|
|
2475
|
+
part="filters filter-ft-locale"
|
|
2476
|
+
exportparts=${this.getFilterExportParts("ft-locale")}
|
|
2467
2477
|
label="${this.labelResolver.resolve("contentLocaleSelector")}"
|
|
2468
2478
|
filterPlaceHolder="${this.labelResolver.resolve("filterInputPlaceHolder",this.labelResolver.resolve("contentLocaleSelector"))}"
|
|
2469
2479
|
.options=${this.contentLocalesAsFilterOptions()}
|
|
2470
2480
|
@change=${t=>this.contentLocale=t.detail[0]}
|
|
2471
2481
|
></ft-filter>
|
|
2472
2482
|
`:V}
|
|
2473
|
-
${Lt(this.facets,(t=>t.key),(t=>{const e=Xe(t),i=e.options.some((t=>{var e,i;return(null!==(i=null===(e=t.subOptions)||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0}));return K`
|
|
2483
|
+
${Lt(this.facets,(t=>t.key),(t=>{const e=Xe(t),i=e.options.some((t=>{var e,i;return(null!==(i=null===(e=t.subOptions)||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0})),o=t.key.replace(":","-");return K`
|
|
2474
2484
|
<ft-filter
|
|
2475
2485
|
class="${i?"ft-search-bar--hierarchical-filter":""}"
|
|
2476
|
-
part="filters"
|
|
2486
|
+
part="filters filter-${o}"
|
|
2487
|
+
exportparts=${this.getFilterExportParts(o)}
|
|
2477
2488
|
id="${e.id}"
|
|
2478
2489
|
label="${e.label}"
|
|
2479
2490
|
filterPlaceHolder="${this.labelResolver.resolve("filterInputPlaceHolder",e.label)}"
|
|
@@ -2525,7 +2536,8 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
2525
2536
|
`;return t?K`
|
|
2526
2537
|
<ft-snap-scroll horizontal controls hideScrollbar limitSize
|
|
2527
2538
|
class="ft-search-bar--selected-filters"
|
|
2528
|
-
part="selected-filters-container"
|
|
2539
|
+
part="selected-filters-container"
|
|
2540
|
+
exportparts="controls:snap-scroll-controls">
|
|
2529
2541
|
${e}
|
|
2530
2542
|
</ft-snap-scroll>
|
|
2531
2543
|
`:K`
|
|
@@ -2549,6 +2561,7 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
2549
2561
|
part="remove-suggestion"
|
|
2550
2562
|
?dense=${!this.isMobile}
|
|
2551
2563
|
label="${this.labelResolver.resolve("removeRecentSearch")}"
|
|
2564
|
+
tooltipPosition="left"
|
|
2552
2565
|
@click=${e=>this.removeRecentSearch(e,t)}></ft-button>
|
|
2553
2566
|
</a>
|
|
2554
2567
|
`))}
|
|
@@ -2574,7 +2587,7 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
2574
2587
|
<ft-icon variant="${e}" part="suggestion-icon">
|
|
2575
2588
|
${i}
|
|
2576
2589
|
</ft-icon>
|
|
2577
|
-
`}openMobileFilters(t){this.isMobile&&(this.mobileMenuOpen=!0,this.displayFacets=!0,this.scrollToFacet=t)}async firstUpdated(t){super.firstUpdated(t),this.initApi()}update(t){var e,i,o,s,n,r;if(t.has("labels")&&(this.labelResolver=new xt(Wo,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.recentSearches=JSON.parse(null!==(i=window.localStorage.getItem(this.recentSearchesStorageKey))&&void 0!==i?i:"[]")),t.has("presets")&&(null!==(o=this.presets)&&void 0!==o?o:[]).forEach((t=>t.filters.forEach((t=>t.values=t.values.map((t=>qe(t))))))),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)}["contentLocale","searchFilters"].some((e=>t.has(e)))&&(this.selectedPreset=null===(r=(null!==(n=this.presets)&&void 0!==n?n:[]).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(),this.availableContentLocalesInitialized=!1,this.facetsInitialized=!1),t.has("api")&&this.updateAvailableContentLocales(),["uiLocale","contentLocale","searchFilters","displayedFilters","api"].some((e=>t.has(e)))&&this.updateFacets(),["query","uiLocale","contentLocale","searchFilters","displayedFilters","api"].some((e=>t.has(e)))&&this.updateSuggestions(),["query","uiLocale","contentLocale","searchFilters"].some((e=>t.has(e)))&&this.dispatchEvent(new qo(this.request))}async updateAvailableContentLocales(){this.api&&(this.availableContentLocales=await this.api.getAvailableSearchLocales().then((t=>t.contentLocales)).catch((()=>[])),this.availableContentLocalesInitialized=!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()),100))}updateFacets(){this.api&&(this.facetsRequest.length>0?(this.facetsLoaded=!1,this.updateFacetsDebouncer.run((async()=>{var t,e;this.facets=null!==(e=await(null===(t=this.api)||void 0===t?void 0:t.search({...this.request,query:""}).then((t=>t.facets)).catch((()=>[]))))&&void 0!==e?e:[],this.facets.forEach((t=>this.knownFacetLabels[t.key]=t.label)),this.facetsLoaded=!0,this.facetsInitialized=!0}))):(this.facets=[],this.facetsInitialized=!0))}updateSuggestions(){this.suggestionsLoaded=!1,this.suggestDebouncer.run((async()=>{this.suggestions=this.api&&this.query.length>2?await this.api.getSuggestions(this.suggestRequest).then((t=>t.suggestions)).catch((()=>[])):[],this.suggestionsLoaded=!0}))}onSearchBarKeyUp(t){const e=t.composedPath()[0];this.query=e.value,"Enter"===t.key&&this.launchSearch()}onSearchBarKeyDown(t){var e,i;switch(t.key){case"Escape":this.mobileMenuOpen=!1,null===(e=this.input)||void 0===e||e.blur();break;case"ArrowDown":t.stopPropagation(),t.preventDefault(),null===(i=this.firstSuggestion)||void 0===i||i.focus()}}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}onSuggestClick(t,e){t.ctrlKey||t.metaKey||this.onSuggestSelected(t,e)}onSuggestKeyUp(t,e){"Enter"!==t.key&&" "!==t.key||this.onSuggestSelected(t,e)}onSuggestSelected(t,e){t.preventDefault(),this.setQuery(e),this.launchSearch()}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 Vo(this.request)),this.mobileMenuOpen=!1,this.displayFacets=!1,this.focus()}saveRecentSearches(){window.localStorage.setItem(this.recentSearchesStorageKey,JSON.stringify(this.recentSearches))}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}getLocaleLabel(t){var e;return null!==(e=this.availableContentLocales.filter((e=>{var i;return(null!==(i=e.lang)&&void 0!==i?i:"").toLowerCase()===(null!=t?t:"").toLowerCase()})).map((t=>t.label)).pop())&&void 0!==e?e:t}setFilter(t,e){let i=this.searchFilters.filter((e=>e.key!==t));this.facets.forEach((i=>{i.key===t&&Ve(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=>Ve(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}removeRecentSearch(t,e){var i,o,s,n;t.preventDefault(),t.stopPropagation();const r=null!==(n=null!==(o=null===(i=this.focusedSuggestion)||void 0===i?void 0:i.previousElementSibling)&&void 0!==o?o:null===(s=this.focusedSuggestion)||void 0===s?void 0:s.nextElementSibling)&&void 0!==n?n:this.input;null==r||r.focus(),this.recentSearches=this.recentSearches.filter((t=>t.toLowerCase()!==e.toLowerCase())),this.saveRecentSearches()}onSuggestKeyDown(t){var e,i,o,s,n,r;switch(t.key){case"ArrowUp":null===(o=null!==(i=null===(e=this.focusedSuggestion)||void 0===e?void 0:e.previousElementSibling)&&void 0!==i?i:this.lastSuggestion)||void 0===o||o.focus(),t.preventDefault(),t.stopPropagation();break;case"ArrowDown":null===(r=null!==(n=null===(s=this.focusedSuggestion)||void 0===s?void 0:s.nextElementSibling)&&void 0!==n?n:this.firstSuggestion)||void 0===r||r.focus(),t.preventDefault(),t.stopPropagation()}}}Jo.elementDefinitions={"ft-accordion":vo,"ft-accordion-item":$o,"ft-button":Ri,"ft-chip":Mo,"ft-filter":po,"ft-filter-option":uo,"ft-icon":Oi,"ft-ripple":ri,"ft-select":jo,"ft-select-option":Do,"ft-size-watcher":Pt,"ft-skeleton":Po,"ft-snap-scroll":eo,"ft-tooltip":fi,"ft-typography":We},Jo.styles=[Ae,Ao,_o,Ho,Zo],Ko([i({type:Boolean})],Jo.prototype,"dense",void 0),Ko([i()],Jo.prototype,"mode",void 0),Ko([i({type:Boolean})],Jo.prototype,"forceMobileMenuOpen",void 0),Ko([i()],Jo.prototype,"baseUrl",void 0),Ko([i()],Jo.prototype,"apiIntegrationIdentifier",void 0),Ko([i()],Jo.prototype,"contentLocale",void 0),Ko([o()],Jo.prototype,"availableContentLocales",void 0),Ko([o()],Jo.prototype,"availableContentLocalesInitialized",void 0),Ko([i()],Jo.prototype,"uiLocale",void 0),Ko([h({})],Jo.prototype,"labels",void 0),Ko([h([])],Jo.prototype,"displayedFilters",void 0),Ko([h([])],Jo.prototype,"presets",void 0),Ko([i({type:String,reflect:!0})],Jo.prototype,"selectedPreset",void 0),Ko([h([])],Jo.prototype,"priors",void 0),Ko([i()],Jo.prototype,"searchRequestSerializer",void 0),Ko([o()],Jo.prototype,"searchFilters",void 0),Ko([o()],Jo.prototype,"sizeCategory",void 0),Ko([o()],Jo.prototype,"displayFacets",void 0),Ko([o()],Jo.prototype,"mobileMenuOpen",void 0),Ko([o()],Jo.prototype,"facets",void 0),Ko([o()],Jo.prototype,"facetsInitialized",void 0),Ko([n(".ft-search-bar--container")],Jo.prototype,"container",void 0),Ko([n(".ft-search-bar--filters-opener")],Jo.prototype,"filtersOpener",void 0),Ko([n(".ft-search-bar--floating-panel")],Jo.prototype,"floatingContainer",void 0),Ko([n("ft-snap-scroll.ft-search-bar--filters-container")],Jo.prototype,"scrollingFiltersContainer",void 0),Ko([n(".ft-search-bar--input")],Jo.prototype,"input",void 0),Ko([o()],Jo.prototype,"query",void 0),Ko([o()],Jo.prototype,"suggestions",void 0),Ko([o()],Jo.prototype,"suggestionsLoaded",void 0),Ko([o()],Jo.prototype,"recentSearches",void 0),Ko([o()],Jo.prototype,"scrollToFacet",void 0),Ko([n(".ft-search-bar--suggestion:first-child")],Jo.prototype,"firstSuggestion",void 0),Ko([n(".ft-search-bar--suggestion:focus-within")],Jo.prototype,"focusedSuggestion",void 0),Ko([n(".ft-search-bar--suggestion:last-child")],Jo.prototype,"lastSuggestion",void 0),Ko([o()],Jo.prototype,"api",void 0),c("ft-search-bar")(function t(e){var i;let o;if("elementDefinitions"in e){o={};const i=e.elementDefinitions;for(let e in i)o[e]=t(i[e])}return i=class extends e{render(){var t;let i=null!==(t=e.styles)&&void 0!==t?t:[];return Array.isArray(i)||(i=[i]),K`
|
|
2590
|
+
`}openMobileFilters(t){this.isMobile&&(this.mobileMenuOpen=!0,this.displayFacets=!0,this.scrollToFacet=t)}async firstUpdated(t){super.firstUpdated(t),this.initApi()}update(t){var e,i,o,s,n,r;if(t.has("labels")&&(this.labelResolver=new xt(Wo,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.recentSearches=JSON.parse(null!==(i=window.localStorage.getItem(this.recentSearchesStorageKey))&&void 0!==i?i:"[]")),t.has("presets")&&(null!==(o=this.presets)&&void 0!==o?o:[]).forEach((t=>t.filters.forEach((t=>t.values=t.values.map((t=>qe(t))))))),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)}["contentLocale","searchFilters"].some((e=>t.has(e)))&&(this.selectedPreset=null===(r=(null!==(n=this.presets)&&void 0!==n?n:[]).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(),this.availableContentLocalesInitialized=!1,this.facetsInitialized=!1),t.has("api")&&this.updateAvailableContentLocales(),["uiLocale","contentLocale","searchFilters","displayedFilters","api"].some((e=>t.has(e)))&&this.updateFacets(),["query","uiLocale","contentLocale","searchFilters","displayedFilters","api"].some((e=>t.has(e)))&&this.updateSuggestions(),["query","uiLocale","contentLocale","searchFilters"].some((e=>t.has(e)))&&this.dispatchEvent(new qo(this.request))}async updateAvailableContentLocales(){this.api&&(this.availableContentLocales=await this.api.getAvailableSearchLocales().then((t=>t.contentLocales)).catch((()=>[])),this.availableContentLocalesInitialized=!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()),100))}updateFacets(){this.api&&(this.facetsRequest.length>0?(this.facetsLoaded=!1,this.updateFacetsDebouncer.run((async()=>{var t,e;this.facets=null!==(e=await(null===(t=this.api)||void 0===t?void 0:t.search({...this.request,query:""}).then((t=>t.facets)).catch((()=>[]))))&&void 0!==e?e:[],this.facets.forEach((t=>this.knownFacetLabels[t.key]=t.label)),this.facetsLoaded=!0,this.facetsInitialized=!0}))):(this.facets=[],this.facetsInitialized=!0))}updateSuggestions(){this.suggestionsLoaded=!1,this.suggestDebouncer.run((async()=>{this.suggestions=this.api&&this.query.length>2?await this.api.getSuggestions(this.suggestRequest).then((t=>t.suggestions)).catch((()=>[])):[],this.suggestionsLoaded=!0}))}onSearchBarKeyUp(t){const e=t.composedPath()[0];this.query=e.value,"Enter"===t.key&&this.launchSearch()}onSearchBarKeyDown(t){var e,i;switch(t.key){case"Escape":this.mobileMenuOpen=!1,null===(e=this.input)||void 0===e||e.blur();break;case"ArrowDown":t.stopPropagation(),t.preventDefault(),null===(i=this.firstSuggestion)||void 0===i||i.focus()}}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}onSuggestClick(t,e){t.ctrlKey||t.metaKey||this.onSuggestSelected(t,e)}onSuggestKeyUp(t,e){"Enter"!==t.key&&" "!==t.key||this.onSuggestSelected(t,e)}onSuggestSelected(t,e){t.preventDefault(),this.setQuery(e),this.launchSearch()}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 Vo(this.request)),this.mobileMenuOpen=!1,this.displayFacets=!1,this.focus()}saveRecentSearches(){window.localStorage.setItem(this.recentSearchesStorageKey,JSON.stringify(this.recentSearches))}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}getLocaleLabel(t){var e;return null!==(e=this.availableContentLocales.filter((e=>{var i;return(null!==(i=e.lang)&&void 0!==i?i:"").toLowerCase()===(null!=t?t:"").toLowerCase()})).map((t=>t.label)).pop())&&void 0!==e?e:t}setFilter(t,e){let i=this.searchFilters.filter((e=>e.key!==t));this.facets.forEach((i=>{i.key===t&&Ve(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=>Ve(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}removeRecentSearch(t,e){var i,o,s,n;t.preventDefault(),t.stopPropagation();const r=null!==(n=null!==(o=null===(i=this.focusedSuggestion)||void 0===i?void 0:i.previousElementSibling)&&void 0!==o?o:null===(s=this.focusedSuggestion)||void 0===s?void 0:s.nextElementSibling)&&void 0!==n?n:this.input;null==r||r.focus(),this.recentSearches=this.recentSearches.filter((t=>t.toLowerCase()!==e.toLowerCase())),this.saveRecentSearches()}onSuggestKeyDown(t){var e,i,o,s,n,r;switch(t.key){case"ArrowUp":null===(o=null!==(i=null===(e=this.focusedSuggestion)||void 0===e?void 0:e.previousElementSibling)&&void 0!==i?i:this.lastSuggestion)||void 0===o||o.focus(),t.preventDefault(),t.stopPropagation();break;case"ArrowDown":null===(r=null!==(n=null===(s=this.focusedSuggestion)||void 0===s?void 0:s.nextElementSibling)&&void 0!==n?n:this.firstSuggestion)||void 0===r||r.focus(),t.preventDefault(),t.stopPropagation()}}getFilterExportParts(t){return["container","header","clear-button","input"].map((e=>this.getFilterSubPartExportAttribute(e,t))).join(",")}getFilterSubPartExportAttribute(t,e){return`${t}:filters-${t},${t}:filter-${e}-${t}`}}Jo.elementDefinitions={"ft-accordion":vo,"ft-accordion-item":$o,"ft-button":Ri,"ft-chip":Mo,"ft-filter":po,"ft-filter-option":uo,"ft-icon":Oi,"ft-ripple":ri,"ft-select":jo,"ft-select-option":Do,"ft-size-watcher":Pt,"ft-skeleton":Po,"ft-snap-scroll":eo,"ft-tooltip":fi,"ft-typography":We},Jo.styles=[Ae,Ao,_o,Ho,Zo],Ko([i({type:Boolean})],Jo.prototype,"dense",void 0),Ko([i()],Jo.prototype,"mode",void 0),Ko([i({type:Boolean})],Jo.prototype,"forceMobileMenuOpen",void 0),Ko([i()],Jo.prototype,"baseUrl",void 0),Ko([i()],Jo.prototype,"apiIntegrationIdentifier",void 0),Ko([i()],Jo.prototype,"contentLocale",void 0),Ko([o()],Jo.prototype,"availableContentLocales",void 0),Ko([o()],Jo.prototype,"availableContentLocalesInitialized",void 0),Ko([i()],Jo.prototype,"uiLocale",void 0),Ko([h({})],Jo.prototype,"labels",void 0),Ko([h([])],Jo.prototype,"displayedFilters",void 0),Ko([h([])],Jo.prototype,"presets",void 0),Ko([i({type:String,reflect:!0})],Jo.prototype,"selectedPreset",void 0),Ko([h([])],Jo.prototype,"priors",void 0),Ko([i()],Jo.prototype,"searchRequestSerializer",void 0),Ko([o()],Jo.prototype,"searchFilters",void 0),Ko([o()],Jo.prototype,"sizeCategory",void 0),Ko([o()],Jo.prototype,"displayFacets",void 0),Ko([o()],Jo.prototype,"mobileMenuOpen",void 0),Ko([o()],Jo.prototype,"facets",void 0),Ko([o()],Jo.prototype,"facetsInitialized",void 0),Ko([n(".ft-search-bar--container")],Jo.prototype,"container",void 0),Ko([n(".ft-search-bar--filters-opener")],Jo.prototype,"filtersOpener",void 0),Ko([n(".ft-search-bar--floating-panel")],Jo.prototype,"floatingContainer",void 0),Ko([n("ft-snap-scroll.ft-search-bar--filters-container")],Jo.prototype,"scrollingFiltersContainer",void 0),Ko([n(".ft-search-bar--input")],Jo.prototype,"input",void 0),Ko([o()],Jo.prototype,"query",void 0),Ko([o()],Jo.prototype,"suggestions",void 0),Ko([o()],Jo.prototype,"suggestionsLoaded",void 0),Ko([o()],Jo.prototype,"recentSearches",void 0),Ko([o()],Jo.prototype,"scrollToFacet",void 0),Ko([n(".ft-search-bar--suggestion:first-child")],Jo.prototype,"firstSuggestion",void 0),Ko([n(".ft-search-bar--suggestion:focus-within")],Jo.prototype,"focusedSuggestion",void 0),Ko([n(".ft-search-bar--suggestion:last-child")],Jo.prototype,"lastSuggestion",void 0),Ko([o()],Jo.prototype,"api",void 0),c("ft-search-bar")(function t(e){var i;let o;if("elementDefinitions"in e){o={};const i=e.elementDefinitions;for(let e in i)o[e]=t(i[e])}return i=class extends e{render(){var t;let i=null!==(t=e.styles)&&void 0!==t?t:[];return Array.isArray(i)||(i=[i]),K`
|
|
2578
2591
|
${i.map((t=>K`
|
|
2579
2592
|
<style>${t}</style>
|
|
2580
2593
|
`))}
|
package/build/ft-search-bar.js
CHANGED
|
@@ -220,8 +220,9 @@ export class FtSearchBar extends FtLitElement {
|
|
|
220
220
|
`;
|
|
221
221
|
}
|
|
222
222
|
renderMobileSearchBarButtons() {
|
|
223
|
-
|
|
224
|
-
|
|
223
|
+
const displayClearButton = this.query || (this.isMobileMenuOpen && !this.forceMobileMenuOpen);
|
|
224
|
+
return html `
|
|
225
|
+
${displayClearButton ? html `
|
|
225
226
|
<div class="ft-search-bar--actions"
|
|
226
227
|
part="search-bar-actions">
|
|
227
228
|
<ft-button class="ft-search-bar--clear-query"
|
|
@@ -229,16 +230,15 @@ export class FtSearchBar extends FtLitElement {
|
|
|
229
230
|
icon="close"
|
|
230
231
|
round
|
|
231
232
|
label="${this.labelResolver.resolve("clearInputButton")}"
|
|
233
|
+
tooltipPosition="left"
|
|
232
234
|
@click=${() => {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
235
|
+
this.setQuery("");
|
|
236
|
+
this.mobileMenuOpen = false;
|
|
237
|
+
this.displayFacets = false;
|
|
238
|
+
}}
|
|
237
239
|
></ft-button>
|
|
238
240
|
</div>
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
return html `
|
|
241
|
+
` : nothing}
|
|
242
242
|
<div class="ft-search-bar--actions"
|
|
243
243
|
part="search-bar-actions">
|
|
244
244
|
<ft-button class="ft-search-bar--launch-search"
|
|
@@ -246,7 +246,8 @@ export class FtSearchBar extends FtLitElement {
|
|
|
246
246
|
icon="search"
|
|
247
247
|
round
|
|
248
248
|
label="${this.labelResolver.resolve("searchButton")}"
|
|
249
|
-
|
|
249
|
+
tooltipPosition="left"
|
|
250
|
+
@click=${() => { var _a; return this.isMobileMenuOpen ? this.launchSearch() : (_a = this.input) === null || _a === void 0 ? void 0 : _a.focus(); }}
|
|
250
251
|
></ft-button>
|
|
251
252
|
</div>
|
|
252
253
|
`;
|
|
@@ -266,7 +267,8 @@ export class FtSearchBar extends FtLitElement {
|
|
|
266
267
|
</ft-typography>
|
|
267
268
|
</div>
|
|
268
269
|
<ft-filter
|
|
269
|
-
part="filters"
|
|
270
|
+
part="filters filter-ft-locale"
|
|
271
|
+
exportparts=${this.getFilterExportParts("ft-locale")}
|
|
270
272
|
class="ft-search-bar--content-locale"
|
|
271
273
|
filterPlaceHolder="${this.labelResolver.resolve("filterInputPlaceHolder", this.labelResolver.resolve("contentLocaleSelector"))}"
|
|
272
274
|
.options=${(this.contentLocalesAsFilterOptions())}
|
|
@@ -276,6 +278,7 @@ export class FtSearchBar extends FtLitElement {
|
|
|
276
278
|
` : null}
|
|
277
279
|
${repeat(this.facets, facet => facet.key, facet => {
|
|
278
280
|
const filter = facetToFilter(facet);
|
|
281
|
+
const keyWithNoColumn = facet.key.replace(":", "-");
|
|
279
282
|
return html `
|
|
280
283
|
<ft-accordion-item data-facet-key="${facet.key}">
|
|
281
284
|
<div class="ft-search-bar--filter-label" slot="toggle">
|
|
@@ -285,7 +288,8 @@ export class FtSearchBar extends FtLitElement {
|
|
|
285
288
|
</ft-typography>
|
|
286
289
|
</div>
|
|
287
290
|
<ft-filter
|
|
288
|
-
part="filters"
|
|
291
|
+
part="filters filter-${keyWithNoColumn}"
|
|
292
|
+
exportparts=${this.getFilterExportParts(keyWithNoColumn)}
|
|
289
293
|
id="${filter.id}"
|
|
290
294
|
filterPlaceHolder="${this.labelResolver.resolve("filterInputPlaceHolder", filter.label)}"
|
|
291
295
|
clearButtonLabel="${this.labelResolver.resolve("clearFilterButton")}"
|
|
@@ -436,10 +440,12 @@ export class FtSearchBar extends FtLitElement {
|
|
|
436
440
|
return html `
|
|
437
441
|
<ft-snap-scroll horizontal limitSize controls
|
|
438
442
|
class="ft-search-bar--filters-container"
|
|
439
|
-
part="filters-container"
|
|
443
|
+
part="filters-container"
|
|
444
|
+
exportparts="controls:snap-scroll-controls">
|
|
440
445
|
${this.hasLocaleSelector ? html `
|
|
441
|
-
<ft-filter
|
|
442
|
-
|
|
446
|
+
<ft-filter class="ft-search-bar--content-locale"
|
|
447
|
+
part="filters filter-ft-locale"
|
|
448
|
+
exportparts=${this.getFilterExportParts("ft-locale")}
|
|
443
449
|
label="${this.labelResolver.resolve("contentLocaleSelector")}"
|
|
444
450
|
filterPlaceHolder="${this.labelResolver.resolve("filterInputPlaceHolder", this.labelResolver.resolve("contentLocaleSelector"))}"
|
|
445
451
|
.options=${(this.contentLocalesAsFilterOptions())}
|
|
@@ -449,10 +455,12 @@ export class FtSearchBar extends FtLitElement {
|
|
|
449
455
|
${repeat(this.facets, facet => facet.key, facet => {
|
|
450
456
|
const filter = facetToFilter(facet);
|
|
451
457
|
const hierachical = filter.options.some(o => { var _a, _b; return ((_b = (_a = o.subOptions) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0; });
|
|
458
|
+
const keyWithNoColumn = facet.key.replace(":", "-");
|
|
452
459
|
return html `
|
|
453
460
|
<ft-filter
|
|
454
461
|
class="${hierachical ? "ft-search-bar--hierarchical-filter" : ""}"
|
|
455
|
-
part="filters"
|
|
462
|
+
part="filters filter-${keyWithNoColumn}"
|
|
463
|
+
exportparts=${this.getFilterExportParts(keyWithNoColumn)}
|
|
456
464
|
id="${filter.id}"
|
|
457
465
|
label="${filter.label}"
|
|
458
466
|
filterPlaceHolder="${this.labelResolver.resolve("filterInputPlaceHolder", filter.label)}"
|
|
@@ -524,7 +532,8 @@ export class FtSearchBar extends FtLitElement {
|
|
|
524
532
|
? html `
|
|
525
533
|
<ft-snap-scroll horizontal controls hideScrollbar limitSize
|
|
526
534
|
class="ft-search-bar--selected-filters"
|
|
527
|
-
part="selected-filters-container"
|
|
535
|
+
part="selected-filters-container"
|
|
536
|
+
exportparts="controls:snap-scroll-controls">
|
|
528
537
|
${filters}
|
|
529
538
|
</ft-snap-scroll>
|
|
530
539
|
`
|
|
@@ -554,6 +563,7 @@ export class FtSearchBar extends FtLitElement {
|
|
|
554
563
|
part="remove-suggestion"
|
|
555
564
|
?dense=${!this.isMobile}
|
|
556
565
|
label="${this.labelResolver.resolve("removeRecentSearch")}"
|
|
566
|
+
tooltipPosition="left"
|
|
557
567
|
@click=${(e) => this.removeRecentSearch(e, query)}></ft-button>
|
|
558
568
|
</a>
|
|
559
569
|
`)}
|
|
@@ -853,6 +863,12 @@ export class FtSearchBar extends FtLitElement {
|
|
|
853
863
|
break;
|
|
854
864
|
}
|
|
855
865
|
}
|
|
866
|
+
getFilterExportParts(metadataKey) {
|
|
867
|
+
return ["container", "header", "clear-button", "input"].map(part => this.getFilterSubPartExportAttribute(part, metadataKey)).join(",");
|
|
868
|
+
}
|
|
869
|
+
getFilterSubPartExportAttribute(part, metadataKey) {
|
|
870
|
+
return `${part}:filters-${part},${part}:filter-${metadataKey}-${part}`;
|
|
871
|
+
}
|
|
856
872
|
}
|
|
857
873
|
FtSearchBar.elementDefinitions = {
|
|
858
874
|
"ft-accordion": FtAccordion,
|