@brightspace-ui/core 1.214.0 → 1.215.3

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.
@@ -1,6 +1,4 @@
1
-
2
- import { FocusVisiblePolyfillMixin } from '../../mixins/focus-visible-polyfill-mixin.js';
3
- export const MenuItemMixin = superclass => class extends FocusVisiblePolyfillMixin(superclass) {
1
+ export const MenuItemMixin = superclass => class extends superclass {
4
2
 
5
3
  static get properties() {
6
4
  return {
@@ -17,8 +17,8 @@ export const menuItemStyles = css`
17
17
  }
18
18
 
19
19
  :host(:hover),
20
- :host(.focus-visible),
21
- :host(.focus-visible[first]),
20
+ :host(:focus-visible),
21
+ :host(:focus-visible[first]),
22
22
  :host([first]:hover) {
23
23
  background-color: var(--d2l-menu-background-color-hover);
24
24
  border-bottom: 1px solid var(--d2l-menu-border-color-hover);
@@ -27,7 +27,7 @@ export const menuItemStyles = css`
27
27
  z-index: 2;
28
28
  }
29
29
 
30
- :host([disabled]), :host([disabled]:hover), :host([disabled].focus-visible) {
30
+ :host([disabled]), :host([disabled]:hover), :host([disabled]:focus-visible) {
31
31
  cursor: default;
32
32
  opacity: 0.75;
33
33
  }
@@ -40,7 +40,7 @@ export const menuItemStyles = css`
40
40
  border-top-color: transparent;
41
41
  }
42
42
 
43
- :host([last].focus-visible),
43
+ :host([last]:focus-visible),
44
44
  :host([last]:hover) {
45
45
  border-bottom-color: var(--d2l-menu-border-color-hover);
46
46
  }
@@ -2,7 +2,6 @@ import '../colors/colors.js';
2
2
  import '../icons/icon.js';
3
3
  import './menu-item-return.js';
4
4
  import { css, html, LitElement } from 'lit-element/lit-element.js';
5
- import { FocusVisiblePolyfillMixin } from '../../mixins/focus-visible-polyfill-mixin.js';
6
5
  import { HierarchicalViewMixin } from '../hierarchical-view/hierarchical-view-mixin.js';
7
6
  import { ThemeMixin } from '../../mixins/theme-mixin.js';
8
7
 
@@ -21,7 +20,7 @@ const keyCodes = {
21
20
  * @slot - Menu items
22
21
  * @fires d2l-menu-resize - Dispatched when size of menu changes (e.g., when nested menu of a different size is opened)
23
22
  */
24
- class Menu extends ThemeMixin(HierarchicalViewMixin(FocusVisiblePolyfillMixin(LitElement))) {
23
+ class Menu extends ThemeMixin(HierarchicalViewMixin(LitElement)) {
25
24
 
26
25
  static get properties() {
27
26
  return {
@@ -1,6 +1,8 @@
1
- import { directive, PropertyPart } from 'lit-html';
1
+ import { directive, PartType } from 'lit-html/directive.js';
2
2
  import { getComposedActiveElement, getNextFocusable } from '../../helpers/focus.js';
3
+ import { AsyncDirective } from 'lit-html/async-directive.js';
3
4
  import { isComposedAncestor } from '../../helpers/dom.js';
5
+ import { noChange } from 'lit-html';
4
6
 
5
7
  const stateMap = new WeakMap();
6
8
  const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;
@@ -10,15 +12,13 @@ const moveYValue = 20;
10
12
 
11
13
  class AnimationState {
12
14
 
13
- constructor(propertyPart) {
14
-
15
- if (!(propertyPart instanceof PropertyPart) || propertyPart.committer.name !== 'animate') {
16
- throw new Error('animation directives must be used with "animate" property');
15
+ constructor(partInfo) {
16
+ if (!(partInfo.type === PartType.PROPERTY) || partInfo.name !== 'animate') {
17
+ throw new Error('animate directives must be used with "animate" property');
17
18
  }
18
-
19
19
  this.id = 0;
20
20
  this.clone = null;
21
- this.elem = propertyPart.committer.element;
21
+ this.elem = partInfo.element;
22
22
  this.state = 'unknown';
23
23
  this.styleAttr = null;
24
24
  this.styleAttrUse = false;
@@ -289,20 +289,37 @@ class AnimationState {
289
289
 
290
290
  }
291
291
 
292
- async function helper(part, action, opts) {
293
- let state = stateMap.get(part);
294
- if (state === undefined) {
295
- state = new AnimationState(part);
296
- stateMap.set(part, state);
292
+ class Hide extends AsyncDirective {
293
+ render() {
294
+ return noChange;
297
295
  }
298
- opts = opts || {};
299
- if (action === 'show') {
300
- state.show(opts);
301
- } else if (action === 'hide') {
296
+ update(part, [opts]) {
297
+ opts = opts || {};
298
+ let state = stateMap.get(part.element);
299
+ if (state === undefined) {
300
+ state = new AnimationState(part);
301
+ stateMap.set(part.element, state);
302
+ }
302
303
  state.hide(opts);
304
+ return this.render();
303
305
  }
304
306
  }
305
307
 
306
- export const hide = directive((opts) => async(part) => helper(part, 'hide', opts));
308
+ class Show extends AsyncDirective {
309
+ render() {
310
+ return noChange;
311
+ }
312
+ update(part, [opts]) {
313
+ opts = opts || {};
314
+ let state = stateMap.get(part.element);
315
+ if (state === undefined) {
316
+ state = new AnimationState(part);
317
+ stateMap.set(part.element, state);
318
+ }
319
+ state.show(opts);
320
+ return this.render();
321
+ }
322
+ }
307
323
 
308
- export const show = directive((opts) => async(part) => helper(part, 'show', opts));
324
+ export const hide = directive(Hide);
325
+ export const show = directive(Show);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "1.214.0",
3
+ "version": "1.215.3",
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",