@brightspace-ui/core 2.118.10 → 2.119.0

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.
@@ -8,7 +8,8 @@ import { inputStyles } from './input-styles.js';
8
8
  import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
9
9
  import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
10
10
 
11
- const INPUT_TIMEOUT_MS = 400;
11
+ export const INPUT_TIMEOUT_MS = 400;
12
+ export const SUPPRESS_ENTER_TIMEOUT_MS = 1000;
12
13
 
13
14
  /**
14
15
  * This component wraps the native "<input type="search">"" element and is for text searching.
@@ -90,6 +91,7 @@ class InputSearch extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement)))
90
91
  super();
91
92
  this._inputTimeout = undefined;
92
93
  this._lastSearchValue = '';
94
+ this._suppressEnter = false;
93
95
  this.disabled = false;
94
96
  this.noClear = false;
95
97
  this.searchOnInput = false;
@@ -194,14 +196,19 @@ class InputSearch extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement)))
194
196
  return;
195
197
  }
196
198
  e.preventDefault();
197
- this._setLastSearchValue(this.value);
198
- this._dispatchEvent();
199
+ const hasChanged = this._setLastSearchValue(this.value);
200
+ if (!this._suppressEnter || hasChanged) {
201
+ this._suppressEnter = true;
202
+ setTimeout(() => this._suppressEnter = false, SUPPRESS_ENTER_TIMEOUT_MS);
203
+ this._dispatchEvent();
204
+ }
199
205
  }
200
206
 
201
207
  _setLastSearchValue(val) {
202
208
  const oldVal = this._lastSearchValue;
203
209
  this._lastSearchValue = val;
204
210
  this.requestUpdate('lastSearchValue', oldVal);
211
+ return (oldVal !== val);
205
212
  }
206
213
 
207
214
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.118.10",
3
+ "version": "2.119.0",
4
4
  "description": "A collection of accessible, free, open-source web components for building Brightspace applications",
5
5
  "type": "module",
6
6
  "repository": "https://github.com/BrightspaceUI/core.git",