@fluid-topics/ft-filter 2.2.35 → 2.2.37

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.
@@ -0,0 +1,8 @@
1
+ import { I18nMessageContext, I18nMessages } from "@fluid-topics/ft-i18n";
2
+ export interface FtFilterMessages extends I18nMessages {
3
+ filterInputPlaceHolder(label: string): string;
4
+ clearFilterButton(): string;
5
+ displayMoreFilterValuesButton(): string;
6
+ noFilterValuesAvailable(): string;
7
+ }
8
+ export declare const ftFilterContext: I18nMessageContext<FtFilterMessages>;
@@ -0,0 +1,2 @@
1
+ import { I18nMessageContext, } from "@fluid-topics/ft-i18n";
2
+ export const ftFilterContext = I18nMessageContext.build("designedFilterComponent");
@@ -29,8 +29,6 @@ export declare class FtFilterLevel extends FtFilterLevel_base {
29
29
  displayCount: boolean;
30
30
  preventNavigation: boolean;
31
31
  filter: string;
32
- moreValuesButtonLabel: string;
33
- noValuesLabel?: string;
34
32
  filteredOptionsNumberAriaNotification?: I18nAttributeValue;
35
33
  displayedValuesLimit: number;
36
34
  protected container?: HTMLDivElement;
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { html, nothing, } from "lit";
8
8
  import { property, query, state, } from "lit/decorators.js";
9
9
  import { repeat } from "lit/directives/repeat.js";
10
- import { Debouncer, flatDeep, FtLitElement, hasChanged, numberProperty, withAriaNotification, withAnalytics, } from "@fluid-topics/ft-wc-utils";
10
+ import { Debouncer, flatDeep, FtLitElement, hasChanged, numberProperty, withAnalytics, withAriaNotification, } from "@fluid-topics/ft-wc-utils";
11
11
  import { FtButton } from "@fluid-topics/ft-button";
12
12
  import { FtTypography, FtTypographyVariants, } from "@fluid-topics/ft-typography";
13
13
  import { FtRipple } from "@fluid-topics/ft-ripple";
@@ -16,6 +16,7 @@ import { FtCheckbox } from "@fluid-topics/ft-checkbox";
16
16
  import { FtRadio, } from "@fluid-topics/ft-radio";
17
17
  import { levelStyles } from "./ft-filter-level.styles";
18
18
  import { withI18n } from "@fluid-topics/ft-i18n";
19
+ import { ftFilterContext } from "./FtFilterMessages";
19
20
  export const analyticsActions = {
20
21
  "more-filters-button-pressed": {
21
22
  label: "Revealing more filters",
@@ -34,7 +35,6 @@ export class FtFilterLevel extends withAnalytics(withI18n(withAriaNotification(F
34
35
  this.displayCount = false;
35
36
  this.preventNavigation = false;
36
37
  this.filter = "";
37
- this.moreValuesButtonLabel = "More";
38
38
  this.displayedValuesLimit = 0;
39
39
  this.displayedPages = 1;
40
40
  this.filteredOptions = [];
@@ -102,9 +102,9 @@ export class FtFilterLevel extends withAnalytics(withI18n(withAriaNotification(F
102
102
  <ft-typography variant="${FtTypographyVariants.body2}">${this.parent.label}</ft-typography>
103
103
  </div>
104
104
  `}
105
- ${this.filteredOptions.length === 0 && this.noValuesLabel ? html `
105
+ ${this.filteredOptions.length === 0 ? html `
106
106
  <ft-typography class="ft-filter-level--no-values" element="span" variant="${FtTypographyVariants.body2}">
107
- ${this.noValuesLabel}
107
+ ${ftFilterContext.messages.noFilterValuesAvailable()}
108
108
  </ft-typography>
109
109
  ` : nothing}
110
110
  ${repeat(limitedOptions, (option) => option.value, (option) => { var _a; return html `
@@ -135,7 +135,7 @@ export class FtFilterLevel extends withAnalytics(withI18n(withAriaNotification(F
135
135
  this.emitAnalyticsAction("more-filters-button-pressed", {});
136
136
  this.displayMore();
137
137
  }}>
138
- ${this.moreValuesButtonLabel}
138
+ ${ftFilterContext.messages.displayMoreFilterValuesButton()}
139
139
  </ft-button>
140
140
  ` : nothing}
141
141
  </div>
@@ -257,12 +257,6 @@ __decorate([
257
257
  __decorate([
258
258
  property({ type: String })
259
259
  ], FtFilterLevel.prototype, "filter", void 0);
260
- __decorate([
261
- property({ type: String })
262
- ], FtFilterLevel.prototype, "moreValuesButtonLabel", void 0);
263
- __decorate([
264
- property({ type: String })
265
- ], FtFilterLevel.prototype, "noValuesLabel", void 0);
266
260
  __decorate([
267
261
  property()
268
262
  ], FtFilterLevel.prototype, "filteredOptionsNumberAriaNotification", void 0);
@@ -18,10 +18,6 @@ export declare class FtFilter extends FtFilter_base implements FtFilterPropertie
18
18
  static styles: import("lit").CSSResult[];
19
19
  id: string;
20
20
  label: string;
21
- filterPlaceHolder: string;
22
- clearButtonLabel: string;
23
- moreValuesButtonLabel: string;
24
- noValuesLabel: string;
25
21
  options: Array<FtFilterOptionProperties>;
26
22
  multivalued: boolean;
27
23
  disabled: boolean;
@@ -6,12 +6,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { html, } from "lit";
8
8
  import { property, query, queryAll, state, } from "lit/decorators.js";
9
- import { Debouncer, deepEqual, flatDeep, withAnalytics, FtLitElement, jsonProperty, numberProperty, waitUntil, } from "@fluid-topics/ft-wc-utils";
9
+ import { Debouncer, deepEqual, flatDeep, FtLitElement, jsonProperty, numberProperty, waitUntil, withAnalytics, } from "@fluid-topics/ft-wc-utils";
10
10
  import { FtTypography, FtTypographyVariants, } from "@fluid-topics/ft-typography";
11
- import { FtFilterLevel, analyticsActions } from "./ft-filter-level";
11
+ import { analyticsActions, FtFilterLevel, } from "./ft-filter-level";
12
12
  import { FtButton } from "@fluid-topics/ft-button";
13
13
  import { FtSnapScroll, } from "@fluid-topics/ft-snap-scroll";
14
14
  import { styles } from "./ft-filter.styles";
15
+ import { ftFilterContext } from "./FtFilterMessages";
15
16
  export class FtFilterChangeEvent extends CustomEvent {
16
17
  constructor(selectedValues) {
17
18
  super("change", { detail: selectedValues });
@@ -22,10 +23,6 @@ export class FtFilter extends withAnalytics(FtLitElement, analyticsActions) {
22
23
  super(...arguments);
23
24
  this.id = "";
24
25
  this.label = "";
25
- this.filterPlaceHolder = "Filter {0}";
26
- this.clearButtonLabel = "Clear";
27
- this.moreValuesButtonLabel = "More";
28
- this.noValuesLabel = "No values available";
29
26
  this.options = [];
30
27
  this.multivalued = false;
31
28
  this.disabled = false;
@@ -54,7 +51,7 @@ export class FtFilter extends withAnalytics(FtLitElement, analyticsActions) {
54
51
  render() {
55
52
  const valuesSelected = this.flatOptions.some((o) => o.selected);
56
53
  const showFilter = this.withScroll || this.filter || this.lastLevelHasHiddenvalues;
57
- const placeholder = this.filterPlaceHolder.replace("{0}", this.label);
54
+ const placeholder = ftFilterContext.messages.filterInputPlaceHolder(this.label);
58
55
  return html `
59
56
  <div class="ft-filter--container ${this.disabled ? "ft-filter--disabled" : ""}"
60
57
  part="container">
@@ -69,14 +66,14 @@ export class FtFilter extends withAnalytics(FtLitElement, analyticsActions) {
69
66
  </div>
70
67
  ${valuesSelected && !this.hideClearButton ? html `
71
68
  <ft-button icon="close"
72
- aria-label="${this.clearButtonLabel + " " + this.label}"
69
+ aria-label="${ftFilterContext.messages.clearFilterButton() + " " + this.label}"
73
70
  dense
74
71
  @click=${() => {
75
72
  this.clear();
76
73
  this.focusOnFirstOption();
77
74
  }}
78
75
  part="clear-button">
79
- ${this.clearButtonLabel}
76
+ ${ftFilterContext.messages.clearFilterButton()}
80
77
  </ft-button>
81
78
  ` : null}
82
79
  </div>
@@ -190,7 +187,6 @@ export class FtFilter extends withAnalytics(FtLitElement, analyticsActions) {
190
187
  filterId="${this.id}"
191
188
  .filter=${this.filter}
192
189
  .configuredAnalyticsActions=${this.configuredAnalyticsActions}
193
- moreValuesButtonLabel="${this.moreValuesButtonLabel}"
194
190
  ?multivalued=${this.multivalued}
195
191
  ?disabled=${this.disabled || className !== "ft-filter--level-center"}
196
192
  ?hideSelectedOptions=${this.raiseSelectedOptions}
@@ -203,7 +199,6 @@ export class FtFilter extends withAnalytics(FtLitElement, analyticsActions) {
203
199
  @display-level=${this.onDisplayLevel}
204
200
  part="values available-values"
205
201
  .exportpartsPrefixes=${["values", "available-values"]}
206
- noValuesLabel="${this.noValuesLabel}"
207
202
  .filteredOptionsNumberAriaNotification=${this.filteredOptionsNumberAriaNotification}
208
203
  ></ft-filter-level>
209
204
  `;
@@ -308,18 +303,6 @@ __decorate([
308
303
  __decorate([
309
304
  property({ type: String })
310
305
  ], FtFilter.prototype, "label", void 0);
311
- __decorate([
312
- property({ type: String })
313
- ], FtFilter.prototype, "filterPlaceHolder", void 0);
314
- __decorate([
315
- property({ type: String })
316
- ], FtFilter.prototype, "clearButtonLabel", void 0);
317
- __decorate([
318
- property({ type: String })
319
- ], FtFilter.prototype, "moreValuesButtonLabel", void 0);
320
- __decorate([
321
- property({ type: String })
322
- ], FtFilter.prototype, "noValuesLabel", void 0);
323
306
  __decorate([
324
307
  jsonProperty([])
325
308
  ], FtFilter.prototype, "options", void 0);