@fluid-topics/ft-search-bar 0.2.6 → 0.2.9
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
CHANGED
|
@@ -55,9 +55,9 @@ export declare class FtSearchBar extends FtLitElement implements FtSearchBarProp
|
|
|
55
55
|
labels: FtSearchBarLabels;
|
|
56
56
|
private labelResolver;
|
|
57
57
|
displayedFilters: Array<string>;
|
|
58
|
-
presets
|
|
59
|
-
priors: Array<FtSearchPrior>;
|
|
58
|
+
presets?: Array<FtSearchPreset>;
|
|
60
59
|
selectedPreset?: string;
|
|
60
|
+
priors?: Array<FtSearchPrior>;
|
|
61
61
|
searchRequestSerializer: (request: FtSearchRequest) => string;
|
|
62
62
|
private searchFilters;
|
|
63
63
|
private sizeCategory;
|
|
@@ -88,6 +88,7 @@ export declare class FtSearchBar extends FtLitElement implements FtSearchBarProp
|
|
|
88
88
|
private get isMobile();
|
|
89
89
|
private get hasFacets();
|
|
90
90
|
private get hasPresets();
|
|
91
|
+
private get hasPriors();
|
|
91
92
|
private get hasLocaleSelector();
|
|
92
93
|
focus(): void;
|
|
93
94
|
clear(): void;
|
|
@@ -728,6 +728,7 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
728
728
|
}
|
|
729
729
|
|
|
730
730
|
.ft-checkbox--box {
|
|
731
|
+
display: flex;
|
|
731
732
|
border: 2px solid ${Ii};
|
|
732
733
|
border-radius: 2px;
|
|
733
734
|
|
|
@@ -1703,6 +1704,7 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
1703
1704
|
<div class="${Dt({"ft-select--option":!0,"ft-select--option-selected":e,"ft-typography--body2":!0})}"
|
|
1704
1705
|
part="option"
|
|
1705
1706
|
tabindex="0"
|
|
1707
|
+
data-value="${t.value}"
|
|
1706
1708
|
@keydown=${e=>this.onOptionKeyDown(e,t)}
|
|
1707
1709
|
@click=${()=>this.selectOption(t)}>
|
|
1708
1710
|
<ft-ripple ?primary=${e} ?activated=${e}></ft-ripple>
|
|
@@ -2221,7 +2223,7 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
2221
2223
|
flex-grow: 1;
|
|
2222
2224
|
flex-shrink: 1;
|
|
2223
2225
|
}
|
|
2224
|
-
`;var Ho=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};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 Zo={filtersButton:"Filters",inputPlaceHolder:"Search",filterInputPlaceHolder:"Filter {0}",clearInputButton:"Clear",clearFilterButton:"Clear",displayMoreFilterValuesButton:"More",searchButton:"Search",noSuggestions:"No results found…",clearFilters:"Clear filters",contentLocaleSelector:"Lang",presetsSelector:"Preset",removeRecentSearch:"Remove",back:"Back"};class Ko extends CustomEvent{constructor(t){super("launch-search",{detail:t,bubbles:!0,composed:!0})}}class Wo extends CustomEvent{constructor(t){super("change",{detail:t})}}class Vo extends vt{constructor(){super(...arguments),this.dense=!1,this.baseUrl="",this.apiIntegrationIdentifier="ft-search-bar",this.availableContentLocales=[],this.labels={},this.labelResolver=new xt(Zo,{}),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=jt.S,this.displayFacets=!1,this.mobileMenuOpen=!1,this.facets=[],this.knownFacetLabels={},this.query="",this.suggestions=[],this.suggestionsLoaded=!0,this.recentSearches=[],this.updateFacetsDebouncer=new t(500),this.suggestDebouncer=new t(300),this.facetsLoaded=!1,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)))))}get recentSearchesStorageKey(){return this.baseUrl+":ft:recent-search-queries"}get request(){return{uiLocale:this.uiLocale,contentLocale:this.contentLocale,query:this.query,facets:this.facetsRequest,priors:this.
|
|
2226
|
+
`;var Ho=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};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 Zo={filtersButton:"Filters",inputPlaceHolder:"Search",filterInputPlaceHolder:"Filter {0}",clearInputButton:"Clear",clearFilterButton:"Clear",displayMoreFilterValuesButton:"More",searchButton:"Search",noSuggestions:"No results found…",clearFilters:"Clear filters",contentLocaleSelector:"Lang",presetsSelector:"Preset",removeRecentSearch:"Remove",back:"Back"};class Ko extends CustomEvent{constructor(t){super("launch-search",{detail:t,bubbles:!0,composed:!0})}}class Wo extends CustomEvent{constructor(t){super("change",{detail:t})}}class Vo extends vt{constructor(){super(...arguments),this.dense=!1,this.baseUrl="",this.apiIntegrationIdentifier="ft-search-bar",this.availableContentLocales=[],this.labels={},this.labelResolver=new xt(Zo,{}),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=jt.S,this.displayFacets=!1,this.mobileMenuOpen=!1,this.facets=[],this.knownFacetLabels={},this.query="",this.suggestions=[],this.suggestionsLoaded=!0,this.recentSearches=[],this.updateFacetsDebouncer=new t(500),this.suggestDebouncer=new t(300),this.facetsLoaded=!1,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)))))}get recentSearchesStorageKey(){return this.baseUrl+":ft:recent-search-queries"}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=>!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:[]}}get isMobile(){return this.sizeCategory===jt.S}get 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}get hasLocaleSelector(){return this.availableContentLocales.length>1}focus(){var t;null===(t=this.container)||void 0===t||t.focus()}clear(){this.query="",this.searchFilters=[],this.input&&(this.input.value=""),this.mobileMenuOpen=!1,this.displayFacets=!1}render(){const t={"ft-search-bar--container":!0,"ft-search-bar--dense":!this.isMobile&&this.dense,"ft-search-bar--mobile":this.isMobile,"ft-search-bar--desktop":!this.isMobile,"ft-search-bar--floating-panel-open":!this.isMobile&&this.displayFacets,"ft-search-bar--mobile-menu-open":this.mobileMenuOpen};return K`
|
|
2225
2227
|
<ft-size-watcher @change=${this.updateSize}></ft-size-watcher>
|
|
2226
2228
|
<div class="${Dt(t)}" part="container" tabindex="-1">
|
|
2227
2229
|
${this.isMobile?this.renderMobileSearchBar():this.renderDesktopSearchBar()}
|
|
@@ -2389,7 +2391,7 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
2389
2391
|
@click=${this.launchSearch}
|
|
2390
2392
|
></ft-button>
|
|
2391
2393
|
</div>
|
|
2392
|
-
`}renderFacetsActions(){return K`
|
|
2394
|
+
`}renderFacetsActions(){var t;return K`
|
|
2393
2395
|
<div class="ft-search-bar--facets-actions">
|
|
2394
2396
|
${this.hasPresets?K`
|
|
2395
2397
|
<ft-select
|
|
@@ -2398,7 +2400,7 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
2398
2400
|
label="${this.labelResolver.resolve("presetsSelector")}"
|
|
2399
2401
|
outlined
|
|
2400
2402
|
@change=${t=>this.selectedPreset=t.detail}>
|
|
2401
|
-
${Lt(this.presets,(t=>t.name),(t=>K`
|
|
2403
|
+
${Lt(null!==(t=this.presets)&&void 0!==t?t:[],(t=>t.name),(t=>K`
|
|
2402
2404
|
<ft-select-option value="${t.name}"
|
|
2403
2405
|
label="${t.name}"
|
|
2404
2406
|
?selected=${t.name===this.selectedPreset}>
|
|
@@ -2531,7 +2533,7 @@ class vi extends Ct{constructor(t){if(super(t),this.it=V,t.type!==St)throw Error
|
|
|
2531
2533
|
<ft-icon variant="${e}" part="suggestion-icon">
|
|
2532
2534
|
${i}
|
|
2533
2535
|
</ft-icon>
|
|
2534
|
-
`}openMobileFilters(t){this.isMobile&&(this.mobileMenuOpen=!0,this.displayFacets=!0,this.scrollToFacet=t)}async firstUpdated(t){var e,i;super.firstUpdated(t),this.initApi(),this.availableContentLocales=null!==(i=await(null===(e=this.api)||void 0===e?void 0:e.getAvailableSearchLocales().then((t=>t.contentLocales)).catch((()=>[]))))&&void 0!==i?i:[]}update(t){var e,i,o;if(t.has("labels")&&(this.labelResolver=new xt(Zo,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("selectedPreset")){const t=this.presets.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===(
|
|
2536
|
+
`}openMobileFilters(t){this.isMobile&&(this.mobileMenuOpen=!0,this.displayFacets=!0,this.scrollToFacet=t)}async firstUpdated(t){var e,i;super.firstUpdated(t),this.initApi(),this.availableContentLocales=null!==(i=await(null===(e=this.api)||void 0===e?void 0:e.getAvailableSearchLocales().then((t=>t.contentLocales)).catch((()=>[]))))&&void 0!==i?i:[]}update(t){var e,i,o,s,n;if(t.has("labels")&&(this.labelResolver=new xt(Zo,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("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)}["contentLocale","searchFilters"].some((e=>t.has(e)))&&(this.selectedPreset=null===(n=(null!==(s=this.presets)&&void 0!==s?s:[]).find((t=>this.compareRequests(t,this.request))))||void 0===n?void 0:n.name),["baseUrl","apiIntegrationIdentifier"].some((e=>t.has(e)))&&this.setApi(),["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 Wo(this.request))}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.setApi(),setTimeout((()=>this.initApi()),100))}setApi(){this.api=window.fluidtopics?new window.fluidtopics.FluidTopicsApi(this.baseUrl,this.apiIntegrationIdentifier,!0):void 0}updateFacets(){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.facets=[]}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 Ko(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()}}}Vo.elementDefinitions={"ft-accordion":vo,"ft-accordion-item":$o,"ft-button":Fi,"ft-chip":Mo,"ft-filter":po,"ft-filter-option":uo,"ft-icon":Oi,"ft-ripple":ri,"ft-select":Io,"ft-select-option":Do,"ft-size-watcher":Tt,"ft-snap-scroll":eo,"ft-tooltip":fi,"ft-typography":We},Vo.styles=[Ae,To,Po,Ao,_o],Ho([i({type:Boolean})],Vo.prototype,"dense",void 0),Ho([i({type:String})],Vo.prototype,"baseUrl",void 0),Ho([i({type:String})],Vo.prototype,"apiIntegrationIdentifier",void 0),Ho([i({type:String})],Vo.prototype,"contentLocale",void 0),Ho([o()],Vo.prototype,"availableContentLocales",void 0),Ho([i({type:String})],Vo.prototype,"uiLocale",void 0),Ho([h({})],Vo.prototype,"labels",void 0),Ho([h([])],Vo.prototype,"displayedFilters",void 0),Ho([h([])],Vo.prototype,"presets",void 0),Ho([i({type:String,reflect:!0})],Vo.prototype,"selectedPreset",void 0),Ho([h([])],Vo.prototype,"priors",void 0),Ho([i()],Vo.prototype,"searchRequestSerializer",void 0),Ho([o()],Vo.prototype,"searchFilters",void 0),Ho([o()],Vo.prototype,"sizeCategory",void 0),Ho([o()],Vo.prototype,"displayFacets",void 0),Ho([o()],Vo.prototype,"mobileMenuOpen",void 0),Ho([o()],Vo.prototype,"facets",void 0),Ho([n(".ft-search-bar--container")],Vo.prototype,"container",void 0),Ho([n(".ft-search-bar--filters-opener")],Vo.prototype,"filtersOpener",void 0),Ho([n(".ft-search-bar--floating-panel")],Vo.prototype,"floatingContainer",void 0),Ho([n("ft-snap-scroll.ft-search-bar--filters-container")],Vo.prototype,"scrollingFiltersContainer",void 0),Ho([n(".ft-search-bar--input")],Vo.prototype,"input",void 0),Ho([o()],Vo.prototype,"query",void 0),Ho([o()],Vo.prototype,"suggestions",void 0),Ho([o()],Vo.prototype,"suggestionsLoaded",void 0),Ho([o()],Vo.prototype,"recentSearches",void 0),Ho([o()],Vo.prototype,"scrollToFacet",void 0),Ho([n(".ft-search-bar--suggestion:first-child")],Vo.prototype,"firstSuggestion",void 0),Ho([n(".ft-search-bar--suggestion:focus-within")],Vo.prototype,"focusedSuggestion",void 0),Ho([n(".ft-search-bar--suggestion:last-child")],Vo.prototype,"lastSuggestion",void 0),Ho([o()],Vo.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`
|
|
2535
2537
|
${i.map((t=>K`
|
|
2536
2538
|
<style>${t}</style>
|
|
2537
2539
|
`))}
|
package/build/ft-search-bar.js
CHANGED
|
@@ -104,7 +104,7 @@ export class FtSearchBar extends FtLitElement {
|
|
|
104
104
|
contentLocale: this.contentLocale,
|
|
105
105
|
query: this.query,
|
|
106
106
|
facets: this.facetsRequest,
|
|
107
|
-
priors: this.
|
|
107
|
+
priors: this.hasPriors ? this.priors : undefined,
|
|
108
108
|
filters: this.searchFilters,
|
|
109
109
|
paging: { perPage: 0, page: 1 },
|
|
110
110
|
sort: [],
|
|
@@ -119,7 +119,6 @@ export class FtSearchBar extends FtLitElement {
|
|
|
119
119
|
contentLocale: this.contentLocale,
|
|
120
120
|
input: this.query,
|
|
121
121
|
filters: this.searchFilters,
|
|
122
|
-
priors: this.priors.length > 0 ? this.priors : undefined,
|
|
123
122
|
sort: []
|
|
124
123
|
};
|
|
125
124
|
}
|
|
@@ -130,7 +129,10 @@ export class FtSearchBar extends FtLitElement {
|
|
|
130
129
|
return this.facetsRequest.length > 0;
|
|
131
130
|
}
|
|
132
131
|
get hasPresets() {
|
|
133
|
-
return this.presets.length > 0;
|
|
132
|
+
return this.presets != null && this.presets.length > 0;
|
|
133
|
+
}
|
|
134
|
+
get hasPriors() {
|
|
135
|
+
return this.priors != null && this.priors.length > 0;
|
|
134
136
|
}
|
|
135
137
|
get hasLocaleSelector() {
|
|
136
138
|
return this.availableContentLocales.length > 1;
|
|
@@ -377,6 +379,7 @@ export class FtSearchBar extends FtLitElement {
|
|
|
377
379
|
`;
|
|
378
380
|
}
|
|
379
381
|
renderFacetsActions() {
|
|
382
|
+
var _a;
|
|
380
383
|
return html `
|
|
381
384
|
<div class="ft-search-bar--facets-actions">
|
|
382
385
|
${this.hasPresets ? html `
|
|
@@ -386,7 +389,7 @@ export class FtSearchBar extends FtLitElement {
|
|
|
386
389
|
label="${this.labelResolver.resolve("presetsSelector")}"
|
|
387
390
|
outlined
|
|
388
391
|
@change=${(e) => this.selectedPreset = e.detail}>
|
|
389
|
-
${repeat(this.presets, p => p.name, p => html `
|
|
392
|
+
${repeat((_a = this.presets) !== null && _a !== void 0 ? _a : [], p => p.name, p => html `
|
|
390
393
|
<ft-select-option value="${p.name}"
|
|
391
394
|
label="${p.name}"
|
|
392
395
|
?selected=${p.name === this.selectedPreset}>
|
|
@@ -587,7 +590,7 @@ export class FtSearchBar extends FtLitElement {
|
|
|
587
590
|
this.availableContentLocales = (_b = await ((_a = this.api) === null || _a === void 0 ? void 0 : _a.getAvailableSearchLocales().then(result => result.contentLocales).catch(() => []))) !== null && _b !== void 0 ? _b : [];
|
|
588
591
|
}
|
|
589
592
|
update(props) {
|
|
590
|
-
var _a, _b, _c;
|
|
593
|
+
var _a, _b, _c, _d, _e;
|
|
591
594
|
if (props.has("labels")) {
|
|
592
595
|
this.labelResolver = new ParametrizedLabelResolver(DEFAULT_LABELS, this.labels);
|
|
593
596
|
}
|
|
@@ -609,13 +612,13 @@ export class FtSearchBar extends FtLitElement {
|
|
|
609
612
|
this.recentSearches = JSON.parse((_b = window.localStorage.getItem(this.recentSearchesStorageKey)) !== null && _b !== void 0 ? _b : "[]");
|
|
610
613
|
}
|
|
611
614
|
if (props.has("selectedPreset")) {
|
|
612
|
-
const currentPreset = this.presets.find(p => p.name === this.selectedPreset);
|
|
615
|
+
const currentPreset = ((_c = this.presets) !== null && _c !== void 0 ? _c : []).find(p => p.name === this.selectedPreset);
|
|
613
616
|
if (currentPreset && !this.compareRequests(this.request, currentPreset)) {
|
|
614
617
|
this.setFiltersFromPreset(currentPreset);
|
|
615
618
|
}
|
|
616
619
|
}
|
|
617
620
|
if (["contentLocale", "searchFilters"].some(p => props.has(p))) {
|
|
618
|
-
this.selectedPreset = (
|
|
621
|
+
this.selectedPreset = (_e = ((_d = this.presets) !== null && _d !== void 0 ? _d : []).find(p => this.compareRequests(p, this.request))) === null || _e === void 0 ? void 0 : _e.name;
|
|
619
622
|
}
|
|
620
623
|
if (["baseUrl", "apiIntegrationIdentifier"].some(p => props.has(p))) {
|
|
621
624
|
this.setApi();
|
|
@@ -865,12 +868,12 @@ __decorate([
|
|
|
865
868
|
__decorate([
|
|
866
869
|
jsonProperty([])
|
|
867
870
|
], FtSearchBar.prototype, "presets", void 0);
|
|
868
|
-
__decorate([
|
|
869
|
-
jsonProperty([])
|
|
870
|
-
], FtSearchBar.prototype, "priors", void 0);
|
|
871
871
|
__decorate([
|
|
872
872
|
property({ type: String, reflect: true })
|
|
873
873
|
], FtSearchBar.prototype, "selectedPreset", void 0);
|
|
874
|
+
__decorate([
|
|
875
|
+
jsonProperty([])
|
|
876
|
+
], FtSearchBar.prototype, "priors", void 0);
|
|
874
877
|
__decorate([
|
|
875
878
|
property()
|
|
876
879
|
], FtSearchBar.prototype, "searchRequestSerializer", void 0);
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
.ft-size-watcher--local .ft-size-watcher--watcher {
|
|
22
22
|
width: 100%;
|
|
23
23
|
}
|
|
24
|
-
`,c([o.property({type:Number})],p.prototype,"debounceTimeout",void 0),c([o.property({type:Boolean})],p.prototype,"local",void 0),c([o.property({type:Number,reflect:!0})],p.prototype,"size",void 0),c([o.property({type:String,reflect:!0})],p.prototype,"category",void 0),c([o.query(".ft-size-watcher--watcher")],p.prototype,"watcher",void 0),e.customElement("ft-size-watcher")(p);const f=globalThis.trustedTypes,d=f?f.createPolicy("lit-html",{createHTML:t=>t}):void 0,u=`lit$${(Math.random()+"").slice(9)}$`,b="?"+u,v=`<${b}>`,g=document,x=(t="")=>g.createComment(t),y=t=>null===t||"object"!=typeof t&&"function"!=typeof t,m=Array.isArray,$=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,w=/-->/g,k=/>/g,S=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,z=/'/g,O=/"/g,B=/^(?:script|style|textarea|title)$/i,C=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),E=Symbol.for("lit-noChange"),I=Symbol.for("lit-nothing"),D=new WeakMap,F=g.createTreeWalker(g,129,null,!1),L=(t,e)=>{const i=t.length-1,o=[];let s,n=2===e?"<svg>":"",r=$;for(let e=0;e<i;e++){const i=t[e];let l,a,c=-1,h=0;for(;h<i.length&&(r.lastIndex=h,a=r.exec(i),null!==a);)h=r.lastIndex,r===$?"!--"===a[1]?r=w:void 0!==a[1]?r=k:void 0!==a[2]?(B.test(a[2])&&(s=RegExp("</"+a[2],"g")),r=S):void 0!==a[3]&&(r=S):r===S?">"===a[0]?(r=null!=s?s:$,c=-1):void 0===a[1]?c=-2:(c=r.lastIndex-a[2].length,l=a[1],r=void 0===a[3]?S:'"'===a[3]?O:z):r===O||r===z?r=S:r===w||r===k?r=$:(r=S,s=void 0);const p=r===S&&t[e+1].startsWith("/>")?" ":"";n+=r===$?i+v:c>=0?(o.push(l),i.slice(0,c)+"$lit$"+i.slice(c)+u+p):i+u+(-2===c?(o.push(void 0),e):p)}const l=n+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==d?d.createHTML(l):l,o]};class j{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let s=0,n=0;const r=t.length-1,l=this.parts,[a,c]=L(t,e);if(this.el=j.createElement(a,i),F.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=F.nextNode())&&l.length<r;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(u)){const i=c[n++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+"$lit$").split(u),e=/([.?@])?(.*)/.exec(i);l.push({type:1,index:s,name:e[2],strings:t,ctor:"."===e[1]?
|
|
24
|
+
`,c([o.property({type:Number})],p.prototype,"debounceTimeout",void 0),c([o.property({type:Boolean})],p.prototype,"local",void 0),c([o.property({type:Number,reflect:!0})],p.prototype,"size",void 0),c([o.property({type:String,reflect:!0})],p.prototype,"category",void 0),c([o.query(".ft-size-watcher--watcher")],p.prototype,"watcher",void 0),e.customElement("ft-size-watcher")(p);const f=globalThis.trustedTypes,d=f?f.createPolicy("lit-html",{createHTML:t=>t}):void 0,u=`lit$${(Math.random()+"").slice(9)}$`,b="?"+u,v=`<${b}>`,g=document,x=(t="")=>g.createComment(t),y=t=>null===t||"object"!=typeof t&&"function"!=typeof t,m=Array.isArray,$=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,w=/-->/g,k=/>/g,S=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,z=/'/g,O=/"/g,B=/^(?:script|style|textarea|title)$/i,C=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),E=Symbol.for("lit-noChange"),I=Symbol.for("lit-nothing"),D=new WeakMap,F=g.createTreeWalker(g,129,null,!1),L=(t,e)=>{const i=t.length-1,o=[];let s,n=2===e?"<svg>":"",r=$;for(let e=0;e<i;e++){const i=t[e];let l,a,c=-1,h=0;for(;h<i.length&&(r.lastIndex=h,a=r.exec(i),null!==a);)h=r.lastIndex,r===$?"!--"===a[1]?r=w:void 0!==a[1]?r=k:void 0!==a[2]?(B.test(a[2])&&(s=RegExp("</"+a[2],"g")),r=S):void 0!==a[3]&&(r=S):r===S?">"===a[0]?(r=null!=s?s:$,c=-1):void 0===a[1]?c=-2:(c=r.lastIndex-a[2].length,l=a[1],r=void 0===a[3]?S:'"'===a[3]?O:z):r===O||r===z?r=S:r===w||r===k?r=$:(r=S,s=void 0);const p=r===S&&t[e+1].startsWith("/>")?" ":"";n+=r===$?i+v:c>=0?(o.push(l),i.slice(0,c)+"$lit$"+i.slice(c)+u+p):i+u+(-2===c?(o.push(void 0),e):p)}const l=n+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==d?d.createHTML(l):l,o]};class j{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let s=0,n=0;const r=t.length-1,l=this.parts,[a,c]=L(t,e);if(this.el=j.createElement(a,i),F.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=F.nextNode())&&l.length<r;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(u)){const i=c[n++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+"$lit$").split(u),e=/([.?@])?(.*)/.exec(i);l.push({type:1,index:s,name:e[2],strings:t,ctor:"."===e[1]?N:"?"===e[1]?_:"@"===e[1]?U:P})}else l.push({type:6,index:s})}for(const e of t)o.removeAttribute(e)}if(B.test(o.tagName)){const t=o.textContent.split(u),e=t.length-1;if(e>0){o.textContent=f?f.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],x()),F.nextNode(),l.push({type:2,index:++s});o.append(t[e],x())}}}else if(8===o.nodeType)if(o.data===b)l.push({type:2,index:s});else{let t=-1;for(;-1!==(t=o.data.indexOf(u,t+1));)l.push({type:7,index:s}),t+=u.length-1}s++}}static createElement(t,e){const i=g.createElement("template");return i.innerHTML=t,i}}function M(t,e,i=t,o){var s,n,r,l;if(e===E)return e;let a=void 0!==o?null===(s=i._$Cl)||void 0===s?void 0:s[o]:i._$Cu;const c=y(e)?void 0:e._$litDirective$;return(null==a?void 0:a.constructor)!==c&&(null===(n=null==a?void 0:a._$AO)||void 0===n||n.call(a,!1),void 0===c?a=void 0:(a=new c(t),a._$AT(t,i,o)),void 0!==o?(null!==(r=(l=i)._$Cl)&&void 0!==r?r:l._$Cl=[])[o]=a:i._$Cu=a),void 0!==a&&(e=M(t,a._$AS(t,e.values),a,o)),e}class T{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:o}=this._$AD,s=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:g).importNode(i,!0);F.currentNode=s;let n=F.nextNode(),r=0,l=0,a=o[0];for(;void 0!==a;){if(r===a.index){let e;2===a.type?e=new A(n,n.nextSibling,this,t):1===a.type?e=new a.ctor(n,a.name,a.strings,this,t):6===a.type&&(e=new Z(n,this,t)),this.v.push(e),a=o[++l]}r!==(null==a?void 0:a.index)&&(n=F.nextNode(),r++)}return s}m(t){let e=0;for(const i of this.v)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class A{constructor(t,e,i,o){var s;this.type=2,this._$AH=I,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$Cg=null===(s=null==o?void 0:o.isConnected)||void 0===s||s}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=M(this,t,e),y(t)?t===I||null==t||""===t?(this._$AH!==I&&this._$AR(),this._$AH=I):t!==this._$AH&&t!==E&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):(t=>{var e;return m(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])})(t)?this.S(t):this.$(t)}M(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.M(t))}$(t){this._$AH!==I&&y(this._$AH)?this._$AA.nextSibling.data=t:this.k(g.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:o}=t,s="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=j.createElement(o.h,this.options)),o);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===s)this._$AH.m(i);else{const t=new T(s,this),e=t.p(this.options);t.m(i),this.k(e),this._$AH=t}}_$AC(t){let e=D.get(t.strings);return void 0===e&&D.set(t.strings,e=new j(t)),e}S(t){m(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const s of t)o===e.length?e.push(i=new A(this.M(x()),this.M(x()),this,this.options)):i=e[o],i._$AI(s),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cg=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class P{constructor(t,e,i,o,s){this.type=1,this._$AH=I,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=s,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=I}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,o){const s=this.strings;let n=!1;if(void 0===s)t=M(this,t,e,0),n=!y(t)||t!==this._$AH&&t!==E,n&&(this._$AH=t);else{const o=t;let r,l;for(t=s[0],r=0;r<s.length-1;r++)l=M(this,o[i+r],e,r),l===E&&(l=this._$AH[r]),n||(n=!y(l)||l!==this._$AH[r]),l===I?t=I:t!==I&&(t+=(null!=l?l:"")+s[r+1]),this._$AH[r]=l}n&&!o&&this.C(t)}C(t){t===I?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class N extends P{constructor(){super(...arguments),this.type=3}C(t){this.element[this.name]=t===I?void 0:t}}const R=f?f.emptyScript:"";class _ extends P{constructor(){super(...arguments),this.type=4}C(t){t&&t!==I?this.element.setAttribute(this.name,R):this.element.removeAttribute(this.name)}}class U extends P{constructor(t,e,i,o,s){super(t,e,i,o,s),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=M(this,t,e,0))&&void 0!==i?i:I)===E)return;const o=this._$AH,s=t===I&&o!==I||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,n=t!==I&&(o===I||s);s&&this.element.removeEventListener(this.name,this,o),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class Z{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){M(this,t)}}const H=window.litHtmlPolyfillSupport;null==H||H(j,A),(null!==(a=globalThis.litHtmlVersions)&&void 0!==a?a:globalThis.litHtmlVersions=[]).push("2.2.4");
|
|
25
25
|
/**
|
|
26
26
|
* @license
|
|
27
27
|
* Copyright 2020 Google LLC
|
|
28
28
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
29
29
|
*/
|
|
30
|
-
const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===K)return null===(i=t)||void 0===i?void 0:i._$litStatic$},V=t=>({_$litStatic$:t,r:K}),W=new Map,G=(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=q(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=W.get(t))&&(r.raw=r,W.set(t,e=r)),i=l}return t(e,...i)})(C);var X,J=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"}(X||(X={}));const Y=e.FtCssVariable.extend("--ft-typography-font-family",e.designSystemVariables.titleFont),Q=e.FtCssVariable.extend("--ft-typography-font-family",e.designSystemVariables.contentFont),tt={fontFamily:Q,fontSize:e.FtCssVariable.create("--ft-typography-font-size","SIZE","16px"),fontWeight:e.FtCssVariable.create("--ft-typography-font-weight","UNKNOWN","normal"),letterSpacing:e.FtCssVariable.create("--ft-typography-letter-spacing","SIZE","0.496px"),lineHeight:e.FtCssVariable.create("--ft-typography-line-height","SIZE","24px"),textTransform:e.FtCssVariable.create("--ft-typography-text-transform","UNKNOWN","inherit")},et=e.FtCssVariable.extend("--ft-typography-title-font-family",Y),it=e.FtCssVariable.extend("--ft-typography-title-font-size",tt.fontSize,"20px"),ot=e.FtCssVariable.extend("--ft-typography-title-font-weight",tt.fontWeight,"normal"),st=e.FtCssVariable.extend("--ft-typography-title-letter-spacing",tt.letterSpacing,"0.15px"),nt=e.FtCssVariable.extend("--ft-typography-title-line-height",tt.lineHeight,"24px"),rt=e.FtCssVariable.extend("--ft-typography-title-text-transform",tt.textTransform,"inherit"),lt=e.FtCssVariable.extend("--ft-typography-title-dense-font-family",Y),at=e.FtCssVariable.extend("--ft-typography-title-dense-font-size",tt.fontSize,"14px"),ct=e.FtCssVariable.extend("--ft-typography-title-dense-font-weight",tt.fontWeight,"normal"),ht=e.FtCssVariable.extend("--ft-typography-title-dense-letter-spacing",tt.letterSpacing,"0.105px"),pt=e.FtCssVariable.extend("--ft-typography-title-dense-line-height",tt.lineHeight,"24px"),ft=e.FtCssVariable.extend("--ft-typography-title-dense-text-transform",tt.textTransform,"inherit"),dt=e.FtCssVariable.extend("--ft-typography-subtitle1-font-family",Q),ut=e.FtCssVariable.extend("--ft-typography-subtitle1-font-size",tt.fontSize,"16px"),bt=e.FtCssVariable.extend("--ft-typography-subtitle1-font-weight",tt.fontWeight,"600"),vt=e.FtCssVariable.extend("--ft-typography-subtitle1-letter-spacing",tt.letterSpacing,"0.144px"),gt=e.FtCssVariable.extend("--ft-typography-subtitle1-line-height",tt.lineHeight,"24px"),xt=e.FtCssVariable.extend("--ft-typography-subtitle1-text-transform",tt.textTransform,"inherit"),yt=e.FtCssVariable.extend("--ft-typography-subtitle2-font-family",Q),mt=e.FtCssVariable.extend("--ft-typography-subtitle2-font-size",tt.fontSize,"14px"),$t=e.FtCssVariable.extend("--ft-typography-subtitle2-font-weight",tt.fontWeight,"normal"),wt=e.FtCssVariable.extend("--ft-typography-subtitle2-letter-spacing",tt.letterSpacing,"0.098px"),kt=e.FtCssVariable.extend("--ft-typography-subtitle2-line-height",tt.lineHeight,"24px"),St=e.FtCssVariable.extend("--ft-typography-subtitle2-text-transform",tt.textTransform,"inherit"),zt={fontFamily:e.FtCssVariable.extend("--ft-typography-body1-font-family",Q),fontSize:e.FtCssVariable.extend("--ft-typography-body1-font-size",tt.fontSize,"16px"),fontWeight:e.FtCssVariable.extend("--ft-typography-body1-font-weight",tt.fontWeight,"normal"),letterSpacing:e.FtCssVariable.extend("--ft-typography-body1-letter-spacing",tt.letterSpacing,"0.496px"),lineHeight:e.FtCssVariable.extend("--ft-typography-body1-line-height",tt.lineHeight,"24px"),textTransform:e.FtCssVariable.extend("--ft-typography-body1-text-transform",tt.textTransform,"inherit")},Ot={fontFamily:e.FtCssVariable.extend("--ft-typography-body2-font-family",Q),fontSize:e.FtCssVariable.extend("--ft-typography-body2-font-size",tt.fontSize,"14px"),fontWeight:e.FtCssVariable.extend("--ft-typography-body2-font-weight",tt.fontWeight,"normal"),letterSpacing:e.FtCssVariable.extend("--ft-typography-body2-letter-spacing",tt.letterSpacing,"0.252px"),lineHeight:e.FtCssVariable.extend("--ft-typography-body2-line-height",tt.lineHeight,"20px"),textTransform:e.FtCssVariable.extend("--ft-typography-body2-text-transform",tt.textTransform,"inherit")},Bt={fontFamily:e.FtCssVariable.extend("--ft-typography-caption-font-family",Q),fontSize:e.FtCssVariable.extend("--ft-typography-caption-font-size",tt.fontSize,"12px"),fontWeight:e.FtCssVariable.extend("--ft-typography-caption-font-weight",tt.fontWeight,"normal"),letterSpacing:e.FtCssVariable.extend("--ft-typography-caption-letter-spacing",tt.letterSpacing,"0.396px"),lineHeight:e.FtCssVariable.extend("--ft-typography-caption-line-height",tt.lineHeight,"16px"),textTransform:e.FtCssVariable.extend("--ft-typography-caption-text-transform",tt.textTransform,"inherit")},Ct=e.FtCssVariable.extend("--ft-typography-breadcrumb-font-family",Q),Et=e.FtCssVariable.extend("--ft-typography-breadcrumb-font-size",tt.fontSize,"10px"),It=e.FtCssVariable.extend("--ft-typography-breadcrumb-font-weight",tt.fontWeight,"normal"),Dt=e.FtCssVariable.extend("--ft-typography-breadcrumb-letter-spacing",tt.letterSpacing,"0.33px"),Ft=e.FtCssVariable.extend("--ft-typography-breadcrumb-line-height",tt.lineHeight,"16px"),Lt=e.FtCssVariable.extend("--ft-typography-breadcrumb-text-transform",tt.textTransform,"inherit"),jt=e.FtCssVariable.extend("--ft-typography-overline-font-family",Q),Mt=e.FtCssVariable.extend("--ft-typography-overline-font-size",tt.fontSize,"10px"),Tt=e.FtCssVariable.extend("--ft-typography-overline-font-weight",tt.fontWeight,"normal"),At=e.FtCssVariable.extend("--ft-typography-overline-letter-spacing",tt.letterSpacing,"1.5px"),
|
|
30
|
+
const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===K)return null===(i=t)||void 0===i?void 0:i._$litStatic$},V=t=>({_$litStatic$:t,r:K}),W=new Map,G=(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=q(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=W.get(t))&&(r.raw=r,W.set(t,e=r)),i=l}return t(e,...i)})(C);var X,J=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"}(X||(X={}));const Y=e.FtCssVariable.extend("--ft-typography-font-family",e.designSystemVariables.titleFont),Q=e.FtCssVariable.extend("--ft-typography-font-family",e.designSystemVariables.contentFont),tt={fontFamily:Q,fontSize:e.FtCssVariable.create("--ft-typography-font-size","SIZE","16px"),fontWeight:e.FtCssVariable.create("--ft-typography-font-weight","UNKNOWN","normal"),letterSpacing:e.FtCssVariable.create("--ft-typography-letter-spacing","SIZE","0.496px"),lineHeight:e.FtCssVariable.create("--ft-typography-line-height","SIZE","24px"),textTransform:e.FtCssVariable.create("--ft-typography-text-transform","UNKNOWN","inherit")},et=e.FtCssVariable.extend("--ft-typography-title-font-family",Y),it=e.FtCssVariable.extend("--ft-typography-title-font-size",tt.fontSize,"20px"),ot=e.FtCssVariable.extend("--ft-typography-title-font-weight",tt.fontWeight,"normal"),st=e.FtCssVariable.extend("--ft-typography-title-letter-spacing",tt.letterSpacing,"0.15px"),nt=e.FtCssVariable.extend("--ft-typography-title-line-height",tt.lineHeight,"24px"),rt=e.FtCssVariable.extend("--ft-typography-title-text-transform",tt.textTransform,"inherit"),lt=e.FtCssVariable.extend("--ft-typography-title-dense-font-family",Y),at=e.FtCssVariable.extend("--ft-typography-title-dense-font-size",tt.fontSize,"14px"),ct=e.FtCssVariable.extend("--ft-typography-title-dense-font-weight",tt.fontWeight,"normal"),ht=e.FtCssVariable.extend("--ft-typography-title-dense-letter-spacing",tt.letterSpacing,"0.105px"),pt=e.FtCssVariable.extend("--ft-typography-title-dense-line-height",tt.lineHeight,"24px"),ft=e.FtCssVariable.extend("--ft-typography-title-dense-text-transform",tt.textTransform,"inherit"),dt=e.FtCssVariable.extend("--ft-typography-subtitle1-font-family",Q),ut=e.FtCssVariable.extend("--ft-typography-subtitle1-font-size",tt.fontSize,"16px"),bt=e.FtCssVariable.extend("--ft-typography-subtitle1-font-weight",tt.fontWeight,"600"),vt=e.FtCssVariable.extend("--ft-typography-subtitle1-letter-spacing",tt.letterSpacing,"0.144px"),gt=e.FtCssVariable.extend("--ft-typography-subtitle1-line-height",tt.lineHeight,"24px"),xt=e.FtCssVariable.extend("--ft-typography-subtitle1-text-transform",tt.textTransform,"inherit"),yt=e.FtCssVariable.extend("--ft-typography-subtitle2-font-family",Q),mt=e.FtCssVariable.extend("--ft-typography-subtitle2-font-size",tt.fontSize,"14px"),$t=e.FtCssVariable.extend("--ft-typography-subtitle2-font-weight",tt.fontWeight,"normal"),wt=e.FtCssVariable.extend("--ft-typography-subtitle2-letter-spacing",tt.letterSpacing,"0.098px"),kt=e.FtCssVariable.extend("--ft-typography-subtitle2-line-height",tt.lineHeight,"24px"),St=e.FtCssVariable.extend("--ft-typography-subtitle2-text-transform",tt.textTransform,"inherit"),zt={fontFamily:e.FtCssVariable.extend("--ft-typography-body1-font-family",Q),fontSize:e.FtCssVariable.extend("--ft-typography-body1-font-size",tt.fontSize,"16px"),fontWeight:e.FtCssVariable.extend("--ft-typography-body1-font-weight",tt.fontWeight,"normal"),letterSpacing:e.FtCssVariable.extend("--ft-typography-body1-letter-spacing",tt.letterSpacing,"0.496px"),lineHeight:e.FtCssVariable.extend("--ft-typography-body1-line-height",tt.lineHeight,"24px"),textTransform:e.FtCssVariable.extend("--ft-typography-body1-text-transform",tt.textTransform,"inherit")},Ot={fontFamily:e.FtCssVariable.extend("--ft-typography-body2-font-family",Q),fontSize:e.FtCssVariable.extend("--ft-typography-body2-font-size",tt.fontSize,"14px"),fontWeight:e.FtCssVariable.extend("--ft-typography-body2-font-weight",tt.fontWeight,"normal"),letterSpacing:e.FtCssVariable.extend("--ft-typography-body2-letter-spacing",tt.letterSpacing,"0.252px"),lineHeight:e.FtCssVariable.extend("--ft-typography-body2-line-height",tt.lineHeight,"20px"),textTransform:e.FtCssVariable.extend("--ft-typography-body2-text-transform",tt.textTransform,"inherit")},Bt={fontFamily:e.FtCssVariable.extend("--ft-typography-caption-font-family",Q),fontSize:e.FtCssVariable.extend("--ft-typography-caption-font-size",tt.fontSize,"12px"),fontWeight:e.FtCssVariable.extend("--ft-typography-caption-font-weight",tt.fontWeight,"normal"),letterSpacing:e.FtCssVariable.extend("--ft-typography-caption-letter-spacing",tt.letterSpacing,"0.396px"),lineHeight:e.FtCssVariable.extend("--ft-typography-caption-line-height",tt.lineHeight,"16px"),textTransform:e.FtCssVariable.extend("--ft-typography-caption-text-transform",tt.textTransform,"inherit")},Ct=e.FtCssVariable.extend("--ft-typography-breadcrumb-font-family",Q),Et=e.FtCssVariable.extend("--ft-typography-breadcrumb-font-size",tt.fontSize,"10px"),It=e.FtCssVariable.extend("--ft-typography-breadcrumb-font-weight",tt.fontWeight,"normal"),Dt=e.FtCssVariable.extend("--ft-typography-breadcrumb-letter-spacing",tt.letterSpacing,"0.33px"),Ft=e.FtCssVariable.extend("--ft-typography-breadcrumb-line-height",tt.lineHeight,"16px"),Lt=e.FtCssVariable.extend("--ft-typography-breadcrumb-text-transform",tt.textTransform,"inherit"),jt=e.FtCssVariable.extend("--ft-typography-overline-font-family",Q),Mt=e.FtCssVariable.extend("--ft-typography-overline-font-size",tt.fontSize,"10px"),Tt=e.FtCssVariable.extend("--ft-typography-overline-font-weight",tt.fontWeight,"normal"),At=e.FtCssVariable.extend("--ft-typography-overline-letter-spacing",tt.letterSpacing,"1.5px"),Pt=e.FtCssVariable.extend("--ft-typography-overline-line-height",tt.lineHeight,"16px"),Nt=e.FtCssVariable.extend("--ft-typography-overline-text-transform",tt.textTransform,"uppercase"),Rt={fontFamily:e.FtCssVariable.extend("--ft-typography-button-font-family",Q),fontSize:e.FtCssVariable.extend("--ft-typography-button-font-size",tt.fontSize,"14px"),fontWeight:e.FtCssVariable.extend("--ft-typography-button-font-weight",tt.fontWeight,"600"),letterSpacing:e.FtCssVariable.extend("--ft-typography-button-letter-spacing",tt.letterSpacing,"1.246px"),lineHeight:e.FtCssVariable.extend("--ft-typography-button-line-height",tt.lineHeight,"16px"),textTransform:e.FtCssVariable.extend("--ft-typography-button-text-transform",tt.textTransform,"uppercase")},_t=i.css`
|
|
31
31
|
.ft-typography--title {
|
|
32
32
|
font-family: ${et};
|
|
33
33
|
font-size: ${it};
|
|
@@ -106,8 +106,8 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
106
106
|
font-size: ${Mt};
|
|
107
107
|
font-weight: ${Tt};
|
|
108
108
|
letter-spacing: ${At};
|
|
109
|
-
line-height: ${
|
|
110
|
-
text-transform: ${
|
|
109
|
+
line-height: ${Pt};
|
|
110
|
+
text-transform: ${Nt};
|
|
111
111
|
}
|
|
112
112
|
`,Xt=i.css`
|
|
113
113
|
.ft-typography--button {
|
|
@@ -551,7 +551,7 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
551
551
|
</ft-tooltip>
|
|
552
552
|
`}resolveIcon(){return this.loading?i.html`
|
|
553
553
|
<ft-loader></ft-loader> `:this.icon?i.html`
|
|
554
|
-
<ft-icon variant="material">${this.icon}</ft-icon> `:i.nothing}focus(){var t;null===(t=this.button)||void 0===t||t.focus()}getLabel(){return this.label||this.textContent}get textContent(){return this.unslotText(this.slottedContent).trim()}unslotText(t){return t instanceof HTMLSlotElement?t.assignedNodes().map((t=>this.unslotText(t))).join(""):(null==t?void 0:t.textContent)||""}hasTextContent(){return this.textContent.length>0}onSlotchange(){this.requestUpdate()}isDisabled(){return this.disabled||this.loading}}Me.elementDefinitions={"ft-ripple":pe,"ft-tooltip":xe,"ft-typography":Jt,"ft-icon":Ce,"ft-loader":me},Ee([o.property({type:Boolean})],Me.prototype,"primary",void 0),Ee([o.property({type:Boolean})],Me.prototype,"outlined",void 0),Ee([o.property({type:Boolean})],Me.prototype,"disabled",void 0),Ee([o.property({type:Boolean})],Me.prototype,"dense",void 0),Ee([o.property({type:Boolean})],Me.prototype,"round",void 0),Ee([o.property({type:String})],Me.prototype,"label",void 0),Ee([o.property({type:String})],Me.prototype,"icon",void 0),Ee([o.property({type:Boolean})],Me.prototype,"trailingIcon",void 0),Ee([o.property({type:Boolean})],Me.prototype,"loading",void 0),Ee([o.property({type:String})],Me.prototype,"tooltipPosition",void 0),Ee([o.query(".ft-button")],Me.prototype,"button",void 0),Ee([o.query(".ft-button--label slot")],Me.prototype,"slottedContent",void 0),e.customElement("ft-button")(Me);var Te=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};const Ae=e.FtCssVariable.extend("--ft-checkbox-text-color",e.designSystemVariables.colorOnSurfaceHigh),
|
|
554
|
+
<ft-icon variant="material">${this.icon}</ft-icon> `:i.nothing}focus(){var t;null===(t=this.button)||void 0===t||t.focus()}getLabel(){return this.label||this.textContent}get textContent(){return this.unslotText(this.slottedContent).trim()}unslotText(t){return t instanceof HTMLSlotElement?t.assignedNodes().map((t=>this.unslotText(t))).join(""):(null==t?void 0:t.textContent)||""}hasTextContent(){return this.textContent.length>0}onSlotchange(){this.requestUpdate()}isDisabled(){return this.disabled||this.loading}}Me.elementDefinitions={"ft-ripple":pe,"ft-tooltip":xe,"ft-typography":Jt,"ft-icon":Ce,"ft-loader":me},Ee([o.property({type:Boolean})],Me.prototype,"primary",void 0),Ee([o.property({type:Boolean})],Me.prototype,"outlined",void 0),Ee([o.property({type:Boolean})],Me.prototype,"disabled",void 0),Ee([o.property({type:Boolean})],Me.prototype,"dense",void 0),Ee([o.property({type:Boolean})],Me.prototype,"round",void 0),Ee([o.property({type:String})],Me.prototype,"label",void 0),Ee([o.property({type:String})],Me.prototype,"icon",void 0),Ee([o.property({type:Boolean})],Me.prototype,"trailingIcon",void 0),Ee([o.property({type:Boolean})],Me.prototype,"loading",void 0),Ee([o.property({type:String})],Me.prototype,"tooltipPosition",void 0),Ee([o.query(".ft-button")],Me.prototype,"button",void 0),Ee([o.query(".ft-button--label slot")],Me.prototype,"slottedContent",void 0),e.customElement("ft-button")(Me);var Te=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};const Ae=e.FtCssVariable.extend("--ft-checkbox-text-color",e.designSystemVariables.colorOnSurfaceHigh),Pe=e.FtCssVariable.external(e.designSystemVariables.colorPrimary,"Design system"),Ne=e.FtCssVariable.external(e.designSystemVariables.colorOnPrimary,"Design system"),Re=e.FtCssVariable.extend("--ft-checkbox-border-color",e.designSystemVariables.colorOnSurfaceMedium),_e=e.FtCssVariable.external(e.designSystemVariables.colorOnSurfaceDisabled,"Design system");class Ue extends e.FtLitElement{constructor(){super(...arguments),this.name="",this.checked=!1,this.indeterminate=!1,this.disabled=!1}render(){const t={"ft-checkbox":!0,"ft-checkbox--checked":this.checked,"ft-checkbox--indeterminate":this.indeterminate,"ft-checkbox--disabled":this.disabled};return i.html`
|
|
555
555
|
<label class="${n.classMap(t)}">
|
|
556
556
|
<div class="ft-checkbox--box-container">
|
|
557
557
|
<input type="checkbox"
|
|
@@ -614,20 +614,21 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
614
614
|
}
|
|
615
615
|
|
|
616
616
|
.ft-checkbox--box {
|
|
617
|
+
display: flex;
|
|
617
618
|
border: 2px solid ${Re};
|
|
618
619
|
border-radius: 2px;
|
|
619
620
|
|
|
620
621
|
width: 18px;
|
|
621
622
|
height: 18px;
|
|
622
623
|
|
|
623
|
-
color: ${
|
|
624
|
+
color: ${Ne};
|
|
624
625
|
}
|
|
625
626
|
|
|
626
627
|
|
|
627
628
|
.ft-checkbox--checked .ft-checkbox--box,
|
|
628
629
|
.ft-checkbox--indeterminate .ft-checkbox--box {
|
|
629
|
-
border-color: ${
|
|
630
|
-
background-color: ${
|
|
630
|
+
border-color: ${Pe};
|
|
631
|
+
background-color: ${Pe};
|
|
631
632
|
}
|
|
632
633
|
|
|
633
634
|
.ft-checkbox--disabled .ft-checkbox--box {
|
|
@@ -1547,7 +1548,7 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
1547
1548
|
.ft-input-label--outlined.ft-input-label--raised .ft-input-label--text {
|
|
1548
1549
|
border-top: none;
|
|
1549
1550
|
}
|
|
1550
|
-
`],Li([o.property({type:String})],Mi.prototype,"text",void 0),Li([o.property({type:Boolean})],Mi.prototype,"raised",void 0),Li([o.property({type:Boolean})],Mi.prototype,"outlined",void 0),Li([o.property({type:Boolean})],Mi.prototype,"disabled",void 0),Li([o.property({type:Boolean})],Mi.prototype,"error",void 0),e.customElement("ft-input-label")(Mi);var Ti=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};class Ai extends e.FtLitElement{constructor(){super(...arguments),this.label="",this.value=null,this.selected=!1}render(){return i.html``}updated(t){super.updated(t),this.dispatchEvent(new CustomEvent("option-change",{detail:this,bubbles:!0}))}}Ai.elementDefinitions={},Ti([o.property({type:String})],Ai.prototype,"label",void 0),Ti([o.property({type:Object,converter:t=>t})],Ai.prototype,"value",void 0),Ti([o.property({type:Boolean,reflect:!0})],Ai.prototype,"selected",void 0);const
|
|
1551
|
+
`],Li([o.property({type:String})],Mi.prototype,"text",void 0),Li([o.property({type:Boolean})],Mi.prototype,"raised",void 0),Li([o.property({type:Boolean})],Mi.prototype,"outlined",void 0),Li([o.property({type:Boolean})],Mi.prototype,"disabled",void 0),Li([o.property({type:Boolean})],Mi.prototype,"error",void 0),e.customElement("ft-input-label")(Mi);var Ti=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};class Ai extends e.FtLitElement{constructor(){super(...arguments),this.label="",this.value=null,this.selected=!1}render(){return i.html``}updated(t){super.updated(t),this.dispatchEvent(new CustomEvent("option-change",{detail:this,bubbles:!0}))}}Ai.elementDefinitions={},Ti([o.property({type:String})],Ai.prototype,"label",void 0),Ti([o.property({type:Object,converter:t=>t})],Ai.prototype,"value",void 0),Ti([o.property({type:Boolean,reflect:!0})],Ai.prototype,"selected",void 0);const Pi={labelSize:e.FtCssVariable.create("--ft-select-label-size","SIZE","11px"),selectedOptionSize:e.FtCssVariable.create("--ft-select-selected-option-size","SIZE","14px"),verticalSpacing:e.FtCssVariable.create("--ft-select-vertical-spacing","SIZE","4px"),selectedOptionColor:e.FtCssVariable.extend("--ft-select-selected-option-color",e.designSystemVariables.colorOnSurface),helperColor:e.FtCssVariable.extend("--ft-select-helper-color",e.designSystemVariables.colorOnSurfaceMedium),optionsColor:e.FtCssVariable.extend("--ft-select-options-color",e.designSystemVariables.colorOnSurface),optionsZIndex:e.FtCssVariable.create("--ft-select-options-z-index","NUMBER","3"),colorSurface:e.FtCssVariable.external(e.designSystemVariables.colorSurface,"Design system"),colorOnSurfaceDisabled:e.FtCssVariable.external(e.designSystemVariables.colorOnSurfaceDisabled,"Design system"),colorPrimary:e.FtCssVariable.external(e.designSystemVariables.colorPrimary,"Design system"),borderRadiusS:e.FtCssVariable.external(e.designSystemVariables.borderRadiusS,"Design system"),elevation02:e.FtCssVariable.external(e.designSystemVariables.elevation02,"Design system"),colorError:e.FtCssVariable.external(e.designSystemVariables.colorError,"Design system")};class Ni extends e.FtLitElement{constructor(){super(...arguments),this.label="",this.helper="",this.outlined=!1,this.disabled=!1,this.error=!1,this.fixedMenuPosition=!1,this.options=[],this.optionsDisplayed=!1,this.focusOptions=!1,this.hideOptions=t=>this.optionsDisplayed=this.optionsDisplayed&&t.composedPath().includes(this.container)}render(){var t,e,o,r,l;let a=this.hasOptionsMenuOpen,c=this.disabled||!this.hasOptions;const h=null!=(null===(t=this.selectedOption)||void 0===t?void 0:t.value)||(null!==(o=null===(e=this.selectedOption)||void 0===e?void 0:e.label)&&void 0!==o?o:"").length>0,p={"ft-select":!0,"ft-select--filled":!this.outlined,"ft-select--outlined":this.outlined,"ft-select--disabled":c,"ft-select--options-displayed":a,"ft-select--has-option-selected":h,"ft-select--no-label":!this.label,"ft-select--fixed":this.fixedMenuPosition,"ft-select--in-error":this.error};return i.html`
|
|
1551
1552
|
<div class="${n.classMap(p)}" part="container">
|
|
1552
1553
|
<div class="ft-select--main-panel" part="main-panel">
|
|
1553
1554
|
<ft-input-label text="${this.label}"
|
|
@@ -1589,12 +1590,13 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
1589
1590
|
<div class="${n.classMap(o)}"
|
|
1590
1591
|
part="option"
|
|
1591
1592
|
tabindex="0"
|
|
1593
|
+
data-value="${t.value}"
|
|
1592
1594
|
@keydown=${e=>this.onOptionKeyDown(e,t)}
|
|
1593
1595
|
@click=${()=>this.selectOption(t)}>
|
|
1594
1596
|
<ft-ripple ?primary=${e} ?activated=${e}></ft-ripple>
|
|
1595
1597
|
${t.label}
|
|
1596
1598
|
</div>
|
|
1597
|
-
`}updated(t){var e;super.updated(t),t.has("options")&&(this.selectedOption=this.options.filter((t=>t.selected))[0]),t.has("selectedOption")&&(this.optionsDisplayed=!1,this.dispatchEvent(new CustomEvent("change",{detail:null===(e=this.selectedOption)||void 0===e?void 0:e.value}))),t.has("optionsDisplayed")&&this.fixedMenuPosition&&this.hasOptionsMenuOpen&&this.positionOptionsMenu()}positionOptionsMenu(){this.optionsMenu.style.top=this.mainPanel.getBoundingClientRect().top+this.mainPanel.getBoundingClientRect().height+"px",this.optionsMenu.style.left=this.mainPanel.getBoundingClientRect().left+"px",this.optionsMenu.style.minWidth=this.mainPanel.getBoundingClientRect().width+"px"}contentAvailableCallback(t){var e,i;t.has("focusOptions")&&this.focusOptions&&(null===(i=null!==(e=this.selectedOptionElement)&&void 0!==e?e:this.firstOption)||void 0===i||i.focus(),this.focusOptions=!1)}get hasOptionsMenuOpen(){return!this.disabled&&this.optionsDisplayed&&this.hasOptions}get hasOptions(){return this.options.length>0}updateOptionsFromSlot(t){var e;t.stopPropagation();let i=null===(e=this.optionsSlot)||void 0===e?void 0:e.assignedElements().map((t=>t));i&&i.length>0&&(this.options=i)}onMainPanelKeyDown(t){switch(t.key){case" ":t.preventDefault(),t.stopPropagation();case"Enter":this.optionsDisplayed=!this.optionsDisplayed,this.focusOptions=!0;break;case"ArrowUp":case"ArrowDown":t.preventDefault(),t.stopPropagation(),this.optionsDisplayed=!0,this.focusOptions=!0}}onOptionsKeyDown(t){var e,i,o,s,n;let r;switch(t.key){case"Escape":this.optionsDisplayed=!1,null===(e=this.mainPanel)||void 0===e||e.focus();break;case"Tab":this.optionsDisplayed=!1;break;case"ArrowUp":t.preventDefault(),t.stopPropagation(),r=null!==(o=null===(i=this.focusedOption)||void 0===i?void 0:i.previousElementSibling)&&void 0!==o?o:this.lastOption;break;case"ArrowDown":t.preventDefault(),t.stopPropagation(),r=null!==(n=null===(s=this.focusedOption)||void 0===s?void 0:s.nextElementSibling)&&void 0!==n?n:this.firstOption}null==r||r.focus()}onOptionKeyDown(t,e){var i;"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),this.selectOption(e),this.optionsDisplayed=!1,null===(i=this.mainPanel)||void 0===i||i.focus())}selectOption(t){this.selectedOption=t;for(let e of this.options)e.selected=e===t}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.hideOptions)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.hideOptions)}}
|
|
1599
|
+
`}updated(t){var e;super.updated(t),t.has("options")&&(this.selectedOption=this.options.filter((t=>t.selected))[0]),t.has("selectedOption")&&(this.optionsDisplayed=!1,this.dispatchEvent(new CustomEvent("change",{detail:null===(e=this.selectedOption)||void 0===e?void 0:e.value}))),t.has("optionsDisplayed")&&this.fixedMenuPosition&&this.hasOptionsMenuOpen&&this.positionOptionsMenu()}positionOptionsMenu(){this.optionsMenu.style.top=this.mainPanel.getBoundingClientRect().top+this.mainPanel.getBoundingClientRect().height+"px",this.optionsMenu.style.left=this.mainPanel.getBoundingClientRect().left+"px",this.optionsMenu.style.minWidth=this.mainPanel.getBoundingClientRect().width+"px"}contentAvailableCallback(t){var e,i;t.has("focusOptions")&&this.focusOptions&&(null===(i=null!==(e=this.selectedOptionElement)&&void 0!==e?e:this.firstOption)||void 0===i||i.focus(),this.focusOptions=!1)}get hasOptionsMenuOpen(){return!this.disabled&&this.optionsDisplayed&&this.hasOptions}get hasOptions(){return this.options.length>0}updateOptionsFromSlot(t){var e;t.stopPropagation();let i=null===(e=this.optionsSlot)||void 0===e?void 0:e.assignedElements().map((t=>t));i&&i.length>0&&(this.options=i)}onMainPanelKeyDown(t){switch(t.key){case" ":t.preventDefault(),t.stopPropagation();case"Enter":this.optionsDisplayed=!this.optionsDisplayed,this.focusOptions=!0;break;case"ArrowUp":case"ArrowDown":t.preventDefault(),t.stopPropagation(),this.optionsDisplayed=!0,this.focusOptions=!0}}onOptionsKeyDown(t){var e,i,o,s,n;let r;switch(t.key){case"Escape":this.optionsDisplayed=!1,null===(e=this.mainPanel)||void 0===e||e.focus();break;case"Tab":this.optionsDisplayed=!1;break;case"ArrowUp":t.preventDefault(),t.stopPropagation(),r=null!==(o=null===(i=this.focusedOption)||void 0===i?void 0:i.previousElementSibling)&&void 0!==o?o:this.lastOption;break;case"ArrowDown":t.preventDefault(),t.stopPropagation(),r=null!==(n=null===(s=this.focusedOption)||void 0===s?void 0:s.nextElementSibling)&&void 0!==n?n:this.firstOption}null==r||r.focus()}onOptionKeyDown(t,e){var i;"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),this.selectOption(e),this.optionsDisplayed=!1,null===(i=this.mainPanel)||void 0===i||i.focus())}selectOption(t){this.selectedOption=t;for(let e of this.options)e.selected=e===t}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.hideOptions)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.hideOptions)}}Ni.elementDefinitions={"ft-input-label":Mi,"ft-typography":Jt,"ft-ripple":pe,"ft-icon":Ce},Ni.styles=[qt,Vt,i.css`
|
|
1598
1600
|
*:focus {
|
|
1599
1601
|
outline: none;
|
|
1600
1602
|
}
|
|
@@ -1608,7 +1610,7 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
1608
1610
|
.ft-select--main-panel {
|
|
1609
1611
|
position: relative;
|
|
1610
1612
|
display: flex;
|
|
1611
|
-
height: calc(4 * ${
|
|
1613
|
+
height: calc(4 * ${Pi.verticalSpacing} + ${Pi.labelSize} + ${Pi.selectedOptionSize});
|
|
1612
1614
|
}
|
|
1613
1615
|
|
|
1614
1616
|
.ft-select--input-panel {
|
|
@@ -1620,8 +1622,8 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
1620
1622
|
padding-left: 16px;
|
|
1621
1623
|
padding-right: 8px;
|
|
1622
1624
|
gap: 8px;
|
|
1623
|
-
color: ${
|
|
1624
|
-
${e.setVariable(se.color,
|
|
1625
|
+
color: ${Pi.selectedOptionColor};
|
|
1626
|
+
${e.setVariable(se.color,Pi.selectedOptionColor)};
|
|
1625
1627
|
}
|
|
1626
1628
|
|
|
1627
1629
|
.ft-select--input-panel,
|
|
@@ -1637,7 +1639,7 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
1637
1639
|
|
|
1638
1640
|
.ft-select--disabled .ft-select--input-panel,
|
|
1639
1641
|
.ft-select--disabled .ft-select--option {
|
|
1640
|
-
color: ${
|
|
1642
|
+
color: ${Pi.colorOnSurfaceDisabled};
|
|
1641
1643
|
}
|
|
1642
1644
|
|
|
1643
1645
|
.ft-select:not(.ft-select--disabled) .ft-select--input-panel,
|
|
@@ -1646,18 +1648,18 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
1646
1648
|
}
|
|
1647
1649
|
|
|
1648
1650
|
ft-input-label {
|
|
1649
|
-
${e.setVariable(ji.fontSize,
|
|
1650
|
-
${e.setVariable(ji.raisedFontSize,
|
|
1651
|
-
${e.setVariable(ji.verticalSpacing,
|
|
1651
|
+
${e.setVariable(ji.fontSize,Pi.selectedOptionSize)};
|
|
1652
|
+
${e.setVariable(ji.raisedFontSize,Pi.labelSize)};
|
|
1653
|
+
${e.setVariable(ji.verticalSpacing,Pi.verticalSpacing)};
|
|
1652
1654
|
}
|
|
1653
1655
|
|
|
1654
1656
|
.ft-select:not(.ft-select--disabled):focus-within ft-icon {
|
|
1655
|
-
color: ${
|
|
1657
|
+
color: ${Pi.colorPrimary};
|
|
1656
1658
|
}
|
|
1657
1659
|
|
|
1658
1660
|
.ft-select:not(.ft-select--disabled):focus-within ft-input-label {
|
|
1659
|
-
${e.setVariable(ji.borderColor,
|
|
1660
|
-
${e.setVariable(ji.textColor,
|
|
1661
|
+
${e.setVariable(ji.borderColor,Pi.colorPrimary)};
|
|
1662
|
+
${e.setVariable(ji.textColor,Pi.colorPrimary)};
|
|
1661
1663
|
}
|
|
1662
1664
|
|
|
1663
1665
|
.ft-select--selected-option {
|
|
@@ -1667,12 +1669,12 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
1667
1669
|
overflow: hidden;
|
|
1668
1670
|
white-space: nowrap;
|
|
1669
1671
|
text-overflow: ellipsis;
|
|
1670
|
-
${e.setVariable(zt.fontSize,
|
|
1671
|
-
${e.setVariable(zt.lineHeight,
|
|
1672
|
+
${e.setVariable(zt.fontSize,Pi.selectedOptionSize)};
|
|
1673
|
+
${e.setVariable(zt.lineHeight,Pi.selectedOptionSize)};
|
|
1672
1674
|
}
|
|
1673
1675
|
|
|
1674
1676
|
.ft-select--in-error .ft-select--selected-option {
|
|
1675
|
-
color: ${
|
|
1677
|
+
color: ${Pi.colorError};
|
|
1676
1678
|
}
|
|
1677
1679
|
|
|
1678
1680
|
ft-icon {
|
|
@@ -1684,16 +1686,16 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
1684
1686
|
}
|
|
1685
1687
|
|
|
1686
1688
|
.ft-select--filled .ft-select--input-panel {
|
|
1687
|
-
border-radius: ${
|
|
1689
|
+
border-radius: ${Pi.borderRadiusS} ${Pi.borderRadiusS} 0 0;
|
|
1688
1690
|
}
|
|
1689
1691
|
|
|
1690
1692
|
.ft-select--filled:not(.ft-select--no-label) .ft-select--selected-option {
|
|
1691
1693
|
align-self: stretch;
|
|
1692
|
-
padding-top: calc(${
|
|
1694
|
+
padding-top: calc(${Pi.labelSize} + 2 * ${Pi.verticalSpacing});
|
|
1693
1695
|
}
|
|
1694
1696
|
|
|
1695
1697
|
.ft-select--outlined .ft-select--input-panel {
|
|
1696
|
-
border-radius: ${
|
|
1698
|
+
border-radius: ${Pi.borderRadiusS};
|
|
1697
1699
|
}
|
|
1698
1700
|
|
|
1699
1701
|
.ft-select--options {
|
|
@@ -1702,10 +1704,10 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
1702
1704
|
top: 100%;
|
|
1703
1705
|
left: 0;
|
|
1704
1706
|
right: 0;
|
|
1705
|
-
color: ${
|
|
1706
|
-
background: ${
|
|
1707
|
-
z-index: ${
|
|
1708
|
-
box-shadow: ${
|
|
1707
|
+
color: ${Pi.optionsColor};
|
|
1708
|
+
background: ${Pi.colorSurface};
|
|
1709
|
+
z-index: ${Pi.optionsZIndex};
|
|
1710
|
+
box-shadow: ${Pi.elevation02};
|
|
1709
1711
|
}
|
|
1710
1712
|
|
|
1711
1713
|
.ft-select--fixed .ft-select--options {
|
|
@@ -1728,13 +1730,13 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
1728
1730
|
|
|
1729
1731
|
.ft-select--helper-text {
|
|
1730
1732
|
padding: 0 12px 0 16px;
|
|
1731
|
-
color: ${
|
|
1733
|
+
color: ${Pi.helperColor};
|
|
1732
1734
|
}
|
|
1733
1735
|
|
|
1734
1736
|
.ft-select--in-error .ft-select--helper-text {
|
|
1735
|
-
color: ${
|
|
1737
|
+
color: ${Pi.colorError};
|
|
1736
1738
|
}
|
|
1737
|
-
`],Ti([o.property({type:String})],
|
|
1739
|
+
`],Ti([o.property({type:String})],Ni.prototype,"label",void 0),Ti([o.property({type:String})],Ni.prototype,"helper",void 0),Ti([o.property({type:Boolean})],Ni.prototype,"outlined",void 0),Ti([o.property({type:Boolean})],Ni.prototype,"disabled",void 0),Ti([o.property({type:Boolean})],Ni.prototype,"error",void 0),Ti([o.property({type:Boolean})],Ni.prototype,"fixedMenuPosition",void 0),Ti([o.property({type:Array})],Ni.prototype,"options",void 0),Ti([o.state()],Ni.prototype,"selectedOption",void 0),Ti([o.state()],Ni.prototype,"optionsDisplayed",void 0),Ti([o.state()],Ni.prototype,"focusOptions",void 0),Ti([o.query(".ft-select")],Ni.prototype,"container",void 0),Ti([o.query(".ft-select--options")],Ni.prototype,"optionsMenu",void 0),Ti([o.query(".ft-select--input-panel")],Ni.prototype,"mainPanel",void 0),Ti([o.query(".ft-select--option:first-child")],Ni.prototype,"firstOption",void 0),Ti([o.query(".ft-select--option:focus")],Ni.prototype,"focusedOption",void 0),Ti([o.query(".ft-select--option.ft-select--option-selected")],Ni.prototype,"selectedOptionElement",void 0),Ti([o.query(".ft-select--option:last-child")],Ni.prototype,"lastOption",void 0),Ti([o.query("slot")],Ni.prototype,"optionsSlot",void 0),e.customElement("ft-select")(Ni),e.customElement("ft-select-option")(Ai);const Ri={height:e.FtCssVariable.create("--ft-search-bar-height","SIZE","38px"),borderRadius:e.FtCssVariable.extend("--ft-search-bar-border-radius",e.designSystemVariables.borderRadiusS),mobileOpenPosition:e.FtCssVariable.create("--ft-search-bar-mobile-open-position","POSITION","fixed"),mobileOpenTop:e.FtCssVariable.create("--ft-search-bar-mobile-open-top","SIZE","0"),mobileOpenBottom:e.FtCssVariable.create("--ft-search-bar-mobile-open-bottom","SIZE","0"),mobileOpenLeft:e.FtCssVariable.create("--ft-search-bar-mobile-open-left","SIZE","0"),mobileOpenRight:e.FtCssVariable.create("--ft-search-bar-mobile-open-right","SIZE","0"),floatingZIndex:e.FtCssVariable.create("--ft-search-bar-floating-components-z-index","NUMBER","2"),colorSurface:e.FtCssVariable.external(e.designSystemVariables.colorSurface,"Design system"),colorOnSurface:e.FtCssVariable.external(e.designSystemVariables.colorOnSurface,"Design system"),colorOnSurfaceMedium:e.FtCssVariable.external(e.designSystemVariables.colorOnSurfaceMedium,"Design system"),colorOutline:e.FtCssVariable.external(e.designSystemVariables.colorOutline,"Design system"),colorPrimary:e.FtCssVariable.external(e.designSystemVariables.colorPrimary,"Design system"),elevation02:e.FtCssVariable.external(e.designSystemVariables.elevation02,"Design system"),buttonColor:e.FtCssVariable.external(De.color,"Button"),buttonRippleColor:e.FtCssVariable.external(De.rippleColor,"Button")},_i=i.css`
|
|
1738
1740
|
* {
|
|
1739
1741
|
box-sizing: border-box;
|
|
1740
1742
|
}
|
|
@@ -1860,7 +1862,7 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
1860
1862
|
.ft-search-bar--left-action.ft-search-bar--content-locale {
|
|
1861
1863
|
${e.setVariable(ji.borderColor,"transparent")};
|
|
1862
1864
|
${e.setVariable(ji.borderRadiusS,i.css`calc(${Ri.borderRadius} - 1px)`)};
|
|
1863
|
-
${e.setVariable(
|
|
1865
|
+
${e.setVariable(Pi.selectedOptionColor,Ri.buttonColor)};
|
|
1864
1866
|
}
|
|
1865
1867
|
|
|
1866
1868
|
.ft-search-bar--left-action.ft-search-bar--content-locale,
|
|
@@ -1887,7 +1889,7 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
1887
1889
|
|
|
1888
1890
|
.ft-search-bar--floating-panel .ft-search-bar--presets {
|
|
1889
1891
|
min-width: 250px;
|
|
1890
|
-
${e.setVariable(
|
|
1892
|
+
${e.setVariable(Pi.optionsZIndex,"2")};
|
|
1891
1893
|
}
|
|
1892
1894
|
|
|
1893
1895
|
.ft-search-bar--floating-panel {
|
|
@@ -2107,7 +2109,7 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
2107
2109
|
flex-grow: 1;
|
|
2108
2110
|
flex-shrink: 1;
|
|
2109
2111
|
}
|
|
2110
|
-
`;var Ki=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};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 qi={filtersButton:"Filters",inputPlaceHolder:"Search",filterInputPlaceHolder:"Filter {0}",clearInputButton:"Clear",clearFilterButton:"Clear",displayMoreFilterValuesButton:"More",searchButton:"Search",noSuggestions:"No results found…",clearFilters:"Clear filters",contentLocaleSelector:"Lang",presetsSelector:"Preset",removeRecentSearch:"Remove",back:"Back"};class Vi extends CustomEvent{constructor(t){super("launch-search",{detail:t,bubbles:!0,composed:!0})}}class Wi extends CustomEvent{constructor(t){super("change",{detail:t})}}class Gi extends e.FtLitElement{constructor(){super(...arguments),this.dense=!1,this.baseUrl="",this.apiIntegrationIdentifier="ft-search-bar",this.availableContentLocales=[],this.labels={},this.labelResolver=new e.ParametrizedLabelResolver(qi,{}),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.S,this.displayFacets=!1,this.mobileMenuOpen=!1,this.facets=[],this.knownFacetLabels={},this.query="",this.suggestions=[],this.suggestionsLoaded=!0,this.recentSearches=[],this.updateFacetsDebouncer=new e.Debouncer(500),this.suggestDebouncer=new e.Debouncer(300),this.facetsLoaded=!1,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)))))}get recentSearchesStorageKey(){return this.baseUrl+":ft:recent-search-queries"}get request(){return{uiLocale:this.uiLocale,contentLocale:this.contentLocale,query:this.query,facets:this.facetsRequest,priors:this.
|
|
2112
|
+
`;var Ki=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};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 qi={filtersButton:"Filters",inputPlaceHolder:"Search",filterInputPlaceHolder:"Filter {0}",clearInputButton:"Clear",clearFilterButton:"Clear",displayMoreFilterValuesButton:"More",searchButton:"Search",noSuggestions:"No results found…",clearFilters:"Clear filters",contentLocaleSelector:"Lang",presetsSelector:"Preset",removeRecentSearch:"Remove",back:"Back"};class Vi extends CustomEvent{constructor(t){super("launch-search",{detail:t,bubbles:!0,composed:!0})}}class Wi extends CustomEvent{constructor(t){super("change",{detail:t})}}class Gi extends e.FtLitElement{constructor(){super(...arguments),this.dense=!1,this.baseUrl="",this.apiIntegrationIdentifier="ft-search-bar",this.availableContentLocales=[],this.labels={},this.labelResolver=new e.ParametrizedLabelResolver(qi,{}),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.S,this.displayFacets=!1,this.mobileMenuOpen=!1,this.facets=[],this.knownFacetLabels={},this.query="",this.suggestions=[],this.suggestionsLoaded=!0,this.recentSearches=[],this.updateFacetsDebouncer=new e.Debouncer(500),this.suggestDebouncer=new e.Debouncer(300),this.facetsLoaded=!1,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)))))}get recentSearchesStorageKey(){return this.baseUrl+":ft:recent-search-queries"}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=>!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:[]}}get isMobile(){return this.sizeCategory===l.S}get 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}get hasLocaleSelector(){return this.availableContentLocales.length>1}focus(){var t;null===(t=this.container)||void 0===t||t.focus()}clear(){this.query="",this.searchFilters=[],this.input&&(this.input.value=""),this.mobileMenuOpen=!1,this.displayFacets=!1}render(){const t={"ft-search-bar--container":!0,"ft-search-bar--dense":!this.isMobile&&this.dense,"ft-search-bar--mobile":this.isMobile,"ft-search-bar--desktop":!this.isMobile,"ft-search-bar--floating-panel-open":!this.isMobile&&this.displayFacets,"ft-search-bar--mobile-menu-open":this.mobileMenuOpen};return i.html`
|
|
2111
2113
|
<ft-size-watcher @change=${this.updateSize}></ft-size-watcher>
|
|
2112
2114
|
<div class="${n.classMap(t)}" part="container" tabindex="-1">
|
|
2113
2115
|
${this.isMobile?this.renderMobileSearchBar():this.renderDesktopSearchBar()}
|
|
@@ -2275,7 +2277,7 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
2275
2277
|
@click=${this.launchSearch}
|
|
2276
2278
|
></ft-button>
|
|
2277
2279
|
</div>
|
|
2278
|
-
`}renderFacetsActions(){return i.html`
|
|
2280
|
+
`}renderFacetsActions(){var t;return i.html`
|
|
2279
2281
|
<div class="ft-search-bar--facets-actions">
|
|
2280
2282
|
${this.hasPresets?i.html`
|
|
2281
2283
|
<ft-select
|
|
@@ -2284,7 +2286,7 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
2284
2286
|
label="${this.labelResolver.resolve("presetsSelector")}"
|
|
2285
2287
|
outlined
|
|
2286
2288
|
@change=${t=>this.selectedPreset=t.detail}>
|
|
2287
|
-
${s.repeat(this.presets,(t=>t.name),(t=>i.html`
|
|
2289
|
+
${s.repeat(null!==(t=this.presets)&&void 0!==t?t:[],(t=>t.name),(t=>i.html`
|
|
2288
2290
|
<ft-select-option value="${t.name}"
|
|
2289
2291
|
label="${t.name}"
|
|
2290
2292
|
?selected=${t.name===this.selectedPreset}>
|
|
@@ -2417,4 +2419,4 @@ const K=Symbol.for(""),q=t=>{var e,i;if((null===(e=t)||void 0===e?void 0:e.r)===
|
|
|
2417
2419
|
<ft-icon variant="${e}" part="suggestion-icon">
|
|
2418
2420
|
${o}
|
|
2419
2421
|
</ft-icon>
|
|
2420
|
-
`}openMobileFilters(t){this.isMobile&&(this.mobileMenuOpen=!0,this.displayFacets=!0,this.scrollToFacet=t)}async firstUpdated(t){var e,i;super.firstUpdated(t),this.initApi(),this.availableContentLocales=null!==(i=await(null===(e=this.api)||void 0===e?void 0:e.getAvailableSearchLocales().then((t=>t.contentLocales)).catch((()=>[]))))&&void 0!==i?i:[]}update(t){var i,o,s;if(t.has("labels")&&(this.labelResolver=new e.ParametrizedLabelResolver(qi,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.recentSearches=JSON.parse(null!==(o=window.localStorage.getItem(this.recentSearchesStorageKey))&&void 0!==o?o:"[]")),t.has("selectedPreset")){const t=this.presets.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===(
|
|
2422
|
+
`}openMobileFilters(t){this.isMobile&&(this.mobileMenuOpen=!0,this.displayFacets=!0,this.scrollToFacet=t)}async firstUpdated(t){var e,i;super.firstUpdated(t),this.initApi(),this.availableContentLocales=null!==(i=await(null===(e=this.api)||void 0===e?void 0:e.getAvailableSearchLocales().then((t=>t.contentLocales)).catch((()=>[]))))&&void 0!==i?i:[]}update(t){var i,o,s,n,r;if(t.has("labels")&&(this.labelResolver=new e.ParametrizedLabelResolver(qi,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.recentSearches=JSON.parse(null!==(o=window.localStorage.getItem(this.recentSearchesStorageKey))&&void 0!==o?o:"[]")),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.setApi(),["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 Wi(this.request))}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.setApi(),setTimeout((()=>this.initApi()),100))}setApi(){this.api=window.fluidtopics?new window.fluidtopics.FluidTopicsApi(this.baseUrl,this.apiIntegrationIdentifier,!0):void 0}updateFacets(){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.facets=[]}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 Vi(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&&Yt(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=>Yt(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()}}}Gi.elementDefinitions={"ft-accordion":xi,"ft-accordion-item":ki,"ft-button":Me,"ft-chip":Fi,"ft-filter":ui,"ft-filter-option":vi,"ft-icon":Ce,"ft-ripple":pe,"ft-select":Ni,"ft-select-option":Ai,"ft-size-watcher":p,"ft-snap-scroll":si,"ft-tooltip":xe,"ft-typography":Jt},Gi.styles=[qt,_i,Ui,Zi,Hi],Ki([o.property({type:Boolean})],Gi.prototype,"dense",void 0),Ki([o.property({type:String})],Gi.prototype,"baseUrl",void 0),Ki([o.property({type:String})],Gi.prototype,"apiIntegrationIdentifier",void 0),Ki([o.property({type:String})],Gi.prototype,"contentLocale",void 0),Ki([o.state()],Gi.prototype,"availableContentLocales",void 0),Ki([o.property({type:String})],Gi.prototype,"uiLocale",void 0),Ki([e.jsonProperty({})],Gi.prototype,"labels",void 0),Ki([e.jsonProperty([])],Gi.prototype,"displayedFilters",void 0),Ki([e.jsonProperty([])],Gi.prototype,"presets",void 0),Ki([o.property({type:String,reflect:!0})],Gi.prototype,"selectedPreset",void 0),Ki([e.jsonProperty([])],Gi.prototype,"priors",void 0),Ki([o.property()],Gi.prototype,"searchRequestSerializer",void 0),Ki([o.state()],Gi.prototype,"searchFilters",void 0),Ki([o.state()],Gi.prototype,"sizeCategory",void 0),Ki([o.state()],Gi.prototype,"displayFacets",void 0),Ki([o.state()],Gi.prototype,"mobileMenuOpen",void 0),Ki([o.state()],Gi.prototype,"facets",void 0),Ki([o.query(".ft-search-bar--container")],Gi.prototype,"container",void 0),Ki([o.query(".ft-search-bar--filters-opener")],Gi.prototype,"filtersOpener",void 0),Ki([o.query(".ft-search-bar--floating-panel")],Gi.prototype,"floatingContainer",void 0),Ki([o.query("ft-snap-scroll.ft-search-bar--filters-container")],Gi.prototype,"scrollingFiltersContainer",void 0),Ki([o.query(".ft-search-bar--input")],Gi.prototype,"input",void 0),Ki([o.state()],Gi.prototype,"query",void 0),Ki([o.state()],Gi.prototype,"suggestions",void 0),Ki([o.state()],Gi.prototype,"suggestionsLoaded",void 0),Ki([o.state()],Gi.prototype,"recentSearches",void 0),Ki([o.state()],Gi.prototype,"scrollToFacet",void 0),Ki([o.query(".ft-search-bar--suggestion:first-child")],Gi.prototype,"firstSuggestion",void 0),Ki([o.query(".ft-search-bar--suggestion:focus-within")],Gi.prototype,"focusedSuggestion",void 0),Ki([o.query(".ft-search-bar--suggestion:last-child")],Gi.prototype,"lastSuggestion",void 0),Ki([o.state()],Gi.prototype,"api",void 0),e.customElement("ft-search-bar")(Gi),t.DEFAULT_LABELS=qi,t.FtSearchBar=Gi,t.FtSearchBarCssVariables=Ri,t.LaunchSearchEvent=Vi,t.SearchStateChangeEvent=Wi,Object.defineProperty(t,"t",{value:!0})}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litRepeat,ftGlobals.litClassMap,ftGlobals.litUnsafeHTML);
|
|
@@ -728,6 +728,7 @@ class gi extends zt{constructor(t){if(super(t),this.it=q,t.type!==Ot)throw Error
|
|
|
728
728
|
}
|
|
729
729
|
|
|
730
730
|
.ft-checkbox--box {
|
|
731
|
+
display: flex;
|
|
731
732
|
border: 2px solid ${Ui};
|
|
732
733
|
border-radius: 2px;
|
|
733
734
|
|
|
@@ -1703,6 +1704,7 @@ class gi extends zt{constructor(t){if(super(t),this.it=q,t.type!==Ot)throw Error
|
|
|
1703
1704
|
<div class="${jt({"ft-select--option":!0,"ft-select--option-selected":e,"ft-typography--body2":!0})}"
|
|
1704
1705
|
part="option"
|
|
1705
1706
|
tabindex="0"
|
|
1707
|
+
data-value="${t.value}"
|
|
1706
1708
|
@keydown=${e=>this.onOptionKeyDown(e,t)}
|
|
1707
1709
|
@click=${()=>this.selectOption(t)}>
|
|
1708
1710
|
<ft-ripple ?primary=${e} ?activated=${e}></ft-ripple>
|
|
@@ -2221,7 +2223,7 @@ class gi extends zt{constructor(t){if(super(t),this.it=q,t.type!==Ot)throw Error
|
|
|
2221
2223
|
flex-grow: 1;
|
|
2222
2224
|
flex-shrink: 1;
|
|
2223
2225
|
}
|
|
2224
|
-
`;var Zo=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};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 Ko={filtersButton:"Filters",inputPlaceHolder:"Search",filterInputPlaceHolder:"Filter {0}",clearInputButton:"Clear",clearFilterButton:"Clear",displayMoreFilterValuesButton:"More",searchButton:"Search",noSuggestions:"No results found…",clearFilters:"Clear filters",contentLocaleSelector:"Lang",presetsSelector:"Preset",removeRecentSearch:"Remove",back:"Back"};class Wo extends CustomEvent{constructor(t){super("launch-search",{detail:t,bubbles:!0,composed:!0})}}class Vo extends CustomEvent{constructor(t){super("change",{detail:t})}}class qo extends gt{constructor(){super(...arguments),this.dense=!1,this.baseUrl="",this.apiIntegrationIdentifier="ft-search-bar",this.availableContentLocales=[],this.labels={},this.labelResolver=new yt(Ko,{}),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=It.S,this.displayFacets=!1,this.mobileMenuOpen=!1,this.facets=[],this.knownFacetLabels={},this.query="",this.suggestions=[],this.suggestionsLoaded=!0,this.recentSearches=[],this.updateFacetsDebouncer=new e(500),this.suggestDebouncer=new e(300),this.facetsLoaded=!1,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)))))}get recentSearchesStorageKey(){return this.baseUrl+":ft:recent-search-queries"}get request(){return{uiLocale:this.uiLocale,contentLocale:this.contentLocale,query:this.query,facets:this.facetsRequest,priors:this.
|
|
2226
|
+
`;var Zo=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};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 Ko={filtersButton:"Filters",inputPlaceHolder:"Search",filterInputPlaceHolder:"Filter {0}",clearInputButton:"Clear",clearFilterButton:"Clear",displayMoreFilterValuesButton:"More",searchButton:"Search",noSuggestions:"No results found…",clearFilters:"Clear filters",contentLocaleSelector:"Lang",presetsSelector:"Preset",removeRecentSearch:"Remove",back:"Back"};class Wo extends CustomEvent{constructor(t){super("launch-search",{detail:t,bubbles:!0,composed:!0})}}class Vo extends CustomEvent{constructor(t){super("change",{detail:t})}}class qo extends gt{constructor(){super(...arguments),this.dense=!1,this.baseUrl="",this.apiIntegrationIdentifier="ft-search-bar",this.availableContentLocales=[],this.labels={},this.labelResolver=new yt(Ko,{}),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=It.S,this.displayFacets=!1,this.mobileMenuOpen=!1,this.facets=[],this.knownFacetLabels={},this.query="",this.suggestions=[],this.suggestionsLoaded=!0,this.recentSearches=[],this.updateFacetsDebouncer=new e(500),this.suggestDebouncer=new e(300),this.facetsLoaded=!1,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)))))}get recentSearchesStorageKey(){return this.baseUrl+":ft:recent-search-queries"}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=>!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:[]}}get isMobile(){return this.sizeCategory===It.S}get 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}get hasLocaleSelector(){return this.availableContentLocales.length>1}focus(){var t;null===(t=this.container)||void 0===t||t.focus()}clear(){this.query="",this.searchFilters=[],this.input&&(this.input.value=""),this.mobileMenuOpen=!1,this.displayFacets=!1}render(){const t={"ft-search-bar--container":!0,"ft-search-bar--dense":!this.isMobile&&this.dense,"ft-search-bar--mobile":this.isMobile,"ft-search-bar--desktop":!this.isMobile,"ft-search-bar--floating-panel-open":!this.isMobile&&this.displayFacets,"ft-search-bar--mobile-menu-open":this.mobileMenuOpen};return W`
|
|
2225
2227
|
<ft-size-watcher @change=${this.updateSize}></ft-size-watcher>
|
|
2226
2228
|
<div class="${jt(t)}" part="container" tabindex="-1">
|
|
2227
2229
|
${this.isMobile?this.renderMobileSearchBar():this.renderDesktopSearchBar()}
|
|
@@ -2389,7 +2391,7 @@ class gi extends zt{constructor(t){if(super(t),this.it=q,t.type!==Ot)throw Error
|
|
|
2389
2391
|
@click=${this.launchSearch}
|
|
2390
2392
|
></ft-button>
|
|
2391
2393
|
</div>
|
|
2392
|
-
`}renderFacetsActions(){return W`
|
|
2394
|
+
`}renderFacetsActions(){var t;return W`
|
|
2393
2395
|
<div class="ft-search-bar--facets-actions">
|
|
2394
2396
|
${this.hasPresets?W`
|
|
2395
2397
|
<ft-select
|
|
@@ -2398,7 +2400,7 @@ class gi extends zt{constructor(t){if(super(t),this.it=q,t.type!==Ot)throw Error
|
|
|
2398
2400
|
label="${this.labelResolver.resolve("presetsSelector")}"
|
|
2399
2401
|
outlined
|
|
2400
2402
|
@change=${t=>this.selectedPreset=t.detail}>
|
|
2401
|
-
${Dt(this.presets,(t=>t.name),(t=>W`
|
|
2403
|
+
${Dt(null!==(t=this.presets)&&void 0!==t?t:[],(t=>t.name),(t=>W`
|
|
2402
2404
|
<ft-select-option value="${t.name}"
|
|
2403
2405
|
label="${t.name}"
|
|
2404
2406
|
?selected=${t.name===this.selectedPreset}>
|
|
@@ -2531,4 +2533,4 @@ class gi extends zt{constructor(t){if(super(t),this.it=q,t.type!==Ot)throw Error
|
|
|
2531
2533
|
<ft-icon variant="${e}" part="suggestion-icon">
|
|
2532
2534
|
${i}
|
|
2533
2535
|
</ft-icon>
|
|
2534
|
-
`}openMobileFilters(t){this.isMobile&&(this.mobileMenuOpen=!0,this.displayFacets=!0,this.scrollToFacet=t)}async firstUpdated(t){var e,i;super.firstUpdated(t),this.initApi(),this.availableContentLocales=null!==(i=await(null===(e=this.api)||void 0===e?void 0:e.getAvailableSearchLocales().then((t=>t.contentLocales)).catch((()=>[]))))&&void 0!==i?i:[]}update(t){var e,i,o;if(t.has("labels")&&(this.labelResolver=new yt(Ko,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("selectedPreset")){const t=this.presets.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===(
|
|
2536
|
+
`}openMobileFilters(t){this.isMobile&&(this.mobileMenuOpen=!0,this.displayFacets=!0,this.scrollToFacet=t)}async firstUpdated(t){var e,i;super.firstUpdated(t),this.initApi(),this.availableContentLocales=null!==(i=await(null===(e=this.api)||void 0===e?void 0:e.getAvailableSearchLocales().then((t=>t.contentLocales)).catch((()=>[]))))&&void 0!==i?i:[]}update(t){var e,i,o,s,n;if(t.has("labels")&&(this.labelResolver=new yt(Ko,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("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)}["contentLocale","searchFilters"].some((e=>t.has(e)))&&(this.selectedPreset=null===(n=(null!==(s=this.presets)&&void 0!==s?s:[]).find((t=>this.compareRequests(t,this.request))))||void 0===n?void 0:n.name),["baseUrl","apiIntegrationIdentifier"].some((e=>t.has(e)))&&this.setApi(),["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 Vo(this.request))}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.setApi(),setTimeout((()=>this.initApi()),100))}setApi(){this.api=window.fluidtopics?new window.fluidtopics.FluidTopicsApi(this.baseUrl,this.apiIntegrationIdentifier,!0):void 0}updateFacets(){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.facets=[]}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 Wo(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&&qe(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=>qe(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()}}}qo.elementDefinitions={"ft-accordion":go,"ft-accordion-item":wo,"ft-button":Ri,"ft-chip":No,"ft-filter":fo,"ft-filter-option":bo,"ft-icon":Ci,"ft-ripple":li,"ft-select":Uo,"ft-select-option":jo,"ft-size-watcher":Pt,"ft-snap-scroll":io,"ft-tooltip":ui,"ft-typography":Ve},qo.styles=[_e,Po,Ao,_o,Ho],Zo([o({type:Boolean})],qo.prototype,"dense",void 0),Zo([o({type:String})],qo.prototype,"baseUrl",void 0),Zo([o({type:String})],qo.prototype,"apiIntegrationIdentifier",void 0),Zo([o({type:String})],qo.prototype,"contentLocale",void 0),Zo([s()],qo.prototype,"availableContentLocales",void 0),Zo([o({type:String})],qo.prototype,"uiLocale",void 0),Zo([p({})],qo.prototype,"labels",void 0),Zo([p([])],qo.prototype,"displayedFilters",void 0),Zo([p([])],qo.prototype,"presets",void 0),Zo([o({type:String,reflect:!0})],qo.prototype,"selectedPreset",void 0),Zo([p([])],qo.prototype,"priors",void 0),Zo([o()],qo.prototype,"searchRequestSerializer",void 0),Zo([s()],qo.prototype,"searchFilters",void 0),Zo([s()],qo.prototype,"sizeCategory",void 0),Zo([s()],qo.prototype,"displayFacets",void 0),Zo([s()],qo.prototype,"mobileMenuOpen",void 0),Zo([s()],qo.prototype,"facets",void 0),Zo([r(".ft-search-bar--container")],qo.prototype,"container",void 0),Zo([r(".ft-search-bar--filters-opener")],qo.prototype,"filtersOpener",void 0),Zo([r(".ft-search-bar--floating-panel")],qo.prototype,"floatingContainer",void 0),Zo([r("ft-snap-scroll.ft-search-bar--filters-container")],qo.prototype,"scrollingFiltersContainer",void 0),Zo([r(".ft-search-bar--input")],qo.prototype,"input",void 0),Zo([s()],qo.prototype,"query",void 0),Zo([s()],qo.prototype,"suggestions",void 0),Zo([s()],qo.prototype,"suggestionsLoaded",void 0),Zo([s()],qo.prototype,"recentSearches",void 0),Zo([s()],qo.prototype,"scrollToFacet",void 0),Zo([r(".ft-search-bar--suggestion:first-child")],qo.prototype,"firstSuggestion",void 0),Zo([r(".ft-search-bar--suggestion:focus-within")],qo.prototype,"focusedSuggestion",void 0),Zo([r(".ft-search-bar--suggestion:last-child")],qo.prototype,"lastSuggestion",void 0),Zo([s()],qo.prototype,"api",void 0),h("ft-search-bar")(qo),t.DEFAULT_LABELS=Ko,t.FtSearchBar=qo,t.FtSearchBarCssVariables=To,t.LaunchSearchEvent=Wo,t.SearchStateChangeEvent=Vo,Object.defineProperty(t,"t",{value:!0})}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-search-bar",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "Search bar component using Fluid Topics public API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,17 +19,17 @@
|
|
|
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.2.
|
|
23
|
-
"@fluid-topics/ft-button": "^0.2.
|
|
24
|
-
"@fluid-topics/ft-chip": "^0.2.
|
|
25
|
-
"@fluid-topics/ft-filter": "^0.2.
|
|
26
|
-
"@fluid-topics/ft-icon": "^0.2.
|
|
27
|
-
"@fluid-topics/ft-select": "^0.2.
|
|
28
|
-
"@fluid-topics/ft-size-watcher": "^0.2.
|
|
29
|
-
"@fluid-topics/ft-snap-scroll": "^0.2.
|
|
30
|
-
"@fluid-topics/ft-tooltip": "^0.2.
|
|
31
|
-
"@fluid-topics/ft-typography": "^0.2.
|
|
32
|
-
"@fluid-topics/ft-wc-utils": "^0.2.
|
|
22
|
+
"@fluid-topics/ft-accordion": "^0.2.9",
|
|
23
|
+
"@fluid-topics/ft-button": "^0.2.9",
|
|
24
|
+
"@fluid-topics/ft-chip": "^0.2.9",
|
|
25
|
+
"@fluid-topics/ft-filter": "^0.2.9",
|
|
26
|
+
"@fluid-topics/ft-icon": "^0.2.9",
|
|
27
|
+
"@fluid-topics/ft-select": "^0.2.9",
|
|
28
|
+
"@fluid-topics/ft-size-watcher": "^0.2.9",
|
|
29
|
+
"@fluid-topics/ft-snap-scroll": "^0.2.9",
|
|
30
|
+
"@fluid-topics/ft-tooltip": "^0.2.9",
|
|
31
|
+
"@fluid-topics/ft-typography": "^0.2.9",
|
|
32
|
+
"@fluid-topics/ft-wc-utils": "^0.2.9",
|
|
33
33
|
"lit": "2.1.3"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@fluid-topics/public-api": "1.0.18"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "046f7fd69b5d3e5a379c44e5b77fd36f89713364"
|
|
42
42
|
}
|