@brightspace-ui/core 3.148.7 → 3.148.8

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
  }
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.8",
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",