@fluid-topics/ft-search-bar 1.0.13 → 1.0.15
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.js +29 -20
- package/build/ft-search-bar.light.js +150 -110
- package/build/ft-search-bar.min.js +160 -120
- 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.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 { FtRadioGroup, FtRadio, } 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
|
}
|
|
@@ -194,6 +195,7 @@ class FtSearchBar extends FtLitElement {
|
|
|
194
195
|
`;
|
|
195
196
|
}
|
|
196
197
|
renderMobileFacets() {
|
|
198
|
+
var _a;
|
|
197
199
|
const currentLocale = this.availableContentLocales.filter(l => l.lang === this.contentLocale).pop();
|
|
198
200
|
return html `
|
|
199
201
|
<ft-accordion class="ft-search-bar--filters-container">
|
|
@@ -208,15 +210,15 @@ class FtSearchBar extends FtLitElement {
|
|
|
208
210
|
</ft-typography>
|
|
209
211
|
` : nothing}
|
|
210
212
|
</div>
|
|
211
|
-
<
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
213
|
+
<div part="content-locale-selector">
|
|
214
|
+
<ft-radio-group @change=${(e) => this.contentLocale = e.detail}>
|
|
215
|
+
${repeat(((_a = this.availableContentLocales) !== null && _a !== void 0 ? _a : []), locale => locale.lang, locale => html `
|
|
216
|
+
<ft-radio .value=${locale.lang}
|
|
217
|
+
?checked=${locale.lang == this.contentLocale}
|
|
218
|
+
>${locale.label}
|
|
219
|
+
</ft-radio>`)}
|
|
220
|
+
</ft-radio-group>
|
|
221
|
+
</div>
|
|
220
222
|
</ft-accordion-item>
|
|
221
223
|
` : null}
|
|
222
224
|
${repeat(this.facets, facet => facet.key, facet => {
|
|
@@ -310,6 +312,7 @@ class FtSearchBar extends FtLitElement {
|
|
|
310
312
|
` : nothing;
|
|
311
313
|
}
|
|
312
314
|
renderDesktopFacets() {
|
|
315
|
+
var _a;
|
|
313
316
|
if (!this.hasFacets()) {
|
|
314
317
|
return nothing;
|
|
315
318
|
}
|
|
@@ -320,16 +323,20 @@ class FtSearchBar extends FtLitElement {
|
|
|
320
323
|
exportpartsPrefix="filters-container"
|
|
321
324
|
data-filters-count="${this.facets.length + (this.hasLocaleSelector() ? 1 : 0)}">
|
|
322
325
|
${this.hasLocaleSelector() ? html `
|
|
323
|
-
<
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
326
|
+
<div part="content-locale-selector">
|
|
327
|
+
<div part="content-locale-selector-header">
|
|
328
|
+
<ft-typography variant="overline" part="content-locale-selector-label">
|
|
329
|
+
${this.labelResolver.resolve("contentLocaleSelector")}
|
|
330
|
+
</ft-typography>
|
|
331
|
+
</div>
|
|
332
|
+
<ft-radio-group @change=${(e) => this.contentLocale = e.detail}>
|
|
333
|
+
${repeat(((_a = this.availableContentLocales) !== null && _a !== void 0 ? _a : []), locale => locale.lang, locale => html `
|
|
334
|
+
<ft-radio .value=${locale.lang}
|
|
335
|
+
?checked=${locale.lang == this.contentLocale}
|
|
336
|
+
>${locale.label}
|
|
337
|
+
</ft-radio>`)}
|
|
338
|
+
</ft-radio-group>
|
|
339
|
+
</div>
|
|
333
340
|
` : nothing}
|
|
334
341
|
${repeat(this.facets, facet => facet.key, facet => {
|
|
335
342
|
const filter = facetToFilter(facet);
|
|
@@ -377,7 +384,7 @@ class FtSearchBar extends FtLitElement {
|
|
|
377
384
|
}
|
|
378
385
|
super.update(props);
|
|
379
386
|
if ((props.has("availableContentLocales") || props.has("contentLocale")) && this.availableContentLocales.length > 0) {
|
|
380
|
-
const isKnown = (locale) => this.availableContentLocales.some(l => l.lang
|
|
387
|
+
const isKnown = (locale) => this.availableContentLocales.some(l => l.lang == locale);
|
|
381
388
|
if (!isKnown(this.contentLocale)) {
|
|
382
389
|
this.contentLocale = props.has("contentLocale") && isKnown(props.get("contentLocale")) ? props.get("contentLocale") : (_a = this.availableContentLocales[0]) === null || _a === void 0 ? void 0 : _a.lang;
|
|
383
390
|
}
|
|
@@ -621,6 +628,8 @@ FtSearchBar.elementDefinitions = {
|
|
|
621
628
|
"ft-snap-scroll": FtSnapScroll,
|
|
622
629
|
"ft-tooltip": FtTooltip,
|
|
623
630
|
"ft-typography": FtTypography,
|
|
631
|
+
"ft-radio-group": FtRadioGroup,
|
|
632
|
+
"ft-radio": FtRadio,
|
|
624
633
|
};
|
|
625
634
|
FtSearchBar.styles = [
|
|
626
635
|
FtTypographyBody2,
|