@brightspace-ui/core 3.338.0 → 3.338.1
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,10 +1,8 @@
|
|
|
1
1
|
import '../colors/colors.js';
|
|
2
|
-
import { css, html, LitElement } from 'lit';
|
|
2
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
3
3
|
import { bodySmallStyles } from '../typography/styles.js';
|
|
4
|
-
import { classMap } from 'lit/directives/class-map.js';
|
|
5
4
|
import { getOverflowDeclarations } from '../../helpers/overflow.js';
|
|
6
5
|
import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
|
|
7
|
-
import { styleMap } from 'lit/directives/style-map.js';
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* A component for a "summary item" child component that describes the content in a collapsible panel.
|
|
@@ -35,9 +33,6 @@ class CollapsiblePanelSummaryItem extends SkeletonMixin(LitElement) {
|
|
|
35
33
|
.d2l-body-small {
|
|
36
34
|
line-height: 1.2rem;
|
|
37
35
|
}
|
|
38
|
-
p.truncate {
|
|
39
|
-
${getOverflowDeclarations({ lines: 1 })}
|
|
40
|
-
}
|
|
41
36
|
`];
|
|
42
37
|
|
|
43
38
|
constructor() {
|
|
@@ -47,13 +42,8 @@ class CollapsiblePanelSummaryItem extends SkeletonMixin(LitElement) {
|
|
|
47
42
|
}
|
|
48
43
|
|
|
49
44
|
render() {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
'd2l-skeletize': true,
|
|
53
|
-
'truncate': this.lines > 0
|
|
54
|
-
};
|
|
55
|
-
const styles = (this.lines > 0) ? { '-webkit-line-clamp': this.lines } : {};
|
|
56
|
-
return html`<p class="${classMap(classes)}" style="${styleMap(styles)}">${this.text}</p>`;
|
|
45
|
+
const styles = this.lines ? getOverflowDeclarations({ lines: this.lines }) : null;
|
|
46
|
+
return html`<p class="d2l-body-small d2l-skeletize" style="${styles ?? nothing}">${this.text}</p>`;
|
|
57
47
|
}
|
|
58
48
|
}
|
|
59
49
|
|
package/components/link/link.js
CHANGED
|
@@ -2,15 +2,14 @@ import '../colors/colors.js';
|
|
|
2
2
|
import '../icons/icon.js';
|
|
3
3
|
import '../tooltip/tooltip.js';
|
|
4
4
|
import { css, html, LitElement, nothing } from 'lit';
|
|
5
|
-
import { getOverflowDeclarations, overflowEllipsisDeclarations } from '../../helpers/overflow.js';
|
|
6
5
|
import { _generateLinkStyles } from './link-styles.js';
|
|
7
6
|
import { classMap } from 'lit/directives/class-map.js';
|
|
8
7
|
import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
|
|
8
|
+
import { getOverflowDeclarations } from '../../helpers/overflow.js';
|
|
9
9
|
import { getUniqueId } from '../../helpers/uniqueId.js';
|
|
10
10
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
11
11
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
12
12
|
import { offscreenStyles } from '../offscreen/offscreen.js';
|
|
13
|
-
import { styleMap } from 'lit/directives/style-map.js';
|
|
14
13
|
|
|
15
14
|
export const linkStyles = _generateLinkStyles('.d2l-link', true);
|
|
16
15
|
|
|
@@ -90,12 +89,6 @@ class Link extends LocalizeCoreElement(FocusMixin(LitElement)) {
|
|
|
90
89
|
align-items: baseline;
|
|
91
90
|
display: flex;
|
|
92
91
|
}
|
|
93
|
-
a span.truncate {
|
|
94
|
-
${getOverflowDeclarations({ lines: 1 })}
|
|
95
|
-
}
|
|
96
|
-
a span.truncate-one {
|
|
97
|
-
${overflowEllipsisDeclarations}
|
|
98
|
-
}
|
|
99
92
|
#new-window {
|
|
100
93
|
line-height: 0;
|
|
101
94
|
white-space: nowrap;
|
|
@@ -157,12 +150,7 @@ class Link extends LocalizeCoreElement(FocusMixin(LitElement)) {
|
|
|
157
150
|
'd2l-link-main': this.main,
|
|
158
151
|
'd2l-link-small': this.small
|
|
159
152
|
};
|
|
160
|
-
const
|
|
161
|
-
'd2l-link-content': true,
|
|
162
|
-
'truncate': this.lines > 1,
|
|
163
|
-
'truncate-one': this.lines === 1
|
|
164
|
-
};
|
|
165
|
-
const styles = { webkitLineClamp: this.lines || null };
|
|
153
|
+
const styles = this.lines ? getOverflowDeclarations({ lines: this.lines }) : null;
|
|
166
154
|
const newWindowElements = (this.target === '_blank')
|
|
167
155
|
? html`<span id="new-window"><span style="font-size: 0;"> </span><d2l-icon icon="tier1:new-window"></d2l-icon></span><span class="d2l-offscreen">${this.localize('components.link.open-in-new-window')}</span>`
|
|
168
156
|
: nothing;
|
|
@@ -186,8 +174,8 @@ class Link extends LocalizeCoreElement(FocusMixin(LitElement)) {
|
|
|
186
174
|
tabindex="${ifDefined(this.disabled && this.disabledTooltip ? 0 : undefined)}"
|
|
187
175
|
target="${ifDefined(this.target)}"
|
|
188
176
|
><span
|
|
189
|
-
class="
|
|
190
|
-
style="${
|
|
177
|
+
class="d2l-link-content"
|
|
178
|
+
style="${styles ?? nothing}"><slot></slot></span>${newWindowElements}</a>${disabledTooltip}`;
|
|
191
179
|
}
|
|
192
180
|
|
|
193
181
|
#linkId = getUniqueId();
|
package/helpers/overflow.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { set } from './template-tags.js';
|
|
2
2
|
import { unsafeCSS } from 'lit';
|
|
3
3
|
|
|
4
|
-
export const overflowHiddenDeclarations = getOverflowDeclarations({});
|
|
5
|
-
export const overflowEllipsisDeclarations = getOverflowDeclarations({ textOverflow: 'ellipsis' });
|
|
4
|
+
export const overflowHiddenDeclarations = getOverflowDeclarations({ lines: 0 });
|
|
5
|
+
export const overflowEllipsisDeclarations = getOverflowDeclarations({ textOverflow: 'ellipsis', lines: 0 });
|
|
6
6
|
|
|
7
|
-
export function getOverflowDeclarations({ textOverflow = '', lines =
|
|
7
|
+
export function getOverflowDeclarations({ textOverflow = '', lines = 1, lit = true } = {}) {
|
|
8
8
|
if (!arguments.length) return overflowHiddenDeclarations;
|
|
9
|
+
if (arguments[0].lines === 1) return overflowEllipsisDeclarations;
|
|
9
10
|
|
|
10
11
|
const declarations = set`
|
|
11
12
|
min-width: 0; /* clamps width of flex items */
|
|
12
13
|
overflow-x: clip;
|
|
13
|
-
${lines
|
|
14
|
+
${lines > 1 || lines.constructor === String
|
|
14
15
|
? set`
|
|
15
16
|
display: -webkit-box;
|
|
16
17
|
overflow-clip-margin: 0.2em;
|
|
17
18
|
overflow-wrap: anywhere;
|
|
18
19
|
overflow-y: clip;
|
|
19
|
-
text-overflow: ${textOverflow || 'ellipsis'};
|
|
20
20
|
-webkit-box-orient: vertical;
|
|
21
21
|
-webkit-line-clamp: ${lines};`
|
|
22
22
|
: set`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "3.338.
|
|
3
|
+
"version": "3.338.1",
|
|
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",
|