@brightspace-ui/core 2.95.0 → 2.96.0

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.
@@ -2,6 +2,7 @@ import '../colors/colors.js';
2
2
  import '../count-badge/count-badge-icon.js';
3
3
  import '../icons/icon.js';
4
4
  import { css, html, LitElement } from 'lit';
5
+ import { FocusMixin } from '../../mixins/focus-mixin.js';
5
6
  import { ifDefined } from 'lit/directives/if-defined.js';
6
7
  import { offscreenStyles } from '../offscreen/offscreen.js';
7
8
  import { RtlMixin } from '../../mixins/rtl-mixin.js';
@@ -10,7 +11,7 @@ import { RtlMixin } from '../../mixins/rtl-mixin.js';
10
11
  * An icon link that can be placed in the `footer` slot.
11
12
  * @slot tooltip - slot for the link tooltip
12
13
  */
13
- class CardFooterLink extends RtlMixin(LitElement) {
14
+ class CardFooterLink extends FocusMixin(RtlMixin(LitElement)) {
14
15
 
15
16
  static get properties() {
16
17
  return {
@@ -100,6 +101,10 @@ class CardFooterLink extends RtlMixin(LitElement) {
100
101
  this.secondaryCountType = 'notification';
101
102
  }
102
103
 
104
+ static get focusElementSelector() {
105
+ return 'a';
106
+ }
107
+
103
108
  render() {
104
109
  const noNumber = this.secondaryCount === undefined;
105
110
  return html`
@@ -4,6 +4,7 @@ import '../expand-collapse/expand-collapse-content.js';
4
4
  import { css, html, LitElement } from 'lit';
5
5
  import { heading1Styles, heading2Styles, heading3Styles, heading4Styles } from '../typography/styles.js';
6
6
  import { classMap } from 'lit/directives/class-map.js';
7
+ import { FocusMixin } from '../../mixins/focus-mixin.js';
7
8
  import { offscreenStyles } from '../offscreen/offscreen.js';
8
9
  import { RtlMixin } from '../../mixins/rtl-mixin.js';
9
10
 
@@ -25,7 +26,7 @@ const defaultHeading = 3;
25
26
  * @fires d2l-collapsible-panel-expand - Dispatched when the panel is expanded
26
27
  * @fires d2l-collapsible-panel-collapse - Dispatched when the panel is collapsed
27
28
  */
28
- class CollapsiblePanel extends RtlMixin(LitElement) {
29
+ class CollapsiblePanel extends FocusMixin(RtlMixin(LitElement)) {
29
30
 
30
31
  static get properties() {
31
32
  return {
@@ -271,6 +272,10 @@ class CollapsiblePanel extends RtlMixin(LitElement) {
271
272
  this._scrolled = false;
272
273
  }
273
274
 
275
+ static get focusElementSelector() {
276
+ return 'button.d2l-offscreen';
277
+ }
278
+
274
279
  disconnectedCallback() {
275
280
  super.disconnectedCallback();
276
281
  if (this._intersectionObserver) this._intersectionObserver.disconnect();
@@ -2,11 +2,12 @@ import '../colors/colors.js';
2
2
  import '../icons/icon.js';
3
3
  import { css, html, LitElement, unsafeCSS } from 'lit';
4
4
  import { CountBadgeMixin } from './count-badge-mixin.js';
5
+ import { FocusMixin } from '../../mixins/focus-mixin.js';
5
6
  import { getFocusPseudoClass } from '../../helpers/focus.js';
6
7
  import { getUniqueId } from '../../helpers/uniqueId.js';
7
8
  import { ifDefined } from 'lit/directives/if-defined.js';
8
9
 
9
- class CountBadgeIcon extends CountBadgeMixin(LitElement) {
10
+ class CountBadgeIcon extends FocusMixin(CountBadgeMixin(LitElement)) {
10
11
 
11
12
  static get properties() {
12
13
  return {
@@ -78,6 +79,10 @@ class CountBadgeIcon extends CountBadgeMixin(LitElement) {
78
79
  this._badgeId = getUniqueId();
79
80
  }
80
81
 
82
+ static get focusElementSelector() {
83
+ return 'd2l-icon';
84
+ }
85
+
81
86
  render() {
82
87
  let numberStyles = {
83
88
  border: '2px solid white',
@@ -1,11 +1,12 @@
1
1
  import '../colors/colors.js';
2
2
  import { css, html, LitElement, unsafeCSS } from 'lit';
3
3
  import { CountBadgeMixin } from './count-badge-mixin.js';
4
+ import { FocusMixin } from '../../mixins/focus-mixin.js';
4
5
  import { getFocusPseudoClass } from '../../helpers/focus.js';
5
6
  import { getUniqueId } from '../../helpers/uniqueId.js';
6
7
  import { ifDefined } from 'lit/directives/if-defined.js';
7
8
 
8
- class CountBadge extends CountBadgeMixin(LitElement) {
9
+ class CountBadge extends FocusMixin(CountBadgeMixin(LitElement)) {
9
10
 
10
11
  static get styles() {
11
12
  return [super.styles, css`
@@ -38,6 +39,10 @@ class CountBadge extends CountBadgeMixin(LitElement) {
38
39
  this._badgeId = getUniqueId();
39
40
  }
40
41
 
42
+ static get focusElementSelector() {
43
+ return '.d2l-count-badge-wrapper';
44
+ }
45
+
41
46
  render() {
42
47
  const tabbable = (this.tabStop || this.hasTooltip) && !(this.hideZero && this.number === 0) && !this.skeleton;
43
48
  const innerHtml = html`
@@ -1,10 +1,5 @@
1
1
  import { html, LitElement } from 'lit';
2
2
 
3
- export const EmptyStateType = {
4
- Search: 'search',
5
- Set: 'set'
6
- };
7
-
8
3
  /**
9
4
  * A component to represent the main filter dimension type - a set of possible values that can be selected.
10
5
  * This component does not render anything, but instead gathers data needed for the d2l-filter.
@@ -104,11 +99,11 @@ class FilterDimensionSet extends LitElement {
104
99
  }
105
100
 
106
101
  getSearchEmptyState() {
107
- return this._getEmptyState(this._searchEmptyStateSlot);
102
+ return this._getEmptyState(this._searchEmptyStateSlot, 'search');
108
103
  }
109
104
 
110
105
  getSetEmptyState() {
111
- return this._getEmptyState(this._setEmptyStateSlot);
106
+ return this._getEmptyState(this._setEmptyStateSlot, 'set');
112
107
  }
113
108
 
114
109
  getValues() {
@@ -134,7 +129,7 @@ class FilterDimensionSet extends LitElement {
134
129
  }));
135
130
  }
136
131
 
137
- _getEmptyState(emptyStateSlot) {
132
+ _getEmptyState(emptyStateSlot, emptyStateType) {
138
133
  if (!emptyStateSlot) return null;
139
134
  const nodes = emptyStateSlot.assignedNodes({ flatten: true });
140
135
  const emptyState = nodes.find((node) => node.nodeType === Node.ELEMENT_NODE && node.tagName.toLowerCase() === 'd2l-filter-dimension-set-empty-state');
@@ -142,7 +137,8 @@ class FilterDimensionSet extends LitElement {
142
137
  return {
143
138
  actionHref: emptyState.actionHref,
144
139
  actionText: emptyState.actionText,
145
- description: emptyState.description
140
+ description: emptyState.description,
141
+ type: emptyStateType
146
142
  };
147
143
  }
148
144
 
@@ -22,7 +22,6 @@ import { bodyCompactStyles, bodySmallStyles, bodyStandardStyles } from '../typog
22
22
  import { css, html, LitElement, nothing } from 'lit';
23
23
  import { announce } from '../../helpers/announce.js';
24
24
  import { classMap } from 'lit/directives/class-map.js';
25
- import { EmptyStateType } from './filter-dimension-set.js';
26
25
  import { FocusMixin } from '../../mixins/focus-mixin.js';
27
26
  import { formatNumber } from '@brightspace-ui/intl/lib/number.js';
28
27
  import { ifDefined } from 'lit/directives/if-defined.js';
@@ -415,7 +414,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
415
414
  `;
416
415
  }
417
416
 
418
- _createEmptyState(emptyState, dimensionKey, type) {
417
+ _createEmptyState(emptyState, dimensionKey) {
419
418
  let emptyStateAction = nothing;
420
419
  if (emptyState.actionText && emptyState.actionHref) {
421
420
  emptyStateAction = html`
@@ -430,7 +429,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
430
429
  <d2l-empty-state-action-button
431
430
  @d2l-empty-state-action="${this._handleEmptyStateAction}"
432
431
  data-dimension-key="${dimensionKey}"
433
- data-type="${type}"
432
+ data-type="${emptyState.type}"
434
433
  text="${emptyState.actionText}">
435
434
  </d2l-empty-state-action-button>
436
435
  `;
@@ -454,7 +453,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
454
453
 
455
454
  if (this._isDimensionEmpty(dimension)) {
456
455
  const emptyState = dimension.setEmptyState
457
- ? this._createEmptyState(dimension.setEmptyState, dimension.key, EmptyStateType.Set)
456
+ ? this._createEmptyState(dimension.setEmptyState, dimension.key)
458
457
  : html`
459
458
  <d2l-empty-state-simple
460
459
  class="d2l-filter-dimension-info-message"
@@ -476,7 +475,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
476
475
  'd2l-offscreen': count !== 0
477
476
  };
478
477
  const emptyState = dimension.searchEmptyState && count === 0
479
- ? this._createEmptyState(dimension.searchEmptyState, dimension.key, EmptyStateType.Search)
478
+ ? this._createEmptyState(dimension.searchEmptyState, dimension.key)
480
479
  : html`
481
480
  <d2l-empty-state-simple
482
481
  class="d2l-filter-dimension-info-message"
@@ -12,13 +12,14 @@ Apply the mixin and set the static `focusElementSelector` to a CSS query selecto
12
12
  import { FocusMixin } from '@brightspace-ui/core/mixins/focus-mixin.js';
13
13
 
14
14
  class MyComponent extends FocusMixin(LitElement) {
15
-
15
+
16
16
  // delegate focus to the underlying input
17
17
  static get focusElementSelector() {
18
- return 'input';
18
+ return 'input';
19
+ }
19
20
 
20
21
  render() {
21
- return html`<input type="text">`;
22
+ return html`<input type="text">`;
22
23
  }
23
24
 
24
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.95.0",
3
+ "version": "2.96.0",
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",