@brightspace-ui/core 3.160.2 → 3.161.0
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.
@@ -0,0 +1,51 @@
|
|
1
|
+
import '../colors/colors.js';
|
2
|
+
import { css, unsafeCSS } from 'lit';
|
3
|
+
import { _isValidCssSelector } from '../../helpers/internal/css.js';
|
4
|
+
import { getFocusRingStyles } from '../../helpers/focus.js';
|
5
|
+
|
6
|
+
/**
|
7
|
+
* A private helper method that should not be used by general consumers
|
8
|
+
*/
|
9
|
+
export const _generateLinkStyles = (selector, includeSkeleton = true) => {
|
10
|
+
if (!_isValidCssSelector(selector)) return;
|
11
|
+
|
12
|
+
const selectorCSS = unsafeCSS(selector);
|
13
|
+
const skeletonStyles = includeSkeleton ? css`
|
14
|
+
:host([skeleton]) ${selectorCSS}.d2l-skeletize::before {
|
15
|
+
bottom: 0.2rem;
|
16
|
+
top: 0.2rem;
|
17
|
+
}
|
18
|
+
:host([skeleton]) ${selectorCSS}.d2l-link-small.d2l-skeletize::before {
|
19
|
+
bottom: 0.15rem;
|
20
|
+
top: 0.15rem;
|
21
|
+
}
|
22
|
+
` : unsafeCSS('');
|
23
|
+
return css`
|
24
|
+
${selectorCSS}, ${selectorCSS}:visited, ${selectorCSS}:active, ${selectorCSS}:link {
|
25
|
+
--d2l-focus-ring-offset: 1px;
|
26
|
+
color: var(--d2l-color-celestine);
|
27
|
+
cursor: pointer;
|
28
|
+
outline-style: none;
|
29
|
+
text-decoration: none;
|
30
|
+
}
|
31
|
+
${selectorCSS}:hover {
|
32
|
+
color: var(--d2l-color-celestine-minus-1);
|
33
|
+
text-decoration: underline;
|
34
|
+
}
|
35
|
+
${getFocusRingStyles(selector, { extraStyles: css`border-radius: 2px; text-decoration: underline;` })}
|
36
|
+
${selectorCSS}.d2l-link-main {
|
37
|
+
font-weight: 700;
|
38
|
+
}
|
39
|
+
${selectorCSS}.d2l-link-small {
|
40
|
+
font-size: 0.7rem;
|
41
|
+
letter-spacing: 0.01rem;
|
42
|
+
line-height: 1.05rem;
|
43
|
+
}
|
44
|
+
@media print {
|
45
|
+
${selectorCSS}, ${selectorCSS}:visited, ${selectorCSS}:active, ${selectorCSS}:link {
|
46
|
+
color: var(--d2l-color-ferrite);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
${skeletonStyles}
|
50
|
+
`;
|
51
|
+
};
|
package/components/link/link.js
CHANGED
@@ -2,10 +2,10 @@ import '../colors/colors.js';
|
|
2
2
|
import '../icons/icon.js';
|
3
3
|
import { css, html, LitElement, nothing } from 'lit';
|
4
4
|
import { getOverflowDeclarations, overflowEllipsisDeclarations } from '../../helpers/overflow.js';
|
5
|
+
import { _generateLinkStyles } from './link-styles.js';
|
5
6
|
import { classMap } from 'lit/directives/class-map.js';
|
6
7
|
import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
|
7
8
|
import { getFlag } from '../../helpers/flags.js';
|
8
|
-
import { getFocusRingStyles } from '../../helpers/focus.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';
|
@@ -13,41 +13,7 @@ import { styleMap } from 'lit/directives/style-map.js';
|
|
13
13
|
|
14
14
|
const overflowClipEnabled = getFlag('GAUD-7887-core-components-overflow-clipping', true);
|
15
15
|
|
16
|
-
export const linkStyles =
|
17
|
-
.d2l-link, .d2l-link:visited, .d2l-link:active, .d2l-link:link {
|
18
|
-
--d2l-focus-ring-offset: 1px;
|
19
|
-
color: var(--d2l-color-celestine);
|
20
|
-
cursor: pointer;
|
21
|
-
outline-style: none;
|
22
|
-
text-decoration: none;
|
23
|
-
}
|
24
|
-
:host([skeleton]) .d2l-link.d2l-skeletize::before {
|
25
|
-
bottom: 0.2rem;
|
26
|
-
top: 0.2rem;
|
27
|
-
}
|
28
|
-
.d2l-link:hover {
|
29
|
-
color: var(--d2l-color-celestine-minus-1);
|
30
|
-
text-decoration: underline;
|
31
|
-
}
|
32
|
-
${getFocusRingStyles('.d2l-link', { extraStyles: css`border-radius: 2px; text-decoration: underline;` })}
|
33
|
-
.d2l-link.d2l-link-main {
|
34
|
-
font-weight: 700;
|
35
|
-
}
|
36
|
-
.d2l-link.d2l-link-small {
|
37
|
-
font-size: 0.7rem;
|
38
|
-
letter-spacing: 0.01rem;
|
39
|
-
line-height: 1.05rem;
|
40
|
-
}
|
41
|
-
:host([skeleton]) .d2l-link.d2l-link-small.d2l-skeletize::before {
|
42
|
-
bottom: 0.15rem;
|
43
|
-
top: 0.15rem;
|
44
|
-
}
|
45
|
-
@media print {
|
46
|
-
.d2l-link, .d2l-link:visited, .d2l-link:active, .d2l-link:link {
|
47
|
-
color: var(--d2l-color-ferrite);
|
48
|
-
}
|
49
|
-
}
|
50
|
-
`;
|
16
|
+
export const linkStyles = _generateLinkStyles('.d2l-link', true);
|
51
17
|
|
52
18
|
/**
|
53
19
|
* This component can be used just like the native anchor tag.
|
@@ -1,24 +1,8 @@
|
|
1
1
|
import '../colors/colors.js';
|
2
2
|
import { css, unsafeCSS } from 'lit';
|
3
|
+
import { _isValidCssSelector } from '../../helpers/internal/css.js';
|
3
4
|
import { svgToCSS } from '../../helpers/svg-to-css.js';
|
4
5
|
|
5
|
-
export const _isValidCssSelector = (selector) => {
|
6
|
-
const partIsValid = (part) => {
|
7
|
-
const re = /([a-zA-Z0-9-_ >.#]+)(\[[a-zA-Z0-9-_]+\])?([a-zA-Z0-9-_ >.#]+)?/g;
|
8
|
-
if (part === ':host') return true;
|
9
|
-
const match = part.match(re);
|
10
|
-
const isValid = !!match && match.length === 1 && match[0].length === part.length;
|
11
|
-
if (!isValid) {
|
12
|
-
console.warn(`Invalid CSS selector: "${part}"`);
|
13
|
-
}
|
14
|
-
return isValid;
|
15
|
-
};
|
16
|
-
|
17
|
-
const parts = selector.split(',');
|
18
|
-
const allValid = parts.every(part => partIsValid(part));
|
19
|
-
return allValid;
|
20
|
-
};
|
21
|
-
|
22
6
|
/**
|
23
7
|
* A private helper method that should not be used by general consumers
|
24
8
|
*/
|
package/helpers/focus.js
CHANGED
@@ -15,6 +15,7 @@ const focusableElements = {
|
|
15
15
|
textarea: true
|
16
16
|
};
|
17
17
|
|
18
|
+
// The default here cannot be changed, as BSI relies on it being true. Do not change the default without adding a way for BSI to override it.
|
18
19
|
const focusVisibleSupportChangesEnabled = getFlag('focus-visible-support-changes-for-focus-rings', true);
|
19
20
|
|
20
21
|
export function getComposedActiveElement() {
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export function _isValidCssSelector(selector) {
|
2
|
+
const partIsValid = (part) => {
|
3
|
+
const re = /([a-zA-Z0-9-_ >.#]+)(\[[a-zA-Z0-9-_]+\])?([a-zA-Z0-9-_ >.#]+)?/g;
|
4
|
+
if (part === ':host') return true;
|
5
|
+
const match = part.match(re);
|
6
|
+
const isValid = !!match && match.length === 1 && match[0].length === part.length;
|
7
|
+
if (!isValid) {
|
8
|
+
console.warn(`Invalid CSS selector: "${part}"`);
|
9
|
+
}
|
10
|
+
return isValid;
|
11
|
+
};
|
12
|
+
|
13
|
+
const parts = selector.split(',');
|
14
|
+
const allValid = parts.every(part => partIsValid(part));
|
15
|
+
return allValid;
|
16
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.161.0",
|
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",
|