@brightspace-ui/core 3.176.5 → 3.176.7

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.
@@ -0,0 +1,37 @@
1
+ import '../../colors/colors.js';
2
+ import '../../button/button-subtle.js';
3
+ import { css, html, LitElement } from 'lit';
4
+ import { HierarchicalViewMixin } from '../../hierarchical-view/hierarchical-view-mixin.js';
5
+ import { LocalizeCoreElement } from '../../../helpers/localize-core-element.js';
6
+
7
+ class DemoView extends LocalizeCoreElement(HierarchicalViewMixin(LitElement)) {
8
+
9
+ static get styles() {
10
+ return [ super.styles,
11
+ css`
12
+ :host {
13
+ box-sizing: border-box;
14
+ color: var(--d2l-color-ferrite);
15
+ cursor: default;
16
+ }
17
+ .d2l-hierarchical-view-content {
18
+ padding: 12px;
19
+ }
20
+ `
21
+ ];
22
+ }
23
+
24
+ render() {
25
+ return html`
26
+ <div class="d2l-hierarchical-view-content">
27
+ <div>Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters.</div>
28
+ <div>
29
+ <d2l-button-subtle text="${this.localize('components.pager-load-more.action')}"></d2l-button-subtle>
30
+ </div>
31
+ </div>
32
+ `;
33
+ }
34
+
35
+ }
36
+
37
+ customElements.define('d2l-dropdown-menu-demo-view', DemoView);
@@ -13,6 +13,7 @@
13
13
  import '../../menu/menu-item-radio.js';
14
14
  import '../dropdown.js';
15
15
  import '../dropdown-menu.js';
16
+ import './dropdown-menu-demo-view.js';
16
17
  </script>
17
18
  </head>
18
19
 
@@ -201,6 +202,24 @@
201
202
  </template>
202
203
  </d2l-demo-snippet>
203
204
 
205
+ <h2>Custom View</h2>
206
+ <d2l-demo-snippet>
207
+ <template>
208
+ <d2l-dropdown>
209
+ <button class="d2l-dropdown-opener">Open it!</button>
210
+ <d2l-dropdown-menu>
211
+ <d2l-menu label="Astronomy">
212
+ <d2l-menu-item text="Introduction"></d2l-menu-item>
213
+ <d2l-menu-item text="Searching for the Heavens">
214
+ <d2l-dropdown-menu-demo-view></d2l-dropdown-menu-demo-view>
215
+ </d2l-menu-item>
216
+ <d2l-menu-item text="The Solar System"></d2l-menu-item>
217
+ </d2l-menu>
218
+ </d2l-dropdown-menu>
219
+ </d2l-dropdown>
220
+ </template>
221
+ </d2l-demo-snippet>
222
+
204
223
  </d2l-demo-page>
205
224
 
206
225
  </body>
@@ -351,7 +351,9 @@ export const DropdownPopoverMixin = superclass => class extends LocalizeCoreElem
351
351
  this._hasHeaderSlotContent = e.target.assignedNodes().length !== 0;
352
352
  }
353
353
 
354
- #handlePopoverClose() {
354
+ #handlePopoverClose(e) {
355
+ // ignore popover close events from nested popovers
356
+ if (e.target !== this) return;
355
357
  setTimeout(() => {
356
358
  this.opened = false;
357
359
 
@@ -365,7 +367,9 @@ export const DropdownPopoverMixin = superclass => class extends LocalizeCoreElem
365
367
  this.dispatchEvent(new CustomEvent('d2l-dropdown-focus-enter', { detail:{ applyFocus: e.detail.applyFocus } }));
366
368
  }
367
369
 
368
- #handlePopoverOpen() {
370
+ #handlePopoverOpen(e) {
371
+ // ignore popover open events from nested popovers
372
+ if (e.target !== this) return;
369
373
  this.opened = true;
370
374
 
371
375
  if (!this.noAutoFit && this.#contentElement) {
@@ -1,12 +1,15 @@
1
1
  import { findComposedAncestor, getComposedParent, isComposedAncestor } from '../../helpers/dom.js';
2
2
  import { getNextFocusable, getPreviousFocusable } from '../../helpers/focus.js';
3
3
  import { css } from 'lit';
4
+ import { getFlag } from '../../helpers/flags.js';
4
5
  import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
5
6
 
6
7
  const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;
7
8
  const __nativeFocus = document.createElement('div').focus;
8
9
  const escapeKeyCode = 27;
9
10
 
11
+ const useResizeFix = getFlag('GAUD-8969-hierarchical-view-resize', true);
12
+
10
13
  export const HierarchicalViewMixin = superclass => class extends superclass {
11
14
 
12
15
  static get properties() {
@@ -523,7 +526,13 @@ export const HierarchicalViewMixin = superclass => class extends superclass {
523
526
  }
524
527
 
525
528
  if (e.detail.isSource && this.__getParentViewFromEvent(e) === this) {
526
- e.detail.sourceView.__dispatchViewResize();
529
+ if (useResizeFix) {
530
+ requestAnimationFrame(() => {
531
+ e.detail.sourceView.__dispatchViewResize();
532
+ });
533
+ } else {
534
+ e.detail.sourceView.__dispatchViewResize();
535
+ }
527
536
  }
528
537
 
529
538
  }
@@ -2679,6 +2679,10 @@
2679
2679
  }
2680
2680
  ]
2681
2681
  },
2682
+ {
2683
+ "name": "d2l-dropdown-menu-demo-view",
2684
+ "path": "./components/dropdown/demo/dropdown-menu-demo-view.js"
2685
+ },
2682
2686
  {
2683
2687
  "name": "d2l-dropdown-button-subtle",
2684
2688
  "path": "./components/dropdown/dropdown-button-subtle.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.176.5",
3
+ "version": "3.176.7",
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",