@fluid-topics/ft-search-bar 1.2.2 → 1.2.3
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/README.md +3 -8
- package/build/ft-search-bar.d.ts +3 -4
- package/build/ft-search-bar.js +8 -14
- package/build/ft-search-bar.light.js +548 -531
- package/build/ft-search-bar.min.js +435 -418
- package/build/managers/DesktopSearchBarManager.js +4 -2
- package/build/managers/MobileSearchBarManager.js +8 -3
- package/build/managers/SuggestManager.d.ts +1 -1
- package/build/managers/SuggestManager.js +15 -23
- package/package.json +16 -16
package/README.md
CHANGED
|
@@ -32,13 +32,12 @@ import "@fluid-topics/public-api/dist/fluidtopics.min.js"
|
|
|
32
32
|
import "@fluid-topics/ft-search-bar"
|
|
33
33
|
|
|
34
34
|
function render() {
|
|
35
|
-
return html`
|
|
36
|
-
<ft-search-bar
|
|
35
|
+
return html`
|
|
36
|
+
<ft-search-bar
|
|
37
37
|
baseUrl="http://doc.fluidtopics.com"
|
|
38
38
|
.displayedFilters=${ [ "Version_FT", "Category", "Platform", "audience" ] }
|
|
39
39
|
@change=${ (e: SearchStateChangeEvent) => console.log("Search state change:", e.detail) }
|
|
40
|
-
|
|
41
|
-
></ft-search-bar>
|
|
40
|
+
></ft-search-bar>
|
|
42
41
|
`
|
|
43
42
|
}
|
|
44
43
|
```
|
|
@@ -67,10 +66,6 @@ function render() {
|
|
|
67
66
|
filtersButton: "Refine your search",
|
|
68
67
|
inputPlaceHolder: "Search our documentation"
|
|
69
68
|
}));
|
|
70
|
-
searchBar.addEventListener("launch-search", event => {
|
|
71
|
-
console.log("Launch search:", event.detail)
|
|
72
|
-
console.log("URL:", searchBar.searchRequestSerializer(event.detail))
|
|
73
|
-
});
|
|
74
69
|
</script>
|
|
75
70
|
</body>
|
|
76
71
|
</html>
|
package/build/ft-search-bar.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { nothing, PropertyValues } from "lit";
|
|
2
2
|
import { ElementDefinitionsMap, FtLitElement, ParametrizedLabelResolver } from "@fluid-topics/ft-wc-utils";
|
|
3
3
|
import { FluidTopicsApi, FtSearchFacet, FtSearchFacetConf, FtSearchLocale, FtSearchPreset, FtSearchPrior, FtSearchRequest, FtSuggestRequest, FtSuggestResult } from "@fluid-topics/public-api";
|
|
4
|
+
import { FtButton } from "@fluid-topics/ft-button";
|
|
4
5
|
import { SuggestManager } from "./managers/SuggestManager";
|
|
5
6
|
import { FacetsChipsManager } from "./managers/FacetsChipsManager";
|
|
6
7
|
import { MobileSearchBarManager } from "./managers/MobileSearchBarManager";
|
|
@@ -14,9 +15,6 @@ declare global {
|
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
export declare const DEFAULT_LABELS: FtSearchBarLabels;
|
|
17
|
-
export declare class LaunchSearchEvent extends CustomEvent<FtSearchRequest> {
|
|
18
|
-
constructor(request: FtSearchRequest);
|
|
19
|
-
}
|
|
20
18
|
export declare class SearchStateChangeEvent extends CustomEvent<FtSearchRequest> {
|
|
21
19
|
constructor(request: FtSearchRequest);
|
|
22
20
|
}
|
|
@@ -54,6 +52,7 @@ export declare class FtSearchBar extends FtLitElement implements FtSearchBarProp
|
|
|
54
52
|
private floatingContainer?;
|
|
55
53
|
private scrollingFiltersContainer?;
|
|
56
54
|
input?: HTMLInputElement;
|
|
55
|
+
launchSearchButton?: FtButton;
|
|
57
56
|
query: string;
|
|
58
57
|
suggestions: Array<FtSuggestResult>;
|
|
59
58
|
recentSearches: Array<string>;
|
|
@@ -97,7 +96,7 @@ export declare class FtSearchBar extends FtLitElement implements FtSearchBarProp
|
|
|
97
96
|
private retrieveFacetsFromSearch;
|
|
98
97
|
private onFloatingContainerKeyUp;
|
|
99
98
|
setQuery(query: string): void;
|
|
100
|
-
|
|
99
|
+
onLaunchSearch(): void;
|
|
101
100
|
private get recentSearchesStorageKey();
|
|
102
101
|
private initRecentSearches;
|
|
103
102
|
saveRecentSearches(): void;
|
package/build/ft-search-bar.js
CHANGED
|
@@ -47,15 +47,6 @@ export const DEFAULT_LABELS = {
|
|
|
47
47
|
back: "Back",
|
|
48
48
|
selectLocale: "Select a language"
|
|
49
49
|
};
|
|
50
|
-
export class LaunchSearchEvent extends CustomEvent {
|
|
51
|
-
constructor(request) {
|
|
52
|
-
super("launch-search", {
|
|
53
|
-
detail: request,
|
|
54
|
-
bubbles: true,
|
|
55
|
-
composed: true
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
50
|
export class SearchStateChangeEvent extends CustomEvent {
|
|
60
51
|
constructor(request) {
|
|
61
52
|
super("change", { detail: request });
|
|
@@ -318,9 +309,10 @@ class FtSearchBar extends FtLitElement {
|
|
|
318
309
|
<div class="ft-search-bar--facets-actions">
|
|
319
310
|
${this.forceMenuOpen ? this.renderDesktopClearFilters() : nothing}
|
|
320
311
|
<ft-button class="ft-search-bar--launch-search"
|
|
312
|
+
href="${this.searchRequestSerializer(this.request)}"
|
|
321
313
|
part="launch-search-in-panel"
|
|
322
314
|
icon="search"
|
|
323
|
-
@click=${this.
|
|
315
|
+
@click=${() => this.onLaunchSearch()}>
|
|
324
316
|
${this.labelResolver.resolve("searchButton")}
|
|
325
317
|
</ft-button>
|
|
326
318
|
</div>
|
|
@@ -551,7 +543,7 @@ class FtSearchBar extends FtLitElement {
|
|
|
551
543
|
}
|
|
552
544
|
this.query = query;
|
|
553
545
|
}
|
|
554
|
-
|
|
546
|
+
onLaunchSearch() {
|
|
555
547
|
if (this.query) {
|
|
556
548
|
let filteredRecentSearches = this.recentSearches
|
|
557
549
|
.filter(q => q.toLowerCase() !== this.query.toLowerCase())
|
|
@@ -559,7 +551,6 @@ class FtSearchBar extends FtLitElement {
|
|
|
559
551
|
this.recentSearches = [this.query, ...filteredRecentSearches];
|
|
560
552
|
this.saveRecentSearches();
|
|
561
553
|
}
|
|
562
|
-
this.dispatchEvent(new LaunchSearchEvent(this.request));
|
|
563
554
|
this.mobileMenuOpen = false;
|
|
564
555
|
this.displayFacets = false;
|
|
565
556
|
this.focus();
|
|
@@ -588,14 +579,14 @@ class FtSearchBar extends FtLitElement {
|
|
|
588
579
|
if (this.focusOnDisplay && !isTouchScreen) {
|
|
589
580
|
this.focusInput();
|
|
590
581
|
}
|
|
591
|
-
ftAppInfoStore.
|
|
582
|
+
ftAppInfoStore.addEventListener("authentication-change", this.initSearchData);
|
|
592
583
|
this.initSearchData();
|
|
593
584
|
}
|
|
594
585
|
disconnectedCallback() {
|
|
595
586
|
super.disconnectedCallback();
|
|
596
587
|
document.removeEventListener("focusin", this.closeFloatingContainer);
|
|
597
588
|
document.addEventListener("click", this.closeFloatingContainer);
|
|
598
|
-
ftAppInfoStore.
|
|
589
|
+
ftAppInfoStore.removeEventListener("authentication-change", this.initSearchData);
|
|
599
590
|
}
|
|
600
591
|
updateSize(e) {
|
|
601
592
|
this.sizeCategory = e.detail.category;
|
|
@@ -772,6 +763,9 @@ __decorate([
|
|
|
772
763
|
__decorate([
|
|
773
764
|
query(".ft-search-bar--input")
|
|
774
765
|
], FtSearchBar.prototype, "input", void 0);
|
|
766
|
+
__decorate([
|
|
767
|
+
query(".ft-search-bar--launch-search")
|
|
768
|
+
], FtSearchBar.prototype, "launchSearchButton", void 0);
|
|
775
769
|
__decorate([
|
|
776
770
|
state()
|
|
777
771
|
], FtSearchBar.prototype, "query", void 0);
|