@brightspace-ui/core 3.137.3 → 3.137.4

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,11 +1,9 @@
1
1
  import '../colors/colors.js';
2
2
  import { css, html, LitElement, nothing } from 'lit';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
- import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
5
4
  import { ifDefined } from 'lit/directives/if-defined.js';
6
5
  import { offscreenStyles } from '../offscreen/offscreen.js';
7
6
  import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
8
- import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
9
7
  import { styleMap } from 'lit/directives/style-map.js';
10
8
 
11
9
  /**
@@ -16,7 +14,7 @@ import { styleMap } from 'lit/directives/style-map.js';
16
14
  * @slot footer - Slot for footer content, such secondary actions
17
15
  * @slot header - Slot for header content, such as course image (no actionable elements)
18
16
  */
19
- class Card extends FocusMixin(RtlMixin(LitElement)) {
17
+ class Card extends LitElement {
20
18
 
21
19
  static get properties() {
22
20
  return {
@@ -142,22 +140,14 @@ class Card extends FocusMixin(RtlMixin(LitElement)) {
142
140
  padding-bottom: 1.2rem;
143
141
  }
144
142
  .d2l-card-actions {
143
+ inset-inline-end: 0.6rem;
145
144
  position: absolute;
146
- right: 0.6rem;
147
145
  top: 0.6rem;
148
146
  /* this must be higher than footer z-index so dropdowns will be on top */
149
147
  z-index: 3;
150
148
  }
151
- :host([dir="rtl"]) .d2l-card-actions {
152
- left: 0.6rem;
153
- right: auto;
154
- }
155
149
  .d2l-card-actions ::slotted(*) {
156
- margin-left: 0.3rem;
157
- }
158
- :host([dir="rtl"]) .d2l-card-actions ::slotted(*) {
159
- margin-left: 0;
160
- margin-right: 0.3rem;
150
+ margin-inline-start: 0.3rem;
161
151
  }
162
152
  .d2l-card-badge {
163
153
  line-height: 0;
@@ -237,6 +227,7 @@ class Card extends FocusMixin(RtlMixin(LitElement)) {
237
227
  this.subtle = false;
238
228
  this._active = false;
239
229
  this._dropdownActionOpen = false;
230
+ this._focusOnFirstRender = false;
240
231
  this._footerHidden = true;
241
232
  this._hover = false;
242
233
  this._tooltipShowing = false;
@@ -244,16 +235,17 @@ class Card extends FocusMixin(RtlMixin(LitElement)) {
244
235
  this._onFooterResize = this._onFooterResize.bind(this);
245
236
  }
246
237
 
247
- static get focusElementSelector() {
248
- return 'a';
249
- }
250
-
251
238
  firstUpdated(changedProperties) {
252
239
  super.firstUpdated(changedProperties);
253
240
  const badgeObserver = new ResizeObserver(this._onBadgeResize);
254
241
  badgeObserver.observe(this.shadowRoot.querySelector('.d2l-card-badge'));
255
242
  const footerObserver = new ResizeObserver(this._onFooterResize);
256
243
  footerObserver.observe(this.shadowRoot.querySelector('.d2l-card-footer'));
244
+
245
+ if (this._focusOnFirstRender) {
246
+ this._focusOnFirstRender = false;
247
+ this.focus();
248
+ }
257
249
  }
258
250
 
259
251
  render() {
@@ -308,6 +300,17 @@ class Card extends FocusMixin(RtlMixin(LitElement)) {
308
300
  `;
309
301
  }
310
302
 
303
+ focus() {
304
+ if (!this.hasUpdated) {
305
+ this._focusOnFirstRender = true;
306
+ return;
307
+ }
308
+
309
+ const elem = this.shadowRoot.querySelector('a[href]');
310
+ if (elem) elem.focus();
311
+ else super.focus();
312
+ }
313
+
311
314
  _onBadgeResize(entries) {
312
315
  if (!entries || entries.length === 0) return;
313
316
  const entry = entries[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.137.3",
3
+ "version": "3.137.4",
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",