@brightspace-ui/core 2.118.10 → 2.119.1

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
  }
@@ -90,10 +90,11 @@ export const OverflowGroupMixin = superclass => class extends LocalizeCoreElemen
90
90
 
91
91
  this._handleItemMutation = this._handleItemMutation.bind(this);
92
92
  this._handleResize = this._handleResize.bind(this);
93
+ this._itemObserver = new MutationObserver(this._handleItemMutation);
93
94
  this._resizeObserver = new ResizeObserver((entries) => requestAnimationFrame(() => this._handleResize(entries)));
94
95
 
95
96
  this._hasResized = false;
96
- this._isObserving = false;
97
+ this._isObservingResize = false;
97
98
  this._itemHeight = 0;
98
99
  this._mini = this.openerType === OPENER_TYPE.ICON;
99
100
  this._overflowContainerHidden = false;
@@ -109,8 +110,8 @@ export const OverflowGroupMixin = superclass => class extends LocalizeCoreElemen
109
110
  disconnectedCallback() {
110
111
  super.disconnectedCallback();
111
112
 
112
- if (this._isObserving) {
113
- this._isObserving = false;
113
+ if (this._isObservingResize) {
114
+ this._isObservingResize = false;
114
115
  this._resizeObserver.disconnect();
115
116
  }
116
117
  }
@@ -147,8 +148,8 @@ export const OverflowGroupMixin = superclass => class extends LocalizeCoreElemen
147
148
  update(changedProperties) {
148
149
  super.update(changedProperties);
149
150
 
150
- if (!this._isObserving) {
151
- this._isObserving = true;
151
+ if (!this._isObservingResize) {
152
+ this._isObservingResize = true;
152
153
  this._resizeObserver.observe(this.shadowRoot.querySelector('.d2l-overflow-group-container'));
153
154
  }
154
155
 
@@ -370,8 +371,7 @@ export const OverflowGroupMixin = superclass => class extends LocalizeCoreElemen
370
371
  await this._getItems();
371
372
 
372
373
  this._slotItems.forEach(item => {
373
- const observer = new MutationObserver(this._handleItemMutation);
374
- observer.observe(item, {
374
+ this._itemObserver.observe(item, {
375
375
  attributes: true, /* required for legacy-Edge, otherwise attributeFilter throws a syntax error */
376
376
  attributeFilter: ['disabled', 'text', 'selected'],
377
377
  childList: false,
@@ -387,4 +387,5 @@ export const OverflowGroupMixin = superclass => class extends LocalizeCoreElemen
387
387
  this.requestUpdate();
388
388
  });
389
389
  }
390
+
390
391
  };
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.1",
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",