@brightspace-ui/core 3.134.3 → 3.135.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.
@@ -5,10 +5,13 @@ import { css, html, LitElement } from 'lit';
5
5
  import { findFormElements, flattenMap, getFormElementData, isCustomFormElement, isNativeFormElement } from './form-helper.js';
6
6
  import { findComposedAncestor } from '../../helpers/dom.js';
7
7
  import { getComposedActiveElement } from '../../helpers/focus.js';
8
+ import { getFlag } from '../../helpers/flags.js';
8
9
  import { getUniqueId } from '../../helpers/uniqueId.js';
9
10
  import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
10
11
  import { localizeFormElement } from './form-element-localize-helper.js';
11
12
 
13
+ const formElementMixinWithNestedFormsParticipates = getFlag('form-element-mixin-nested-forms', true);
14
+
12
15
  /**
13
16
  * A component that can be used to build sections containing interactive controls that are validated and submitted as a group.
14
17
  * Values of these interactive controls are aggregated but the user is responsible for handling submission via the @d2l-form-submit event.
@@ -165,7 +168,13 @@ class Form extends LocalizeCoreElement(LitElement) {
165
168
  }
166
169
  }
167
170
  }
168
- } else {
171
+ } else if (!formElementMixinWithNestedFormsParticipates) {
172
+ const eleErrors = await this._validateFormElement(ele, true);
173
+ if (eleErrors.length > 0) {
174
+ errorMap.set(ele, eleErrors);
175
+ }
176
+ }
177
+ if (formElementMixinWithNestedFormsParticipates) {
169
178
  const eleErrors = await this._validateFormElement(ele, true);
170
179
  if (eleErrors.length > 0) {
171
180
  errorMap.set(ele, eleErrors);
@@ -354,13 +363,16 @@ class Form extends LocalizeCoreElement(LitElement) {
354
363
  }
355
364
 
356
365
  async _validateFormElement(ele, showNewErrors) {
366
+ const isCustom = isCustomFormElement(ele);
367
+ const isNative = isNativeFormElement(ele);
368
+ if (!isCustom && !isNative) return [];
357
369
  // if validation occurs before we've rendered,
358
370
  // localization may not have loaded yet
359
371
  await this._firstUpdatePromise;
360
372
  ele.id = ele.id || getUniqueId();
361
- if (isCustomFormElement(ele)) {
373
+ if (isCustom) {
362
374
  return ele.validate(showNewErrors);
363
- } else if (isNativeFormElement(ele)) {
375
+ } else if (isNative) {
364
376
  const customs = [...this._validationCustoms].filter(custom => custom.forElement === ele);
365
377
  const results = await Promise.all(customs.map(custom => custom.validate()));
366
378
  const errors = customs.map(custom => custom.failureText).filter((_, i) => !results[i]);
@@ -341,6 +341,7 @@ export const ListItemDragDropMixin = superclass => class extends superclass {
341
341
  :host([selected]) d2l-list-item-drag-handle,
342
342
  :host([current]) d2l-list-item-drag-handle,
343
343
  :host([_focusing-elem]) d2l-list-item-drag-handle,
344
+ :host([_list-item-new-styles][_focusing]) d2l-list-item-drag-handle,
344
345
  d2l-list-item-drag-handle:hover,
345
346
  d2l-list-item-drag-handle.d2l-hovering,
346
347
  d2l-list-item-drag-handle.d2l-focusing {
@@ -637,7 +637,10 @@ export const ListItemMixin = superclass => class extends composeMixins(
637
637
  return node.role === 'row' || node.role === 'listitem';
638
638
  }
639
639
 
640
- _onFocusIn() {
640
+ _onFocusIn(e) {
641
+ if (this._listItemNewStyles) {
642
+ e.stopPropagation(); // prevent _focusing from being set on the parent
643
+ }
641
644
  this._focusing = true;
642
645
  if (this.role !== 'row' || !tabPressed || hasDisplayedKeyboardTooltip) return;
643
646
  this._displayKeyboardTooltip = true;
@@ -1,7 +1,5 @@
1
1
  import '../colors/colors.js';
2
2
  import { css } from 'lit';
3
- import { findComposedAncestor } from '../../helpers/dom.js';
4
- import { getComposedActiveElement } from '../../helpers/focus.js';
5
3
  import { ListItemLinkMixin } from './list-item-link-mixin.js';
6
4
 
7
5
  export const ListItemNavMixin = superclass => class extends ListItemLinkMixin(superclass) {
@@ -119,15 +117,10 @@ export const ListItemNavMixin = superclass => class extends ListItemLinkMixin(su
119
117
  super._handleLinkClick(e);
120
118
  }
121
119
 
120
+ /* clean up (including _focusingElem) with GAUD-7495-list-item-new-styles flag */
122
121
  #handleFocusIn(e) {
123
122
  e.stopPropagation(); // prevent _focusing from being set on the parent
124
- requestAnimationFrame(() => {
125
- const activeElement = getComposedActiveElement();
126
- const parentListItem = findComposedAncestor(activeElement, (node) => node.role === 'row' || node.role === 'listitem');
127
- if (parentListItem && parentListItem === this) {
128
- this._focusingElem = true;
129
- }
130
- });
123
+ this._focusingElem = true;
131
124
  }
132
125
 
133
126
  #handleFocusOut() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.134.3",
3
+ "version": "3.135.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",