@brightspace-ui/core 1.176.2 → 1.177.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/count-badge/README.md +15 -0
- package/components/count-badge/count-badge.js +72 -23
- package/components/count-badge/demo/count-badge.html +30 -8
- package/components/dropdown/dropdown-content-mixin.js +12 -10
- package/components/expand-collapse/README.md +49 -9
- package/components/expand-collapse/expand-collapse-content.js +10 -0
- package/components/{more-less → expand-collapse}/screenshots/more-less.png +0 -0
- package/components/filter/filter.js +4 -3
- package/components/more-less/README.md +1 -25
- package/components/more-less/more-less.js +4 -0
- package/components/selection/selection-mixin.js +2 -0
- package/components/status-indicator/README.md +0 -1
- package/custom-elements.json +86 -23
- package/package.json +1 -1
|
@@ -24,6 +24,21 @@ The `d2l-count-badge` element is a web component to display a number count, eith
|
|
|
24
24
|
| `type`, default: `count` | String | The type of the badge. Valid options are `"notification"` and `"count"`. Notification badges are orange and count badges are grey. |
|
|
25
25
|
| `max-digits`, default: `2` when `type="notification"` | Number | Optionally specify a digit limit, after which numbers are truncated. Defaults to two for `"notification"` type and no limit for `"count"` type.
|
|
26
26
|
| `hide-zero`, default: `false` | Boolean | Optionally choose not to show the count badge when the number is zero. |
|
|
27
|
+
| `text`, required | String | Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled. |
|
|
28
|
+
| `tab-stop`, default: `false` | Boolean | Optionally choose to make the badge a tab stop. |
|
|
29
|
+
| `announce-changes`, default: `false` | Boolean | Optionally choose to announce changes to the badge with an aria-live region. If the text property is changed, the text will be read by screen-readers. |
|
|
30
|
+
| `has-tooltip`, default: `false` | Boolean | Optionally choose to have a tooltip below the badge. |
|
|
31
|
+
|
|
32
|
+
### Accessibility Properties
|
|
33
|
+
|
|
34
|
+
To make your `d2l-count-badge` accessible, use the following properties when applicable:
|
|
35
|
+
|
|
36
|
+
| Attribute | Description |
|
|
37
|
+
|--|--|
|
|
38
|
+
| `text`, required | Only the text will be read by screen-readers (not the number), so include the number in the text. |
|
|
39
|
+
| `tab-stop` | A tab stop allows screen-reader users to easily tab to the badge. Otherwise, screen-reader users will need to arrow through to the badge. |
|
|
40
|
+
| `announce-changes` | Use "announce-changes" if screen-reader users should be notified that the badge has been updated, such as a new notification. The "text" property will be read as soon as the screen-reader is idle. |
|
|
41
|
+
| `has-tooltip` | The tooltip will be visible on hover/tab-stop, and read out by screen-readers. |
|
|
27
42
|
|
|
28
43
|
## Future Enhancements
|
|
29
44
|
|
|
@@ -1,18 +1,53 @@
|
|
|
1
1
|
import '../colors/colors.js';
|
|
2
|
+
import '../tooltip/tooltip.js';
|
|
2
3
|
import { css, html, LitElement } from 'lit-element/lit-element.js';
|
|
4
|
+
import { getUniqueId } from '../../helpers/uniqueId.js';
|
|
5
|
+
import { ifDefined } from 'lit-html/directives/if-defined.js';
|
|
6
|
+
import { offscreenStyles } from '../offscreen/offscreen.js';
|
|
3
7
|
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
4
8
|
|
|
5
9
|
class CountBadge extends RtlMixin(LitElement) {
|
|
6
10
|
|
|
7
11
|
static get properties() {
|
|
8
12
|
return {
|
|
13
|
+
/**
|
|
14
|
+
* Optionally choose to announce changes to the badge with an aria-live region. If the number property is changed, the text will be read by screenreaders. Defaults to false.
|
|
15
|
+
* @type {boolean}
|
|
16
|
+
*/
|
|
17
|
+
announceChanges: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
attribute: 'announce-changes'
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* Optionally add a tooltip on the badge. Defaults to false.
|
|
23
|
+
* @type {boolean}
|
|
24
|
+
*/
|
|
25
|
+
hasTooltip: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
attribute: 'has-tooltip'
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* Optionally choose to not render the count badge when the number is zero. Defaults to false.
|
|
31
|
+
* @type {boolean}
|
|
32
|
+
*/
|
|
33
|
+
hideZero: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
attribute: 'hide-zero'
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* Optionally specify a digit limit, after which numbers are truncated. Defaults to two for "notification" type and no limit for "count" type.
|
|
39
|
+
* @type {number}
|
|
40
|
+
*/
|
|
41
|
+
maxDigits: {
|
|
42
|
+
type: Number,
|
|
43
|
+
attribute: 'max-digits'
|
|
44
|
+
},
|
|
9
45
|
/**
|
|
10
46
|
* The number to be displayed on the badge. Must be a positive integer.
|
|
11
47
|
* @type {number}
|
|
12
48
|
*/
|
|
13
49
|
number: {
|
|
14
50
|
type: Number,
|
|
15
|
-
reflect: true,
|
|
16
51
|
attribute: 'number'
|
|
17
52
|
},
|
|
18
53
|
/**
|
|
@@ -25,37 +60,34 @@ class CountBadge extends RtlMixin(LitElement) {
|
|
|
25
60
|
attribute: 'size'
|
|
26
61
|
},
|
|
27
62
|
/**
|
|
28
|
-
*
|
|
29
|
-
* @type {
|
|
63
|
+
* Optionally choose to add a tab stop to the badge. Defaults to false.
|
|
64
|
+
* @type {boolean}
|
|
30
65
|
*/
|
|
31
|
-
|
|
32
|
-
type:
|
|
33
|
-
|
|
34
|
-
attribute: 'type'
|
|
66
|
+
tabStop: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
attribute: 'tab-stop'
|
|
35
69
|
},
|
|
36
70
|
/**
|
|
37
|
-
*
|
|
38
|
-
* @type {
|
|
71
|
+
* * Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled.
|
|
72
|
+
* @type {string}
|
|
39
73
|
*/
|
|
40
|
-
|
|
41
|
-
type:
|
|
42
|
-
reflect: true,
|
|
43
|
-
attribute: 'max-digits'
|
|
74
|
+
text: {
|
|
75
|
+
type: String
|
|
44
76
|
},
|
|
45
77
|
/**
|
|
46
|
-
*
|
|
47
|
-
* @type {
|
|
78
|
+
* The type of the badge. Defaults to "count".
|
|
79
|
+
* @type {'count'|'notification'}
|
|
48
80
|
*/
|
|
49
|
-
|
|
50
|
-
type:
|
|
81
|
+
type: {
|
|
82
|
+
type: String,
|
|
51
83
|
reflect: true,
|
|
52
|
-
attribute: '
|
|
53
|
-
}
|
|
84
|
+
attribute: 'type'
|
|
85
|
+
}
|
|
54
86
|
};
|
|
55
87
|
}
|
|
56
88
|
|
|
57
89
|
static get styles() {
|
|
58
|
-
return [ css`
|
|
90
|
+
return [offscreenStyles, css`
|
|
59
91
|
:host([hidden]) {
|
|
60
92
|
display: none;
|
|
61
93
|
}
|
|
@@ -112,9 +144,16 @@ class CountBadge extends RtlMixin(LitElement) {
|
|
|
112
144
|
|
|
113
145
|
constructor() {
|
|
114
146
|
super();
|
|
115
|
-
this.
|
|
116
|
-
this.
|
|
147
|
+
this.announceChanges = false;
|
|
148
|
+
this.hasTooltip = false;
|
|
117
149
|
this.hideZero = false;
|
|
150
|
+
this.size = 'small';
|
|
151
|
+
this.tabStop = false;
|
|
152
|
+
this.text = '';
|
|
153
|
+
this.type = 'count';
|
|
154
|
+
|
|
155
|
+
this._badgeId = getUniqueId();
|
|
156
|
+
this._textId = getUniqueId();
|
|
118
157
|
}
|
|
119
158
|
|
|
120
159
|
connectedCallback() {
|
|
@@ -134,7 +173,17 @@ class CountBadge extends RtlMixin(LitElement) {
|
|
|
134
173
|
numberString = `${'9'.repeat(this.maxDigits)}+`;
|
|
135
174
|
}
|
|
136
175
|
return html`
|
|
137
|
-
<div
|
|
176
|
+
<div
|
|
177
|
+
class="d2l-count-badge-number"
|
|
178
|
+
id="${this._badgeId}"
|
|
179
|
+
tabindex="${ifDefined(this.tabStop || this.hasTooltip ? '0' : undefined)}"
|
|
180
|
+
aria-labelledby="${ifDefined(this.hasTooltip ? undefined : this._textId)}">
|
|
181
|
+
<div aria-hidden="true">${numberString}</div>
|
|
182
|
+
${this.hasTooltip ?
|
|
183
|
+
html`<d2l-tooltip id="${this._textId}" for="${this._badgeId}" aria-live="${this.announceChanges ? 'polite' : 'off'}">${this.text}</d2l-tooltip>`
|
|
184
|
+
: html`<span id="${this._textId}" class="d2l-offscreen" aria-live="${this.announceChanges ? 'polite' : 'off'}">"${this.text}"</span>`}
|
|
185
|
+
</div>
|
|
186
|
+
`;
|
|
138
187
|
}
|
|
139
188
|
}
|
|
140
189
|
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
<script type="module">
|
|
10
10
|
import '../../demo/demo-page.js';
|
|
11
11
|
import '../count-badge.js';
|
|
12
|
+
import '../../button/button.js';
|
|
12
13
|
</script>
|
|
13
14
|
</head>
|
|
14
15
|
<body unresolved>
|
|
@@ -17,22 +18,43 @@
|
|
|
17
18
|
<h2>Small Notification Badge</h2>
|
|
18
19
|
<d2l-demo-snippet>
|
|
19
20
|
<template>
|
|
20
|
-
<d2l-count-badge size="small" type="notification" number="1"></d2l-count-badge>
|
|
21
|
-
<d2l-count-badge size="small" type="notification" number="10"></d2l-count-badge>
|
|
22
|
-
<d2l-count-badge size="small" type="notification" number="100"></d2l-count-badge>
|
|
21
|
+
<d2l-count-badge size="small" tab-stop text=" 1 new notification." type="notification" number="1"></d2l-count-badge>
|
|
22
|
+
<d2l-count-badge size="small" text="10 new notifications." type="notification" number="10"></d2l-count-badge>
|
|
23
|
+
<d2l-count-badge size="small" text="100 new notifications." type="notification" number="100"></d2l-count-badge>
|
|
24
|
+
</template>
|
|
25
|
+
</d2l-demo-snippet>
|
|
26
|
+
|
|
27
|
+
<h2>Small Notification Badge with live region</h2>
|
|
28
|
+
<d2l-demo-snippet>
|
|
29
|
+
<template>
|
|
30
|
+
<d2l-count-badge id="badge-announce-changes"size="small" announce-changes tab-stop text=" 1 new notification." type="notification" number="1"></d2l-count-badge>
|
|
31
|
+
<d2l-button id="increment-count">Increment Count</d2l-button>
|
|
23
32
|
</template>
|
|
24
33
|
</d2l-demo-snippet>
|
|
25
34
|
|
|
26
35
|
<h2>Large Count Badge</h2>
|
|
27
36
|
<d2l-demo-snippet>
|
|
28
37
|
<template>
|
|
29
|
-
<d2l-count-badge size="large" type="count" number="1"></d2l-count-badge>
|
|
30
|
-
<d2l-count-badge size="large" type="count" number="10"></d2l-count-badge>
|
|
31
|
-
<d2l-count-badge size="large" type="count" number="100"></d2l-count-badge>
|
|
32
|
-
<d2l-count-badge size="large" type="count" number="777777"></d2l-count-badge>
|
|
33
|
-
<d2l-count-badge size="large" type="count" number="777777" max-digits="5"></d2l-count-badge>
|
|
38
|
+
<d2l-count-badge size="large" text="1 new notification." type="count" number="1"></d2l-count-badge>
|
|
39
|
+
<d2l-count-badge size="large" text="10 new notifications." type="count" number="10"></d2l-count-badge>
|
|
40
|
+
<d2l-count-badge size="large" text="100 new notifications." type="count" number="100"></d2l-count-badge>
|
|
41
|
+
<d2l-count-badge size="large" text="777777 new notifications." type="count" number="777777"></d2l-count-badge>
|
|
42
|
+
<d2l-count-badge size="large" text="777777 new notifications."type="count" number="777777" max-digits="5"></d2l-count-badge>
|
|
43
|
+
</template>
|
|
44
|
+
</d2l-demo-snippet>
|
|
45
|
+
|
|
46
|
+
<h2>Small Notification Badge with Tooltip</h2>
|
|
47
|
+
<d2l-demo-snippet>
|
|
48
|
+
<template>
|
|
49
|
+
<d2l-count-badge size="small" has-tooltip text=" 3 new notification." type="notification" number="1"></d2l-count-badge>
|
|
34
50
|
</template>
|
|
35
51
|
</d2l-demo-snippet>
|
|
36
52
|
</d2l-demo-page>
|
|
53
|
+
<script type="module">
|
|
54
|
+
document.getElementById('increment-count').addEventListener('click', () => {
|
|
55
|
+
document.getElementById('badge-announce-changes').number += 1;
|
|
56
|
+
document.getElementById('badge-announce-changes').text = `${document.getElementById('badge-announce-changes').number} new notifications.`;
|
|
57
|
+
});
|
|
58
|
+
</script>
|
|
37
59
|
</body>
|
|
38
60
|
</html>
|
|
@@ -323,7 +323,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
323
323
|
this.opened = false;
|
|
324
324
|
};
|
|
325
325
|
|
|
326
|
-
if (!reduceMotion && this.
|
|
326
|
+
if (!reduceMotion && this._useMobileStyling && this.mobileTray && isVisible(this)) {
|
|
327
327
|
this.shadowRoot.querySelector('.d2l-dropdown-content-width')
|
|
328
328
|
.addEventListener('animationend', hide, { once: true });
|
|
329
329
|
this._closing = true;
|
|
@@ -352,14 +352,14 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
352
352
|
this.__applyFocus = applyFocus !== undefined ? applyFocus : true;
|
|
353
353
|
this.opened = true;
|
|
354
354
|
await this.updateComplete;
|
|
355
|
-
this._showBackdrop = this.
|
|
355
|
+
this._showBackdrop = this._useMobileStyling && this.mobileTray;
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
async resize() {
|
|
359
359
|
if (!this.opened) {
|
|
360
360
|
return;
|
|
361
361
|
}
|
|
362
|
-
this._showBackdrop = this.
|
|
362
|
+
this._showBackdrop = this._useMobileStyling && this.mobileTray;
|
|
363
363
|
await this.__position();
|
|
364
364
|
}
|
|
365
365
|
|
|
@@ -504,7 +504,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
504
504
|
}
|
|
505
505
|
|
|
506
506
|
await this.__position();
|
|
507
|
-
this._showBackdrop = this.
|
|
507
|
+
this._showBackdrop = this._useMobileStyling && this.mobileTray;
|
|
508
508
|
|
|
509
509
|
if (!this.noAutoFocus && this.__applyFocus) {
|
|
510
510
|
const focusable = getFirstFocusableDescendant(this);
|
|
@@ -530,7 +530,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
530
530
|
|
|
531
531
|
if (newValue) {
|
|
532
532
|
|
|
533
|
-
if (ifrauBackdropService && this.mobileTray && this.
|
|
533
|
+
if (ifrauBackdropService && this.mobileTray && this._useMobileStyling) {
|
|
534
534
|
this._ifrauContextInfo = await ifrauBackdropService.showBackdrop();
|
|
535
535
|
}
|
|
536
536
|
|
|
@@ -542,7 +542,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
542
542
|
clearDismissible(this.__dismissibleId);
|
|
543
543
|
this.__dismissibleId = null;
|
|
544
544
|
}
|
|
545
|
-
if (ifrauBackdropService && this.mobileTray && this.
|
|
545
|
+
if (ifrauBackdropService && this.mobileTray && this._useMobileStyling) {
|
|
546
546
|
ifrauBackdropService.hideBackdrop();
|
|
547
547
|
this._ifrauContextInfo = null;
|
|
548
548
|
}
|
|
@@ -771,8 +771,10 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
771
771
|
this.dispatchEvent(new CustomEvent('d2l-dropdown-focus-enter'));
|
|
772
772
|
}
|
|
773
773
|
|
|
774
|
-
_handleMobileResize() {
|
|
774
|
+
async _handleMobileResize() {
|
|
775
775
|
this._useMobileStyling = this.mediaQueryList.matches;
|
|
776
|
+
this._showBackdrop = this._useMobileStyling && this.mobileTray;
|
|
777
|
+
if (this.opened) await this.__position();
|
|
776
778
|
}
|
|
777
779
|
|
|
778
780
|
_renderContent() {
|
|
@@ -787,9 +789,9 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
787
789
|
}
|
|
788
790
|
}
|
|
789
791
|
|
|
790
|
-
const specialMobileStyle = this.
|
|
791
|
-
const mobileTrayRightLeft = this.
|
|
792
|
-
const mobileTrayBottom = this.
|
|
792
|
+
const specialMobileStyle = this._useMobileStyling && this.mobileTray;
|
|
793
|
+
const mobileTrayRightLeft = this._useMobileStyling && (this.mobileTray === 'right' || this.mobileTray === 'left');
|
|
794
|
+
const mobileTrayBottom = this._useMobileStyling && (this.mobileTray === 'bottom');
|
|
793
795
|
|
|
794
796
|
let maxWidthOverride = this.maxWidth;
|
|
795
797
|
if (mobileTrayRightLeft) {
|
|
@@ -1,36 +1,76 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Collapsible Containers
|
|
2
2
|
|
|
3
|
-
## Expand Collapse Content
|
|
3
|
+
## Expand Collapse Content [d2l-expand-collapse-content]
|
|
4
4
|
|
|
5
5
|
The `d2l-expand-collapse-content` element can be used to create expandable and collapsible content. This component only provides the logic to expand and collapse the content; controlling when and how it expands or collapses is the responsibility of the user.
|
|
6
6
|
|
|
7
|
+
<!-- docs: start hidden content -->
|
|
7
8
|

|
|
9
|
+
<!-- docs: end hidden content -->
|
|
8
10
|
|
|
11
|
+
<!-- docs: demo live name:d2l-expand-collapse-content autoSize:false display:block size:small -->
|
|
9
12
|
```html
|
|
10
13
|
<script type="module">
|
|
14
|
+
import '@brightspace-ui/core/components/button/button.js';
|
|
11
15
|
import '@brightspace-ui/core/components/expand-collapse/expand-collapse-content.js';
|
|
12
|
-
</script>
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
const button = document.querySelector('d2l-button');
|
|
18
|
+
button.addEventListener('click', () => {
|
|
19
|
+
const section = document.querySelector('d2l-expand-collapse-content');
|
|
20
|
+
section.expanded = !section.expanded;
|
|
21
|
+
button.setAttribute('aria-expanded', section.expanded ? 'true' : 'false');
|
|
22
|
+
});
|
|
23
|
+
</script>
|
|
24
|
+
<d2l-button primary>Toggle</d2l-button>
|
|
25
|
+
<d2l-expand-collapse-content>
|
|
15
26
|
<p>My expand collapse content.</p>
|
|
16
27
|
</d2l-expand-collapse-content>
|
|
17
28
|
```
|
|
18
29
|
|
|
19
|
-
|
|
30
|
+
<!-- docs: start hidden content -->
|
|
31
|
+
### Properties
|
|
20
32
|
|
|
21
33
|
| Property | Type | Description |
|
|
22
34
|
|--|--|--|
|
|
23
35
|
| `expanded` | Boolean, default: `false` | Specifies the expanded/collapsed state of the content |
|
|
24
36
|
|
|
25
|
-
|
|
37
|
+
### Events
|
|
26
38
|
|
|
27
39
|
- `d2l-expand-collapse-content-expand`: dispatched when the content starts to expand. The `detail` contains an `expandComplete` promise that can be waited on to determine when the content has finished expanding.
|
|
28
40
|
- `d2l-expand-collapse-content-collapse`: dispatched when the content starts to collapse. The `detail` contains a `collapseComplete` promise that can be waited on to determine when the content has finished collapsing.
|
|
41
|
+
<!-- docs: end hidden content -->
|
|
29
42
|
|
|
30
|
-
|
|
43
|
+
### Accessibility Properties
|
|
31
44
|
|
|
32
45
|
To make your usage of `d2l-expand-collapse-content` accessible, the [`aria-expanded` attribute](https://www.w3.org/TR/wai-aria/#aria-expanded) should be added to the element that controls expanding and collapsing the content with `"true"` or `"false"` to indicate that the content is expanded or collapsed.
|
|
33
46
|
|
|
34
|
-
##
|
|
47
|
+
## More-Less [d2l-more-less]
|
|
48
|
+
|
|
49
|
+
The `d2l-more-less` element can be used to minimize the display of long content, while providing a way to reveal the full content.
|
|
35
50
|
|
|
36
|
-
|
|
51
|
+
<!-- docs: start hidden content -->
|
|
52
|
+

|
|
53
|
+
<!-- docs: end hidden content -->
|
|
54
|
+
|
|
55
|
+
<!-- docs: demo live name:d2l-more-less -->
|
|
56
|
+
```html
|
|
57
|
+
<script type="module">
|
|
58
|
+
import '@brightspace-ui/core/components/more-less/more-less.js';
|
|
59
|
+
</script>
|
|
60
|
+
<d2l-more-less>
|
|
61
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
62
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
63
|
+
</d2l-more-less>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
<!-- docs: start hidden content -->
|
|
67
|
+
### Properties
|
|
68
|
+
|
|
69
|
+
| Property | Type | Description |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| `blur-color` | String | Gradient HEX formatted color of the blurring effect (defaults to white). |
|
|
72
|
+
| `expanded` | Boolean | Specifies the expanded/collapsed state of the content |
|
|
73
|
+
| `h-align` | String | A value of `text` aligns the leading edge of text |
|
|
74
|
+
| `height` | String, default: `'4em'` | Maximum height of the content when in "less" mode. The `d2l-more-less` element itself will take up additional vertical space for the fading effect as well as the more/less button itself. |
|
|
75
|
+
| `inactive` | Boolean | Whether the component is active or inactive |
|
|
76
|
+
<!-- docs: end hidden content -->
|
|
@@ -12,10 +12,20 @@ const states = {
|
|
|
12
12
|
EXPANDED: 'expanded', // fully expanded
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* A component used to minimize the display of long content, while providing a way to reveal the full content.
|
|
17
|
+
* @slot - Default content placed inside of the component
|
|
18
|
+
* @fires d2l-expand-collapse-content-expand - Dispatched when the content starts to expand. The `detail` contains an `expandComplete` promise that can be waited on to determine when the content has finished expanding.
|
|
19
|
+
* @fires d2l-expand-collapse-content-collapse - Dispatched when the content starts to collapse. The `detail` contains a `collapseComplete` promise that can be waited on to determine when the content has finished collapsing.
|
|
20
|
+
*/
|
|
15
21
|
class ExpandCollapseContent extends LitElement {
|
|
16
22
|
|
|
17
23
|
static get properties() {
|
|
18
24
|
return {
|
|
25
|
+
/**
|
|
26
|
+
* Specifies the expanded/collapsed state of the content
|
|
27
|
+
* @type {boolean}
|
|
28
|
+
*/
|
|
19
29
|
expanded: { type: Boolean, reflect: true },
|
|
20
30
|
_height: { type: String },
|
|
21
31
|
_state: { type: String }
|
|
File without changes
|
|
@@ -213,11 +213,12 @@ class Filter extends LocalizeCoreElement(RtlMixin(LitElement)) {
|
|
|
213
213
|
}
|
|
214
214
|
return this._dimensions.map((dimension) => {
|
|
215
215
|
const builtDimension = this._buildDimension(dimension);
|
|
216
|
-
const
|
|
217
|
-
|
|
216
|
+
const countBadgeId = `filters-applied-count-${dimension.key}`;
|
|
217
|
+
const filtersAppliedText = `${this.localize('components.filter.filterCountDescription', { number: dimension.appliedCount })}`;
|
|
218
|
+
return html`<d2l-menu-item text="${dimension.text}" description="${dimension.text}." aria-describedby="${countBadgeId}">
|
|
218
219
|
${builtDimension}
|
|
219
220
|
<div slot="supporting">
|
|
220
|
-
<d2l-count-badge number="${dimension.appliedCount}" max-digits="2" hide-zero></d2l-count-badge>
|
|
221
|
+
<d2l-count-badge id="${countBadgeId}" number="${dimension.appliedCount}" max-digits="2" text="${filtersAppliedText}" hide-zero></d2l-count-badge>
|
|
221
222
|
</div>
|
|
222
223
|
</d2l-menu-item>`;
|
|
223
224
|
});
|
|
@@ -1,27 +1,3 @@
|
|
|
1
1
|
# More-Less
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-

|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<script type="module">
|
|
9
|
-
import '@brightspace-ui/core/components/more-less/more-less.js';
|
|
10
|
-
</script>
|
|
11
|
-
<d2l-more-less>
|
|
12
|
-
Grumpy wizards make toxic brew for the evil Queen and Jack.
|
|
13
|
-
</d2l-more-less>
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
**Properties:**
|
|
17
|
-
|
|
18
|
-
| Property | Type | Description |
|
|
19
|
-
|--|--|--|
|
|
20
|
-
| `blur-color` | String | Gradient HEX formatted color of the blurring effect (defaults to white). |
|
|
21
|
-
| `expanded` | Boolean | Specifies the expanded/collapsed state of the content |
|
|
22
|
-
| `h-align` | String | A value of `text` aligns the leading edge of text |
|
|
23
|
-
| `height` | String, default: `'4em'` | Maximum height of the content when in "less" mode. The `d2l-more-less` element itself will take up additional vertical space for the fading effect as well as the more/less button itself. |
|
|
24
|
-
|
|
25
|
-
## Future Enhancements
|
|
26
|
-
|
|
27
|
-
Looking for an enhancement not listed here? Create a GitHub issue!
|
|
3
|
+
See [more-less](https://github.com/BrightspaceUI/core/tree/main/components/expand-collapse/README.md#more-less-d2l-more-less).
|
|
@@ -19,11 +19,13 @@ class MoreLess extends LocalizeCoreElement(LitElement) {
|
|
|
19
19
|
return {
|
|
20
20
|
/**
|
|
21
21
|
* The gradient color of the blurring effect
|
|
22
|
+
* @type {string}
|
|
22
23
|
*/
|
|
23
24
|
blurColor: { type: String, attribute: 'blur-color' },
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* Indicates whether element is in "more" state
|
|
28
|
+
* @type {boolean}
|
|
27
29
|
*/
|
|
28
30
|
expanded: { type: Boolean, reflect: true },
|
|
29
31
|
|
|
@@ -35,11 +37,13 @@ class MoreLess extends LocalizeCoreElement(LitElement) {
|
|
|
35
37
|
|
|
36
38
|
/**
|
|
37
39
|
* The maximum height of the content when in "less" state
|
|
40
|
+
* @type {string}
|
|
38
41
|
*/
|
|
39
42
|
height: { type: String },
|
|
40
43
|
|
|
41
44
|
/**
|
|
42
45
|
* Whether the component is active or inactive
|
|
46
|
+
* @type {boolean}
|
|
43
47
|
*/
|
|
44
48
|
inactive: { type: Boolean, reflect: true },
|
|
45
49
|
__blurBackground: { type: String },
|
|
@@ -171,6 +171,8 @@ export const SelectionMixin = superclass => class extends RtlMixin(superclass) {
|
|
|
171
171
|
if (selectable.selected && selectable !== target) selectable.selected = false;
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
|
+
|
|
175
|
+
this._updateSelectionObservers();
|
|
174
176
|
}
|
|
175
177
|
|
|
176
178
|
_handleSelectionObserverSubscribe(e) {
|
|
@@ -106,7 +106,6 @@ The state is used to apply a meaningful colour to the status indicator to assist
|
|
|
106
106
|
```html
|
|
107
107
|
<script type="module">
|
|
108
108
|
import '@brightspace-ui/core/components/status-indicator/status-indicator.js';
|
|
109
|
-
import '@brightspace-ui/core/components/status-indicator/status-indicator.js';
|
|
110
109
|
</script>
|
|
111
110
|
<style>
|
|
112
111
|
.status-format {
|
package/custom-elements.json
CHANGED
|
@@ -1008,21 +1008,33 @@
|
|
|
1008
1008
|
"name": "d2l-count-badge",
|
|
1009
1009
|
"path": "./components/count-badge/count-badge.js",
|
|
1010
1010
|
"attributes": [
|
|
1011
|
+
{
|
|
1012
|
+
"name": "max-digits",
|
|
1013
|
+
"description": "Optionally specify a digit limit, after which numbers are truncated. Defaults to two for \"notification\" type and no limit for \"count\" type.",
|
|
1014
|
+
"type": "number"
|
|
1015
|
+
},
|
|
1011
1016
|
{
|
|
1012
1017
|
"name": "number",
|
|
1013
1018
|
"description": "The number to be displayed on the badge. Must be a positive integer.",
|
|
1014
1019
|
"type": "number"
|
|
1015
1020
|
},
|
|
1016
1021
|
{
|
|
1017
|
-
"name": "
|
|
1018
|
-
"description": "Optionally
|
|
1019
|
-
"type": "
|
|
1022
|
+
"name": "announce-changes",
|
|
1023
|
+
"description": "Optionally choose to announce changes to the badge with an aria-live region. If the number property is changed, the text will be read by screenreaders. Defaults to false.",
|
|
1024
|
+
"type": "boolean",
|
|
1025
|
+
"default": "false"
|
|
1020
1026
|
},
|
|
1021
1027
|
{
|
|
1022
|
-
"name": "
|
|
1023
|
-
"description": "
|
|
1024
|
-
"type": "
|
|
1025
|
-
"default": "
|
|
1028
|
+
"name": "has-tooltip",
|
|
1029
|
+
"description": "Optionally add a tooltip on the badge. Defaults to false.",
|
|
1030
|
+
"type": "boolean",
|
|
1031
|
+
"default": "false"
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
"name": "hide-zero",
|
|
1035
|
+
"description": "Optionally choose to not render the count badge when the number is zero. Defaults to false.",
|
|
1036
|
+
"type": "boolean",
|
|
1037
|
+
"default": "false"
|
|
1026
1038
|
},
|
|
1027
1039
|
{
|
|
1028
1040
|
"name": "size",
|
|
@@ -1031,13 +1043,31 @@
|
|
|
1031
1043
|
"default": "\"small\""
|
|
1032
1044
|
},
|
|
1033
1045
|
{
|
|
1034
|
-
"name": "
|
|
1035
|
-
"description": "Optionally choose to
|
|
1046
|
+
"name": "tab-stop",
|
|
1047
|
+
"description": "Optionally choose to add a tab stop to the badge. Defaults to false.",
|
|
1036
1048
|
"type": "boolean",
|
|
1037
1049
|
"default": "false"
|
|
1050
|
+
},
|
|
1051
|
+
{
|
|
1052
|
+
"name": "text",
|
|
1053
|
+
"description": "* Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled.",
|
|
1054
|
+
"type": "string",
|
|
1055
|
+
"default": "\"\""
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
"name": "type",
|
|
1059
|
+
"description": "The type of the badge. Defaults to \"count\".",
|
|
1060
|
+
"type": "'count'|'notification'",
|
|
1061
|
+
"default": "\"count\""
|
|
1038
1062
|
}
|
|
1039
1063
|
],
|
|
1040
1064
|
"properties": [
|
|
1065
|
+
{
|
|
1066
|
+
"name": "maxDigits",
|
|
1067
|
+
"attribute": "max-digits",
|
|
1068
|
+
"description": "Optionally specify a digit limit, after which numbers are truncated. Defaults to two for \"notification\" type and no limit for \"count\" type.",
|
|
1069
|
+
"type": "number"
|
|
1070
|
+
},
|
|
1041
1071
|
{
|
|
1042
1072
|
"name": "number",
|
|
1043
1073
|
"attribute": "number",
|
|
@@ -1045,17 +1075,25 @@
|
|
|
1045
1075
|
"type": "number"
|
|
1046
1076
|
},
|
|
1047
1077
|
{
|
|
1048
|
-
"name": "
|
|
1049
|
-
"attribute": "
|
|
1050
|
-
"description": "Optionally
|
|
1051
|
-
"type": "
|
|
1078
|
+
"name": "announceChanges",
|
|
1079
|
+
"attribute": "announce-changes",
|
|
1080
|
+
"description": "Optionally choose to announce changes to the badge with an aria-live region. If the number property is changed, the text will be read by screenreaders. Defaults to false.",
|
|
1081
|
+
"type": "boolean",
|
|
1082
|
+
"default": "false"
|
|
1052
1083
|
},
|
|
1053
1084
|
{
|
|
1054
|
-
"name": "
|
|
1055
|
-
"attribute": "
|
|
1056
|
-
"description": "
|
|
1057
|
-
"type": "
|
|
1058
|
-
"default": "
|
|
1085
|
+
"name": "hasTooltip",
|
|
1086
|
+
"attribute": "has-tooltip",
|
|
1087
|
+
"description": "Optionally add a tooltip on the badge. Defaults to false.",
|
|
1088
|
+
"type": "boolean",
|
|
1089
|
+
"default": "false"
|
|
1090
|
+
},
|
|
1091
|
+
{
|
|
1092
|
+
"name": "hideZero",
|
|
1093
|
+
"attribute": "hide-zero",
|
|
1094
|
+
"description": "Optionally choose to not render the count badge when the number is zero. Defaults to false.",
|
|
1095
|
+
"type": "boolean",
|
|
1096
|
+
"default": "false"
|
|
1059
1097
|
},
|
|
1060
1098
|
{
|
|
1061
1099
|
"name": "size",
|
|
@@ -1065,11 +1103,25 @@
|
|
|
1065
1103
|
"default": "\"small\""
|
|
1066
1104
|
},
|
|
1067
1105
|
{
|
|
1068
|
-
"name": "
|
|
1069
|
-
"attribute": "
|
|
1070
|
-
"description": "Optionally choose to
|
|
1106
|
+
"name": "tabStop",
|
|
1107
|
+
"attribute": "tab-stop",
|
|
1108
|
+
"description": "Optionally choose to add a tab stop to the badge. Defaults to false.",
|
|
1071
1109
|
"type": "boolean",
|
|
1072
1110
|
"default": "false"
|
|
1111
|
+
},
|
|
1112
|
+
{
|
|
1113
|
+
"name": "text",
|
|
1114
|
+
"attribute": "text",
|
|
1115
|
+
"description": "* Descriptive text for the badge which will act as an accessible label and tooltip text when tooltips are enabled.",
|
|
1116
|
+
"type": "string",
|
|
1117
|
+
"default": "\"\""
|
|
1118
|
+
},
|
|
1119
|
+
{
|
|
1120
|
+
"name": "type",
|
|
1121
|
+
"attribute": "type",
|
|
1122
|
+
"description": "The type of the badge. Defaults to \"count\".",
|
|
1123
|
+
"type": "'count'|'notification'",
|
|
1124
|
+
"default": "\"count\""
|
|
1073
1125
|
}
|
|
1074
1126
|
]
|
|
1075
1127
|
},
|
|
@@ -2536,9 +2588,11 @@
|
|
|
2536
2588
|
{
|
|
2537
2589
|
"name": "d2l-expand-collapse-content",
|
|
2538
2590
|
"path": "./components/expand-collapse/expand-collapse-content.js",
|
|
2591
|
+
"description": "A component used to minimize the display of long content, while providing a way to reveal the full content.",
|
|
2539
2592
|
"attributes": [
|
|
2540
2593
|
{
|
|
2541
2594
|
"name": "expanded",
|
|
2595
|
+
"description": "Specifies the expanded/collapsed state of the content",
|
|
2542
2596
|
"type": "boolean",
|
|
2543
2597
|
"default": "false"
|
|
2544
2598
|
}
|
|
@@ -2547,16 +2601,25 @@
|
|
|
2547
2601
|
{
|
|
2548
2602
|
"name": "expanded",
|
|
2549
2603
|
"attribute": "expanded",
|
|
2604
|
+
"description": "Specifies the expanded/collapsed state of the content",
|
|
2550
2605
|
"type": "boolean",
|
|
2551
2606
|
"default": "false"
|
|
2552
2607
|
}
|
|
2553
2608
|
],
|
|
2554
2609
|
"events": [
|
|
2555
2610
|
{
|
|
2556
|
-
"name": "d2l-expand-collapse-content-expand"
|
|
2611
|
+
"name": "d2l-expand-collapse-content-expand",
|
|
2612
|
+
"description": "Dispatched when the content starts to expand. The `detail` contains an `expandComplete` promise that can be waited on to determine when the content has finished expanding."
|
|
2557
2613
|
},
|
|
2558
2614
|
{
|
|
2559
|
-
"name": "d2l-expand-collapse-content-collapse"
|
|
2615
|
+
"name": "d2l-expand-collapse-content-collapse",
|
|
2616
|
+
"description": "Dispatched when the content starts to collapse. The `detail` contains a `collapseComplete` promise that can be waited on to determine when the content has finished collapsing."
|
|
2617
|
+
}
|
|
2618
|
+
],
|
|
2619
|
+
"slots": [
|
|
2620
|
+
{
|
|
2621
|
+
"name": "",
|
|
2622
|
+
"description": "Default content placed inside of the component"
|
|
2560
2623
|
}
|
|
2561
2624
|
]
|
|
2562
2625
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.177.0",
|
|
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": {
|