@brightspace-ui/core 1.173.0 → 1.175.1
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/components/backdrop/README.md +19 -16
- package/components/breadcrumbs/README.md +38 -24
- package/components/inputs/docs/input-date-time.md +3 -1
- package/components/inputs/input-date-time-range.js +17 -9
- package/components/inputs/input-date-time.js +1 -1
- package/components/inputs/input-date.js +22 -3
- package/components/inputs/input-time.js +2 -2
- package/components/loading-spinner/README.md +17 -1
- package/components/status-indicator/README.md +70 -53
- package/components/typography/typography.js +1 -1
- package/components/typography/typography.scss +1 -1
- package/custom-elements.json +28 -2
- package/package.json +1 -1
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
# Backdrop
|
|
2
|
-
|
|
3
|
-
## d2l-backdrop
|
|
1
|
+
# Backdrop [d2l-backdrop]
|
|
4
2
|
|
|
5
3
|
The `d2l-backdrop` element is a web component to display a semi-transparent backdrop behind a specified sibling element. It also hides elements other than the target from assistive technologies by applying `role="presentation"` and `aria-hidden="true"`.
|
|
6
4
|
|
|
5
|
+
<!-- docs: demo live name:d2l-backdrop size:small -->
|
|
7
6
|
```html
|
|
8
7
|
<script type="module">
|
|
8
|
+
import '@brightspace-ui/core/components/button/button.js';
|
|
9
9
|
import '@brightspace-ui/core/components/backdrop/backdrop.js';
|
|
10
|
+
import '@brightspace-ui/core/components/switch/switch.js';
|
|
10
11
|
</script>
|
|
11
12
|
<style>
|
|
12
|
-
#target { position: relative; z-index: 1000; }
|
|
13
|
+
#target { position: relative; z-index: 1000; margin: 40px; }
|
|
13
14
|
</style>
|
|
14
|
-
|
|
15
|
-
<div id="target"><button>
|
|
16
|
-
<d2l-backdrop for-target="target"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
<div>
|
|
16
|
+
<div id="target"><d2l-button primary>Toggle backdrop</d2l-button></div>
|
|
17
|
+
<d2l-backdrop for-target="target"></d2l-backdrop>
|
|
18
|
+
</div>
|
|
19
|
+
<span>Background content</span>
|
|
20
|
+
<script>
|
|
21
|
+
const backdrop = document.querySelector('d2l-backdrop');
|
|
22
|
+
document.querySelector('#target > d2l-button').addEventListener('click', () => {
|
|
23
|
+
backdrop.shown = !backdrop.shown;
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
25
26
|
```
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
<!-- docs: start hidden content -->
|
|
29
|
+
### Properties:
|
|
28
30
|
|
|
29
31
|
| Property | Type | Description |
|
|
30
32
|
|--|--|--|
|
|
@@ -36,3 +38,4 @@ button.addEventListener('click', () => {
|
|
|
36
38
|
## Future Enhancements
|
|
37
39
|
|
|
38
40
|
Looking for an enhancement not listed here? Create a GitHub issue!
|
|
41
|
+
<!-- docs: end hidden content -->
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Breadcrumbs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Breadcrumbs are a way-finding tool that helps users understand where they are within an application, while also offering an easy way to navigate "up" to higher level pages.
|
|
4
4
|
|
|
5
5
|
<!-- docs: start hidden content -->
|
|
6
6
|

|
|
@@ -9,32 +9,47 @@ The `d2l-breadcrumbs` element can be used to help users understand where they ar
|
|
|
9
9
|
<!-- docs: demo display:block -->
|
|
10
10
|
```html
|
|
11
11
|
<script type="module">
|
|
12
|
-
import '@brightspace-ui/core/components/breadcrumbs/breadcrumb-current-page.js';
|
|
13
12
|
import '@brightspace-ui/core/components/breadcrumbs/breadcrumbs.js';
|
|
14
13
|
</script>
|
|
15
14
|
<d2l-breadcrumbs>
|
|
16
|
-
<d2l-breadcrumb text="Item 1" href="
|
|
17
|
-
<d2l-breadcrumb text="Item 2" href="
|
|
18
|
-
<d2l-breadcrumb
|
|
15
|
+
<d2l-breadcrumb text="Item 1" href="#"></d2l-breadcrumb>
|
|
16
|
+
<d2l-breadcrumb text="Item 2" href="#"></d2l-breadcrumb>
|
|
17
|
+
<d2l-breadcrumb text="Item 3" href="#"></d2l-breadcrumb>
|
|
19
18
|
</d2l-breadcrumbs>
|
|
20
19
|
```
|
|
21
20
|
|
|
22
21
|
## Best Practices
|
|
23
22
|
<!-- docs: start best practices -->
|
|
24
23
|
<!-- docs: start dos -->
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* Structure breadcrumbs around information architecture rather than the user's browsing history
|
|
25
|
+
* Keep breadcrumbs short and sweet; it's okay to simplify language in a breadcrumb
|
|
27
26
|
<!-- docs: end dos -->
|
|
28
27
|
|
|
29
28
|
<!-- docs: start donts -->
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* Don't repeat the current page name in the breadcrumb
|
|
30
|
+
* Avoid displaying more than one breadcrumb control on a page
|
|
31
|
+
* Don't use breadcrumbs as a stepper, see [Wizards](https://github.com/BrightspaceUILabs/wizard) instead
|
|
32
32
|
<!-- docs: end donts -->
|
|
33
33
|
<!-- docs: end best practices -->
|
|
34
34
|
|
|
35
35
|
## Responsive Behavior
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
Breadcrumbs that overflow their container will appear to fade at the edge.
|
|
38
|
+
|
|
39
|
+
<!-- docs: demo display:block -->
|
|
40
|
+
```html
|
|
41
|
+
<script type="module">
|
|
42
|
+
import '@brightspace-ui/core/components/breadcrumbs/breadcrumbs.js';
|
|
43
|
+
</script>
|
|
44
|
+
<d2l-breadcrumbs>
|
|
45
|
+
<d2l-breadcrumb text="Table of Contents" href="#"></d2l-breadcrumb>
|
|
46
|
+
<d2l-breadcrumb text="Unit 1: Shakespeare" href="#"></d2l-breadcrumb>
|
|
47
|
+
<d2l-breadcrumb text="Lesson 1: Introduction" href="#"></d2l-breadcrumb>
|
|
48
|
+
<d2l-breadcrumb text="The Comedies, Tragedies, and Histories" href="#"></d2l-breadcrumb>
|
|
49
|
+
</d2l-breadcrumbs>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This works well for mobile or other touch devices but not as well for mouse or keyboard users, so we have two other options for managing width.
|
|
38
53
|
|
|
39
54
|
### Limited Width
|
|
40
55
|
|
|
@@ -50,8 +65,8 @@ Set a `max-width` to constrain breadcrumbs to a particular width:
|
|
|
50
65
|
import '@brightspace-ui/core/components/breadcrumbs/breadcrumbs.js';
|
|
51
66
|
</script>
|
|
52
67
|
<d2l-breadcrumbs style="max-width: 250px">
|
|
53
|
-
<d2l-breadcrumb text="Trucate Basic Item 1" href="
|
|
54
|
-
<d2l-breadcrumb text="Truncate Basic Item 2" href="
|
|
68
|
+
<d2l-breadcrumb text="Trucate Basic Item 1" href="#"></d2l-breadcrumb>
|
|
69
|
+
<d2l-breadcrumb text="Truncate Basic Item 2" href="#"></d2l-breadcrumb>
|
|
55
70
|
</d2l-breadcrumbs>
|
|
56
71
|
```
|
|
57
72
|
|
|
@@ -63,15 +78,15 @@ Set a `max-width` to constrain breadcrumbs to a particular width:
|
|
|
63
78
|
|
|
64
79
|
Alternately, add the `compact` attribute to only display the last breadcrumb. The `d2l-breadcrumb-current-page` will be hidden:
|
|
65
80
|
|
|
66
|
-
<!-- docs: demo code -->
|
|
81
|
+
<!-- docs: demo code display:block -->
|
|
67
82
|
```html
|
|
68
83
|
<script type="module">
|
|
69
84
|
import '@brightspace-ui/core/components/breadcrumbs/breadcrumb-current-page.js';
|
|
70
85
|
import '@brightspace-ui/core/components/breadcrumbs/breadcrumbs.js';
|
|
71
86
|
</script>
|
|
72
87
|
<d2l-breadcrumbs compact>
|
|
73
|
-
<d2l-breadcrumb text="Item 1" href="
|
|
74
|
-
<d2l-breadcrumb text="Item 2" href="
|
|
88
|
+
<d2l-breadcrumb text="Item 1" href="#"></d2l-breadcrumb>
|
|
89
|
+
<d2l-breadcrumb text="Item 2" href="#"></d2l-breadcrumb>
|
|
75
90
|
<d2l-breadcrumb-current-page text="Current Page"></d2l-breadcrumb-current-page>
|
|
76
91
|
</d2l-breadcrumbs>
|
|
77
92
|
```
|
|
@@ -84,9 +99,9 @@ Alternately, add the `compact` attribute to only display the last breadcrumb. Th
|
|
|
84
99
|
import '@brightspace-ui/core/components/breadcrumbs/breadcrumbs.js';
|
|
85
100
|
</script>
|
|
86
101
|
<d2l-breadcrumbs>
|
|
87
|
-
<d2l-breadcrumb text="Item 1" href="
|
|
88
|
-
<d2l-breadcrumb text="Item 2" href="
|
|
89
|
-
<d2l-breadcrumb text="Item 3" href="
|
|
102
|
+
<d2l-breadcrumb text="Item 1" href="#"></d2l-breadcrumb>
|
|
103
|
+
<d2l-breadcrumb text="Item 2" href="#"></d2l-breadcrumb>
|
|
104
|
+
<d2l-breadcrumb text="Item 3" href="#"></d2l-breadcrumb>
|
|
90
105
|
</d2l-breadcrumbs>
|
|
91
106
|
```
|
|
92
107
|
|
|
@@ -106,7 +121,7 @@ Alternately, add the `compact` attribute to only display the last breadcrumb. Th
|
|
|
106
121
|
import '@brightspace-ui/core/components/breadcrumbs/breadcrumbs.js';
|
|
107
122
|
</script>
|
|
108
123
|
<d2l-breadcrumbs>
|
|
109
|
-
<d2l-breadcrumb text="Item 1" href="
|
|
124
|
+
<d2l-breadcrumb text="Item 1" href="#"></d2l-breadcrumb>
|
|
110
125
|
</d2l-breadcrumbs>
|
|
111
126
|
```
|
|
112
127
|
|
|
@@ -131,9 +146,7 @@ To make your usage of `d2l-breadcrumb` (child) accessible, use the following att
|
|
|
131
146
|
|
|
132
147
|
## Current Page [d2l-breadcrumb-current-page]
|
|
133
148
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
Use the `d2l-breadcrumb-current-page` element for this:
|
|
149
|
+
Older pages or tools include the current page name at the end of the breadcrumb, even though this is not best practice going forward. Use the d2l-breadcrumb-current-page if you need to replicate this in a legacy page:
|
|
137
150
|
|
|
138
151
|
<!-- docs: demo live name:d2l-breadcrumb-current-page display:block -->
|
|
139
152
|
```html
|
|
@@ -142,8 +155,9 @@ Use the `d2l-breadcrumb-current-page` element for this:
|
|
|
142
155
|
import '@brightspace-ui/core/components/breadcrumbs/breadcrumbs.js';
|
|
143
156
|
</script>
|
|
144
157
|
<d2l-breadcrumbs>
|
|
145
|
-
<d2l-breadcrumb text="Item 1" href="
|
|
146
|
-
<d2l-breadcrumb text="Item 2" href="
|
|
158
|
+
<d2l-breadcrumb text="Item 1" href="#"></d2l-breadcrumb>
|
|
159
|
+
<d2l-breadcrumb text="Item 2" href="#"></d2l-breadcrumb>
|
|
147
160
|
<d2l-breadcrumb-current-page text="Current Page"></d2l-breadcrumb-current-page>
|
|
148
161
|
</d2l-breadcrumbs>
|
|
149
162
|
```
|
|
163
|
+
|
|
@@ -272,7 +272,7 @@ size:xlarge
|
|
|
272
272
|
| `localized` | Boolean | Indicates that any timezone localization will be handeld by the consumer and so any values will not be converted from/to UTC |
|
|
273
273
|
| `max-value` | String | Maximum valid date/time that could be selected by a user |
|
|
274
274
|
| `min-value` | String | Minimum valid date/time that could be selected by a user |
|
|
275
|
-
| `opened` | Boolean |
|
|
275
|
+
| `opened` | Boolean | Indicates if the date or time dropdown is open |
|
|
276
276
|
| `required` | Boolean | Indicates that a value is required |
|
|
277
277
|
| `time-default-value`| String, default:`'00:00:00'` | Set default value of time input. Accepts ISO 8601 time format (`hh:mm:ss`) and the following keywords: `startOfDay`,`endOfDay`. |
|
|
278
278
|
| `value` | String, default `''` | Value of the input. |
|
|
@@ -324,11 +324,13 @@ size:xlarge
|
|
|
324
324
|
| `child-labels-hidden` | Boolean | Visually hides the labels for start and end date-time inputs |
|
|
325
325
|
| `disabled` | Boolean | Disables the inputs |
|
|
326
326
|
| `end-label` | String, default `'End Date'` | Accessible label for the second date-time input |
|
|
327
|
+
| `end-opened` | Boolean | Indicates if the end date or time dropdown is open |
|
|
327
328
|
| `end-value` | String, default `''` | Value of the second date-time input |
|
|
328
329
|
| `inclusive-date-range` | Boolean | Validate on inclusive range (i.e., it is valid for start and end date-times to be equal) |
|
|
329
330
|
| `label-hidden` | Boolean | Hides the fieldset label visually |
|
|
330
331
|
| `required` | Boolean | Indicates that values are required |
|
|
331
332
|
| `start-label` | String, default `'Start Date'` | Accessible label for the first date-time input |
|
|
333
|
+
| `start-opened` | Boolean | Indicates if the start date or time dropdown is open |
|
|
332
334
|
| `start-value` | String, default `''` | Value of the first date-time input |
|
|
333
335
|
|
|
334
336
|
### Events
|
|
@@ -85,6 +85,10 @@ class InputDateTimeRange extends SkeletonMixin(FormElementMixin(RtlMixin(Localiz
|
|
|
85
85
|
* @default "End Date"
|
|
86
86
|
*/
|
|
87
87
|
endLabel: { attribute: 'end-label', reflect: true, type: String },
|
|
88
|
+
/**
|
|
89
|
+
* Indicates if the end date or time dropdown is open
|
|
90
|
+
*/
|
|
91
|
+
endOpened: { attribute: 'end-opened', type: Boolean },
|
|
88
92
|
/**
|
|
89
93
|
* Value of the end date-time input
|
|
90
94
|
* @type {string}
|
|
@@ -127,14 +131,16 @@ class InputDateTimeRange extends SkeletonMixin(FormElementMixin(RtlMixin(Localiz
|
|
|
127
131
|
* @default "Start Date"
|
|
128
132
|
*/
|
|
129
133
|
startLabel: { attribute: 'start-label', reflect: true, type: String },
|
|
134
|
+
/**
|
|
135
|
+
* Indicates if the start date or time dropdown is open
|
|
136
|
+
*/
|
|
137
|
+
startOpened: { attribute: 'start-opened', type: Boolean },
|
|
130
138
|
/**
|
|
131
139
|
* Value of the start date-time input
|
|
132
140
|
* @type {string}
|
|
133
141
|
*/
|
|
134
142
|
startValue: { attribute: 'start-value', reflect: true, type: String },
|
|
135
|
-
|
|
136
|
-
_slotOccupied: { type: Boolean },
|
|
137
|
-
_startDropdownOpened: { type: Boolean }
|
|
143
|
+
_slotOccupied: { type: Boolean }
|
|
138
144
|
};
|
|
139
145
|
}
|
|
140
146
|
|
|
@@ -162,14 +168,14 @@ class InputDateTimeRange extends SkeletonMixin(FormElementMixin(RtlMixin(Localiz
|
|
|
162
168
|
this.autoShiftDates = false;
|
|
163
169
|
this.childLabelsHidden = false;
|
|
164
170
|
this.disabled = false;
|
|
171
|
+
this.endOpened = false;
|
|
165
172
|
this.inclusiveDateRange = false;
|
|
166
173
|
this.labelHidden = false;
|
|
167
174
|
this.localized = false;
|
|
168
175
|
this.required = false;
|
|
176
|
+
this.startOpened = false;
|
|
169
177
|
|
|
170
|
-
this._startDropdownOpened = false;
|
|
171
178
|
this._startInputId = getUniqueId();
|
|
172
|
-
this._endDropdownOpened = false;
|
|
173
179
|
this._endInputId = getUniqueId();
|
|
174
180
|
|
|
175
181
|
this._slotOccupied = false;
|
|
@@ -197,8 +203,8 @@ class InputDateTimeRange extends SkeletonMixin(FormElementMixin(RtlMixin(Localiz
|
|
|
197
203
|
const startDateTimeInput = this.shadowRoot.querySelector('.d2l-input-date-time-range-start');
|
|
198
204
|
const endDateTimeInput = this.shadowRoot.querySelector('.d2l-input-date-time-range-end');
|
|
199
205
|
|
|
200
|
-
const tooltipStart = (this.validationError && !this.
|
|
201
|
-
const tooltipEnd = (this.validationError && !this.
|
|
206
|
+
const tooltipStart = (this.validationError && !this.startOpened && !this.childErrors.has(startDateTimeInput)) ? html`<d2l-tooltip align="start" announced for="${this._startInputId}" position="bottom" state="error">${this.validationError}</d2l-tooltip>` : null;
|
|
207
|
+
const tooltipEnd = (this.validationError && !this.endOpened && !this.childErrors.has(endDateTimeInput)) ? html`<d2l-tooltip align="start" announced for="${this._endInputId}" position="bottom" state="error">${this.validationError}</d2l-tooltip>` : null;
|
|
202
208
|
return html`
|
|
203
209
|
${tooltipStart}
|
|
204
210
|
${tooltipEnd}
|
|
@@ -226,6 +232,7 @@ class InputDateTimeRange extends SkeletonMixin(FormElementMixin(RtlMixin(Localiz
|
|
|
226
232
|
?localized="${this.localized}"
|
|
227
233
|
max-value="${ifDefined(this.maxValue)}"
|
|
228
234
|
min-value="${ifDefined(this.minValue)}"
|
|
235
|
+
?opened="${this.startOpened}"
|
|
229
236
|
?required="${this.required}"
|
|
230
237
|
?skeleton="${this.skeleton}"
|
|
231
238
|
time-default-value="startOfDay"
|
|
@@ -247,6 +254,7 @@ class InputDateTimeRange extends SkeletonMixin(FormElementMixin(RtlMixin(Localiz
|
|
|
247
254
|
?localized="${this.localized}"
|
|
248
255
|
max-value="${ifDefined(this.maxValue)}"
|
|
249
256
|
min-value="${ifDefined(this.minValue)}"
|
|
257
|
+
?opened="${this.endOpened}"
|
|
250
258
|
?required="${this.required}"
|
|
251
259
|
?skeleton="${this.skeleton}"
|
|
252
260
|
time-default-value="endOfDay"
|
|
@@ -325,9 +333,9 @@ class InputDateTimeRange extends SkeletonMixin(FormElementMixin(RtlMixin(Localiz
|
|
|
325
333
|
|
|
326
334
|
_handleDropdownToggle(e) {
|
|
327
335
|
if (e.target.classList.contains('d2l-input-date-time-range-start')) {
|
|
328
|
-
this.
|
|
336
|
+
this.startOpened = e.detail.opened;
|
|
329
337
|
} else {
|
|
330
|
-
this.
|
|
338
|
+
this.endOpened = e.detail.opened;
|
|
331
339
|
}
|
|
332
340
|
}
|
|
333
341
|
|
|
@@ -70,7 +70,7 @@ class InputDateTime extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(R
|
|
|
70
70
|
*/
|
|
71
71
|
minValue: { attribute: 'min-value', reflect: true, type: String },
|
|
72
72
|
/**
|
|
73
|
-
*
|
|
73
|
+
* Indicates if the date or time dropdown is open
|
|
74
74
|
*/
|
|
75
75
|
opened: { type: Boolean },
|
|
76
76
|
/**
|
|
@@ -16,6 +16,8 @@ import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
|
|
|
16
16
|
import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
|
|
17
17
|
import { styleMap } from 'lit-html/directives/style-map.js';
|
|
18
18
|
|
|
19
|
+
const mediaQueryList = window.matchMedia('(max-width: 615px)');
|
|
20
|
+
|
|
19
21
|
export function formatISODateInUserCalDescriptor(val) {
|
|
20
22
|
return formatDate(getDateFromISODate(val));
|
|
21
23
|
}
|
|
@@ -148,6 +150,8 @@ class InputDate extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(LitEl
|
|
|
148
150
|
this._inputTextFocusMouseup = false;
|
|
149
151
|
this._inputTextFocusShowTooltip = true; // true by default so hover triggers tooltip
|
|
150
152
|
this._namespace = 'components.input-date';
|
|
153
|
+
this._openCalendarOnly = false;
|
|
154
|
+
this._openedOnKeydown = false;
|
|
151
155
|
this._showInfoTooltip = true;
|
|
152
156
|
this._shownValue = '';
|
|
153
157
|
|
|
@@ -232,7 +236,7 @@ class InputDate extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(LitEl
|
|
|
232
236
|
@d2l-dropdown-focus-enter="${this._handleFocusTrapEnter}"
|
|
233
237
|
max-width="335"
|
|
234
238
|
min-height="${this._hiddenCalendarHeight}"
|
|
235
|
-
no-auto-fit
|
|
239
|
+
?no-auto-fit="${!mediaQueryList.matches}"
|
|
236
240
|
trap-focus
|
|
237
241
|
no-auto-focus
|
|
238
242
|
mobile-tray="bottom"
|
|
@@ -438,13 +442,15 @@ class InputDate extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(LitEl
|
|
|
438
442
|
_handleKeydown(e) {
|
|
439
443
|
// open dropdown on down arrow or enter and focus on calendar focus date
|
|
440
444
|
if (e.keyCode === 40 || e.keyCode === 13) {
|
|
445
|
+
this._openedOnKeydown = true;
|
|
441
446
|
this.opened = true;
|
|
442
447
|
e.preventDefault();
|
|
443
448
|
}
|
|
444
449
|
}
|
|
445
450
|
|
|
446
|
-
_handleMouseup() {
|
|
451
|
+
_handleMouseup(e) {
|
|
447
452
|
this._inputTextFocusMouseup = true;
|
|
453
|
+
this._openCalendarOnly = e.srcElement.tagName.toLowerCase() === 'd2l-icon';
|
|
448
454
|
this.opened = !this.opened;
|
|
449
455
|
}
|
|
450
456
|
|
|
@@ -461,13 +467,26 @@ class InputDate extends SkeletonMixin(FormElementMixin(LocalizeCoreElement(LitEl
|
|
|
461
467
|
|
|
462
468
|
await this._handleChange();
|
|
463
469
|
|
|
464
|
-
if
|
|
470
|
+
// on small screens, only open calendar if calendar icon is selected,
|
|
471
|
+
// otherwise only open text input
|
|
472
|
+
if (mediaQueryList.matches && this._openCalendarOnly) {
|
|
473
|
+
this._dropdown.toggleOpen(true);
|
|
474
|
+
} else if (mediaQueryList.matches && !this._openCalendarOnly && !this._openedOnKeydown) {
|
|
475
|
+
this._openCalendarOnly = false;
|
|
476
|
+
this._openedOnKeydown = false;
|
|
477
|
+
this.opened = false;
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
else if (this._inputTextFocusMouseup) {
|
|
465
481
|
this._dropdown.open(false);
|
|
466
482
|
} else {
|
|
467
483
|
this._dropdown.open();
|
|
468
484
|
this._calendar.focus();
|
|
469
485
|
this._setFormattedValue();
|
|
470
486
|
}
|
|
487
|
+
if (mediaQueryList.matches) this._calendar.focus();
|
|
488
|
+
this._openCalendarOnly = false;
|
|
489
|
+
this._openedOnKeydown = false;
|
|
471
490
|
}
|
|
472
491
|
|
|
473
492
|
_setFormattedValue() {
|
|
@@ -258,7 +258,8 @@ class InputTime extends SkeletonMixin(FormElementMixin(LitElement)) {
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
const hiddenContent = this.shadowRoot.querySelector('.d2l-input-time-hidden-content');
|
|
261
|
-
this.addEventListener('d2l-localize-behavior-language-changed', () => {
|
|
261
|
+
this.addEventListener('d2l-localize-behavior-language-changed', async() => {
|
|
262
|
+
await this.updateComplete;
|
|
262
263
|
this._formattedValue = formatTime(getDateFromISOTime(this.value));
|
|
263
264
|
INTERVALS.clear();
|
|
264
265
|
this.requestUpdate();
|
|
@@ -322,7 +323,6 @@ class InputTime extends SkeletonMixin(FormElementMixin(LitElement)) {
|
|
|
322
323
|
no-padding-footer
|
|
323
324
|
max-height="${ifDefined(this.maxHeight)}"
|
|
324
325
|
min-width="195"
|
|
325
|
-
mobile-tray="bottom"
|
|
326
326
|
?opened="${opened}">
|
|
327
327
|
<d2l-menu
|
|
328
328
|
aria-labelledby="${this._dropdownId}-label"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Loading Spinners
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A loading spinner indicates that something is happening and we don't know how long it will take.
|
|
4
|
+
|
|
4
5
|
<!-- docs: demo name:d2l-loading-spinner -->
|
|
5
6
|
```html
|
|
6
7
|
<script type="module">
|
|
@@ -13,6 +14,21 @@ The loading spinner can be used to indicate to a user that the current page/comp
|
|
|
13
14
|

|
|
14
15
|
<!-- docs: end hidden content -->
|
|
15
16
|
|
|
17
|
+
## Best Practices
|
|
18
|
+
|
|
19
|
+
<!-- docs: start best practices -->
|
|
20
|
+
<!-- docs: start dos -->
|
|
21
|
+
* Use a loading spinner when the user initiates an action with indeterminate length, and it's expected to take longer than a couple seconds
|
|
22
|
+
* Adjust the size proportionally to the area that is being loaded; small for a widget or dropdown, larger for a large list or an entire page
|
|
23
|
+
* For a better user experience, use a Skeleton loader instead when possible
|
|
24
|
+
<!-- docs: end dos -->
|
|
25
|
+
|
|
26
|
+
<!-- docs: start donts -->
|
|
27
|
+
* Don't use a loading spinner it if the user's action is nearly instant, as it may appear to flash or flicker on the screen before disappearing
|
|
28
|
+
* Avoid using multiple spinners on one screen, as this can overwhelm users and create anxiety - see Skeleton loaders instead
|
|
29
|
+
<!-- docs: end donts -->
|
|
30
|
+
<!-- docs: end best practices -->
|
|
31
|
+
|
|
16
32
|
## Loading Spinner [d2l-loading-spinner]
|
|
17
33
|
|
|
18
34
|
<!-- docs: demo live name:d2l-loading-spinner -->
|
|
@@ -11,29 +11,34 @@ Status Indicators are used to communicate the status of an item. They are non-in
|
|
|
11
11
|
import '@brightspace-ui/core/components/status-indicator/status-indicator.js';
|
|
12
12
|
</script>
|
|
13
13
|
<style>
|
|
14
|
-
div {
|
|
15
|
-
width: 100%;
|
|
16
|
-
}
|
|
17
14
|
.status-format {
|
|
18
15
|
display: flex;
|
|
19
|
-
justify-content: space-
|
|
16
|
+
justify-content: space-evenly;
|
|
17
|
+
text-align: center;
|
|
18
|
+
width: 30rem;
|
|
19
|
+
margin: 0px auto;
|
|
20
20
|
}
|
|
21
21
|
d2l-status-indicator {
|
|
22
|
-
margin:
|
|
22
|
+
margin: .6rem;
|
|
23
|
+
display: block;
|
|
23
24
|
}
|
|
24
25
|
</style>
|
|
25
|
-
<div>
|
|
26
|
-
<div class="status-format">
|
|
27
|
-
<d2l-status-indicator state="default" text="due today"></d2l-status-indicator>
|
|
28
|
-
<d2l-status-indicator state="success" text="complete"></d2l-status-indicator>
|
|
29
|
-
<d2l-status-indicator state="alert" text="overdue"></d2l-status-indicator>
|
|
30
|
-
<d2l-status-indicator state="none" text="closed"></d2l-status-indicator>
|
|
31
|
-
</div>
|
|
32
26
|
|
|
33
|
-
|
|
27
|
+
<div class="status-format d2l-typography">
|
|
28
|
+
<div>
|
|
29
|
+
<d2l-status-indicator state="default" text="due today"></d2l-status-indicator>
|
|
34
30
|
<d2l-status-indicator state="default" text="due today" bold></d2l-status-indicator>
|
|
31
|
+
</div>
|
|
32
|
+
<div>
|
|
33
|
+
<d2l-status-indicator state="success" text="complete"></d2l-status-indicator>
|
|
35
34
|
<d2l-status-indicator state="success" text="complete" bold></d2l-status-indicator>
|
|
35
|
+
</div>
|
|
36
|
+
<div>
|
|
37
|
+
<d2l-status-indicator state="alert" text="overdue"></d2l-status-indicator>
|
|
36
38
|
<d2l-status-indicator state="alert" text="overdue" bold></d2l-status-indicator>
|
|
39
|
+
</div>
|
|
40
|
+
<div>
|
|
41
|
+
<d2l-status-indicator state="none" text="closed"></d2l-status-indicator>
|
|
37
42
|
<d2l-status-indicator state="none" text="closed" bold></d2l-status-indicator>
|
|
38
43
|
</div>
|
|
39
44
|
</div>
|
|
@@ -42,16 +47,16 @@ Status Indicators are used to communicate the status of an item. They are non-in
|
|
|
42
47
|
## Best Practices
|
|
43
48
|
<!-- docs: start best practices -->
|
|
44
49
|
<!-- docs: start dos -->
|
|
45
|
-
* Only use when status is critical to the users’ workflow
|
|
46
|
-
* Maintain consistent placement when used in a list
|
|
47
|
-
* Limit text values to one word; 2 max
|
|
50
|
+
* Only use when status is critical to the users’ workflow
|
|
51
|
+
* Maintain consistent placement when used in a list
|
|
52
|
+
* Limit text values to one word; 2 max
|
|
48
53
|
<!-- docs: end dos -->
|
|
49
54
|
|
|
50
55
|
<!-- docs: start donts -->
|
|
51
|
-
* Don't render as a link
|
|
52
|
-
* Don't compose the element such that the user will think that the indicator is interactive
|
|
53
|
-
* Avoid using verbs
|
|
54
|
-
* Don't include additional text in the status badge
|
|
56
|
+
* Don't render as a link; if the user requires a call to action, use a button
|
|
57
|
+
* Don't compose the element such that the user will think that the indicator is interactive
|
|
58
|
+
* Avoid using verbs
|
|
59
|
+
* Don't include additional text in the status badge
|
|
55
60
|
<!-- docs: end donts -->
|
|
56
61
|
<!-- docs: end best practices -->
|
|
57
62
|
|
|
@@ -76,19 +81,28 @@ Status Indicators are used to communicate the status of an item. They are non-in
|
|
|
76
81
|
| `state` | String, default: `default` | State of status indicator to display. Can be one of `default`, `success`, `alert` , `none` |
|
|
77
82
|
<!-- docs: end hidden content -->
|
|
78
83
|
|
|
79
|
-
### Bold
|
|
80
|
-
|
|
84
|
+
### Bold
|
|
85
|
+
|
|
86
|
+
Use the bold style if the state is central to the user's task and should have maximum prominence. Use the default style if the state is important but not critical to the user's workflow. It is acceptable to mix the styles if one particular state should stand out more than the rest.
|
|
87
|
+
|
|
88
|
+
<!-- docs: demo live -->
|
|
81
89
|
```html
|
|
82
90
|
<script type="module">
|
|
83
91
|
import '@brightspace-ui/core/components/status-indicator/status-indicator.js';
|
|
84
92
|
</script>
|
|
85
93
|
<d2l-status-indicator state="alert" text="overdue" bold></d2l-status-indicator>
|
|
86
94
|
```
|
|
87
|
-
Use the bold style if the state is central to the user's task and should have maximum prominence. Use the default style if the state is important but not critical to the user's workflow. It is acceptable to mix the styles if one particular state should stand out more than the rest.
|
|
88
|
-
|
|
89
95
|
|
|
90
96
|
### States
|
|
91
|
-
|
|
97
|
+
|
|
98
|
+
The state is used to apply a meaningful colour to the status indicator to assist with scannability. The visible label should still have a clear meaning so that users who can't see the colour can still understand the state.
|
|
99
|
+
|
|
100
|
+
* **Default** - the state is important but not urgent
|
|
101
|
+
* **Success** - the state is considered positive or complete
|
|
102
|
+
* **Alert** - the state requires urgent attention
|
|
103
|
+
* **None** - the state is not important
|
|
104
|
+
|
|
105
|
+
<!-- docs: demo display:block -->
|
|
92
106
|
```html
|
|
93
107
|
<script type="module">
|
|
94
108
|
import '@brightspace-ui/core/components/status-indicator/status-indicator.js';
|
|
@@ -98,43 +112,48 @@ Use the bold style if the state is central to the user's task and should have m
|
|
|
98
112
|
.status-format {
|
|
99
113
|
display: flex;
|
|
100
114
|
justify-content: space-evenly;
|
|
101
|
-
|
|
115
|
+
text-align: center;
|
|
116
|
+
width: 30rem;
|
|
117
|
+
margin: 0px auto;
|
|
102
118
|
}
|
|
103
119
|
d2l-status-indicator {
|
|
104
|
-
margin:
|
|
120
|
+
margin: .6rem;
|
|
121
|
+
display: block;
|
|
122
|
+
}
|
|
123
|
+
.status-format p {
|
|
124
|
+
margin-top: 0px;
|
|
105
125
|
}
|
|
106
126
|
</style>
|
|
107
|
-
<div>
|
|
108
|
-
<div class="status-format d2l-typography">
|
|
109
|
-
<span class="title">Default</span>
|
|
110
|
-
<span class="title">Success</span>
|
|
111
|
-
<span class="title">Alert</span>
|
|
112
|
-
<span class="title">None</span>
|
|
113
|
-
</div>
|
|
114
|
-
<div class="status-format">
|
|
115
|
-
<d2l-status-indicator state="default" text="due today"></d2l-status-indicator>
|
|
116
|
-
<d2l-status-indicator state="success" text="complete"></d2l-status-indicator>
|
|
117
|
-
<d2l-status-indicator state="alert" text="overdue"></d2l-status-indicator>
|
|
118
|
-
<d2l-status-indicator state="none" text="closed"></d2l-status-indicator>
|
|
119
|
-
</div>
|
|
120
127
|
|
|
121
|
-
|
|
128
|
+
<div class="status-format d2l-typography">
|
|
129
|
+
<div>
|
|
130
|
+
<p class="d2l-label-text">Default</p>
|
|
131
|
+
<d2l-status-indicator state="default" text="due today"></d2l-status-indicator>
|
|
122
132
|
<d2l-status-indicator state="default" text="due today" bold></d2l-status-indicator>
|
|
133
|
+
</div>
|
|
134
|
+
<div>
|
|
135
|
+
<p class="d2l-label-text">Success</p>
|
|
136
|
+
<d2l-status-indicator state="success" text="complete"></d2l-status-indicator>
|
|
123
137
|
<d2l-status-indicator state="success" text="complete" bold></d2l-status-indicator>
|
|
138
|
+
</div>
|
|
139
|
+
<div>
|
|
140
|
+
<p class="d2l-label-text">Alert</p>
|
|
141
|
+
<d2l-status-indicator state="alert" text="overdue"></d2l-status-indicator>
|
|
124
142
|
<d2l-status-indicator state="alert" text="overdue" bold></d2l-status-indicator>
|
|
143
|
+
</div>
|
|
144
|
+
<div>
|
|
145
|
+
<p class="d2l-label-text">None</p>
|
|
146
|
+
<d2l-status-indicator state="none" text="closed"></d2l-status-indicator>
|
|
125
147
|
<d2l-status-indicator state="none" text="closed" bold></d2l-status-indicator>
|
|
126
148
|
</div>
|
|
127
149
|
</div>
|
|
128
|
-
```
|
|
129
|
-
The state is used to apply a meaningful colour to the status indicator to assist with scannability. The visible label should still have a clear meaning so that users who can't see the colour can still understand the state.
|
|
130
150
|
|
|
131
|
-
|
|
132
|
-
* Success - the state is considered positive or complete
|
|
133
|
-
* Alert - the state requires urgent attention
|
|
134
|
-
* None - the state is not important
|
|
151
|
+
```
|
|
135
152
|
|
|
136
153
|
### Content
|
|
137
154
|
|
|
155
|
+
The text label should be kept short; one or two words at most. If more information is needed to explain the state or give extra context, the information should be included after the label and should use the same color to associate the information with the state. When placing additional text on the same line as the status indicator, ensure that the bottom of the text is even across all elements.
|
|
156
|
+
|
|
138
157
|
<!-- docs: demo -->
|
|
139
158
|
```html
|
|
140
159
|
<script type="module">
|
|
@@ -149,8 +168,8 @@ The state is used to apply a meaningful colour to the status indicator to assist
|
|
|
149
168
|
.align-item.bullet::before {
|
|
150
169
|
color: var(--d2l-color-tungsten);
|
|
151
170
|
content: '\002022';
|
|
152
|
-
margin-left:
|
|
153
|
-
margin-right:
|
|
171
|
+
margin-left: 6px;
|
|
172
|
+
margin-right: 6px;
|
|
154
173
|
}
|
|
155
174
|
.card {
|
|
156
175
|
min-width: 300px
|
|
@@ -195,7 +214,8 @@ The state is used to apply a meaningful colour to the status indicator to assist
|
|
|
195
214
|
</h4>
|
|
196
215
|
<div class="indicator">
|
|
197
216
|
<d2l-status-indicator state="alert" text="overdue" bold></d2l-status-indicator>
|
|
198
|
-
|
|
217
|
+
<span class="align-item" style="margin-left: 6px; color: var(--d2l-color-cinnabar);">Ends Tomorrow</span>
|
|
218
|
+
<span class="align-item bullet">Grade 6 Science</span>
|
|
199
219
|
<span class="align-item bullet">Assignment</span>
|
|
200
220
|
</div>
|
|
201
221
|
<div class="d2l-typography text">
|
|
@@ -205,9 +225,6 @@ The state is used to apply a meaningful colour to the status indicator to assist
|
|
|
205
225
|
|
|
206
226
|
</div>
|
|
207
227
|
```
|
|
208
|
-
|
|
209
|
-
The text label should be kept short; one or two words at most. If more information is needed to explain the state or give extra context, the information should be included after the label and should use the same color to associate the information with the state. When placing additional text on the same line as the status indicator, ensure that the bottom of the text is even across all elements.
|
|
210
|
-
|
|
211
228
|
<!-- docs: start hidden content -->
|
|
212
229
|
|
|
213
230
|
## Future Enhancements
|
|
@@ -67,7 +67,7 @@ if (!document.head.querySelector('#d2l-typography-font-face')) {
|
|
|
67
67
|
|
|
68
68
|
.d2l-typography:lang(ar),
|
|
69
69
|
.d2l-typography :lang(ar) {
|
|
70
|
-
font-family: '
|
|
70
|
+
font-family: 'Segoe UI', 'Geeza Pro', sans-serif;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
.d2l-typography:lang(zh),
|
package/custom-elements.json
CHANGED
|
@@ -3640,6 +3640,12 @@
|
|
|
3640
3640
|
"type": "boolean",
|
|
3641
3641
|
"default": "false"
|
|
3642
3642
|
},
|
|
3643
|
+
{
|
|
3644
|
+
"name": "end-opened",
|
|
3645
|
+
"description": "Indicates if the end date or time dropdown is open",
|
|
3646
|
+
"type": "boolean",
|
|
3647
|
+
"default": "false"
|
|
3648
|
+
},
|
|
3643
3649
|
{
|
|
3644
3650
|
"name": "inclusive-date-range",
|
|
3645
3651
|
"description": "Validates on inclusive range (i.e., it is valid for start and end date-times to be equal)",
|
|
@@ -3664,6 +3670,12 @@
|
|
|
3664
3670
|
"type": "boolean",
|
|
3665
3671
|
"default": "false"
|
|
3666
3672
|
},
|
|
3673
|
+
{
|
|
3674
|
+
"name": "start-opened",
|
|
3675
|
+
"description": "Indicates if the start date or time dropdown is open",
|
|
3676
|
+
"type": "boolean",
|
|
3677
|
+
"default": "false"
|
|
3678
|
+
},
|
|
3667
3679
|
{
|
|
3668
3680
|
"name": "skeleton",
|
|
3669
3681
|
"type": "boolean",
|
|
@@ -3736,6 +3748,13 @@
|
|
|
3736
3748
|
"type": "boolean",
|
|
3737
3749
|
"default": "false"
|
|
3738
3750
|
},
|
|
3751
|
+
{
|
|
3752
|
+
"name": "endOpened",
|
|
3753
|
+
"attribute": "end-opened",
|
|
3754
|
+
"description": "Indicates if the end date or time dropdown is open",
|
|
3755
|
+
"type": "boolean",
|
|
3756
|
+
"default": "false"
|
|
3757
|
+
},
|
|
3739
3758
|
{
|
|
3740
3759
|
"name": "inclusiveDateRange",
|
|
3741
3760
|
"attribute": "inclusive-date-range",
|
|
@@ -3764,6 +3783,13 @@
|
|
|
3764
3783
|
"type": "boolean",
|
|
3765
3784
|
"default": "false"
|
|
3766
3785
|
},
|
|
3786
|
+
{
|
|
3787
|
+
"name": "startOpened",
|
|
3788
|
+
"attribute": "start-opened",
|
|
3789
|
+
"description": "Indicates if the start date or time dropdown is open",
|
|
3790
|
+
"type": "boolean",
|
|
3791
|
+
"default": "false"
|
|
3792
|
+
},
|
|
3767
3793
|
{
|
|
3768
3794
|
"name": "skeleton",
|
|
3769
3795
|
"attribute": "skeleton",
|
|
@@ -3833,7 +3859,7 @@
|
|
|
3833
3859
|
},
|
|
3834
3860
|
{
|
|
3835
3861
|
"name": "opened",
|
|
3836
|
-
"description": "
|
|
3862
|
+
"description": "Indicates if the date or time dropdown is open",
|
|
3837
3863
|
"type": "boolean",
|
|
3838
3864
|
"default": "false"
|
|
3839
3865
|
},
|
|
@@ -3904,7 +3930,7 @@
|
|
|
3904
3930
|
{
|
|
3905
3931
|
"name": "opened",
|
|
3906
3932
|
"attribute": "opened",
|
|
3907
|
-
"description": "
|
|
3933
|
+
"description": "Indicates if the date or time dropdown is open",
|
|
3908
3934
|
"type": "boolean",
|
|
3909
3935
|
"default": "false"
|
|
3910
3936
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.175.1",
|
|
4
4
|
"description": "A collection of accessible, free, open-source web components for building Brightspace applications",
|
|
5
5
|
"repository": "https://github.com/BrightspaceUI/core.git",
|
|
6
6
|
"publishConfig": {
|