@brightspace-ui/labs 2.38.0 → 2.38.2
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.
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import '@brightspace-ui/core/components/link/link.js';
|
|
2
2
|
import { html, LitElement } from 'lit';
|
|
3
3
|
import { CommunityBase } from './community-base.js';
|
|
4
4
|
|
|
@@ -12,7 +12,7 @@ class CommunityLink extends CommunityBase(LitElement) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
render() {
|
|
15
|
-
return html`<d2l-
|
|
15
|
+
return html`<d2l-link target="_blank" href="${this.communityArticleDirective(this.langController.language)}" ?small=${this.small} >${this.text}</d2l-link>`;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -10,6 +10,7 @@ import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
|
|
|
10
10
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
11
11
|
|
|
12
12
|
const mediaQueryList = window.matchMedia('(max-width: 615px)');
|
|
13
|
+
const immersiveNavTextSpacingFlag = getFlag('GAUD-8465-immersive-nav-text-spacing', false);
|
|
13
14
|
|
|
14
15
|
class NavigationImmersive extends LitElement {
|
|
15
16
|
|
|
@@ -38,6 +39,7 @@ class NavigationImmersive extends LitElement {
|
|
|
38
39
|
reflect: true
|
|
39
40
|
},
|
|
40
41
|
_dynamicSpacingHeight: { state: true },
|
|
42
|
+
_spacingUseHeightVar: { attribute: '_spacing-use-height-var', type: Boolean, reflect: true },
|
|
41
43
|
_middleHidden: { state: true },
|
|
42
44
|
_middleNoRightBorder: { state: true },
|
|
43
45
|
_smallWidth: { state: true }
|
|
@@ -130,10 +132,13 @@ class NavigationImmersive extends LitElement {
|
|
|
130
132
|
}
|
|
131
133
|
|
|
132
134
|
.d2l-labs-navigation-immersive-spacing {
|
|
133
|
-
height: calc(var(--d2l-labs-navigation-immersive-height-main) + 5px);
|
|
134
135
|
position: unset;
|
|
135
136
|
}
|
|
136
137
|
|
|
138
|
+
:host([_spacing-use-height-var]) .d2l-labs-navigation-immersive-spacing {
|
|
139
|
+
height: calc(var(--d2l-labs-navigation-immersive-height-main) + 5px);
|
|
140
|
+
}
|
|
141
|
+
|
|
137
142
|
@media (max-width: 929px) {
|
|
138
143
|
.d2l-labs-navigation-immersive-margin {
|
|
139
144
|
margin: 0 24px;
|
|
@@ -173,9 +178,10 @@ class NavigationImmersive extends LitElement {
|
|
|
173
178
|
this._middleNoRightBorder = true;
|
|
174
179
|
this._middleObserver = new ResizeObserver(this._onMiddleResize.bind(this));
|
|
175
180
|
this._rightObserver = new ResizeObserver(this._onRightResize.bind(this));
|
|
181
|
+
this._spacingUseHeightVar = !immersiveNavTextSpacingFlag;
|
|
176
182
|
|
|
177
183
|
// Only create navigation observer if feature flag is enabled
|
|
178
|
-
if (
|
|
184
|
+
if (immersiveNavTextSpacingFlag) {
|
|
179
185
|
this._navigationObserver = new ResizeObserver(this._onNavigationResize.bind(this));
|
|
180
186
|
}
|
|
181
187
|
|
|
@@ -235,8 +241,6 @@ class NavigationImmersive extends LitElement {
|
|
|
235
241
|
`;
|
|
236
242
|
}
|
|
237
243
|
|
|
238
|
-
#prevHeight = 0;
|
|
239
|
-
|
|
240
244
|
_handleBackClick() {
|
|
241
245
|
this.dispatchEvent(
|
|
242
246
|
new CustomEvent(
|
|
@@ -263,15 +267,9 @@ class NavigationImmersive extends LitElement {
|
|
|
263
267
|
}
|
|
264
268
|
|
|
265
269
|
const newHeight = entries[0].contentRect.height;
|
|
266
|
-
if (
|
|
267
|
-
this.#prevHeight = newHeight;
|
|
268
|
-
return;
|
|
269
|
-
} else if (this.#prevHeight === newHeight) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
270
|
+
if (!newHeight) return;
|
|
272
271
|
|
|
273
|
-
this
|
|
274
|
-
this._dynamicSpacingHeight = newHeight + 5; // 5px is the standard spacing buffer
|
|
272
|
+
this._dynamicSpacingHeight = newHeight;
|
|
275
273
|
}
|
|
276
274
|
|
|
277
275
|
_onRightResize(entries) {
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
// Delete this file once core#4001 is merged.
|
|
2
|
-
// https://github.com/BrightspaceUI/core/pull/4001
|
|
3
|
-
import '@brightspace-ui/core/components/colors/colors';
|
|
4
|
-
import '@brightspace-ui/core/components/icons/icon.js';
|
|
5
|
-
import { css, html, LitElement, nothing, unsafeCSS } from 'lit';
|
|
6
|
-
import { classMap } from 'lit/directives/class-map.js';
|
|
7
|
-
import { FocusMixin } from '@brightspace-ui/core/mixins/focus/focus-mixin.js';
|
|
8
|
-
import { getFocusPseudoClass } from '@brightspace-ui/core/helpers/focus.js';
|
|
9
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
10
|
-
import { LocalizeCoreElement } from '@brightspace-ui/core/helpers/localize-core-element.js';
|
|
11
|
-
import { offscreenStyles } from '@brightspace-ui/core/components/offscreen/offscreen.js';
|
|
12
|
-
import { styleMap } from 'lit/directives/style-map.js';
|
|
13
|
-
|
|
14
|
-
export const linkStyles = css`
|
|
15
|
-
.d2l-link, .d2l-link:visited, .d2l-link:active, .d2l-link:link {
|
|
16
|
-
color: var(--d2l-color-celestine);
|
|
17
|
-
cursor: pointer;
|
|
18
|
-
outline-style: none;
|
|
19
|
-
text-decoration: none;
|
|
20
|
-
}
|
|
21
|
-
:host([skeleton]) .d2l-link.d2l-skeletize::before {
|
|
22
|
-
bottom: 0.2rem;
|
|
23
|
-
top: 0.2rem;
|
|
24
|
-
}
|
|
25
|
-
.d2l-link:hover {
|
|
26
|
-
color: var(--d2l-color-celestine-minus-1);
|
|
27
|
-
text-decoration: underline;
|
|
28
|
-
}
|
|
29
|
-
.d2l-link:${unsafeCSS(getFocusPseudoClass())} {
|
|
30
|
-
border-radius: 2px;
|
|
31
|
-
outline: 2px solid var(--d2l-color-celestine);
|
|
32
|
-
outline-offset: 1px;
|
|
33
|
-
text-decoration: underline;
|
|
34
|
-
}
|
|
35
|
-
.d2l-link.d2l-link-main {
|
|
36
|
-
font-weight: 700;
|
|
37
|
-
}
|
|
38
|
-
.d2l-link.d2l-link-small {
|
|
39
|
-
font-size: 0.7rem;
|
|
40
|
-
letter-spacing: 0.01rem;
|
|
41
|
-
line-height: 1.05rem;
|
|
42
|
-
}
|
|
43
|
-
:host([skeleton]) .d2l-link.d2l-link-small.d2l-skeletize::before {
|
|
44
|
-
bottom: 0.15rem;
|
|
45
|
-
top: 0.15rem;
|
|
46
|
-
}
|
|
47
|
-
@media print {
|
|
48
|
-
.d2l-link, .d2l-link:visited, .d2l-link:active, .d2l-link:link {
|
|
49
|
-
color: var(--d2l-color-ferrite);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* This component can be used just like the native anchor tag.
|
|
56
|
-
* @slot - The content (e.g., text) that when selected causes navigation
|
|
57
|
-
*/
|
|
58
|
-
class Link extends LocalizeCoreElement(FocusMixin(LitElement)) {
|
|
59
|
-
|
|
60
|
-
static get properties() {
|
|
61
|
-
return {
|
|
62
|
-
/**
|
|
63
|
-
* Sets an accessible label
|
|
64
|
-
* @type {string}
|
|
65
|
-
*/
|
|
66
|
-
ariaLabel: { type: String, attribute: 'aria-label' },
|
|
67
|
-
/**
|
|
68
|
-
* Download a URL instead of navigating to it
|
|
69
|
-
* @type {boolean}
|
|
70
|
-
*/
|
|
71
|
-
download: { type: Boolean },
|
|
72
|
-
/**
|
|
73
|
-
* REQUIRED: URL or URL fragment of the link
|
|
74
|
-
* @type {string}
|
|
75
|
-
*/
|
|
76
|
-
href: { type: String },
|
|
77
|
-
/**
|
|
78
|
-
* Whether to apply the "main" link style
|
|
79
|
-
* @type {boolean}
|
|
80
|
-
*/
|
|
81
|
-
main: { type: Boolean, reflect: true },
|
|
82
|
-
/**
|
|
83
|
-
* The number of lines to display before truncating text with an ellipsis. The text will not be truncated unless a value is specified.
|
|
84
|
-
* @type {number}
|
|
85
|
-
*/
|
|
86
|
-
lines: { type: Number },
|
|
87
|
-
/**
|
|
88
|
-
* Whether to apply the "small" link style
|
|
89
|
-
* @type {boolean}
|
|
90
|
-
*/
|
|
91
|
-
small: { type: Boolean, reflect: true },
|
|
92
|
-
/**
|
|
93
|
-
* Where to display the linked URL
|
|
94
|
-
* @type {string}
|
|
95
|
-
*/
|
|
96
|
-
target: { type: String },
|
|
97
|
-
/**
|
|
98
|
-
* Whether to display the open in new window icon
|
|
99
|
-
* @type {boolean}
|
|
100
|
-
*/
|
|
101
|
-
newWindow: { type: Boolean, attribute: 'new-window' }
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
static get styles() {
|
|
106
|
-
return [ linkStyles, offscreenStyles,
|
|
107
|
-
css`
|
|
108
|
-
:host {
|
|
109
|
-
display: inline;
|
|
110
|
-
}
|
|
111
|
-
:host([hidden]) {
|
|
112
|
-
display: none;
|
|
113
|
-
}
|
|
114
|
-
:host([small]) {
|
|
115
|
-
/* needed to keep host element same height as link */
|
|
116
|
-
font-size: 0.7rem;
|
|
117
|
-
line-height: 1.05rem;
|
|
118
|
-
}
|
|
119
|
-
a {
|
|
120
|
-
display: inherit;
|
|
121
|
-
}
|
|
122
|
-
a.truncate {
|
|
123
|
-
-webkit-box-orient: vertical;
|
|
124
|
-
display: -webkit-box;
|
|
125
|
-
overflow: hidden;
|
|
126
|
-
overflow-wrap: anywhere;
|
|
127
|
-
}
|
|
128
|
-
d2l-icon.d2l-new-window {
|
|
129
|
-
color: var(--d2l-color-celestine);
|
|
130
|
-
vertical-align: inherit;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
:host([small]) d2l-icon.d2l-new-window {
|
|
134
|
-
height: 14px;
|
|
135
|
-
width: 14px;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
@media print {
|
|
139
|
-
d2l-icon.d2l-new-window {
|
|
140
|
-
display: none;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
`
|
|
144
|
-
];
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
constructor() {
|
|
148
|
-
super();
|
|
149
|
-
this.download = false;
|
|
150
|
-
this.main = false;
|
|
151
|
-
this.small = false;
|
|
152
|
-
this.lines = 0;
|
|
153
|
-
this.newWindow = false;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
static get focusElementSelector() {
|
|
157
|
-
return '.d2l-link';
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
render() {
|
|
161
|
-
const linkClasses = {
|
|
162
|
-
'd2l-link': true,
|
|
163
|
-
'd2l-link-main': this.main,
|
|
164
|
-
'd2l-link-small': this.small,
|
|
165
|
-
'truncate': this.lines > 0
|
|
166
|
-
};
|
|
167
|
-
const styles = (this.lines > 0) ? { '-webkit-line-clamp': this.lines } : {};
|
|
168
|
-
const target = this.newWindow && this.target === undefined
|
|
169
|
-
? '_blank'
|
|
170
|
-
: this.target;
|
|
171
|
-
/* eslint-disable @stylistic/indent */
|
|
172
|
-
return html`
|
|
173
|
-
<a
|
|
174
|
-
aria-label="${ifDefined(this.ariaLabel)}"
|
|
175
|
-
class="${classMap(linkClasses)}"
|
|
176
|
-
style="${styleMap(styles)}"
|
|
177
|
-
?download="${this.download}"
|
|
178
|
-
href="${ifDefined(this.href)}"
|
|
179
|
-
target="${ifDefined(target)}"
|
|
180
|
-
>
|
|
181
|
-
<span style="white-space: nowrap;">
|
|
182
|
-
<span style="white-space: normal;"><slot></slot></span>${this.newWindow ? html` <d2l-icon class="d2l-new-window" icon="tier1:new-window"></d2l-icon>`
|
|
183
|
-
: nothing}
|
|
184
|
-
${target === '_blank' ? html`<span class="d2l-offscreen">${this.localize('components.link.open-in-new-window')}</span>`
|
|
185
|
-
: nothing}
|
|
186
|
-
</span>
|
|
187
|
-
</a>`;
|
|
188
|
-
}
|
|
189
|
-
/* eslint-enable @stylistic/indent */
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
customElements.define('d2l-labs-link-temp', Link);
|