@brightspace-ui/core 3.148.7 → 3.148.9

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,11 @@
1
1
  import '../colors/colors.js';
2
2
  import '../icons/icon.js';
3
3
  import { css, html, LitElement, nothing } from 'lit';
4
+ import { getOverflowDeclarations, overflowEllipsisDeclarations } from '../../helpers/overflow.js';
4
5
  import { classMap } from 'lit/directives/class-map.js';
5
6
  import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
6
7
  import { getFlag } from '../../helpers/flags.js';
7
8
  import { getFocusRingStyles } from '../../helpers/focus.js';
8
- import { getOverflowDeclarations } from '../../helpers/overflow.js';
9
9
  import { ifDefined } from 'lit/directives/if-defined.js';
10
10
  import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
11
11
  import { offscreenStyles } from '../offscreen/offscreen.js';
@@ -112,7 +112,11 @@ class Link extends LocalizeCoreElement(FocusMixin(LitElement)) {
112
112
  a {
113
113
  display: inherit;
114
114
  }
115
- a.truncate {
115
+ :host([lines]) a {
116
+ align-items: baseline;
117
+ display: flex;
118
+ }
119
+ a span.truncate {
116
120
  ${overflowClipEnabled ? getOverflowDeclarations({ lines: 1 }) : css`
117
121
  -webkit-box-orient: vertical;
118
122
  display: -webkit-box;
@@ -120,12 +124,20 @@ class Link extends LocalizeCoreElement(FocusMixin(LitElement)) {
120
124
  overflow-wrap: anywhere;
121
125
  `}
122
126
  }
127
+ a span.truncate-one {
128
+ ${overflowEllipsisDeclarations}
129
+ }
130
+ #new-window {
131
+ line-height: 0;
132
+ white-space: nowrap;
133
+ }
123
134
  d2l-icon {
124
135
  color: var(--d2l-color-celestine);
125
- height: 0.95em;
136
+ height: calc(1em - 1px);
126
137
  margin-inline-start: 0.315em;
138
+ transform: translateY(0.1em);
127
139
  vertical-align: inherit;
128
- width: 0.95em;
140
+ width: calc(1em - 1px);
129
141
  }
130
142
 
131
143
  a:hover d2l-icon {
@@ -157,22 +169,31 @@ class Link extends LocalizeCoreElement(FocusMixin(LitElement)) {
157
169
  const linkClasses = {
158
170
  'd2l-link': true,
159
171
  'd2l-link-main': this.main,
160
- 'd2l-link-small': this.small,
161
- 'truncate': this.lines > 0
172
+ 'd2l-link-small': this.small
173
+ };
174
+ const spanClasses = {
175
+ 'truncate': this.lines > 1,
176
+ 'truncate-one': this.lines === 1
162
177
  };
163
178
  const styles = { webkitLineClamp: this.lines || null };
164
179
  const newWindowElements = (this.target === '_blank')
165
- ? html`<span style="white-space: nowrap; line-height: 0;"><span style="font-size: 0;">&nbsp;</span><d2l-icon icon="tier1:new-window"></d2l-icon></span><span class="d2l-offscreen">${this.localize('components.link.open-in-new-window')}</span>`
180
+ ? html`<span id="new-window"><span style="font-size: 0;">&nbsp;</span><d2l-icon icon="tier1:new-window"></d2l-icon></span><span class="d2l-offscreen">${this.localize('components.link.open-in-new-window')}</span>`
166
181
  : nothing;
167
182
 
183
+ /*
184
+ * NOTICE:
185
+ * All html template whitespace within this component is critical to proper rendering and wrapping.
186
+ * Do not modify for readability!
187
+ */
168
188
  return html`<a
169
189
  aria-label="${ifDefined(this.ariaLabel)}"
170
190
  class="${classMap(linkClasses)}"
171
- style="${styleMap(styles)}"
172
191
  ?download="${this.download}"
173
192
  href="${ifDefined(this.href)}"
174
193
  target="${ifDefined(this.target)}"
175
- ><slot></slot>${newWindowElements}</a>`;
194
+ ><span
195
+ class="${classMap(spanClasses)}"
196
+ style="${styleMap(styles)}"><slot></slot></span>${newWindowElements}</a>`;
176
197
  }
177
198
 
178
199
  }
@@ -123,14 +123,14 @@ class ListDemoNav extends LitElement {
123
123
 
124
124
  this.requestUpdate();
125
125
  await this.updateComplete;
126
- await this.updateComplete;
127
126
 
128
127
  if (e.detail.keyboardActive) {
129
- setTimeout(() => {
128
+ setTimeout(async() => {
130
129
  if (!this.shadowRoot) return;
131
130
  const newItem = this.shadowRoot.querySelector('d2l-list').getListItemByKey(sourceListItems[0].key);
131
+ await newItem.waitForUpdateComplete();
132
132
  newItem.activateDragHandle();
133
- }, 50);
133
+ });
134
134
  }
135
135
  }
136
136
 
@@ -134,14 +134,14 @@ class ListDemoNested extends LitElement {
134
134
 
135
135
  this.requestUpdate();
136
136
  await this.updateComplete;
137
- await this.updateComplete;
138
137
 
139
138
  if (e.detail.keyboardActive) {
140
- setTimeout(() => {
139
+ setTimeout(async() => {
141
140
  if (!this.shadowRoot) return;
142
141
  const newItem = this.shadowRoot.querySelector('d2l-list').getListItemByKey(sourceListItems[0].key);
142
+ await newItem.waitForUpdateComplete();
143
143
  newItem.activateDragHandle();
144
- }, 50);
144
+ });
145
145
  }
146
146
 
147
147
  }
@@ -6,7 +6,7 @@ import './list-item-placement-marker.js';
6
6
  import '../tooltip/tooltip.js';
7
7
  import '../expand-collapse/expand-collapse-content.js';
8
8
  import { css, html, nothing, unsafeCSS } from 'lit';
9
- import { findComposedAncestor, getComposedParent } from '../../helpers/dom.js';
9
+ import { findComposedAncestor, getComposedChildren, getComposedParent } from '../../helpers/dom.js';
10
10
  import { interactiveElements, isInteractiveInComposedPath } from '../../helpers/interactive.js';
11
11
  import { classMap } from 'lit/directives/class-map.js';
12
12
  import { composeMixins } from '../../helpers/composeMixins.js';
@@ -24,6 +24,7 @@ import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
24
24
  import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
25
25
  import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
26
26
  import { styleMap } from 'lit/directives/style-map.js';
27
+ import { waitForElem } from '../../helpers/internal/waitForElem.js';
27
28
 
28
29
  let tabPressed = false;
29
30
  let tabListenerAdded = false;
@@ -594,6 +595,12 @@ export const ListItemMixin = superclass => class extends composeMixins(
594
595
  this._siblingHasColor = siblingHasColor;
595
596
  }
596
597
 
598
+ async waitForUpdateComplete() {
599
+ const predicate = () => true;
600
+ const composedChildren = getComposedChildren(this, predicate);
601
+ await Promise.all(composedChildren.map(child => waitForElem(child, predicate)));
602
+ }
603
+
597
604
  _getFlattenedListItems(listItem) {
598
605
  const listItems = new Map();
599
606
  const lazyLoadListItems = new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.148.7",
3
+ "version": "3.148.9",
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",
@@ -68,7 +68,7 @@
68
68
  "dependencies": {
69
69
  "@brightspace-ui/intl": "^3",
70
70
  "@brightspace-ui/lms-context-provider": "^1",
71
- "@open-wc/dedupe-mixin": "^1",
71
+ "@open-wc/dedupe-mixin": "^2",
72
72
  "ifrau": "^0.41",
73
73
  "lit": "^3",
74
74
  "prismjs": "^1",