@brightspace-ui/core 3.69.0 → 3.71.0
Sign up to get free protection for your applications and to get access to all the features.
- package/components/inputs/demo/input-text.html +2 -2
- package/components/inputs/docs/input-text.md +1 -0
- package/components/inputs/input-text.js +4 -2
- package/components/inputs/sass/checkbox.scss +4 -4
- package/components/inputs/sass/radio.scss +5 -5
- package/components/inputs/sass/select.scss +6 -6
- package/components/inputs/sass/text.scss +6 -6
- package/components/inputs/sass/textarea.scss +4 -4
- package/components/link/link.scss +6 -6
- package/components/typography/typography.scss +3 -3
- package/custom-elements.json +4 -4
- package/mixins/localize/README.md +33 -0
- package/package.json +3 -3
@@ -132,9 +132,9 @@
|
|
132
132
|
<h2>Inline Help</h2>
|
133
133
|
<d2l-demo-snippet>
|
134
134
|
<template>
|
135
|
-
<d2l-input-text label="
|
135
|
+
<d2l-input-text label="Alphabet" pattern="[a-z]*" pattern-failure-text="Must be a lowercase letter from a to z">
|
136
136
|
<div slot="inline-help">
|
137
|
-
|
137
|
+
Enter only lowercase letters from the alphabet.
|
138
138
|
</div>
|
139
139
|
</d2l-input-text>
|
140
140
|
</template>
|
@@ -81,6 +81,7 @@ The `<d2l-input-text>` element is a simple wrapper around the native `<input typ
|
|
81
81
|
| `name` | String | Name of the input |
|
82
82
|
| `novalidate` | Boolean | Disables the built-in validation |
|
83
83
|
| `pattern` | String | Regular expression pattern to validate the value |
|
84
|
+
| `pattern-failure-text` | String | Text to display when input fails validation against the pattern. If a list of characters is included in the message, use `LocalizeMixin`'s `localizeCharacter`. |
|
84
85
|
| `prevent-submit` | Boolean | Prevents pressing ENTER from submitting forms |
|
85
86
|
| `readonly` | Boolean | Makes the input read-only |
|
86
87
|
| `required` | Boolean | Indicates that a value is required |
|
@@ -102,12 +102,12 @@ class InputText extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(La
|
|
102
102
|
*/
|
103
103
|
minlength: { type: Number },
|
104
104
|
/**
|
105
|
-
* Regular expression pattern to validate the value
|
105
|
+
* ADVANCED: Regular expression pattern to validate the value
|
106
106
|
* @type {string}
|
107
107
|
*/
|
108
108
|
pattern: { type: String },
|
109
109
|
/**
|
110
|
-
* Text to display when input fails validation against the pattern
|
110
|
+
* ADVANCED: Text to display when input fails validation against the pattern. If a list of characters is included in the message, use `LocalizeMixin`'s `localizeCharacter`.
|
111
111
|
*/
|
112
112
|
patternFailureText: { type: String, attribute: 'pattern-failure-text' },
|
113
113
|
/**
|
@@ -332,6 +332,8 @@ class InputText extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(La
|
|
332
332
|
} else if (this.type === 'url') {
|
333
333
|
return this.localize('components.form-element.input.url.typeMismatch');
|
334
334
|
}
|
335
|
+
} else if (this.validity.patternMismatch && (typeof this.patternFailureText === 'string')) {
|
336
|
+
return this.patternFailureText;
|
335
337
|
}
|
336
338
|
return super.validationMessage;
|
337
339
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
@
|
1
|
+
@use "../../colors/colors.scss";
|
2
2
|
|
3
3
|
@mixin d2l-input-checkbox() {
|
4
4
|
-webkit-appearance: none;
|
@@ -21,13 +21,13 @@
|
|
21
21
|
}
|
22
22
|
&,
|
23
23
|
&:hover:disabled {
|
24
|
-
background-color:
|
25
|
-
border-color:
|
24
|
+
background-color: colors.$d2l-color-regolith;
|
25
|
+
border-color: colors.$d2l-color-galena;
|
26
26
|
border-width: 1px;
|
27
27
|
}
|
28
28
|
&:hover,
|
29
29
|
&:focus {
|
30
|
-
border-color:
|
30
|
+
border-color: colors.$d2l-color-celestine;
|
31
31
|
border-width: 2px;
|
32
32
|
outline-width: 0;
|
33
33
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
@
|
1
|
+
@use "../../colors/colors.scss";
|
2
2
|
|
3
3
|
@mixin d2l-input-radio() {
|
4
4
|
-webkit-appearance: none;
|
@@ -21,18 +21,18 @@
|
|
21
21
|
}
|
22
22
|
&,
|
23
23
|
&:hover:disabled {
|
24
|
-
background-color:
|
25
|
-
border-color:
|
24
|
+
background-color: colors.$d2l-color-regolith;
|
25
|
+
border-color: colors.$d2l-color-galena;
|
26
26
|
border-width: 1px;
|
27
27
|
}
|
28
28
|
&:hover,
|
29
29
|
&:focus {
|
30
|
-
border-color:
|
30
|
+
border-color: colors.$d2l-color-celestine;
|
31
31
|
border-width: 2px;
|
32
32
|
outline-width: 0;
|
33
33
|
}
|
34
34
|
&[aria-invalid="true"] {
|
35
|
-
border-color:
|
35
|
+
border-color: colors.$d2l-color-cinnabar;
|
36
36
|
}
|
37
37
|
&:disabled {
|
38
38
|
opacity: 0.5;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
@
|
1
|
+
@use "../../colors/colors.scss";
|
2
2
|
|
3
3
|
@mixin d2l-input-select() {
|
4
4
|
-webkit-appearance: none;
|
@@ -11,7 +11,7 @@
|
|
11
11
|
border-radius: 0.3rem;
|
12
12
|
border-style: solid;
|
13
13
|
box-sizing: border-box;
|
14
|
-
color:
|
14
|
+
color: colors.$d2l-color-ferrite;
|
15
15
|
display: inline-block;
|
16
16
|
font-family: inherit;
|
17
17
|
font-size: 0.8rem;
|
@@ -25,7 +25,7 @@
|
|
25
25
|
&,
|
26
26
|
&:hover:disabled {
|
27
27
|
background-color: #ffffff;
|
28
|
-
border-color:
|
28
|
+
border-color: colors.$d2l-color-galena;
|
29
29
|
border-width: 1px;
|
30
30
|
box-shadow: inset 0 2px 0 0 rgba(177, 185, 190, 0.2); /* corundum */
|
31
31
|
padding: 0.4rem 0.75rem;
|
@@ -44,7 +44,7 @@
|
|
44
44
|
}
|
45
45
|
&:hover,
|
46
46
|
&:focus {
|
47
|
-
border-color:
|
47
|
+
border-color: colors.$d2l-color-celestine;
|
48
48
|
border-width: 2px;
|
49
49
|
outline-style: none; /* Safari */
|
50
50
|
outline-width: 0;
|
@@ -56,7 +56,7 @@
|
|
56
56
|
background-position: center right 17px, center right calc(1px + 11px + 17px);
|
57
57
|
background-repeat: no-repeat, no-repeat;
|
58
58
|
background-size: 11px 7px, 0.8rem 0.8rem;
|
59
|
-
border-color:
|
59
|
+
border-color: colors.$d2l-color-cinnabar;
|
60
60
|
}
|
61
61
|
&:disabled {
|
62
62
|
opacity: 0.5;
|
@@ -65,7 +65,7 @@
|
|
65
65
|
&:focus::-ms-value,
|
66
66
|
&:hover::-ms-value {
|
67
67
|
background-color: transparent;
|
68
|
-
color:
|
68
|
+
color: colors.$d2l-color-ferrite;
|
69
69
|
}
|
70
70
|
/* IE11 to hide the native chevron */
|
71
71
|
&::-ms-expand {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
@
|
1
|
+
@use "../../colors/colors.scss";
|
2
2
|
|
3
3
|
@mixin d2l-input-text(
|
4
4
|
$include-pseudo-classes: true,
|
@@ -12,7 +12,7 @@
|
|
12
12
|
border-width: 1px;
|
13
13
|
box-shadow: inset 0 2px 0 0 rgba(177, 185, 190, 0.2), /* corundum */;
|
14
14
|
box-sizing: border-box;
|
15
|
-
color:
|
15
|
+
color: colors.$d2l-color-ferrite;
|
16
16
|
display: inline-block;
|
17
17
|
font-family: inherit;
|
18
18
|
font-size: 0.8rem;
|
@@ -27,26 +27,26 @@
|
|
27
27
|
width: 100%;
|
28
28
|
&::placeholder,
|
29
29
|
&::-ms-input-placeholder {
|
30
|
-
color:
|
30
|
+
color: colors.$d2l-color-galena;
|
31
31
|
font-size: 0.8rem;
|
32
32
|
font-weight: 400;
|
33
33
|
opacity: 1; /* Firefox has non-1 default */
|
34
34
|
}
|
35
35
|
&:hover,
|
36
36
|
&:focus {
|
37
|
-
border-color:
|
37
|
+
border-color: colors.$d2l-color-celestine;
|
38
38
|
border-width: 2px;
|
39
39
|
outline-style: none;
|
40
40
|
outline-width: 0;
|
41
41
|
padding: $padding-focus;
|
42
42
|
}
|
43
43
|
&[aria-invalid="true"] {
|
44
|
-
border-color:
|
44
|
+
border-color: colors.$d2l-color-cinnabar;
|
45
45
|
}
|
46
46
|
&,
|
47
47
|
&:hover:disabled,
|
48
48
|
&[aria-invalid="true"]:disabled {
|
49
|
-
border-color:
|
49
|
+
border-color: colors.$d2l-color-galena;
|
50
50
|
border-width: 1px;
|
51
51
|
padding: $padding;
|
52
52
|
}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
@
|
2
|
-
@
|
1
|
+
@use "../../colors/colors.scss";
|
2
|
+
@use "./text.scss";
|
3
3
|
|
4
4
|
@mixin d2l-input-textarea() {
|
5
|
-
|
5
|
+
overflow: auto;
|
6
|
+
@include text.d2l-input-text(
|
6
7
|
$include-pseudo-classes: false,
|
7
8
|
$line-height: normal,
|
8
9
|
$padding: 0.5rem 0.75rem,
|
9
10
|
$padding-focus: calc(0.5rem - 1px) calc(0.75rem - 1px)
|
10
11
|
);
|
11
|
-
overflow: auto;
|
12
12
|
&[aria-invalid="true"] {
|
13
13
|
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDE4IDE4Ij4KICA8cGF0aCBmaWxsPSIjY2QyMDI2IiBkPSJNMTcuNzkgMTUuMTFsLTctMTRhMiAyIDAgMCAwLTMuNTggMGwtNyAxNGExLjk3NSAxLjk3NSAwIDAgMCAuMDkgMS45NEEyIDIgMCAwIDAgMiAxOGgxNGExLjk5NCAxLjk5NCAwIDAgMCAxLjctLjk1IDEuOTY3IDEuOTY3IDAgMCAwIC4wOS0xLjk0ek05IDE2YTEuNSAxLjUgMCAxIDEgMS41LTEuNUExLjUgMS41IDAgMCAxIDkgMTZ6bS45OC00LjgwNmExIDEgMCAwIDEtMS45NiAwbC0uOTktNUExIDEgMCAwIDEgOC4wMSA1aDEuOTgzYTEgMSAwIDAgMSAuOTggMS4xOTR6Ii8+Cjwvc3ZnPgo=");
|
14
14
|
background-position: top 12px right 18px;
|
@@ -1,27 +1,27 @@
|
|
1
|
-
@
|
1
|
+
@use "../colors/colors.scss";
|
2
2
|
|
3
3
|
@mixin d2l-link() {
|
4
4
|
&,
|
5
5
|
&:visited,
|
6
6
|
&:link,
|
7
7
|
&:active {
|
8
|
-
color:
|
8
|
+
color: colors.$d2l-color-celestine;
|
9
9
|
cursor: pointer;
|
10
10
|
text-decoration: none;
|
11
11
|
}
|
12
12
|
&:hover {
|
13
|
-
color:
|
13
|
+
color: colors.$d2l-color-celestine-minus-1;
|
14
14
|
text-decoration: underline;
|
15
15
|
}
|
16
16
|
&:focus-visible {
|
17
17
|
border-radius: 2px;
|
18
|
-
outline: 2px solid
|
18
|
+
outline: 2px solid colors.$d2l-color-celestine;
|
19
19
|
outline-offset: 1px;
|
20
20
|
text-decoration: underline;
|
21
21
|
}
|
22
22
|
.d2l-focus-visible-not-supported &:focus {
|
23
23
|
border-radius: 2px;
|
24
|
-
outline: 2px solid
|
24
|
+
outline: 2px solid colors.$d2l-color-celestine;
|
25
25
|
outline-offset: 1px;
|
26
26
|
text-decoration: underline;
|
27
27
|
}
|
@@ -36,7 +36,7 @@
|
|
36
36
|
}
|
37
37
|
@media print {
|
38
38
|
&, &:visited, &:link, &:active {
|
39
|
-
color:
|
39
|
+
color: colors.$d2l-color-ferrite;
|
40
40
|
}
|
41
41
|
}
|
42
42
|
}
|
@@ -1,8 +1,8 @@
|
|
1
|
-
@
|
1
|
+
@use "../colors/colors.scss";
|
2
2
|
|
3
3
|
@mixin d2l-typography {
|
4
4
|
|
5
|
-
color:
|
5
|
+
color: colors.$d2l-color-ferrite;
|
6
6
|
display: block;
|
7
7
|
font-family: "Lato", "Lucida Sans Unicode", "Lucida Grande", sans-serif;
|
8
8
|
font-size: 0.95rem;
|
@@ -108,7 +108,7 @@
|
|
108
108
|
}
|
109
109
|
|
110
110
|
@mixin d2l-body-small {
|
111
|
-
color:
|
111
|
+
color: colors.$d2l-color-tungsten;
|
112
112
|
font-size: 0.7rem;
|
113
113
|
font-weight: 400;
|
114
114
|
line-height: 1rem;
|
package/custom-elements.json
CHANGED
@@ -6847,12 +6847,12 @@
|
|
6847
6847
|
},
|
6848
6848
|
{
|
6849
6849
|
"name": "pattern",
|
6850
|
-
"description": "Regular expression pattern to validate the value",
|
6850
|
+
"description": "ADVANCED: Regular expression pattern to validate the value",
|
6851
6851
|
"type": "string"
|
6852
6852
|
},
|
6853
6853
|
{
|
6854
6854
|
"name": "pattern-failure-text",
|
6855
|
-
"description": "Text to display when input fails validation against the pattern",
|
6855
|
+
"description": "ADVANCED: Text to display when input fails validation against the pattern. If a list of characters is included in the message, use `LocalizeMixin`'s `localizeCharacter`.",
|
6856
6856
|
"type": "string"
|
6857
6857
|
},
|
6858
6858
|
{
|
@@ -7013,13 +7013,13 @@
|
|
7013
7013
|
{
|
7014
7014
|
"name": "pattern",
|
7015
7015
|
"attribute": "pattern",
|
7016
|
-
"description": "Regular expression pattern to validate the value",
|
7016
|
+
"description": "ADVANCED: Regular expression pattern to validate the value",
|
7017
7017
|
"type": "string"
|
7018
7018
|
},
|
7019
7019
|
{
|
7020
7020
|
"name": "patternFailureText",
|
7021
7021
|
"attribute": "pattern-failure-text",
|
7022
|
-
"description": "Text to display when input fails validation against the pattern",
|
7022
|
+
"description": "ADVANCED: Text to display when input fails validation against the pattern. If a list of characters is included in the message, use `LocalizeMixin`'s `localizeCharacter`.",
|
7023
7023
|
"type": "string"
|
7024
7024
|
},
|
7025
7025
|
{
|
@@ -152,6 +152,39 @@ this.localizeHTML('octopus', {
|
|
152
152
|
});
|
153
153
|
```
|
154
154
|
|
155
|
+
### Common Resources
|
156
|
+
|
157
|
+
Some localization resources are common and shared across D2L applications. To use these resources, set the `loadCommon` option:
|
158
|
+
|
159
|
+
```javascript
|
160
|
+
static get localizeConfig() {
|
161
|
+
return {
|
162
|
+
loadCommon: true
|
163
|
+
};
|
164
|
+
}
|
165
|
+
```
|
166
|
+
|
167
|
+
#### localizeCharacter
|
168
|
+
|
169
|
+
The localized value of the following characters can be accessed using `localizeCharacter(char)`:
|
170
|
+
* `'` (apostrophe)
|
171
|
+
* `&` (ampersand)
|
172
|
+
* `*` (asterisk)
|
173
|
+
* `\` (backslash)
|
174
|
+
* `:` (colon)
|
175
|
+
* `,` (comma)
|
176
|
+
* `>` (greater-than sign)
|
177
|
+
* `<` (less-than sign)
|
178
|
+
* `#` (number sign)
|
179
|
+
* `%` (percent sign)
|
180
|
+
* `|` (pipe)
|
181
|
+
* `?` (question mark)
|
182
|
+
* `"` (quotation mark)
|
183
|
+
|
184
|
+
```javascript
|
185
|
+
this.localizeCharacter('&'); // -> 'ampersand' in en-US
|
186
|
+
```
|
187
|
+
|
155
188
|
## Off-Stack Language Overrides
|
156
189
|
|
157
190
|
To enable OSLO, map the project's localization resources to a language collection in Brightspace by defining `osloCollection` in `localizeConfig`:
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.71.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",
|
@@ -11,7 +11,7 @@
|
|
11
11
|
"build:clean": "node ./cli/clean.js",
|
12
12
|
"build:icons": "node ./cli/icon-generator.js",
|
13
13
|
"build:illustrations": "node ./cli/empty-state-illustration-generator.js",
|
14
|
-
"build:sass": "
|
14
|
+
"build:sass": "sass ./test/sass.scss > ./test/sass.output.css",
|
15
15
|
"build:wca": "wca analyze \"{components,templates}/**/*.js\" --format json --outFile custom-elements.json",
|
16
16
|
"build": "npm run build:clean && npm run build:icons && npm run build:illustrations && npm run build:sass && npm run build:wca",
|
17
17
|
"build-static": "rollup -c ./rollup/rollup.config.js",
|
@@ -59,10 +59,10 @@
|
|
59
59
|
"eslint-config-brightspace": "^1.2.1",
|
60
60
|
"glob-all": "^3",
|
61
61
|
"messageformat-validator": "^2",
|
62
|
-
"node-sass": "^9",
|
63
62
|
"rollup": "^4",
|
64
63
|
"rollup-plugin-copy": "^3",
|
65
64
|
"rollup-plugin-delete": "^2",
|
65
|
+
"sass": "^1",
|
66
66
|
"sinon": "^19",
|
67
67
|
"stylelint": "^16",
|
68
68
|
"web-component-analyzer": "^2"
|