@brightspace-ui/core 3.174.0 → 3.174.2

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.
@@ -210,6 +210,14 @@ class InputText extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(La
210
210
  display: inline-block;
211
211
  vertical-align: bottom;
212
212
  }
213
+ :host(:not([skeleton])) .d2l-input-label {
214
+ margin: 0;
215
+ padding-block: 0 0.4rem;
216
+ padding-inline: 0;
217
+ }
218
+ :host(:not([skeleton]):not([input-width])) .d2l-input-label {
219
+ width: 100%;
220
+ }
213
221
  .d2l-input-container {
214
222
  display: flex;
215
223
  }
@@ -301,8 +309,6 @@ class InputText extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(La
301
309
 
302
310
  this._handleBlur = this._handleBlur.bind(this);
303
311
  this._handleFocus = this._handleFocus.bind(this);
304
- this._handleMouseEnter = this._handleMouseEnter.bind(this);
305
- this._handleMouseLeave = this._handleMouseLeave.bind(this);
306
312
  this._perfMonitor = new PerfMonitor(this);
307
313
  }
308
314
 
@@ -361,18 +367,12 @@ class InputText extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(La
361
367
  if (this.hasAttribute('aria-label')) {
362
368
  this.labelRequired = false;
363
369
  }
364
- this.addEventListener('mouseover', this._handleMouseEnter);
365
- this.addEventListener('mouseout', this._handleMouseLeave);
366
- this.addEventListener('click', this._handleClick);
367
370
  }
368
371
 
369
372
  disconnectedCallback() {
370
373
  super.disconnectedCallback();
371
374
  if (this._intersectionObserver) this._intersectionObserver.disconnect();
372
375
  const container = this.shadowRoot && this.shadowRoot.querySelector('.d2l-input-text-container');
373
- this.removeEventListener('mouseover', this._handleMouseEnter);
374
- this.removeEventListener('mouseout', this._handleMouseLeave);
375
- this.removeEventListener('click', this._handleClick);
376
376
  if (!container) return;
377
377
  container.removeEventListener('blur', this._handleBlur, true);
378
378
  container.removeEventListener('focus', this._handleFocus, true);
@@ -430,6 +430,9 @@ class InputText extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(La
430
430
  const inputContainerStyles = {
431
431
  maxWidth: this.inputWidth
432
432
  };
433
+ const labelStyles = {
434
+ minWidth: this.skeleton ? undefined : this.inputWidth
435
+ };
433
436
 
434
437
  const firstSlotName = (this.dir === 'rtl') ? 'right' : 'left';
435
438
  const lastSlotName = (this.dir === 'rtl') ? 'left' : 'right';
@@ -453,7 +456,10 @@ class InputText extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(La
453
456
 
454
457
  const input = html`
455
458
  <div class="d2l-input-container">
456
- <div class="d2l-input-text-container d2l-skeletize" style="${styleMap(inputContainerStyles)}">
459
+ <div class="d2l-input-text-container d2l-skeletize"
460
+ @mouseenter="${this._handleMouseEnter}"
461
+ @mouseleave="${this._handleMouseLeave}"
462
+ style="${styleMap(inputContainerStyles)}">
457
463
  <input
458
464
  aria-describedby="${ifDefined(ariaDescribedByIds.length > 0 ? ariaDescribedByIds : undefined)}"
459
465
  aria-haspopup="${ifDefined(this.ariaHaspopup)}"
@@ -496,7 +502,7 @@ class InputText extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(La
496
502
  let label = nothing;
497
503
  if (this.label && !this.labelHidden && !this.labelledBy) {
498
504
  const unitLabel = this._getUnitLabel();
499
- label = html`<label class="d2l-input-label d2l-skeletize" for="${this._inputId}">${this.label}${unitLabel ? html`<span class="d2l-offscreen">${unitLabel}</span>` : ''}</label>`;
505
+ label = html`<label class="d2l-input-label d2l-skeletize" for="${this._inputId}" style="${styleMap(labelStyles)}">${this.label}${unitLabel ? html`<span class="d2l-offscreen">${unitLabel}</span>` : ''}</label>`;
500
506
  }
501
507
 
502
508
  let tooltip = nothing;
@@ -587,12 +593,6 @@ class InputText extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(La
587
593
  ));
588
594
  }
589
595
 
590
- _handleClick(e) {
591
- const input = this.shadowRoot?.querySelector('.d2l-input');
592
- if (!input || e.composedPath()[0] !== this) return;
593
- input.focus();
594
- }
595
-
596
596
  _handleFocus() {
597
597
  this._focused = true;
598
598
  }
@@ -92,8 +92,7 @@ class InputTextArea extends InputInlineHelpMixin(FocusMixin(LabelledMixin(FormEl
92
92
  * Value of the input
93
93
  * @type {string}
94
94
  */
95
- value: { type: String },
96
- _hovered: { state: true }
95
+ value: { type: String }
97
96
  };
98
97
  }
99
98
 
@@ -109,6 +108,14 @@ class InputTextArea extends InputInlineHelpMixin(FocusMixin(LabelledMixin(FormEl
109
108
  display: inline-block;
110
109
  vertical-align: bottom;
111
110
  }
111
+ :host(:not([skeleton])) .d2l-input-label {
112
+ margin: 0;
113
+ padding-block: 0 0.4rem;
114
+ padding-inline: 0;
115
+ }
116
+ :host(:not([skeleton]):not([input-width])) .d2l-input-label {
117
+ width: 100%;
118
+ }
112
119
  .d2l-input-textarea-container {
113
120
  height: 100%;
114
121
  max-width: 100%;
@@ -159,7 +166,6 @@ class InputTextArea extends InputInlineHelpMixin(FocusMixin(LabelledMixin(FormEl
159
166
  this.value = '';
160
167
 
161
168
  this._descriptionId = getUniqueId();
162
- this._hovered = false;
163
169
  this._inlineHelpId = getUniqueId();
164
170
  this._textareaId = getUniqueId();
165
171
  }
@@ -196,16 +202,6 @@ class InputTextArea extends InputInlineHelpMixin(FocusMixin(LabelledMixin(FormEl
196
202
  if (this.hasAttribute('aria-label')) {
197
203
  this.labelRequired = false;
198
204
  }
199
- this.addEventListener('mouseover', this._handleMouseEnter);
200
- this.addEventListener('mouseout', this._handleMouseLeave);
201
- this.addEventListener('click', this._handleClick);
202
- }
203
-
204
- disconnectedCallback() {
205
- super.disconnectedCallback();
206
- this.removeEventListener('mouseover', this._handleMouseEnter);
207
- this.removeEventListener('mouseout', this._handleMouseLeave);
208
- this.removeEventListener('click', this._handleClick);
209
205
  }
210
206
 
211
207
  render() {
@@ -227,12 +223,14 @@ class InputTextArea extends InputInlineHelpMixin(FocusMixin(LabelledMixin(FormEl
227
223
  if (this.maxRows > 0) mirrorStyles.maxHeight = `calc(${this.maxRows + 1}rem + 2px)`;
228
224
 
229
225
  const inputClasses = {
230
- 'd2l-input': true,
231
- 'd2l-input-focus': !this.disabled && this._hovered
226
+ 'd2l-input': true
232
227
  };
233
228
  const inputContainerStyles = {
234
229
  maxWidth: this.inputWidth
235
230
  };
231
+ const labelStyles = {
232
+ minWidth: this.skeleton ? undefined : this.inputWidth
233
+ };
236
234
 
237
235
  const textarea = html`
238
236
  <div class="d2l-input-textarea-container d2l-skeletize" style="${styleMap(inputContainerStyles)}">
@@ -264,7 +262,7 @@ class InputTextArea extends InputInlineHelpMixin(FocusMixin(LabelledMixin(FormEl
264
262
 
265
263
  if (this.label && !this.labelHidden && !this.labelledBy) {
266
264
  return html`
267
- <label class="d2l-input-label d2l-skeletize" for="${this._textareaId}">${this.label}</label>
265
+ <label class="d2l-input-label d2l-skeletize" for="${this._textareaId}" style="${styleMap(labelStyles)}">${this.label}</label>
268
266
  ${textarea}`;
269
267
  }
270
268
 
@@ -332,12 +330,6 @@ class InputTextArea extends InputInlineHelpMixin(FocusMixin(LabelledMixin(FormEl
332
330
  ));
333
331
  }
334
332
 
335
- _handleClick(e) {
336
- const input = this.shadowRoot && this.shadowRoot.querySelector('textarea');
337
- if (!input || e.composedPath()[0] !== this) return;
338
- input.focus();
339
- }
340
-
341
333
  _handleInput(e) {
342
334
  this.value = e.target.value;
343
335
  return true;
@@ -347,14 +339,6 @@ class InputTextArea extends InputInlineHelpMixin(FocusMixin(LabelledMixin(FormEl
347
339
  e.preventDefault();
348
340
  }
349
341
 
350
- _handleMouseEnter() {
351
- this._hovered = true;
352
- }
353
-
354
- _handleMouseLeave() {
355
- this._hovered = false;
356
- }
357
-
358
342
  }
359
343
 
360
344
  customElements.define('d2l-input-textarea', InputTextArea);
package/helpers/flags.js CHANGED
@@ -34,6 +34,8 @@ let dispatchingKnownFlags = false;
34
34
  function addKnownFlag(key, value, defaultValue) {
35
35
  if (!knownFlags.has(key)) knownFlags.set(key, { value, defaultValue });
36
36
 
37
+ if (globalThis.document?.dispatchEvent === undefined) return;
38
+
37
39
  if (dispatchingKnownFlags) return;
38
40
  dispatchingKnownFlags = true;
39
41
  setTimeout(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.174.0",
3
+ "version": "3.174.2",
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",