@brightspace-ui/core 3.169.1 → 3.170.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.
@@ -17,15 +17,17 @@
|
|
17
17
|
|
18
18
|
<d2l-demo-snippet>
|
19
19
|
<template>
|
20
|
-
<d2l-progress label="Progress" value="
|
20
|
+
<d2l-progress label="Progress" value="1" max="3"></d2l-progress>
|
21
21
|
</template>
|
22
22
|
</d2l-demo-snippet>
|
23
23
|
|
24
|
-
<h2>
|
24
|
+
<h2>Sizes</h2>
|
25
25
|
|
26
26
|
<d2l-demo-snippet>
|
27
27
|
<template>
|
28
|
-
<d2l-progress small label="
|
28
|
+
<d2l-progress size="small" label="Small" value="8" max="10"></d2l-progress>
|
29
|
+
<d2l-progress size="medium" label="Medium(default)" value="8" max="10"></d2l-progress>
|
30
|
+
<d2l-progress size="large" label="Large" value="8" max="10"></d2l-progress>
|
29
31
|
</template>
|
30
32
|
</d2l-demo-snippet>
|
31
33
|
|
@@ -57,7 +59,7 @@
|
|
57
59
|
|
58
60
|
<d2l-demo-snippet>
|
59
61
|
<template>
|
60
|
-
<d2l-progress label="Progress" value-hidden label-hidden
|
62
|
+
<d2l-progress label="Progress" value-hidden label-hidden value="50"></d2l-progress>
|
61
63
|
</template>
|
62
64
|
</d2l-demo-snippet>
|
63
65
|
|
@@ -3,10 +3,10 @@ import { bodyCompactStyles, bodySmallStyles } from '../typography/styles.js';
|
|
3
3
|
import { css, html, LitElement, unsafeCSS } from 'lit';
|
4
4
|
import { classMap } from 'lit/directives/class-map.js';
|
5
5
|
import { formatPercent } from '@brightspace-ui/intl';
|
6
|
-
import { getSeparator } from '@brightspace-ui/intl/lib/list.js';
|
7
6
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
7
|
+
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
8
8
|
|
9
|
-
class Progress extends LitElement {
|
9
|
+
class Progress extends LocalizeCoreElement(LitElement) {
|
10
10
|
|
11
11
|
static get properties() {
|
12
12
|
return {
|
@@ -36,26 +36,30 @@ class Progress extends LitElement {
|
|
36
36
|
*/
|
37
37
|
valueHidden: { type: Boolean, attribute: 'value-hidden' },
|
38
38
|
/**
|
39
|
-
*
|
40
|
-
* @type {
|
39
|
+
* The size of the progress bar
|
40
|
+
* @type {'small'|'medium'|'large'}
|
41
41
|
*/
|
42
|
-
|
42
|
+
size: { type: String, reflect: true },
|
43
43
|
};
|
44
44
|
}
|
45
45
|
|
46
46
|
static get styles() {
|
47
47
|
return [bodySmallStyles, bodyCompactStyles, css`
|
48
48
|
:host {
|
49
|
-
|
49
|
+
align-items: center;
|
50
|
+
display: flex;
|
51
|
+
flex-wrap: wrap;
|
50
52
|
min-width: 6rem;
|
51
53
|
}
|
52
|
-
:host([hidden])
|
53
|
-
.text[hidden] {
|
54
|
+
:host([hidden]) {
|
54
55
|
display: none;
|
55
56
|
}
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
:host([value-hidden]) {
|
58
|
+
row-gap: 0.3rem;
|
59
|
+
}
|
60
|
+
|
61
|
+
#label {
|
62
|
+
flex: 1 0 100%;
|
59
63
|
}
|
60
64
|
|
61
65
|
progress {
|
@@ -68,11 +72,36 @@ class Progress extends LitElement {
|
|
68
72
|
border-radius: 0.9rem;
|
69
73
|
box-shadow: inset 0 2px var(--d2l-color-mica);
|
70
74
|
display: block;
|
71
|
-
|
72
|
-
width: 100%;
|
73
|
-
}
|
74
|
-
:host([small]) progress {
|
75
|
+
flex: 1;
|
75
76
|
height: 0.6rem;
|
77
|
+
margin-inline-end: 0.4rem;
|
78
|
+
}
|
79
|
+
.value {
|
80
|
+
text-align: end;
|
81
|
+
width: 2.42rem;
|
82
|
+
}
|
83
|
+
|
84
|
+
:host([size="small"]) {
|
85
|
+
progress {
|
86
|
+
height: 0.3rem;
|
87
|
+
margin-inline-end: 0.3rem;
|
88
|
+
}
|
89
|
+
|
90
|
+
.value {
|
91
|
+
width: 2.15rem;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
:host([size="large"]) {
|
96
|
+
line-height: 1.5rem;
|
97
|
+
progress {
|
98
|
+
height: 0.9rem;
|
99
|
+
margin-inline-end: 0.5rem;
|
100
|
+
}
|
101
|
+
|
102
|
+
.value {
|
103
|
+
width: 2.82rem;
|
104
|
+
}
|
76
105
|
}
|
77
106
|
|
78
107
|
progress.complete {
|
@@ -90,10 +119,7 @@ class Progress extends LitElement {
|
|
90
119
|
background-color: var(--d2l-progress-color);
|
91
120
|
border: 1px solid transparent;
|
92
121
|
border-radius: 0.9rem;
|
93
|
-
transition: width 0.
|
94
|
-
}
|
95
|
-
progress.complete::${unsafeCSS(selector)} {
|
96
|
-
transition: none;
|
122
|
+
transition: width 0.4s ease-out;
|
97
123
|
}
|
98
124
|
/* these are necessary to avoid showing border when value is 0 */
|
99
125
|
progress[value="0"]::${unsafeCSS(selector)} {
|
@@ -114,7 +140,7 @@ class Progress extends LitElement {
|
|
114
140
|
this.max = 100;
|
115
141
|
this.value = 0;
|
116
142
|
this.valueHidden = false;
|
117
|
-
this.
|
143
|
+
this.size = 'medium';
|
118
144
|
}
|
119
145
|
|
120
146
|
render() {
|
@@ -122,20 +148,16 @@ class Progress extends LitElement {
|
|
122
148
|
'complete': this.value === this.max
|
123
149
|
};
|
124
150
|
const textClasses = {
|
125
|
-
'
|
126
|
-
'd2l-body-
|
127
|
-
'd2l-body-compact': !this.small
|
151
|
+
'd2l-body-small': this.size === 'small',
|
152
|
+
'd2l-body-compact': this.size === 'medium'
|
128
153
|
};
|
154
|
+
const valueClasses = { ...textClasses, value: true };
|
129
155
|
|
130
156
|
const percentage = Math.floor(100 * this.value / this.max) / 100;
|
131
157
|
const perecentageText = formatPercent(percentage);
|
132
158
|
|
133
159
|
return html`
|
134
|
-
<div class=${classMap(textClasses)}
|
135
|
-
<span ?hidden=${this.labelHidden} id="label">${this.label}</span>
|
136
|
-
<span style="font-size: 0;">${getSeparator({ nonBreaking: true })}</span>
|
137
|
-
<span ?hidden=${this.valueHidden}>${perecentageText}</span>
|
138
|
-
</div>
|
160
|
+
<div ?hidden=${this.labelHidden} id="label" class=${classMap(textClasses)}>${this.label}</div>
|
139
161
|
<progress
|
140
162
|
aria-labelledby="${ifDefined(this.labelHidden ? undefined : 'label')}"
|
141
163
|
aria-label="${ifDefined(this.labelHidden ? this.label : undefined)}"
|
@@ -144,6 +166,8 @@ class Progress extends LitElement {
|
|
144
166
|
value="${this.value}"
|
145
167
|
max="${this.max}">
|
146
168
|
</progress>
|
169
|
+
<div ?hidden=${this.valueHidden} class=${classMap(valueClasses)}>${perecentageText}</div>
|
170
|
+
|
147
171
|
`;
|
148
172
|
}
|
149
173
|
|
package/custom-elements.json
CHANGED
@@ -11851,10 +11851,10 @@
|
|
11851
11851
|
"default": "false"
|
11852
11852
|
},
|
11853
11853
|
{
|
11854
|
-
"name": "
|
11855
|
-
"description": "
|
11856
|
-
"type": "
|
11857
|
-
"default": "
|
11854
|
+
"name": "size",
|
11855
|
+
"description": "The size of the progress bar",
|
11856
|
+
"type": "'small'|'medium'|'large'",
|
11857
|
+
"default": "\"medium\""
|
11858
11858
|
}
|
11859
11859
|
],
|
11860
11860
|
"properties": [
|
@@ -11893,11 +11893,11 @@
|
|
11893
11893
|
"default": "false"
|
11894
11894
|
},
|
11895
11895
|
{
|
11896
|
-
"name": "
|
11897
|
-
"attribute": "
|
11898
|
-
"description": "
|
11899
|
-
"type": "
|
11900
|
-
"default": "
|
11896
|
+
"name": "size",
|
11897
|
+
"attribute": "size",
|
11898
|
+
"description": "The size of the progress bar",
|
11899
|
+
"type": "'small'|'medium'|'large'",
|
11900
|
+
"default": "\"medium\""
|
11901
11901
|
}
|
11902
11902
|
]
|
11903
11903
|
},
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.170.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",
|