@brightspace-ui/core 3.262.9 → 3.263.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { css } from 'lit';
|
|
1
|
+
import { css, unsafeCSS } from 'lit';
|
|
2
|
+
import { _isValidCssSelector } from '../../helpers/internal/css.js';
|
|
2
3
|
import { registerSemanticVariableForSvgImageUrl } from '../colors/colors.js';
|
|
3
4
|
|
|
4
5
|
registerSemanticVariableForSvgImageUrl(
|
|
@@ -8,29 +9,55 @@ registerSemanticVariableForSvgImageUrl(
|
|
|
8
9
|
</svg>`
|
|
9
10
|
);
|
|
10
11
|
|
|
12
|
+
/**
|
|
13
|
+
* A private helper method that should not be used by general consumers
|
|
14
|
+
*/
|
|
15
|
+
export function _generateInputLabelStyles(selector) {
|
|
16
|
+
if (!selector || !_isValidCssSelector(selector.trim())) return;
|
|
17
|
+
const trimmedSelector = selector.trim().split(',').map(s => s.trim()).join(',\n');
|
|
18
|
+
const cssSelector = unsafeCSS(trimmedSelector);
|
|
19
|
+
|
|
20
|
+
return css`
|
|
21
|
+
${cssSelector} {
|
|
22
|
+
cursor: default;
|
|
23
|
+
display: block;
|
|
24
|
+
font-size: 0.7rem;
|
|
25
|
+
font-weight: 700;
|
|
26
|
+
letter-spacing: 0.2px;
|
|
27
|
+
line-height: 0.9rem;
|
|
28
|
+
margin-block: 0 0.4rem;
|
|
29
|
+
margin-inline: 0;
|
|
30
|
+
padding: 0;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A private helper method that should not be used by general consumers
|
|
37
|
+
*/
|
|
38
|
+
export function _generateInputLabelRequiredStyles(selector) {
|
|
39
|
+
if (!selector || !_isValidCssSelector(selector.trim())) return;
|
|
40
|
+
const selectorList = selector.trim().split(',');
|
|
41
|
+
const joinedSelector = selectorList.map(s => `${s.trim()}::after`).join(',\n');
|
|
42
|
+
const cssSelector = unsafeCSS(joinedSelector);
|
|
43
|
+
|
|
44
|
+
return css`
|
|
45
|
+
${cssSelector} {
|
|
46
|
+
background-image: var(--d2l-input-label-required-image);
|
|
47
|
+
bottom: 0.25rem;
|
|
48
|
+
content: "";
|
|
49
|
+
display: inline-block;
|
|
50
|
+
height: 0.3rem;
|
|
51
|
+
inset-inline-start: 0.15rem;
|
|
52
|
+
position: relative;
|
|
53
|
+
width: 0.25rem;
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
|
|
11
58
|
export const inputLabelStyles = css`
|
|
12
|
-
.d2l-input-label
|
|
13
|
-
|
|
14
|
-
display: block;
|
|
15
|
-
font-size: 0.7rem;
|
|
16
|
-
font-weight: 700;
|
|
17
|
-
letter-spacing: 0.2px;
|
|
18
|
-
line-height: 0.9rem;
|
|
19
|
-
margin-block: 0 0.4rem;
|
|
20
|
-
margin-inline: 0;
|
|
21
|
-
padding: 0;
|
|
22
|
-
}
|
|
23
|
-
:host([required]) .d2l-input-label::after,
|
|
24
|
-
.d2l-input-label-required::after {
|
|
25
|
-
background-image: var(--d2l-input-label-required-image);
|
|
26
|
-
bottom: 0.25rem;
|
|
27
|
-
content: "";
|
|
28
|
-
display: inline-block;
|
|
29
|
-
height: 0.3rem;
|
|
30
|
-
inset-inline-start: 0.15rem;
|
|
31
|
-
position: relative;
|
|
32
|
-
width: 0.25rem;
|
|
33
|
-
}
|
|
59
|
+
${_generateInputLabelStyles('.d2l-input-label')}
|
|
60
|
+
${_generateInputLabelRequiredStyles(':host([required]) .d2l-input-label,.d2l-input-label-required')}
|
|
34
61
|
:host([skeleton]) .d2l-input-label.d2l-skeletize::before {
|
|
35
62
|
bottom: 0.25rem;
|
|
36
63
|
top: 0.15rem;
|
package/helpers/internal/css.js
CHANGED
|
@@ -10,7 +10,7 @@ export function _isValidCssSelector(selector) {
|
|
|
10
10
|
].every((part, i) => (i !== 1 && part === '') || partIsValid(part));
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const re = /([a-zA-Z0-9-_ >.#]+)(\[[a-zA-Z0-9-_="]+\])?([a-zA-Z0-9-_ >.#]+)?/g;
|
|
13
|
+
const re = /([:a-zA-Z0-9-_ >.#]+)(\(?\[[a-zA-Z0-9-_="]+\]\)?)?([a-zA-Z0-9-_ >.#]+)?/g;
|
|
14
14
|
if (part === ':host') return true;
|
|
15
15
|
const match = part.match(re);
|
|
16
16
|
const isValid = !!match && match.length === 1 && match[0].length === part.length;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.263.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",
|