@fluid-topics/ft-filter 1.1.75 → 1.1.77

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.
@@ -25,12 +25,9 @@ export declare class FtFilterLevel extends FtLitElement {
25
25
  private goBackOnKeyPress;
26
26
  private goBackOnClick;
27
27
  private displayMore;
28
- private onRadioChange;
29
28
  private buildMultiValuedOption;
30
29
  private buildMonoValuedOption;
31
- private onRadioKeyUp;
30
+ private onRadioKeyDown;
32
31
  private optionsChanged;
33
32
  private displayLevel;
34
- connectedCallback(): void;
35
- private makeRadioKeyBoardNavigable;
36
33
  }
@@ -116,18 +116,6 @@ class FtFilterLevel extends FtLitElement {
116
116
  }
117
117
  displayMore() {
118
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
- });
131
119
  }
132
120
  buildMultiValuedOption(option) {
133
121
  var _a;
@@ -135,7 +123,6 @@ class FtFilterLevel extends FtLitElement {
135
123
  <ft-checkbox name="${this.filterId}"
136
124
  part="multivalued-option"
137
125
  data-value="${option.value}"
138
-
139
126
  .checked=${option.selected}
140
127
  .disabled=${this.disabled}
141
128
  .indeterminate=${flatDeep((_a = option.subOptions) !== null && _a !== void 0 ? _a : [], o => { var _a; return (_a = o.subOptions) !== null && _a !== void 0 ? _a : []; }).some(o => o.selected)}
@@ -149,17 +136,19 @@ class FtFilterLevel extends FtLitElement {
149
136
  <ft-radio name="${this.filterId + Math.round(Math.random() * 1000000)}"
150
137
  part="monovalued-option"
151
138
  data-value="${option.value}"
139
+ value="${option.value}"
152
140
  .checked=${option.selected}
153
141
  .disabled=${this.disabled}
154
- @click=${(e) => this.optionsChanged(e, option)}
155
- @keyup=${(e) => this.onRadioKeyUp(e, option)}
156
- @change=${(e) => this.onRadioChange(e)}>
142
+ @keydown=${(e) => this.onRadioKeyDown(e, option)}
143
+ @change=${(e) => this.optionsChanged(e, option)}>
157
144
  ${option.renderOption ? option.renderOption : option.label}${this.displayCount ? ` (${option.count})` : ""}
158
145
  </ft-radio>
159
146
  `;
160
147
  }
161
- onRadioKeyUp(e, option) {
162
- if (option.selected && e.key === " ") {
148
+ onRadioKeyDown(e, option) {
149
+ e.stopPropagation();
150
+ if (e.key === " " || e.key === "Enter") {
151
+ e.preventDefault();
163
152
  this.optionsChanged(e, option);
164
153
  }
165
154
  }
@@ -170,23 +159,6 @@ class FtFilterLevel extends FtLitElement {
170
159
  displayLevel(option) {
171
160
  this.dispatchEvent(new CustomEvent("display-level", { detail: option }));
172
161
  }
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
- }
190
162
  }
191
163
  FtFilterLevel.elementDefinitions = {
192
164
  "ft-button": FtButton,