@brightspace-ui/core 1.196.0 → 1.197.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.
- package/components/alert/README.md +9 -5
- package/components/backdrop/README.md +6 -11
- package/components/backdrop/backdrop.js +3 -0
- package/components/breadcrumbs/breadcrumbs.js +2 -1
- package/components/button/README.md +1 -1
- package/components/button/button-icon.js +1 -0
- package/components/button/button-mixin.js +2 -0
- package/components/button/button-subtle.js +1 -0
- package/components/button/button.js +1 -0
- package/components/button/floating-buttons.js +1 -0
- package/components/calendar/calendar.js +1 -1
- package/components/card/README.md +1 -1
- package/components/card/card-footer-link.js +12 -2
- package/components/card/card-loading-shimmer.js +1 -0
- package/components/card/card.js +9 -0
- package/components/count-badge/count-badge-icon.js +17 -9
- package/components/count-badge/count-badge-mixin.js +52 -47
- package/components/count-badge/count-badge.js +5 -4
- package/components/dialog/README.md +1 -1
- package/components/dialog/dialog-confirm.js +1 -2
- package/components/dialog/dialog-fullscreen.js +4 -5
- package/components/dialog/dialog-mixin.js +2 -0
- package/components/dialog/dialog.js +0 -2
- package/components/dropdown/README.md +2 -8
- package/components/dropdown/dropdown-button-subtle.js +3 -3
- package/components/dropdown/dropdown-button.js +2 -0
- package/components/dropdown/dropdown-content-mixin.js +25 -6
- package/components/dropdown/dropdown-content.js +0 -3
- package/components/dropdown/dropdown-context-menu.js +2 -0
- package/components/dropdown/dropdown-menu.js +0 -3
- package/components/dropdown/dropdown-more.js +2 -0
- package/components/dropdown/dropdown-opener-mixin.js +2 -0
- package/components/dropdown/dropdown-tabs.js +0 -3
- package/components/filter/README.md +4 -4
- package/components/focus-trap/README.md +0 -4
- package/components/form/docs/form-element-mixin.md +0 -4
- package/components/html-block/README.md +2 -7
- package/components/icons/images/tier3/rubric-graded.svg +2 -2
- package/components/inputs/input-radio-styles.js +2 -1
- package/components/list/README.md +2 -1
- package/components/list/demo/list-item-custom.js +7 -3
- package/components/list/demo/list-nested.html +6 -62
- package/components/list/list-item-generic-layout.js +85 -14
- package/components/list/list.js +27 -2
- package/components/loading-spinner/README.md +1 -1
- package/components/meter/README.md +1 -5
- package/components/offscreen/README.md +0 -6
- package/components/selection/selection-input.js +4 -2
- package/components/selection/selection-mixin.js +1 -0
- package/components/status-indicator/README.md +1 -7
- package/components/switch/README.md +1 -5
- package/components/switch/switch-mixin.js +1 -0
- package/components/tabs/README.md +0 -3
- package/components/tooltip/README.md +1 -1
- package/custom-elements.json +59 -71
- package/generated/icons/tier3/rubric-graded.js +3 -2
- package/helpers/focus.js +4 -2
- package/mixins/labelled-mixin.js +1 -0
- package/package.json +1 -1
- package/templates/primary-secondary/README.md +2 -6
|
@@ -6,6 +6,14 @@ Alerts communicate critical information relating to the state of the system and
|
|
|
6
6
|
<script type="module">
|
|
7
7
|
import '@brightspace-ui/core/components/alert/alert-toast.js';
|
|
8
8
|
</script>
|
|
9
|
+
<!-- docs: start hidden content -->
|
|
10
|
+
<style>
|
|
11
|
+
d2l-alert-toast {
|
|
12
|
+
margin-left: 0 !important;
|
|
13
|
+
margin-right: 0 !important;
|
|
14
|
+
}
|
|
15
|
+
</style>
|
|
16
|
+
<!-- docs: end hidden content -->
|
|
9
17
|
|
|
10
18
|
<d2l-alert type="default" button-text="Undo" has-close-button>
|
|
11
19
|
A message.
|
|
@@ -26,7 +34,7 @@ The `d2l-alert` component can be used to communicate important information relat
|
|
|
26
34
|
* Do use to let the user know when the system is in a state that will prevent them from completing their action
|
|
27
35
|
* Do highlight information that requires the user’s attention and/or action.
|
|
28
36
|
* Do provide a clear call to action if it can help resolve the alert
|
|
29
|
-
* Do provide a control to dismiss the alert and prevent the message from displaying again, if applicable
|
|
37
|
+
* Do provide a control to dismiss the alert and prevent the message from displaying again, if applicable
|
|
30
38
|
* Do use sentence case for alert text, but avoid unnecessary punctuation by not placing periods at the end of single sentences
|
|
31
39
|
<!-- docs: end dos -->
|
|
32
40
|
|
|
@@ -113,8 +121,4 @@ a pop-up at the bottom of the screen that automatically dismisses itself by defa
|
|
|
113
121
|
|
|
114
122
|
### Events
|
|
115
123
|
* `d2l-alert-toast-close`: dispatched when the toast is closed
|
|
116
|
-
|
|
117
|
-
## Future Enhancements
|
|
118
|
-
|
|
119
|
-
Looking for an enhancement not listed here? Create a GitHub issue!
|
|
120
124
|
<!-- docs: end hidden content -->
|
|
@@ -8,6 +8,11 @@ The `d2l-backdrop` element is a web component to display a semi-transparent back
|
|
|
8
8
|
import '@brightspace-ui/core/components/button/button.js';
|
|
9
9
|
import '@brightspace-ui/core/components/backdrop/backdrop.js';
|
|
10
10
|
import '@brightspace-ui/core/components/switch/switch.js';
|
|
11
|
+
|
|
12
|
+
const backdrop = document.querySelector('d2l-backdrop');
|
|
13
|
+
document.querySelector('#target > d2l-button').addEventListener('click', () => {
|
|
14
|
+
backdrop.shown = !backdrop.shown;
|
|
15
|
+
});
|
|
11
16
|
</script>
|
|
12
17
|
<style>
|
|
13
18
|
#target { position: relative; z-index: 1000; margin: 40px; }
|
|
@@ -17,12 +22,6 @@ The `d2l-backdrop` element is a web component to display a semi-transparent back
|
|
|
17
22
|
<d2l-backdrop for-target="target"></d2l-backdrop>
|
|
18
23
|
</div>
|
|
19
24
|
<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>
|
|
26
25
|
```
|
|
27
26
|
|
|
28
27
|
<!-- docs: start hidden content -->
|
|
@@ -34,8 +33,4 @@ The `d2l-backdrop` element is a web component to display a semi-transparent back
|
|
|
34
33
|
| `no-animate-hide` | Boolean | Disables the fade-out transition while the backdrop is being hidden |
|
|
35
34
|
| `shown` | Boolean | Used to control whether the backdrop is shown |
|
|
36
35
|
| `slow-transition` | Boolean | Increases the fade transition time to 1200ms (default is 200ms) |
|
|
37
|
-
|
|
38
|
-
## Future Enhancements
|
|
39
|
-
|
|
40
|
-
Looking for an enhancement not listed here? Create a GitHub issue!
|
|
41
|
-
<!-- docs: end hidden content -->
|
|
36
|
+
<!-- docs: end hidden content -->
|
|
@@ -17,16 +17,19 @@ class Backdrop extends LitElement {
|
|
|
17
17
|
return {
|
|
18
18
|
/**
|
|
19
19
|
* REQUIRED: id of the target element to display backdrop behind
|
|
20
|
+
* @type {string}
|
|
20
21
|
*/
|
|
21
22
|
forTarget: { type: String, attribute: 'for-target' },
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Disables the fade-out transition while the backdrop is being hidden
|
|
26
|
+
* @type {boolean}
|
|
25
27
|
*/
|
|
26
28
|
noAnimateHide: { type: Boolean, attribute: 'no-animate-hide' },
|
|
27
29
|
|
|
28
30
|
/**
|
|
29
31
|
* Used to control whether the backdrop is shown
|
|
32
|
+
* @type {boolean}
|
|
30
33
|
*/
|
|
31
34
|
shown: { type: Boolean },
|
|
32
35
|
_state: { type: String, reflect: true }
|
|
@@ -5,13 +5,14 @@ import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Help users understand where they are within the application, and provide useful clues about how the space is organized. They also provide a convenient navigation mechanism.
|
|
8
|
-
* @slot -
|
|
8
|
+
* @slot - Breadcrumb items
|
|
9
9
|
*/
|
|
10
10
|
class Breadcrumbs extends LocalizeCoreElement(RtlMixin(LitElement)) {
|
|
11
11
|
static get properties() {
|
|
12
12
|
return {
|
|
13
13
|
/**
|
|
14
14
|
* Renders in compact mode, displaying only the last item
|
|
15
|
+
* @type {boolean}
|
|
15
16
|
*/
|
|
16
17
|
compact: { type: Boolean, reflect: true }
|
|
17
18
|
};
|
|
@@ -156,7 +156,7 @@ To make your `d2l-button-icon` accessible, use the following properties when app
|
|
|
156
156
|
See [floating buttons](https://github.com/BrightspaceUI/core/tree/main/components/button/floating-buttons.md).
|
|
157
157
|
|
|
158
158
|
<!-- docs: start hidden content -->
|
|
159
|
-
## Future
|
|
159
|
+
## Future Improvements
|
|
160
160
|
|
|
161
161
|
- `<d2l-button-preset type="save">` for common button types that will have built-in language support
|
|
162
162
|
|
|
@@ -22,10 +22,12 @@ export const ButtonMixin = superclass => class extends FocusVisiblePolyfillMixin
|
|
|
22
22
|
autofocus: { type: Boolean, reflect: true },
|
|
23
23
|
/**
|
|
24
24
|
* Disables the button
|
|
25
|
+
* @type {boolean}
|
|
25
26
|
*/
|
|
26
27
|
disabled: { type: Boolean, reflect: true },
|
|
27
28
|
/**
|
|
28
29
|
* Tooltip text when disabled
|
|
30
|
+
* @type {string}
|
|
29
31
|
*/
|
|
30
32
|
disabledTooltip: { type: String, attribute: 'disabled-tooltip' },
|
|
31
33
|
/**
|
|
@@ -17,6 +17,7 @@ class FloatingButtons extends RtlMixin(LitElement) {
|
|
|
17
17
|
return {
|
|
18
18
|
/**
|
|
19
19
|
* Indicates to display buttons as always floating
|
|
20
|
+
* @type {boolean}
|
|
20
21
|
*/
|
|
21
22
|
alwaysFloat: { type: Boolean, attribute: 'always-float', reflect: true },
|
|
22
23
|
_containerMarginLeft: { attribute: false, type: String },
|
|
@@ -132,7 +132,6 @@ export function getPrevMonth(month) {
|
|
|
132
132
|
/**
|
|
133
133
|
* A component can be used to display a responsively sized calendar that allows for date selection.
|
|
134
134
|
* @slot - Content displayed under the calendar (e.g., buttons)
|
|
135
|
-
* @fires d2l-calendar-selected - Dispatched when a date is selected through click, space, or enter. "e.detail.date" is in ISO 8601 calendar date format ("YYYY-MM-DD").
|
|
136
135
|
*/
|
|
137
136
|
class Calendar extends LocalizeCoreElement(RtlMixin(LitElement)) {
|
|
138
137
|
|
|
@@ -620,6 +619,7 @@ class Calendar extends LocalizeCoreElement(RtlMixin(LitElement)) {
|
|
|
620
619
|
composed: true,
|
|
621
620
|
detail: { date: this.selectedValue }
|
|
622
621
|
};
|
|
622
|
+
/** Dispatched when a date is selected through click, space, or enter. "e.detail.date" is in ISO 8601 calendar date format ("YYYY-MM-DD"). */
|
|
623
623
|
this.dispatchEvent(new CustomEvent('d2l-calendar-selected', eventDetails));
|
|
624
624
|
}
|
|
625
625
|
|
|
@@ -272,7 +272,7 @@ The `d2l-card-footer-link` element is an icon link that can be placed in the `fo
|
|
|
272
272
|
|
|
273
273
|
See the [anchor element docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) for more information on standard link attributes and their values.
|
|
274
274
|
|
|
275
|
-
## Future
|
|
275
|
+
## Future Improvements
|
|
276
276
|
|
|
277
277
|
* scroll API for the dialog content (see [#341](https://github.com/BrightspaceUI/core/issues/341))
|
|
278
278
|
|
|
@@ -16,30 +16,37 @@ class CardFooterLink extends RtlMixin(LitElement) {
|
|
|
16
16
|
return {
|
|
17
17
|
/**
|
|
18
18
|
* Download a URL instead of navigating to it
|
|
19
|
+
* @type {boolean}
|
|
19
20
|
*/
|
|
20
21
|
download: { type: Boolean, reflect: true },
|
|
21
22
|
/**
|
|
22
23
|
* URL or URL fragment of the link
|
|
24
|
+
* @type {string}
|
|
23
25
|
*/
|
|
24
26
|
href: { type: String, reflect: true },
|
|
25
27
|
/**
|
|
26
28
|
* Indicates the human language of the linked resource; purely advisory, with no built-in functionality
|
|
29
|
+
* @type {string}
|
|
27
30
|
*/
|
|
28
31
|
hreflang: { type: String, reflect: true },
|
|
29
32
|
/**
|
|
30
33
|
* REQUIRED: Preset icon key (e.g. "tier1:gear"). Must be a tier 1 icon.
|
|
34
|
+
* @type {string}
|
|
31
35
|
*/
|
|
32
36
|
icon: { type: String, reflect: true },
|
|
33
37
|
/**
|
|
34
38
|
* Specifies the relationship of the target object to the link object
|
|
39
|
+
* @type {string}
|
|
35
40
|
*/
|
|
36
41
|
rel: { type: String, reflect: true },
|
|
37
42
|
/**
|
|
38
43
|
* Secondary count to display as a count bubble on the icon
|
|
44
|
+
* @type {number}
|
|
39
45
|
*/
|
|
40
46
|
secondaryCount: { type: Number, attribute: 'secondary-count', reflect: true },
|
|
41
47
|
/**
|
|
42
48
|
* Maximum digits to display in the secondary count. Defaults to no limit
|
|
49
|
+
* @type {string}
|
|
43
50
|
*/
|
|
44
51
|
secondaryCountMaxDigits: { type: String, attribute: 'secondary-count-max-digits' },
|
|
45
52
|
/**
|
|
@@ -49,14 +56,17 @@ class CardFooterLink extends RtlMixin(LitElement) {
|
|
|
49
56
|
secondaryCountType: { type: String, attribute: 'secondary-count-type', reflect: true },
|
|
50
57
|
/**
|
|
51
58
|
* Where to display the linked URL
|
|
59
|
+
* @type {string}
|
|
52
60
|
*/
|
|
53
61
|
target: { type: String, reflect: true },
|
|
54
62
|
/**
|
|
55
63
|
* REQUIRED: Accessible text for the link (not visible, gets announced when user focuses)
|
|
64
|
+
* @type {string}
|
|
56
65
|
*/
|
|
57
66
|
text: { type: String, reflect: true },
|
|
58
67
|
/**
|
|
59
68
|
* Specifies the media type in the form of a MIME type for the linked URL; purely advisory, with no built-in functionality
|
|
69
|
+
* @type {string}
|
|
60
70
|
*/
|
|
61
71
|
type: { type: String, reflect: true }
|
|
62
72
|
};
|
|
@@ -108,7 +118,7 @@ class CardFooterLink extends RtlMixin(LitElement) {
|
|
|
108
118
|
render() {
|
|
109
119
|
const noNumber = this.secondaryCount === undefined;
|
|
110
120
|
return html`
|
|
111
|
-
<a @focus="${this._onFocus}"
|
|
121
|
+
<a @focus="${this._onFocus}"
|
|
112
122
|
@blur="${this._onBlur}"
|
|
113
123
|
?download="${this.download}"
|
|
114
124
|
href="${ifDefined(this.href)}"
|
|
@@ -121,7 +131,7 @@ class CardFooterLink extends RtlMixin(LitElement) {
|
|
|
121
131
|
aria-hidden="true"
|
|
122
132
|
icon="${this.icon}"
|
|
123
133
|
max-digits="${ifDefined(this.secondaryCountMaxDigits ? this.secondaryCountMaxDigits : undefined)}"
|
|
124
|
-
number="${noNumber ? 0 : this.secondaryCount}"
|
|
134
|
+
number="${noNumber ? 0 : this.secondaryCount}"
|
|
125
135
|
?hide-zero="${noNumber}"
|
|
126
136
|
text="${this.text}"
|
|
127
137
|
type="${this._getType()}">
|
package/components/card/card.js
CHANGED
|
@@ -21,38 +21,47 @@ class Card extends RtlMixin(LitElement) {
|
|
|
21
21
|
return {
|
|
22
22
|
/**
|
|
23
23
|
* Style the card's content and footer as centered horizontally
|
|
24
|
+
* @type {boolean}
|
|
24
25
|
*/
|
|
25
26
|
alignCenter: { type: Boolean, attribute: 'align-center', reflect: true },
|
|
26
27
|
/**
|
|
27
28
|
* Download a URL instead of navigating to it
|
|
29
|
+
* @type {boolean}
|
|
28
30
|
*/
|
|
29
31
|
download: { type: Boolean, reflect: true },
|
|
30
32
|
/**
|
|
31
33
|
* Location for the primary action/navigation
|
|
34
|
+
* @type {string}
|
|
32
35
|
*/
|
|
33
36
|
href: { type: String, reflect: true },
|
|
34
37
|
/**
|
|
35
38
|
* Indicates the human language of the linked resource; purely advisory, with no built-in functionality
|
|
39
|
+
* @type {string}
|
|
36
40
|
*/
|
|
37
41
|
hreflang: { type: String, reflect: true },
|
|
38
42
|
/**
|
|
39
43
|
* Specifies the relationship of the target object to the link object
|
|
44
|
+
* @type {string}
|
|
40
45
|
*/
|
|
41
46
|
rel: { type: String, reflect: true },
|
|
42
47
|
/**
|
|
43
48
|
* Subtle aesthetic on non-white backgrounds
|
|
49
|
+
* @type {boolean}
|
|
44
50
|
*/
|
|
45
51
|
subtle: { type: Boolean, reflect: true },
|
|
46
52
|
/**
|
|
47
53
|
* Where to display the linked URL
|
|
54
|
+
* @type {string}
|
|
48
55
|
*/
|
|
49
56
|
target: { type: String, reflect: true },
|
|
50
57
|
/**
|
|
51
58
|
* Accessible text for the card (will be announced when AT user focuses)
|
|
59
|
+
* @type {string}
|
|
52
60
|
*/
|
|
53
61
|
text: { type: String, reflect: true },
|
|
54
62
|
/**
|
|
55
63
|
* Specifies the media type in the form of a MIME type for the linked URL; purely advisory, with no built-in functionality
|
|
64
|
+
* @type {string}
|
|
56
65
|
*/
|
|
57
66
|
type: { type: String, reflect: true },
|
|
58
67
|
_active: { type: Boolean, reflect: true },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../colors/colors.js';
|
|
2
2
|
import '../icons/icon.js';
|
|
3
|
-
import { CountBadgeMixin, countBadgeStyles } from './count-badge-mixin.js';
|
|
4
3
|
import { css, html, LitElement } from 'lit-element/lit-element.js';
|
|
4
|
+
import { CountBadgeMixin } from './count-badge-mixin.js';
|
|
5
5
|
import { getUniqueId } from '../../helpers/uniqueId.js';
|
|
6
6
|
import { ifDefined } from 'lit-html/directives/if-defined.js';
|
|
7
7
|
|
|
@@ -21,7 +21,7 @@ class CountBadgeIcon extends CountBadgeMixin(LitElement) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
static get styles() {
|
|
24
|
-
return [
|
|
24
|
+
return [super.styles, css`
|
|
25
25
|
:host(.focus-visible) d2l-icon,
|
|
26
26
|
:host([focus-ring]) d2l-icon,
|
|
27
27
|
d2l-icon.focus-visible {
|
|
@@ -29,6 +29,10 @@ class CountBadgeIcon extends CountBadgeMixin(LitElement) {
|
|
|
29
29
|
outline: none;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
.d2l-count-badge-wrapper {
|
|
33
|
+
display: inline-block;
|
|
34
|
+
}
|
|
35
|
+
|
|
32
36
|
:host {
|
|
33
37
|
padding-right: var(--d2l-count-badge-icon-padding);
|
|
34
38
|
}
|
|
@@ -81,16 +85,20 @@ class CountBadgeIcon extends CountBadgeMixin(LitElement) {
|
|
|
81
85
|
position: 'relative',
|
|
82
86
|
left: this.dir === 'rtl' ? 0 : 'var(--d2l-count-badge-icon-padding)',
|
|
83
87
|
right: this.dir === 'rtl' ? 'var(--d2l-count-badge-icon-padding)' : 0,
|
|
84
|
-
top: numberPadding
|
|
88
|
+
top: numberPadding,
|
|
89
|
+
visibility: this.skeleton ? 'hidden' : undefined
|
|
85
90
|
};
|
|
91
|
+
const tabbable = (this.tabStop || this.hasTooltip) && !this.skeleton;
|
|
86
92
|
const innerHtml = html`
|
|
87
93
|
${this.renderCount(numberStyles)}
|
|
88
|
-
<d2l-
|
|
89
|
-
icon="${this.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
<div class="d2l-skeletize d2l-count-badge-wrapper">
|
|
95
|
+
<d2l-icon id="${this._badgeId}"
|
|
96
|
+
icon="${this.icon}"
|
|
97
|
+
tabindex="${ifDefined(tabbable ? '0' : undefined)}"
|
|
98
|
+
aria-labelledby="${ifDefined(this.getAriaLabelId())}"
|
|
99
|
+
role="img">
|
|
100
|
+
</d2l-icon>
|
|
101
|
+
</div>
|
|
94
102
|
`;
|
|
95
103
|
return this.renderTooltips(innerHtml, this._badgeId);
|
|
96
104
|
}
|
|
@@ -6,50 +6,10 @@ import { getUniqueId } from '../../helpers/uniqueId.js';
|
|
|
6
6
|
import { LocalizeCoreElement } from '../../lang/localize-core-element.js';
|
|
7
7
|
import { offscreenStyles } from '../offscreen/offscreen.js';
|
|
8
8
|
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
9
|
+
import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
|
|
9
10
|
import { styleMap } from 'lit-html/directives/style-map';
|
|
10
11
|
|
|
11
|
-
export const
|
|
12
|
-
:host([hidden]) {
|
|
13
|
-
display: none;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
:host {
|
|
17
|
-
display: inline-block;
|
|
18
|
-
min-width: 0.9rem;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.d2l-count-badge-number {
|
|
22
|
-
font-weight: bold;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
:host([type="notification"]) .d2l-count-badge-number {
|
|
26
|
-
background-color: var(--d2l-color-carnelian-minus-1);
|
|
27
|
-
color: white;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
:host([type="count"]) .d2l-count-badge-number {
|
|
31
|
-
background-color: var(--d2l-color-gypsum);
|
|
32
|
-
color: var(--d2l-color-tungsten);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
:host([size="small"]) .d2l-count-badge-number {
|
|
36
|
-
border-radius: 0.55rem;
|
|
37
|
-
font-size: 0.6rem;
|
|
38
|
-
line-height: 0.9rem;
|
|
39
|
-
padding-left: 0.3rem;
|
|
40
|
-
padding-right: 0.3rem;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
:host([size="large"]) .d2l-count-badge-number {
|
|
44
|
-
border-radius: 0.7rem;
|
|
45
|
-
font-size: 0.8rem;
|
|
46
|
-
line-height: 1.2rem;
|
|
47
|
-
padding-left: 0.4rem;
|
|
48
|
-
padding-right: 0.4rem;
|
|
49
|
-
}
|
|
50
|
-
`];
|
|
51
|
-
|
|
52
|
-
export const CountBadgeMixin = superclass => class extends LocalizeCoreElement(RtlMixin(superclass)) {
|
|
12
|
+
export const CountBadgeMixin = superclass => class extends LocalizeCoreElement(SkeletonMixin(RtlMixin(superclass))) {
|
|
53
13
|
|
|
54
14
|
static get properties() {
|
|
55
15
|
return {
|
|
@@ -138,6 +98,49 @@ export const CountBadgeMixin = superclass => class extends LocalizeCoreElement(R
|
|
|
138
98
|
};
|
|
139
99
|
}
|
|
140
100
|
|
|
101
|
+
static get styles() {
|
|
102
|
+
return [super.styles, offscreenStyles, css`
|
|
103
|
+
:host([hidden]) {
|
|
104
|
+
display: none;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
:host {
|
|
108
|
+
display: inline-block;
|
|
109
|
+
min-width: 0.9rem;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.d2l-count-badge-number {
|
|
113
|
+
font-weight: bold;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
:host([type="notification"]) .d2l-count-badge-number {
|
|
117
|
+
background-color: var(--d2l-color-carnelian-minus-1);
|
|
118
|
+
color: white;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
:host([type="count"]) .d2l-count-badge-number {
|
|
122
|
+
background-color: var(--d2l-color-gypsum);
|
|
123
|
+
color: var(--d2l-color-tungsten);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
:host([size="small"]) .d2l-count-badge-number {
|
|
127
|
+
border-radius: 0.55rem;
|
|
128
|
+
font-size: 0.6rem;
|
|
129
|
+
line-height: 0.9rem;
|
|
130
|
+
padding-left: 0.3rem;
|
|
131
|
+
padding-right: 0.3rem;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
:host([size="large"]) .d2l-count-badge-number {
|
|
135
|
+
border-radius: 0.7rem;
|
|
136
|
+
font-size: 0.8rem;
|
|
137
|
+
line-height: 1.2rem;
|
|
138
|
+
padding-left: 0.4rem;
|
|
139
|
+
padding-right: 0.4rem;
|
|
140
|
+
}
|
|
141
|
+
`];
|
|
142
|
+
}
|
|
143
|
+
|
|
141
144
|
constructor() {
|
|
142
145
|
super();
|
|
143
146
|
this.announceChanges = false;
|
|
@@ -166,10 +169,12 @@ export const CountBadgeMixin = superclass => class extends LocalizeCoreElement(R
|
|
|
166
169
|
renderCount(numberStyles) {
|
|
167
170
|
let numberString = `${this.number}`;
|
|
168
171
|
const hideNumber = this.hideZero && this.number === 0;
|
|
169
|
-
numberStyles
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
if (!numberStyles || numberStyles.visibility !== 'hidden') {
|
|
173
|
+
numberStyles = {
|
|
174
|
+
...numberStyles,
|
|
175
|
+
visibility: hideNumber ? 'hidden' : 'visible'
|
|
176
|
+
};
|
|
177
|
+
}
|
|
173
178
|
if (this.maxDigits && this.number.toString().length > this.maxDigits) {
|
|
174
179
|
numberString = `${'9'.repeat(this.maxDigits)}`;
|
|
175
180
|
numberString = formatNumber(parseInt(numberString));
|
|
@@ -193,7 +198,7 @@ export const CountBadgeMixin = superclass => class extends LocalizeCoreElement(R
|
|
|
193
198
|
aria-live="${this.announceChanges ? 'polite' : 'off'}">
|
|
194
199
|
${innerHtml}
|
|
195
200
|
</div>
|
|
196
|
-
${this.hasTooltip ? html`<d2l-tooltip for="${badgeId}" for-type="label">${this.text}</d2l-tooltip>` : null}
|
|
201
|
+
${this.hasTooltip && !this.skeleton ? html`<d2l-tooltip for="${badgeId}" for-type="label">${this.text}</d2l-tooltip>` : null}
|
|
197
202
|
`;
|
|
198
203
|
}
|
|
199
204
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import '../colors/colors.js';
|
|
2
|
-
import { CountBadgeMixin, countBadgeStyles } from './count-badge-mixin.js';
|
|
3
2
|
import { css, html, LitElement } from 'lit-element/lit-element.js';
|
|
3
|
+
import { CountBadgeMixin } from './count-badge-mixin.js';
|
|
4
4
|
import { getUniqueId } from '../../helpers/uniqueId.js';
|
|
5
5
|
import { ifDefined } from 'lit-html/directives/if-defined.js';
|
|
6
6
|
|
|
7
7
|
class CountBadge extends CountBadgeMixin(LitElement) {
|
|
8
8
|
|
|
9
9
|
static get styles() {
|
|
10
|
-
return [
|
|
10
|
+
return [super.styles, css`
|
|
11
11
|
:host(.focus-visible) .d2l-count-badge-wrapper,
|
|
12
12
|
:host([focus-ring]) .d2l-count-badge-wrapper,
|
|
13
13
|
.d2l-count-badge-wrapper.focus-visible {
|
|
@@ -36,11 +36,12 @@ class CountBadge extends CountBadgeMixin(LitElement) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
render() {
|
|
39
|
+
const tabbable = (this.tabStop || this.hasTooltip) && !(this.hideZero && this.number === 0) && !this.skeleton;
|
|
39
40
|
const innerHtml = html`
|
|
40
41
|
<div
|
|
41
|
-
class="d2l-count-badge-wrapper"
|
|
42
|
+
class="d2l-count-badge-wrapper d2l-skeletize"
|
|
42
43
|
id="${this._badgeId}"
|
|
43
|
-
tabindex="${ifDefined(
|
|
44
|
+
tabindex="${ifDefined(tabbable ? '0' : undefined)}"
|
|
44
45
|
aria-labelledby="${ifDefined(this.getAriaLabelId())}"
|
|
45
46
|
role="img">
|
|
46
47
|
${this.renderCount()}
|
|
@@ -264,7 +264,7 @@ document.querySelector('#open').addEventListener('click', () => {
|
|
|
264
264
|
```
|
|
265
265
|
|
|
266
266
|
<!-- docs: start hidden content -->
|
|
267
|
-
## Future
|
|
267
|
+
## Future Improvements
|
|
268
268
|
|
|
269
269
|
* scroll API for the dialog content (see [#341](https://github.com/BrightspaceUI/core/issues/341))
|
|
270
270
|
|
|
@@ -8,8 +8,6 @@ import { heading3Styles } from '../typography/styles.js';
|
|
|
8
8
|
/**
|
|
9
9
|
* A simple confirmation dialog for prompting the user. Apply the "data-dialog-action" attribute to workflow buttons to automatically close the confirm dialog with the action value.
|
|
10
10
|
* @slot footer - Slot for footer content such as workflow buttons
|
|
11
|
-
* @fires d2l-dialog-open - Dispatched when the dialog is opened
|
|
12
|
-
* @fires d2l-dialog-close - Dispatched with the action value when the dialog is closed for any reason
|
|
13
11
|
*/
|
|
14
12
|
class DialogConfirm extends DialogMixin(LitElement) {
|
|
15
13
|
|
|
@@ -17,6 +15,7 @@ class DialogConfirm extends DialogMixin(LitElement) {
|
|
|
17
15
|
return {
|
|
18
16
|
/**
|
|
19
17
|
* REQUIRED: The text content for the confirmation dialog
|
|
18
|
+
* @type {string}
|
|
20
19
|
*/
|
|
21
20
|
text: { type: String }
|
|
22
21
|
};
|
|
@@ -16,8 +16,6 @@ const mediaQueryList = window.matchMedia('(max-width: 615px)');
|
|
|
16
16
|
* A generic fullscreen dialog that provides a slot for arbitrary content and a "footer" slot for workflow buttons. Apply the "data-dialog-action" attribute to workflow buttons to automatically close the dialog with the action value.
|
|
17
17
|
* @slot - Default slot for content inside dialog
|
|
18
18
|
* @slot footer - Slot for footer content such as workflow buttons
|
|
19
|
-
* @fires d2l-dialog-open - Dispatched when the dialog is opened
|
|
20
|
-
* @fires d2l-dialog-close - Dispatched with the action value when the dialog is closed for any reason
|
|
21
19
|
*/
|
|
22
20
|
class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElement))) {
|
|
23
21
|
|
|
@@ -25,6 +23,7 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
|
|
|
25
23
|
return {
|
|
26
24
|
/**
|
|
27
25
|
* Whether to render a loading-spinner and wait for state changes via AsyncContainerMixin
|
|
26
|
+
* @type {boolean}
|
|
28
27
|
*/
|
|
29
28
|
async: { type: Boolean },
|
|
30
29
|
_hasFooterContent: { type: Boolean, attribute: false },
|
|
@@ -45,7 +44,7 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
|
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
@media (min-width: 616px) {
|
|
48
|
-
|
|
47
|
+
|
|
49
48
|
.d2l-dialog-header {
|
|
50
49
|
border-bottom: 1px solid var(--d2l-color-gypsum);
|
|
51
50
|
padding-bottom: 0.9rem;
|
|
@@ -72,7 +71,7 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
|
|
|
72
71
|
:host([dir="rtl"]) .d2l-dialog-header > div > d2l-button-icon {
|
|
73
72
|
margin: -2px 0 0 -12px;
|
|
74
73
|
}
|
|
75
|
-
|
|
74
|
+
|
|
76
75
|
dialog.d2l-dialog-outer,
|
|
77
76
|
div.d2l-dialog-outer {
|
|
78
77
|
border-radius: 8px;
|
|
@@ -164,7 +163,7 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
|
|
|
164
163
|
margin-left: -13px;
|
|
165
164
|
margin-right: 15px;
|
|
166
165
|
}
|
|
167
|
-
|
|
166
|
+
|
|
168
167
|
dialog.d2l-dialog-outer,
|
|
169
168
|
div.d2l-dialog-outer {
|
|
170
169
|
margin: 0 !important;
|
|
@@ -244,6 +244,7 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
|
244
244
|
allowBodyScroll(this._bodyScrollKey);
|
|
245
245
|
this._bodyScrollKey = null;
|
|
246
246
|
if (this._action === undefined) this._action = abortAction;
|
|
247
|
+
/** Dispatched with the action value when the dialog is closed for any reason */
|
|
247
248
|
this.dispatchEvent(new CustomEvent(
|
|
248
249
|
'd2l-dialog-close', {
|
|
249
250
|
bubbles: true,
|
|
@@ -346,6 +347,7 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
|
346
347
|
}
|
|
347
348
|
|
|
348
349
|
if (!reduceMotion) await animPromise;
|
|
350
|
+
/** Dispatched when the dialog is opened */
|
|
349
351
|
this.dispatchEvent(new CustomEvent(
|
|
350
352
|
'd2l-dialog-open', { bubbles: true, composed: true }
|
|
351
353
|
));
|
|
@@ -17,8 +17,6 @@ const mediaQueryList = window.matchMedia('(max-width: 615px), (max-height: 420px
|
|
|
17
17
|
* A generic dialog that provides a slot for arbitrary content and a "footer" slot for workflow buttons. Apply the "data-dialog-action" attribute to workflow buttons to automatically close the dialog with the action value.
|
|
18
18
|
* @slot - Default slot for content inside dialog
|
|
19
19
|
* @slot footer - Slot for footer content such as workflow buttons
|
|
20
|
-
* @fires d2l-dialog-open - Dispatched when the dialog is opened
|
|
21
|
-
* @fires d2l-dialog-close - Dispatched with the action value when the dialog is closed for any reason
|
|
22
20
|
*/
|
|
23
21
|
class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElement))) {
|
|
24
22
|
|
|
@@ -36,7 +36,7 @@ A Dropdown is a button that opens a floating container to offer menu items or ot
|
|
|
36
36
|
<script>
|
|
37
37
|
window.addEventListener('load', function () {
|
|
38
38
|
var demoElem = document.querySelector('#demo-element');
|
|
39
|
-
if (!demoElem.hasAttribute('data-first-load')) return;
|
|
39
|
+
if (!demoElem.hasAttribute('data-first-load')) return;
|
|
40
40
|
setTimeout(() => {
|
|
41
41
|
var dropdown = document.querySelector('d2l-dropdown');
|
|
42
42
|
dropdown.toggleOpen();
|
|
@@ -164,7 +164,7 @@ If the dropdown is initially empty when it's opened, the dropdown pointer will n
|
|
|
164
164
|
|
|
165
165
|
### Accessibility Properties
|
|
166
166
|
|
|
167
|
-
To make your `d2l-dropdown-button-subtle` accessible, use the following properties when applicable:
|
|
167
|
+
To make your `d2l-dropdown-button-subtle` accessible, use the following properties when applicable:
|
|
168
168
|
|
|
169
169
|
| Attribute | Description |
|
|
170
170
|
|---|---|
|
|
@@ -454,9 +454,3 @@ To make your usage of `d2l-dropdown-more` accessible, use the following property
|
|
|
454
454
|
</d2l-dropdown-tabs>
|
|
455
455
|
</d2l-dropdown>
|
|
456
456
|
```
|
|
457
|
-
|
|
458
|
-
<!-- docs: start hidden content -->
|
|
459
|
-
## Future Enhancements
|
|
460
|
-
|
|
461
|
-
Looking for an enhancement not listed here? Create a GitHub issue!
|
|
462
|
-
<!-- docs: end hidden content -->
|