@fluid-topics/ft-search-bar 1.0.14 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ft-search-bar.css.js +38 -0
- package/build/ft-search-bar.d.ts +1 -1
- package/build/ft-search-bar.js +31 -27
- package/build/ft-search-bar.light.js +90 -55
- package/build/ft-search-bar.min.js +187 -152
- package/package.json +14 -14
|
@@ -6,6 +6,8 @@ import { FtSelectCssVariables } from "@fluid-topics/ft-select/build/ft-select.cs
|
|
|
6
6
|
import { FtSkeletonCssVariables } from "@fluid-topics/ft-skeleton/build/ft-skeleton.css";
|
|
7
7
|
import { FtTooltipCssVariables } from "@fluid-topics/ft-tooltip/build/ft-tooltip.css";
|
|
8
8
|
import { FtSnapScrollCssVariables } from "@fluid-topics/ft-snap-scroll/build/ft-snap-scroll.css";
|
|
9
|
+
import { FtFilterCssVariables } from "@fluid-topics/ft-filter/build/ft-filter.css";
|
|
10
|
+
import { FtTypographyCssVariables } from "@fluid-topics/ft-typography/build/ft-typography.css";
|
|
9
11
|
export const FtSearchBarCssVariables = {
|
|
10
12
|
height: FtCssVariableFactory.create("--ft-search-bar-height", "SIZE", "38px"),
|
|
11
13
|
borderRadius: FtCssVariableFactory.extend("--ft-search-bar-border-radius", designSystemVariables.borderRadiusS),
|
|
@@ -185,6 +187,42 @@ export const searchBarCss = css `
|
|
|
185
187
|
border-radius: calc(${FtSearchBarCssVariables.borderRadius} - 1px) 0 0 calc(${FtSearchBarCssVariables.borderRadius} - 1px);
|
|
186
188
|
}
|
|
187
189
|
|
|
190
|
+
[part="content-locale-selector"] {
|
|
191
|
+
flex-grow: 0;
|
|
192
|
+
display: flex;
|
|
193
|
+
flex-direction: column;
|
|
194
|
+
max-height: 100%;
|
|
195
|
+
max-width: 100%;
|
|
196
|
+
color: ${FtFilterCssVariables.colorOnSurface};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
[part="content-locale-selector"] > ft-radio-group {
|
|
200
|
+
flex-grow: 1;
|
|
201
|
+
flex-shrink: 1;
|
|
202
|
+
overflow: auto;
|
|
203
|
+
display: flex;
|
|
204
|
+
flex-direction: column;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
[part="content-locale-selector-header"] {
|
|
208
|
+
display: flex;
|
|
209
|
+
flex-wrap: wrap;
|
|
210
|
+
gap: 4px;
|
|
211
|
+
flex-shrink: 0;
|
|
212
|
+
padding: 0 10px;
|
|
213
|
+
margin-bottom: 8px;
|
|
214
|
+
${setVariable(FtTypographyCssVariables.fontSize, "14px")};
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
[part="content-locale-selector-label"] {
|
|
218
|
+
display: block;
|
|
219
|
+
flex-shrink: 1;
|
|
220
|
+
flex-grow: 1;
|
|
221
|
+
word-break: break-word;
|
|
222
|
+
${setVariable(FtTypographyCssVariables.lineHeight, "22px")};
|
|
223
|
+
${setVariable(FtTypographyCssVariables.fontWeight, "bold")};
|
|
224
|
+
}
|
|
225
|
+
|
|
188
226
|
`;
|
|
189
227
|
//language=css
|
|
190
228
|
export const facetsCss = css `
|
package/build/ft-search-bar.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ export declare class FtSearchBar extends FtLitElement implements FtSearchBarProp
|
|
|
76
76
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
77
77
|
protected renderSearchBar(): import("lit-html").TemplateResult<1>;
|
|
78
78
|
renderMobileFacets(): import("lit-html").TemplateResult<1>;
|
|
79
|
-
private
|
|
79
|
+
private getContentLocaleRadioGroup;
|
|
80
80
|
renderDesktopMenu(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
81
81
|
renderFacetsActions(): import("lit-html").TemplateResult<1>;
|
|
82
82
|
private renderDesktopClearFilters;
|
package/build/ft-search-bar.js
CHANGED
|
@@ -26,6 +26,7 @@ import { SuggestManager } from "./managers/SuggestManager";
|
|
|
26
26
|
import { FacetsChipsManager } from "./managers/FacetsChipsManager";
|
|
27
27
|
import { MobileSearchBarManager } from "./managers/MobileSearchBarManager";
|
|
28
28
|
import { DesktopSearchBarManager } from "./managers/DesktopSearchBarManager";
|
|
29
|
+
import { FtRadio, FtRadioGroup, } from "@fluid-topics/ft-radio";
|
|
29
30
|
if (window.fluidtopics == null) {
|
|
30
31
|
console.warn("Fluid Topics public API was not found. You can find it here: https://www.npmjs.com/package/@fluid-topics/public-api");
|
|
31
32
|
}
|
|
@@ -208,15 +209,9 @@ class FtSearchBar extends FtLitElement {
|
|
|
208
209
|
</ft-typography>
|
|
209
210
|
` : nothing}
|
|
210
211
|
</div>
|
|
211
|
-
<
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
.exportpartsPrefixes=${["filter", "filter-ft-locale"]}
|
|
215
|
-
class="ft-search-bar--content-locale"
|
|
216
|
-
filterPlaceHolder="${this.labelResolver.resolve("filterInputPlaceHolder", this.labelResolver.resolve("contentLocaleSelector"))}"
|
|
217
|
-
.options=${(this.contentLocalesAsFilterOptions())}
|
|
218
|
-
@change=${(e) => this.contentLocale = e.detail[0]}
|
|
219
|
-
></ft-filter>
|
|
212
|
+
<div part="content-locale-selector">
|
|
213
|
+
${this.getContentLocaleRadioGroup()}
|
|
214
|
+
</div>
|
|
220
215
|
</ft-accordion-item>
|
|
221
216
|
` : null}
|
|
222
217
|
${repeat(this.facets, facet => facet.key, facet => {
|
|
@@ -253,12 +248,22 @@ class FtSearchBar extends FtLitElement {
|
|
|
253
248
|
</ft-accordion>
|
|
254
249
|
`;
|
|
255
250
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
251
|
+
getContentLocaleRadioGroup() {
|
|
252
|
+
var _a;
|
|
253
|
+
return html `
|
|
254
|
+
<ft-radio-group
|
|
255
|
+
@change=${(e) => this.contentLocale = (e.detail === "all" ? undefined : e.detail)}>
|
|
256
|
+
${repeat(((_a = this.availableContentLocales) !== null && _a !== void 0 ? _a : []), locale => locale.lang, locale => {
|
|
257
|
+
var _a;
|
|
258
|
+
return html `
|
|
259
|
+
<ft-radio value="${(_a = locale.lang) !== null && _a !== void 0 ? _a : "all"}"
|
|
260
|
+
?checked=${locale.lang == this.contentLocale}>
|
|
261
|
+
${locale.label}
|
|
262
|
+
</ft-radio>
|
|
263
|
+
`;
|
|
264
|
+
})}
|
|
265
|
+
</ft-radio-group>
|
|
266
|
+
`;
|
|
262
267
|
}
|
|
263
268
|
renderDesktopMenu() {
|
|
264
269
|
return this.hasFacets() ? html `
|
|
@@ -320,17 +325,14 @@ class FtSearchBar extends FtLitElement {
|
|
|
320
325
|
exportpartsPrefix="filters-container"
|
|
321
326
|
data-filters-count="${this.facets.length + (this.hasLocaleSelector() ? 1 : 0)}">
|
|
322
327
|
${this.hasLocaleSelector() ? html `
|
|
323
|
-
<
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
forceOneSelected
|
|
332
|
-
@change=${(e) => this.contentLocale = e.detail[0]}
|
|
333
|
-
></ft-filter>
|
|
328
|
+
<div part="content-locale-selector">
|
|
329
|
+
<div part="content-locale-selector-header">
|
|
330
|
+
<ft-typography variant="overline" part="content-locale-selector-label">
|
|
331
|
+
${this.labelResolver.resolve("contentLocaleSelector")}
|
|
332
|
+
</ft-typography>
|
|
333
|
+
</div>
|
|
334
|
+
${this.getContentLocaleRadioGroup()}
|
|
335
|
+
</div>
|
|
334
336
|
` : nothing}
|
|
335
337
|
${repeat(this.facets, facet => facet.key, facet => {
|
|
336
338
|
const filter = facetToFilter(facet);
|
|
@@ -378,7 +380,7 @@ class FtSearchBar extends FtLitElement {
|
|
|
378
380
|
}
|
|
379
381
|
super.update(props);
|
|
380
382
|
if ((props.has("availableContentLocales") || props.has("contentLocale")) && this.availableContentLocales.length > 0) {
|
|
381
|
-
const isKnown = (locale) => this.availableContentLocales.some(l => l.lang
|
|
383
|
+
const isKnown = (locale) => this.availableContentLocales.some(l => l.lang == locale);
|
|
382
384
|
if (!isKnown(this.contentLocale)) {
|
|
383
385
|
this.contentLocale = props.has("contentLocale") && isKnown(props.get("contentLocale")) ? props.get("contentLocale") : (_a = this.availableContentLocales[0]) === null || _a === void 0 ? void 0 : _a.lang;
|
|
384
386
|
}
|
|
@@ -622,6 +624,8 @@ FtSearchBar.elementDefinitions = {
|
|
|
622
624
|
"ft-snap-scroll": FtSnapScroll,
|
|
623
625
|
"ft-tooltip": FtTooltip,
|
|
624
626
|
"ft-typography": FtTypography,
|
|
627
|
+
"ft-radio-group": FtRadioGroup,
|
|
628
|
+
"ft-radio": FtRadio,
|
|
625
629
|
};
|
|
626
630
|
FtSearchBar.styles = [
|
|
627
631
|
FtTypographyBody2,
|