@fluid-topics/ft-filter 1.1.71 → 1.1.72

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.
@@ -16,6 +16,7 @@ export declare class FtFilterLevel extends FtLitElement {
16
16
  private noValuesLabel?;
17
17
  displayedValuesLimit: number;
18
18
  private container?;
19
+ private radios?;
19
20
  private displayedPages;
20
21
  get hasHiddenValues(): boolean;
21
22
  private get limit();
@@ -24,9 +25,12 @@ export declare class FtFilterLevel extends FtLitElement {
24
25
  private goBackOnKeyPress;
25
26
  private goBackOnClick;
26
27
  private displayMore;
28
+ private onRadioChange;
27
29
  private buildMultiValuedOption;
28
30
  private buildMonoValuedOption;
29
31
  private onRadioKeyUp;
30
32
  private optionsChanged;
31
33
  private displayLevel;
34
+ connectedCallback(): void;
35
+ private makeRadioKeyBoardNavigable;
32
36
  }
@@ -56,6 +56,7 @@ class FtFilterLevel extends FtLitElement {
56
56
  <div tabindex="0"
57
57
  part="controls go-back"
58
58
  class="ft-filter-level--go-back"
59
+ aria-label="back to ${this.parent.label}"
59
60
  ?disabled=${this.disabled}
60
61
  @keyup=${this.goBackOnKeyPress}
61
62
  @click=${this.goBackOnClick}>
@@ -72,7 +73,7 @@ class FtFilterLevel extends FtLitElement {
72
73
  ${repeat(limitedOptions, option => option.value, option => {
73
74
  var _a;
74
75
  return html `
75
- <div class="ft-filter-level--option" part="options">
76
+ <div class="ft-filter-level--option" part="options" tabindex="-1">
76
77
  ${this.multivalued
77
78
  ? this.buildMultiValuedOption(option)
78
79
  : this.buildMonoValuedOption(option)}
@@ -81,6 +82,7 @@ class FtFilterLevel extends FtLitElement {
81
82
  : html `
82
83
  <ft-button icon="thin_arrow_right"
83
84
  part="controls navigate-hierarchy"
85
+ aria-label="expand node"
84
86
  label="${option.label}"
85
87
  ?disabled=${this.disabled}
86
88
  tooltipPosition="left"
@@ -114,6 +116,18 @@ class FtFilterLevel extends FtLitElement {
114
116
  }
115
117
  displayMore() {
116
118
  this.displayedPages++;
119
+ this.makeRadioKeyBoardNavigable();
120
+ }
121
+ onRadioChange(e) {
122
+ var _a;
123
+ e.stopPropagation();
124
+ const event = e;
125
+ (_a = this.radios) === null || _a === void 0 ? void 0 : _a.forEach(radio => {
126
+ //we put radio.name in the FtRadioChangeEvent detail.value because in ft-filter-level
127
+ //ft-radio don't have value
128
+ radio.checked = (radio.name === event.detail.value);
129
+ radio.setAttribute("tabindex", "0"); // to make all ft-radio keyboard navigable
130
+ });
117
131
  }
118
132
  buildMultiValuedOption(option) {
119
133
  var _a;
@@ -139,7 +153,7 @@ class FtFilterLevel extends FtLitElement {
139
153
  .disabled=${this.disabled}
140
154
  @click=${(e) => this.optionsChanged(e, option)}
141
155
  @keyup=${(e) => this.onRadioKeyUp(e, option)}
142
- @change=${(e) => e.stopPropagation()}>
156
+ @change=${(e) => this.onRadioChange(e)}>
143
157
  ${option.renderOption ? option.renderOption : option.label}${this.displayCount ? ` (${option.count})` : ""}
144
158
  </ft-radio>
145
159
  `;
@@ -156,6 +170,23 @@ class FtFilterLevel extends FtLitElement {
156
170
  displayLevel(option) {
157
171
  this.dispatchEvent(new CustomEvent("display-level", { detail: option }));
158
172
  }
173
+ connectedCallback() {
174
+ super.connectedCallback();
175
+ this.makeRadioKeyBoardNavigable();
176
+ }
177
+ makeRadioKeyBoardNavigable() {
178
+ if (!this.multivalued) {
179
+ setTimeout(() => {
180
+ var _a, _b;
181
+ this.radios = Array.from((_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll("ft-radio"));
182
+ (_b = this.radios) === null || _b === void 0 ? void 0 : _b.forEach(option => {
183
+ var _a, _b;
184
+ option.setAttribute("tabindex", "0");
185
+ (_b = (_a = option.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("input[type=\"radio\"]")) === null || _b === void 0 ? void 0 : _b.setAttribute("tabindex", "-1");
186
+ });
187
+ }, 5);
188
+ }
189
+ }
159
190
  }
160
191
  FtFilterLevel.elementDefinitions = {
161
192
  "ft-button": FtButton,
@@ -206,6 +237,9 @@ __decorate([
206
237
  __decorate([
207
238
  query(".ft-filter-level--container")
208
239
  ], FtFilterLevel.prototype, "container", void 0);
240
+ __decorate([
241
+ state()
242
+ ], FtFilterLevel.prototype, "radios", void 0);
209
243
  __decorate([
210
244
  state()
211
245
  ], FtFilterLevel.prototype, "displayedPages", void 0);