@fluid-topics/ft-search-bar 0.2.20 → 0.3.0
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.css.d.ts +17 -20
- package/build/ft-search-bar.css.js +18 -126
- package/build/ft-search-bar.d.ts +36 -49
- package/build/ft-search-bar.js +46 -410
- package/build/ft-search-bar.light.js +414 -411
- package/build/ft-search-bar.min.js +493 -484
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/package.json +15 -15
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import { FtCssVariable } from "@fluid-topics/ft-wc-utils";
|
|
2
1
|
export declare const FtSearchBarCssVariables: {
|
|
3
|
-
height: FtCssVariable;
|
|
4
|
-
borderRadius: FtCssVariable;
|
|
5
|
-
mobileOpenPosition: FtCssVariable;
|
|
6
|
-
mobileOpenTop: FtCssVariable;
|
|
7
|
-
mobileOpenBottom: FtCssVariable;
|
|
8
|
-
mobileOpenLeft: FtCssVariable;
|
|
9
|
-
mobileOpenRight: FtCssVariable;
|
|
10
|
-
desktopFiltersHeight: FtCssVariable;
|
|
11
|
-
floatingZIndex: FtCssVariable;
|
|
12
|
-
colorSurface: FtCssVariable;
|
|
13
|
-
colorOnSurface: FtCssVariable;
|
|
14
|
-
colorOnSurfaceMedium: FtCssVariable;
|
|
15
|
-
colorOutline: FtCssVariable;
|
|
16
|
-
colorPrimary: FtCssVariable;
|
|
17
|
-
elevation02: FtCssVariable;
|
|
18
|
-
buttonColor: FtCssVariable;
|
|
19
|
-
buttonRippleColor: FtCssVariable;
|
|
2
|
+
height: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
3
|
+
borderRadius: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
4
|
+
mobileOpenPosition: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
5
|
+
mobileOpenTop: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
6
|
+
mobileOpenBottom: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
7
|
+
mobileOpenLeft: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
8
|
+
mobileOpenRight: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
9
|
+
desktopFiltersHeight: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
10
|
+
floatingZIndex: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
11
|
+
colorSurface: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
12
|
+
colorOnSurface: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
13
|
+
colorOnSurfaceMedium: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
14
|
+
colorOutline: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
15
|
+
colorPrimary: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
16
|
+
elevation02: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
17
|
+
buttonColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
18
|
+
buttonRippleColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
20
19
|
};
|
|
21
20
|
export declare const searchBarCss: import("lit").CSSResult;
|
|
22
21
|
export declare const facetsCss: import("lit").CSSResult;
|
|
23
|
-
export declare const selectedFiltersCss: import("lit").CSSResult;
|
|
24
|
-
export declare const suggestionsCss: import("lit").CSSResult;
|
|
25
22
|
//# sourceMappingURL=ft-search-bar.css.d.ts.map
|
|
@@ -1,30 +1,28 @@
|
|
|
1
|
-
import { designSystemVariables,
|
|
1
|
+
import { designSystemVariables, FtCssVariableFactory, setVariable } from "@fluid-topics/ft-wc-utils";
|
|
2
2
|
import { css } from "lit";
|
|
3
3
|
import { FtButtonCssVariables } from "@fluid-topics/ft-button";
|
|
4
4
|
import { FtInputLabelCssVariables } from "@fluid-topics/ft-input-label";
|
|
5
5
|
import { FtSelectCssVariables } from "@fluid-topics/ft-select";
|
|
6
|
-
import { FtSnapScrollCssVariables } from "@fluid-topics/ft-snap-scroll";
|
|
7
|
-
import { FtChipCssVariables } from "@fluid-topics/ft-chip";
|
|
8
6
|
import { FtSkeletonCssVariables } from "@fluid-topics/ft-skeleton";
|
|
9
7
|
import { FtTooltipCssVariables } from "@fluid-topics/ft-tooltip";
|
|
10
8
|
export const FtSearchBarCssVariables = {
|
|
11
|
-
height:
|
|
12
|
-
borderRadius:
|
|
13
|
-
mobileOpenPosition:
|
|
14
|
-
mobileOpenTop:
|
|
15
|
-
mobileOpenBottom:
|
|
16
|
-
mobileOpenLeft:
|
|
17
|
-
mobileOpenRight:
|
|
18
|
-
desktopFiltersHeight:
|
|
19
|
-
floatingZIndex:
|
|
20
|
-
colorSurface:
|
|
21
|
-
colorOnSurface:
|
|
22
|
-
colorOnSurfaceMedium:
|
|
23
|
-
colorOutline:
|
|
24
|
-
colorPrimary:
|
|
25
|
-
elevation02:
|
|
26
|
-
buttonColor:
|
|
27
|
-
buttonRippleColor:
|
|
9
|
+
height: FtCssVariableFactory.create("--ft-search-bar-height", "SIZE", "38px"),
|
|
10
|
+
borderRadius: FtCssVariableFactory.extend("--ft-search-bar-border-radius", designSystemVariables.borderRadiusS),
|
|
11
|
+
mobileOpenPosition: FtCssVariableFactory.create("--ft-search-bar-mobile-open-position", "POSITION", "fixed"),
|
|
12
|
+
mobileOpenTop: FtCssVariableFactory.create("--ft-search-bar-mobile-open-top", "SIZE", "0"),
|
|
13
|
+
mobileOpenBottom: FtCssVariableFactory.create("--ft-search-bar-mobile-open-bottom", "SIZE", "0"),
|
|
14
|
+
mobileOpenLeft: FtCssVariableFactory.create("--ft-search-bar-mobile-open-left", "SIZE", "0"),
|
|
15
|
+
mobileOpenRight: FtCssVariableFactory.create("--ft-search-bar-mobile-open-right", "SIZE", "0"),
|
|
16
|
+
desktopFiltersHeight: FtCssVariableFactory.create("--ft-search-bar-desktop-filters-height", "SIZE", "350px"),
|
|
17
|
+
floatingZIndex: FtCssVariableFactory.create("--ft-search-bar-floating-components-z-index", "NUMBER", "3"),
|
|
18
|
+
colorSurface: FtCssVariableFactory.external(designSystemVariables.colorSurface, "Design system"),
|
|
19
|
+
colorOnSurface: FtCssVariableFactory.external(designSystemVariables.colorOnSurface, "Design system"),
|
|
20
|
+
colorOnSurfaceMedium: FtCssVariableFactory.external(designSystemVariables.colorOnSurfaceMedium, "Design system"),
|
|
21
|
+
colorOutline: FtCssVariableFactory.external(designSystemVariables.colorOutline, "Design system"),
|
|
22
|
+
colorPrimary: FtCssVariableFactory.external(designSystemVariables.colorPrimary, "Design system"),
|
|
23
|
+
elevation02: FtCssVariableFactory.external(designSystemVariables.elevation02, "Design system"),
|
|
24
|
+
buttonColor: FtCssVariableFactory.external(FtButtonCssVariables.color, "Button"),
|
|
25
|
+
buttonRippleColor: FtCssVariableFactory.external(FtButtonCssVariables.rippleColor, "Button"),
|
|
28
26
|
};
|
|
29
27
|
//language=css
|
|
30
28
|
export const searchBarCss = css `
|
|
@@ -318,110 +316,4 @@ export const facetsCss = css `
|
|
|
318
316
|
margin: 0;
|
|
319
317
|
}
|
|
320
318
|
`;
|
|
321
|
-
//language=css
|
|
322
|
-
export const selectedFiltersCss = css `
|
|
323
|
-
.ft-search-bar--selected-filters:not(ft-snap-scroll) {
|
|
324
|
-
flex-shrink: 0;
|
|
325
|
-
display: flex;
|
|
326
|
-
flex-direction: row;
|
|
327
|
-
flex-wrap: wrap;
|
|
328
|
-
gap: 8px;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
ft-snap-scroll.ft-search-bar--selected-filters {
|
|
332
|
-
overflow: hidden;
|
|
333
|
-
${setVariable(FtSnapScrollCssVariables.gap, "4px")};
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
ft-snap-scroll.ft-search-bar--selected-filters::part(content) {
|
|
337
|
-
align-items: center;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
.ft-search-bar--desktop ft-snap-scroll.ft-search-bar--selected-filters {
|
|
341
|
-
${setVariable(FtChipCssVariables.iconSize, "17px")};
|
|
342
|
-
${setVariable(FtChipCssVariables.fontSize, "12px")};
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
.ft-search-bar--selected-filters * {
|
|
346
|
-
max-width: 100%;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
.ft-search-bar--selected-filters ft-chip {
|
|
350
|
-
flex-grow: 0;
|
|
351
|
-
}
|
|
352
|
-
`;
|
|
353
|
-
//language=css
|
|
354
|
-
export const suggestionsCss = css `
|
|
355
|
-
.ft-search-bar--mobile .ft-search-bar--suggestions {
|
|
356
|
-
flex-grow: 1;
|
|
357
|
-
flex-shrink: 1;
|
|
358
|
-
overflow-y: auto;
|
|
359
|
-
height: 0;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
.ft-search-bar--mobile-menu-open .ft-search-bar--suggestions {
|
|
363
|
-
border-top: 1px solid ${FtSearchBarCssVariables.colorOutline};
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
.ft-search-bar--mobile-menu-open .ft-search-bar--suggestions {
|
|
367
|
-
height: initial;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
.ft-search-bar--floating-panel,
|
|
371
|
-
.ft-search-bar--desktop .ft-search-bar--suggestions {
|
|
372
|
-
position: absolute;
|
|
373
|
-
z-index: ${FtSearchBarCssVariables.floatingZIndex};
|
|
374
|
-
top: 100%;
|
|
375
|
-
left: -1px;
|
|
376
|
-
right: -1px;
|
|
377
|
-
display: none;
|
|
378
|
-
background: ${FtSearchBarCssVariables.colorSurface};
|
|
379
|
-
border: 1px solid ${FtSearchBarCssVariables.colorOutline};
|
|
380
|
-
border-radius: 0 0 ${FtSearchBarCssVariables.borderRadius} ${FtSearchBarCssVariables.borderRadius};
|
|
381
|
-
box-shadow: ${FtSearchBarCssVariables.elevation02};
|
|
382
|
-
outline: none;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
.ft-search-bar--desktop .ft-search-bar--suggestions {
|
|
386
|
-
top: calc(100% + 2px);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
.ft-search-bar--input-container:focus-within .ft-search-bar--suggestions-not-empty {
|
|
390
|
-
display: block;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
.ft-search-bar--suggestion {
|
|
394
|
-
text-decoration: none;
|
|
395
|
-
position: relative;
|
|
396
|
-
display: flex;
|
|
397
|
-
align-items: center;
|
|
398
|
-
padding: 8px;
|
|
399
|
-
gap: 8px;
|
|
400
|
-
cursor: pointer;
|
|
401
|
-
color: ${FtSearchBarCssVariables.colorOnSurface};
|
|
402
|
-
min-height: 52px;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
.ft-search-bar--suggestion > *:not(ft-ripple) {
|
|
406
|
-
position: relative;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
.ft-search-bar--desktop .ft-search-bar--suggestion {
|
|
410
|
-
min-height: 44px;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
.ft-search-bar--suggestion:focus {
|
|
414
|
-
outline: none;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
.ft-search-bar--recent-search + .ft-search-bar--suggestion:not(.ft-search-bar--recent-search) {
|
|
418
|
-
border-top: 1px solid ${FtSearchBarCssVariables.colorOutline};
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
.ft-search-bar--suggestion ft-typography {
|
|
422
|
-
display: block;
|
|
423
|
-
flex-grow: 1;
|
|
424
|
-
flex-shrink: 1;
|
|
425
|
-
}
|
|
426
|
-
`;
|
|
427
319
|
//# sourceMappingURL=ft-search-bar.css.js.map
|
package/build/ft-search-bar.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { PropertyValues } from "lit";
|
|
2
|
-
import { ElementDefinitionsMap, FtLitElement, ParametrizedLabels } from "@fluid-topics/ft-wc-utils";
|
|
3
|
-
import { FluidTopicsApi, FtSearchFacetConf, FtSearchPreset, FtSearchPrior, FtSearchRequest, FtSuggestRequest } from "@fluid-topics/public-api";
|
|
1
|
+
import { nothing, PropertyValues } from "lit";
|
|
2
|
+
import { ElementDefinitionsMap, FtLitElement, ParametrizedLabelResolver, ParametrizedLabels } from "@fluid-topics/ft-wc-utils";
|
|
3
|
+
import { FluidTopicsApi, FtSearchFacet, FtSearchFacetConf, FtSearchLocale, FtSearchPreset, FtSearchPrior, FtSearchRequest, FtSuggestRequest, FtSuggestResult } from "@fluid-topics/public-api";
|
|
4
|
+
import { SuggestManager } from "./managers/SuggestManager";
|
|
5
|
+
import { FacetsChipsManager } from "./managers/FacetsChipsManager";
|
|
6
|
+
import { MobileSearchBarManager } from "./managers/MobileSearchBarManager";
|
|
7
|
+
import { DesktopSearchBarManager } from "./managers/DesktopSearchBarManager";
|
|
4
8
|
declare global {
|
|
5
9
|
interface Window {
|
|
6
10
|
fluidtopics?: {
|
|
@@ -39,7 +43,6 @@ export interface FtSearchBarProperties {
|
|
|
39
43
|
selectedPreset?: string;
|
|
40
44
|
dense: boolean;
|
|
41
45
|
}
|
|
42
|
-
export { FtSearchBarCssVariables } from "./ft-search-bar.css";
|
|
43
46
|
export declare class LaunchSearchEvent extends CustomEvent<FtSearchRequest> {
|
|
44
47
|
constructor(request: FtSearchRequest);
|
|
45
48
|
}
|
|
@@ -56,11 +59,11 @@ export declare class FtSearchBar extends FtLitElement implements FtSearchBarProp
|
|
|
56
59
|
baseUrl: string;
|
|
57
60
|
apiIntegrationIdentifier: string;
|
|
58
61
|
contentLocale?: string;
|
|
59
|
-
|
|
62
|
+
availableContentLocales: Array<FtSearchLocale>;
|
|
60
63
|
private availableContentLocalesInitialized;
|
|
61
64
|
uiLocale?: string;
|
|
62
65
|
labels: FtSearchBarLabels;
|
|
63
|
-
|
|
66
|
+
labelResolver: ParametrizedLabelResolver<FtSearchBarLabels>;
|
|
64
67
|
displayedFilters: Array<string>;
|
|
65
68
|
presets?: Array<FtSearchPreset>;
|
|
66
69
|
selectedPreset?: string;
|
|
@@ -68,56 +71,46 @@ export declare class FtSearchBar extends FtLitElement implements FtSearchBarProp
|
|
|
68
71
|
searchRequestSerializer: (request: FtSearchRequest) => string;
|
|
69
72
|
private searchFilters;
|
|
70
73
|
private sizeCategory;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
displayFacets: boolean;
|
|
75
|
+
mobileMenuOpen: boolean;
|
|
76
|
+
isMobileMenuOpen(): boolean;
|
|
77
|
+
facets: Array<FtSearchFacet>;
|
|
75
78
|
private facetsInitialized;
|
|
76
79
|
private knownFacetLabels;
|
|
77
80
|
private container?;
|
|
78
81
|
private filtersOpener?;
|
|
79
82
|
private floatingContainer?;
|
|
80
83
|
private scrollingFiltersContainer?;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
private scrollToFacet?;
|
|
87
|
-
private firstSuggestion?;
|
|
88
|
-
private focusedSuggestion?;
|
|
89
|
-
private lastSuggestion?;
|
|
84
|
+
input?: HTMLInputElement;
|
|
85
|
+
query: string;
|
|
86
|
+
suggestions: Array<FtSuggestResult>;
|
|
87
|
+
recentSearches: Array<string>;
|
|
88
|
+
scrollToFacet?: string;
|
|
90
89
|
private updateFacetsDebouncer;
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
api?: FluidTopicsApi;
|
|
91
|
+
suggestManager: SuggestManager;
|
|
92
|
+
selectedFacetsManager: FacetsChipsManager;
|
|
93
|
+
desktopSearchBarManager: DesktopSearchBarManager;
|
|
94
|
+
mobileSearchBarManager: MobileSearchBarManager;
|
|
93
95
|
get request(): FtSearchRequest;
|
|
94
96
|
get facetsRequest(): Array<FtSearchFacetConf>;
|
|
95
97
|
get suggestRequest(): FtSuggestRequest;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
isMobile(): boolean;
|
|
99
|
+
hasFacets(): boolean;
|
|
98
100
|
private get hasPresets();
|
|
99
101
|
private get hasPriors();
|
|
100
|
-
|
|
102
|
+
hasLocaleSelector(): boolean;
|
|
101
103
|
focus(): void;
|
|
102
104
|
focusInput(): void;
|
|
103
105
|
clear(): void;
|
|
104
106
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
105
107
|
protected renderSearchBar(): import("lit-html").TemplateResult<1>;
|
|
106
|
-
|
|
107
|
-
private renderMobileSearchBarButtons;
|
|
108
|
-
private renderMobileFacets;
|
|
108
|
+
renderMobileFacets(): import("lit-html").TemplateResult<1>;
|
|
109
109
|
private contentLocalesAsFilterOptions;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
private renderSearchBarLeftAction;
|
|
113
|
-
private renderDesktopSearchBarButtons;
|
|
114
|
-
private renderFacetsActions;
|
|
110
|
+
renderDesktopMenu(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
111
|
+
renderFacetsActions(): import("lit-html").TemplateResult<1>;
|
|
115
112
|
private renderDesktopClearFilters;
|
|
116
113
|
private renderDesktopFacets;
|
|
117
|
-
private renderSelectedFacets;
|
|
118
|
-
private renderSuggestions;
|
|
119
|
-
private getIcon;
|
|
120
|
-
private openMobileFilters;
|
|
121
114
|
protected firstUpdated(props: PropertyValues): Promise<void>;
|
|
122
115
|
protected update(props: PropertyValues): void;
|
|
123
116
|
private updateAvailableContentLocales;
|
|
@@ -125,29 +118,23 @@ export declare class FtSearchBar extends FtLitElement implements FtSearchBarProp
|
|
|
125
118
|
private initApi;
|
|
126
119
|
private facetsLoaded;
|
|
127
120
|
private updateFacets;
|
|
128
|
-
private updateSuggestions;
|
|
129
|
-
private onSearchBarKeyUp;
|
|
130
|
-
private onSearchBarKeyDown;
|
|
131
121
|
private onFloatingContainerKeyUp;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
private onSuggestKeyUp;
|
|
135
|
-
private onSuggestSelected;
|
|
136
|
-
private launchSearch;
|
|
122
|
+
setQuery(query: string): void;
|
|
123
|
+
launchSearch(): void;
|
|
137
124
|
private get recentSearchesStorageKey();
|
|
138
125
|
private initRecentSearches;
|
|
139
|
-
|
|
126
|
+
saveRecentSearches(): void;
|
|
140
127
|
private closeFloatingContainer;
|
|
141
128
|
connectedCallback(): void;
|
|
142
129
|
disconnectedCallback(): void;
|
|
143
130
|
private updateSize;
|
|
144
|
-
|
|
145
|
-
private setFilter;
|
|
131
|
+
setFilter(key: string, selectedValues: Array<string>): void;
|
|
146
132
|
private compareFilters;
|
|
147
133
|
private compareRequests;
|
|
148
134
|
private setFiltersFromPreset;
|
|
149
135
|
private clearFilters;
|
|
150
|
-
|
|
151
|
-
|
|
136
|
+
querySelector(selectors: string): HTMLElement | null;
|
|
137
|
+
querySelectorAll(selectors: string): NodeListOf<HTMLElement>;
|
|
138
|
+
renderDesktopFloatingMenu(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
152
139
|
}
|
|
153
140
|
//# sourceMappingURL=ft-search-bar.d.ts.map
|