@brightspace-ui/core 1.195.0 → 1.196.3
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/list/README.md +1 -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 +16 -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-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/helpers/htmlAttributeObserverController.js +38 -0
- package/mixins/labelled-mixin.js +1 -0
- package/package.json +1 -1
- package/templates/primary-secondary/README.md +2 -6
|
@@ -14,14 +14,14 @@ class DropdownButtonSubtle extends DropdownOpenerMixin(LitElement) {
|
|
|
14
14
|
return {
|
|
15
15
|
/**
|
|
16
16
|
* A description to be added to the opener button for accessibility when text on button does not provide enough context
|
|
17
|
+
* @type {string}
|
|
17
18
|
*/
|
|
18
19
|
description: { type: String },
|
|
19
20
|
/**
|
|
20
21
|
* REQUIRED: Text for the button
|
|
22
|
+
* @type {string}
|
|
21
23
|
*/
|
|
22
|
-
text: {
|
|
23
|
-
type: String
|
|
24
|
-
}
|
|
24
|
+
text: { type: String }
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -15,6 +15,7 @@ class DropdownButton extends DropdownOpenerMixin(RtlMixin(LitElement)) {
|
|
|
15
15
|
return {
|
|
16
16
|
/**
|
|
17
17
|
* Optionally render button as primary button
|
|
18
|
+
* @type {boolean}
|
|
18
19
|
*/
|
|
19
20
|
primary: {
|
|
20
21
|
type: Boolean,
|
|
@@ -23,6 +24,7 @@ class DropdownButton extends DropdownOpenerMixin(RtlMixin(LitElement)) {
|
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* REQUIRED: Text for the button
|
|
27
|
+
* @type {string}
|
|
26
28
|
*/
|
|
27
29
|
text: {
|
|
28
30
|
type: String
|
|
@@ -29,12 +29,14 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
29
29
|
},
|
|
30
30
|
/**
|
|
31
31
|
* Optionally provide boundaries to where the dropdown will appear. Valid properties are "above", "below", "left", and "right".
|
|
32
|
+
* @type {object}
|
|
32
33
|
*/
|
|
33
34
|
boundary: {
|
|
34
35
|
type: Object,
|
|
35
36
|
},
|
|
36
37
|
/**
|
|
37
38
|
* Override default max-width (undefined). Specify a number that would be the px value.
|
|
39
|
+
* @type {number}
|
|
38
40
|
*/
|
|
39
41
|
maxWidth: {
|
|
40
42
|
type: Number,
|
|
@@ -43,6 +45,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
43
45
|
},
|
|
44
46
|
/**
|
|
45
47
|
* Override default min-width (undefined). Specify a number that would be the px value.
|
|
48
|
+
* @type {number}
|
|
46
49
|
*/
|
|
47
50
|
minWidth: {
|
|
48
51
|
type: Number,
|
|
@@ -51,6 +54,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
51
54
|
},
|
|
52
55
|
/**
|
|
53
56
|
* Override max-height. Note that the default behaviour is to be as tall as necessary within the viewport, so this property is usually not needed.
|
|
57
|
+
* @type {number}
|
|
54
58
|
*/
|
|
55
59
|
maxHeight: {
|
|
56
60
|
type: Number,
|
|
@@ -58,6 +62,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
58
62
|
},
|
|
59
63
|
/**
|
|
60
64
|
* Override the breakpoint at which mobile styling is used. Defaults to 616px.
|
|
65
|
+
* @type {number}
|
|
61
66
|
*/
|
|
62
67
|
mobileBreakpointOverride: {
|
|
63
68
|
type: Number,
|
|
@@ -65,6 +70,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
65
70
|
},
|
|
66
71
|
/**
|
|
67
72
|
* Override default height used for required space when `no-auto-fit` is true. Specify a number that would be the px value. Note that the default behaviour is to be as tall as necessary within the viewport, so this property is usually not needed.
|
|
73
|
+
* @type {number}
|
|
68
74
|
*/
|
|
69
75
|
minHeight: {
|
|
70
76
|
type: Number,
|
|
@@ -73,6 +79,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
73
79
|
},
|
|
74
80
|
/**
|
|
75
81
|
* Opt-out of showing a close button in the footer of tray-style mobile dropdowns.
|
|
82
|
+
* @type {boolean}
|
|
76
83
|
*/
|
|
77
84
|
noMobileCloseButton: {
|
|
78
85
|
type: Boolean,
|
|
@@ -90,6 +97,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
90
97
|
},
|
|
91
98
|
/**
|
|
92
99
|
* Opt out of automatically closing on focus or click outside of the dropdown content
|
|
100
|
+
* @type {boolean}
|
|
93
101
|
*/
|
|
94
102
|
noAutoClose: {
|
|
95
103
|
type: Boolean,
|
|
@@ -98,6 +106,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
98
106
|
},
|
|
99
107
|
/**
|
|
100
108
|
* Opt out of auto-sizing
|
|
109
|
+
* @type {boolean}
|
|
101
110
|
*/
|
|
102
111
|
noAutoFit: {
|
|
103
112
|
type: Boolean,
|
|
@@ -106,6 +115,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
106
115
|
},
|
|
107
116
|
/**
|
|
108
117
|
* Opt out of focus being automatically moved to the first focusable element in the dropdown when opened
|
|
118
|
+
* @type {boolean}
|
|
109
119
|
*/
|
|
110
120
|
noAutoFocus: {
|
|
111
121
|
type: Boolean,
|
|
@@ -114,6 +124,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
114
124
|
},
|
|
115
125
|
/**
|
|
116
126
|
* Render with no padding
|
|
127
|
+
* @type {boolean}
|
|
117
128
|
*/
|
|
118
129
|
noPadding: {
|
|
119
130
|
type: Boolean,
|
|
@@ -122,6 +133,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
122
133
|
},
|
|
123
134
|
/**
|
|
124
135
|
* Render the footer with no padding (if it has content)
|
|
136
|
+
* @type {boolean}
|
|
125
137
|
*/
|
|
126
138
|
noPaddingFooter: {
|
|
127
139
|
type: Boolean,
|
|
@@ -130,6 +142,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
130
142
|
},
|
|
131
143
|
/**
|
|
132
144
|
* Render the header with no padding (if it has content)
|
|
145
|
+
* @type {boolean}
|
|
133
146
|
*/
|
|
134
147
|
noPaddingHeader: {
|
|
135
148
|
type: Boolean,
|
|
@@ -138,6 +151,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
138
151
|
},
|
|
139
152
|
/**
|
|
140
153
|
* Render without a pointer
|
|
154
|
+
* @type {boolean}
|
|
141
155
|
*/
|
|
142
156
|
noPointer: {
|
|
143
157
|
type: Boolean,
|
|
@@ -162,6 +176,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
162
176
|
},
|
|
163
177
|
/**
|
|
164
178
|
* Optionally render a d2l-focus-trap around the dropdown content
|
|
179
|
+
* @type {boolean}
|
|
165
180
|
*/
|
|
166
181
|
trapFocus: {
|
|
167
182
|
type: Boolean,
|
|
@@ -170,6 +185,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
170
185
|
},
|
|
171
186
|
/**
|
|
172
187
|
* Provide custom offset, positive or negative
|
|
188
|
+
* @type {string}
|
|
173
189
|
*/
|
|
174
190
|
verticalOffset: {
|
|
175
191
|
type: String,
|
|
@@ -549,6 +565,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
549
565
|
this._showBackdrop = false;
|
|
550
566
|
await this.updateComplete;
|
|
551
567
|
|
|
568
|
+
/** Dispatched when the dropdown is closed */
|
|
552
569
|
this.dispatchEvent(new CustomEvent('d2l-dropdown-close', { bubbles: true, composed: true }));
|
|
553
570
|
|
|
554
571
|
}
|
|
@@ -656,6 +673,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
656
673
|
await this.updateComplete;
|
|
657
674
|
}
|
|
658
675
|
|
|
676
|
+
/** Dispatched when the dropdown position finishes adjusting */
|
|
659
677
|
this.dispatchEvent(new CustomEvent('d2l-dropdown-position', { bubbles: true, composed: true }));
|
|
660
678
|
};
|
|
661
679
|
|
|
@@ -1006,6 +1024,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
1006
1024
|
content.focus();
|
|
1007
1025
|
}
|
|
1008
1026
|
}
|
|
1027
|
+
/** Dispatched when user focus enters the dropdown content (trap-focus option only) */
|
|
1009
1028
|
this.dispatchEvent(new CustomEvent('d2l-dropdown-focus-enter'));
|
|
1010
1029
|
}
|
|
1011
1030
|
|
|
@@ -1054,16 +1073,16 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
1054
1073
|
'd2l-dropdown-content-footer': this._hasFooter || (this._useMobileStyling && this.mobileTray && !this.noMobileCloseButton)
|
|
1055
1074
|
};
|
|
1056
1075
|
|
|
1057
|
-
let dropdownContentSlots = html`
|
|
1058
|
-
<div
|
|
1059
|
-
id="d2l-dropdown-wrapper"
|
|
1060
|
-
class="d2l-dropdown-content-width"
|
|
1076
|
+
let dropdownContentSlots = html`
|
|
1077
|
+
<div
|
|
1078
|
+
id="d2l-dropdown-wrapper"
|
|
1079
|
+
class="d2l-dropdown-content-width"
|
|
1061
1080
|
style=${styleMap(widthStyle)}
|
|
1062
|
-
?data-closing="${this._closing}">
|
|
1081
|
+
?data-closing="${this._closing}">
|
|
1063
1082
|
<div class=${classMap(topClasses)} style=${styleMap(headerStyle)}>
|
|
1064
1083
|
<slot name="header" @slotchange="${this.__handleHeaderSlotChange}"></slot>
|
|
1065
1084
|
</div>
|
|
1066
|
-
<div
|
|
1085
|
+
<div
|
|
1067
1086
|
class="d2l-dropdown-content-container"
|
|
1068
1087
|
style=${styleMap(contentStyle)}
|
|
1069
1088
|
@scroll=${this.__toggleScrollStyles}>
|
|
@@ -8,9 +8,6 @@ import { dropdownContentStyles } from './dropdown-content-styles.js';
|
|
|
8
8
|
* @slot header - Sticky container at the top of the dropdown
|
|
9
9
|
* @slot footer - Sticky container at the bottom of the dropdown
|
|
10
10
|
* @fires d2l-dropdown-open - Dispatched when the dropdown is opened
|
|
11
|
-
* @fires d2l-dropdown-close - Dispatched when the dropdown is closed
|
|
12
|
-
* @fires d2l-dropdown-focus-enter - Dispatched when user focus enters the dropdown content (trap-focus option only)
|
|
13
|
-
* @fires d2l-dropdown-position - Dispatched when the dropdown position finishes adjusting
|
|
14
11
|
*/
|
|
15
12
|
class DropdownContent extends DropdownContentMixin(LitElement) {
|
|
16
13
|
|
|
@@ -14,6 +14,7 @@ class DropdownContextMenu extends DropdownOpenerMixin(VisibleOnAncestorMixin(Lit
|
|
|
14
14
|
return {
|
|
15
15
|
/**
|
|
16
16
|
* REQUIRED: Label for the context-menu button
|
|
17
|
+
* @type {string}
|
|
17
18
|
*/
|
|
18
19
|
text: {
|
|
19
20
|
type: String
|
|
@@ -21,6 +22,7 @@ class DropdownContextMenu extends DropdownOpenerMixin(VisibleOnAncestorMixin(Lit
|
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Attribute for busy/rich backgrounds
|
|
25
|
+
* @type {boolean}
|
|
24
26
|
*/
|
|
25
27
|
translucent: {
|
|
26
28
|
type: Boolean
|
|
@@ -9,9 +9,6 @@ import { ThemeMixin } from '../../mixins/theme-mixin.js';
|
|
|
9
9
|
* @slot header - Sticky container at the top of the dropdown
|
|
10
10
|
* @slot footer - Sticky container at the bottom of the dropdown
|
|
11
11
|
* @fires d2l-dropdown-open - Dispatched when the dropdown is opened
|
|
12
|
-
* @fires d2l-dropdown-close - Dispatched when the dropdown is closed
|
|
13
|
-
* @fires d2l-dropdown-focus-enter - Dispatched when user focus enters the dropdown content (trap-focus option only)
|
|
14
|
-
* @fires d2l-dropdown-position - Dispatched when the dropdown position finishes adjusting
|
|
15
12
|
*/
|
|
16
13
|
class DropdownMenu extends ThemeMixin(DropdownContentMixin(LitElement)) {
|
|
17
14
|
|
|
@@ -14,6 +14,7 @@ class DropdownMore extends DropdownOpenerMixin(VisibleOnAncestorMixin(LitElement
|
|
|
14
14
|
return {
|
|
15
15
|
/**
|
|
16
16
|
* REQUIRED: Label for the more button
|
|
17
|
+
* @type {string}
|
|
17
18
|
*/
|
|
18
19
|
text: {
|
|
19
20
|
type: String
|
|
@@ -21,6 +22,7 @@ class DropdownMore extends DropdownOpenerMixin(VisibleOnAncestorMixin(LitElement
|
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Attribute for busy/rich backgrounds
|
|
25
|
+
* @type {boolean}
|
|
24
26
|
*/
|
|
25
27
|
translucent: {
|
|
26
28
|
type: Boolean
|
|
@@ -4,6 +4,7 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
4
4
|
return {
|
|
5
5
|
/**
|
|
6
6
|
* Disables the dropdown opener
|
|
7
|
+
* @type {boolean}
|
|
7
8
|
*/
|
|
8
9
|
disabled: {
|
|
9
10
|
type: Boolean,
|
|
@@ -19,6 +20,7 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Prevents the dropdown from opening automatically on or on key press
|
|
23
|
+
* @type {boolean}
|
|
22
24
|
*/
|
|
23
25
|
noAutoOpen: {
|
|
24
26
|
type: Boolean,
|
|
@@ -8,9 +8,6 @@ import { dropdownContentStyles } from './dropdown-content-styles.js';
|
|
|
8
8
|
* @slot header - Sticky container at the top of the dropdown
|
|
9
9
|
* @slot footer - Sticky container at the bottom of the dropdown
|
|
10
10
|
* @fires d2l-dropdown-open - Dispatched when the dropdown is opened
|
|
11
|
-
* @fires d2l-dropdown-close - Dispatched when the dropdown is closed
|
|
12
|
-
* @fires d2l-dropdown-focus-enter - Dispatched when user focus enters the dropdown content (trap-focus option only)
|
|
13
|
-
* @fires d2l-dropdown-position - Dispatched when the dropdown position finishes adjusting
|
|
14
11
|
*/
|
|
15
12
|
class DropdownTabs extends DropdownContentMixin(LitElement) {
|
|
16
13
|
|
|
@@ -93,7 +93,7 @@ The `d2l-filter` component allows a user to filter on one or more dimensions of
|
|
|
93
93
|
</d2l-filter>
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
### Single Vs Multi Dimensional
|
|
96
|
+
### Single Vs Multi Dimensional
|
|
97
97
|
A filter can be a single dimension (like picking from a list of courses) or offer multiple dimensions (filter by role, or department, or something else). Single-dimension filters can be used side-by-side to promote filters that are more commonly used, while tucking less-used filters into a multi-dimensional filter.
|
|
98
98
|
|
|
99
99
|
<!-- docs: demo code autoSize:false align:start size:large -->
|
|
@@ -149,7 +149,7 @@ A filter can be a single dimension (like picking from a list of courses) or offe
|
|
|
149
149
|
</d2l-filter-dimension-set>
|
|
150
150
|
</d2l-filter>
|
|
151
151
|
</div>
|
|
152
|
-
```
|
|
152
|
+
```
|
|
153
153
|
|
|
154
154
|
### Accessibility
|
|
155
155
|
The filter will announce changes to filter selections, search results, and when filters are being cleared. It is up to the consumer to then announce when these changes have propagated and resulted in new/loaded/updated data on the page. This is very important for screenreader users who are not able to visually see the page changing behind the filter control as selections are made.
|
|
@@ -191,7 +191,7 @@ The `d2l-filter-dimension-set` component is the main dimension type that will wo
|
|
|
191
191
|
}, 100);
|
|
192
192
|
});
|
|
193
193
|
</script>
|
|
194
|
-
<!-- docs: end hidden content -->
|
|
194
|
+
<!-- docs: end hidden content -->
|
|
195
195
|
<d2l-filter>
|
|
196
196
|
<d2l-filter-dimension-set key="course" text="Course" >
|
|
197
197
|
<d2l-filter-dimension-set-value key="art" text="Art" selected><d2l-filter-dimension-set-value>
|
|
@@ -239,7 +239,7 @@ This component is built to be used alongside the [d2l-filter-dimension-set](#fil
|
|
|
239
239
|
**Coming Soon!**
|
|
240
240
|
|
|
241
241
|
<!-- docs: start hidden content -->
|
|
242
|
-
## Future
|
|
242
|
+
## Future Improvements
|
|
243
243
|
|
|
244
244
|
* ability to delay change events until the user has pressed an apply button (see [#341](https://github.com/BrightspaceUI/core/issues/341))
|
|
245
245
|
|
|
@@ -29,8 +29,4 @@ The `d2l-focus-trap` is a generic container that will trap user focus from leavi
|
|
|
29
29
|
### Events
|
|
30
30
|
|
|
31
31
|
- `d2l-focus-trap-enter`: dispatched when focus enters the trap. May be used to override initial focus placement when focus enters the trap.
|
|
32
|
-
|
|
33
|
-
## Future Enhancements
|
|
34
|
-
|
|
35
|
-
Looking for an enhancement not listed here? Create a GitHub issue!
|
|
36
32
|
<!-- docs: end hidden content -->
|
|
@@ -166,7 +166,3 @@ customElements.define('my-form-element', MyFormElement);
|
|
|
166
166
|
- If you need to create a custom form element that wraps native form elements like `input`, `select` and `textarea`, more information can be found here.
|
|
167
167
|
- **[Nesting Custom Form Elements](./form-element-nesting.md)**
|
|
168
168
|
- If you need to create a custom form element that nests other custom form elements like `d2l-input-text` inside its shadow DOM, more information can be found here.
|
|
169
|
-
|
|
170
|
-
## Future Enhancements
|
|
171
|
-
|
|
172
|
-
Looking for an enhancement not listed here? Create a GitHub issue!
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# HTML Content Display
|
|
2
2
|
|
|
3
|
-
Components to assist with displaying user-authored HTML within your webpage.
|
|
3
|
+
Components to assist with displaying user-authored HTML within your webpage.
|
|
4
4
|
|
|
5
5
|
## HTML Block [d2l-html-block]
|
|
6
6
|
|
|
@@ -110,7 +110,7 @@ Examples are provided to display how user-authored math can be embedded within y
|
|
|
110
110
|
<script type="module">
|
|
111
111
|
import '@brightspace-ui/core/components/html-block/html-block.js';
|
|
112
112
|
import '@brightspace-ui/core/components/icons/icon.js';
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
</script>
|
|
115
115
|
<script>
|
|
116
116
|
window.D2L = {};
|
|
@@ -132,8 +132,3 @@ Examples are provided to display how user-authored math can be embedded within y
|
|
|
132
132
|
</template>
|
|
133
133
|
</d2l-html-block>
|
|
134
134
|
```
|
|
135
|
-
<!-- docs: start hidden content -->
|
|
136
|
-
## Future Enhancements
|
|
137
|
-
|
|
138
|
-
Looking for an enhancement not listed here? Create a GitHub issue!
|
|
139
|
-
<!-- docs: end hidden content -->
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
<svg height="30" width="30" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30">
|
|
2
2
|
<path fill="#494c4e" d="M17.641,17.98l-9.89,11.5a1.488,1.488,0,0,1-1.13.52.277.277,0,0,1-.09-.01.22.22,0,0,1-.08.01,1.509,1.509,0,0,1-1.01-.39l-4.95-4.5a1.5,1.5,0,1,1,2.02-2.22l3.9,3.55,8.95-10.42a1.5,1.5,0,1,1,2.28,1.96Z"/>
|
|
3
|
-
<path fill="#494c4e" d="M26,0H4A4.012,4.012,0,0,0,0,4V20.85a3.5,3.5,0,0,1,1.505-.35A3.492,3.492,0,0,1,2,20.545V16H7v5H3.3a3.439,3.439,0,0,1,.556.411L5.6,23H6.729L9,20.356V16h3.741l1.1-1.282A3.48,3.48,0,0,1,16,13.551V9h5v5H18.3a3.417,3.417,0,0,1,1.547,2H21v5H17.681L14,25.28V28H11.661l-1.72,2H26a4.012,4.012,0,0,0,4-4V4A4.012,4.012,0,0,0,26,0ZM7,14H2V9H7ZM7,7H2V4A2.006,2.006,0,0,1,4,2H7Zm7,7H9V9h5Zm0-7H9V2h5Zm7,21H16V23h5ZM21,7H16V2h5Zm7,19a2.006,2.006,0,0,1-2,2H23V23h5Zm0-5H23V16h5Zm0-7H23V9h5Zm0-7H23V2h3a2.006,2.006,0,0,1,2,2Z"
|
|
4
|
-
</svg>
|
|
3
|
+
<path fill="#494c4e" d="M26,0H4A4.012,4.012,0,0,0,0,4V20.85a3.5,3.5,0,0,1,1.505-.35A3.492,3.492,0,0,1,2,20.545V16H7v5H3.3a3.439,3.439,0,0,1,.556.411L5.6,23H6.729L9,20.356V16h3.741l1.1-1.282A3.48,3.48,0,0,1,16,13.551V9h5v5H18.3a3.417,3.417,0,0,1,1.547,2H21v5H17.681L14,25.28V28H11.661l-1.72,2H26a4.012,4.012,0,0,0,4-4V4A4.012,4.012,0,0,0,26,0ZM7,14H2V9H7ZM7,7H2V4A2.006,2.006,0,0,1,4,2H7Zm7,7H9V9h5Zm0-7H9V2h5Zm7,21H16V23h5ZM21,7H16V2h5Zm7,19a2.006,2.006,0,0,1-2,2H23V23h5Zm0-5H23V16h5Zm0-7H23V9h5Zm0-7H23V2h3a2.006,2.006,0,0,1,2,2Z"/>
|
|
4
|
+
</svg>
|
|
@@ -495,7 +495,7 @@ This event includes a detail object with helper methods attached to it.
|
|
|
495
495
|
|
|
496
496
|
|
|
497
497
|
<!-- docs: start hidden content -->
|
|
498
|
-
## Future
|
|
498
|
+
## Future Improvements
|
|
499
499
|
|
|
500
500
|
- Paging: integration with "load more", "scroll" and "numeric" paging mechanisms
|
|
501
501
|
|
|
@@ -32,7 +32,7 @@ const demoData = {
|
|
|
32
32
|
'L3-1': {
|
|
33
33
|
primaryText: 'Glaciation (L3)',
|
|
34
34
|
supportingText: 'Supporting Info',
|
|
35
|
-
nested: [ 'L4-1' ]
|
|
35
|
+
nested: [ 'L4-1', 'L4-2' ]
|
|
36
36
|
},
|
|
37
37
|
'L3-2': {
|
|
38
38
|
primaryText: 'Weathering (L3)',
|
|
@@ -45,7 +45,11 @@ const demoData = {
|
|
|
45
45
|
'L4-1': {
|
|
46
46
|
primaryText: 'Ice Sheets',
|
|
47
47
|
supportingText: 'Supporting Info',
|
|
48
|
-
nested: [ 'L5-1'
|
|
48
|
+
nested: [ /*'L5-1', 'L5-2', 'L5-3', 'L5-4', 'L5-5'*/ ]
|
|
49
|
+
},
|
|
50
|
+
'L4-2': {
|
|
51
|
+
primaryText: 'Alpine Glaciers',
|
|
52
|
+
supportingText: 'Supporting Info'
|
|
49
53
|
},
|
|
50
54
|
'L5-1': {
|
|
51
55
|
primaryText: 'Topic L5-1',
|
|
@@ -178,7 +182,7 @@ class DemoListItemCustom extends ListItemMixin(LitElement) {
|
|
|
178
182
|
|
|
179
183
|
if (demoData[this.key].nested && demoData[this.key].nested.length > 0) {
|
|
180
184
|
itemTemplates.nested = html`
|
|
181
|
-
<d2l-list separators="all">
|
|
185
|
+
<d2l-list grid separators="all">
|
|
182
186
|
${demoData[this.key].nested.map(itemKey => html`<d2l-demo-list-item-custom selectable key="${itemKey}"></d2l-demo-list-item-custom>`)}
|
|
183
187
|
</d2l-list>
|
|
184
188
|
`;
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
</head>
|
|
24
24
|
<body unresolved>
|
|
25
25
|
|
|
26
|
-
<d2l-demo-page page-title="d2l-list
|
|
26
|
+
<d2l-demo-page page-title="d2l-list (nested)">
|
|
27
27
|
|
|
28
28
|
<h2>Nested</h2>
|
|
29
29
|
|
|
30
30
|
<d2l-demo-snippet>
|
|
31
31
|
<template>
|
|
32
|
-
<d2l-list>
|
|
32
|
+
<d2l-list grid>
|
|
33
33
|
<d2l-list-header slot="header">
|
|
34
34
|
<d2l-selection-action icon="tier1:bookmark-hollow" text="Bookmark" requires-selection></d2l-selection-action>
|
|
35
35
|
<d2l-selection-action icon="tier1:gear" text="Settings"></d2l-selection-action>
|
|
@@ -39,80 +39,24 @@
|
|
|
39
39
|
<div>Earth Sciences (L1)</div>
|
|
40
40
|
<div slot="supporting-info">Earth science or geoscience includes all fields of natural science related to planet Earth. This is a branch of science dealing with the physical and chemical constitution of Earth and its atmosphere. Earth science can be considered to be a branch of planetary science, but with a much older history.</div>
|
|
41
41
|
</d2l-list-item-content>
|
|
42
|
-
<d2l-list slot="nested" separators="all">
|
|
42
|
+
<d2l-list slot="nested" grid separators="all">
|
|
43
43
|
<d2l-list-item selectable key="L2-1" label="Label for L2-1">
|
|
44
44
|
<d2l-list-item-content>
|
|
45
45
|
<div>Introductory Earth Sciences (L2)</div>
|
|
46
46
|
<div slot="supporting-info">This course explores the geological processes of the Earth's interior and surface. These include volcanism, earthquakes, mountain building, glaciation and weathering. Students will gain an appreciation of how these processes have controlled the evolution of our planet and the role of geology in meeting society's current and future demand for sustainable energy and mineral resources.</div>
|
|
47
47
|
</d2l-list-item-content>
|
|
48
|
-
<d2l-list slot="nested" separators="all">
|
|
48
|
+
<d2l-list slot="nested" grid separators="all">
|
|
49
49
|
<d2l-list-item selectable key="L3-1" label="Label for L3-1">
|
|
50
50
|
<d2l-list-item-content>
|
|
51
51
|
<div>Glaciation (L3)</div>
|
|
52
52
|
<div slot="supporting-info">Supporting Info</div>
|
|
53
53
|
</d2l-list-item-content>
|
|
54
|
-
<d2l-list slot="nested" separators="all">
|
|
54
|
+
<d2l-list slot="nested" grid separators="all">
|
|
55
55
|
<d2l-list-item selectable key="L4-1" label="Label for L4-1">
|
|
56
56
|
<d2l-list-item-content>
|
|
57
57
|
<div>Ice Sheets (L4)</div>
|
|
58
58
|
<div slot="supporting-info">Supporting Info</div>
|
|
59
59
|
</d2l-list-item-content>
|
|
60
|
-
<d2l-list slot="nested" separators="all">
|
|
61
|
-
<d2l-list-item selectable key="L5-1" label="Label for L5-1">
|
|
62
|
-
<d2l-list-item-content>
|
|
63
|
-
<div>Topic 1 (L5)</div>
|
|
64
|
-
<div slot="supporting-info">Supporting Info</div>
|
|
65
|
-
</d2l-list-item-content>
|
|
66
|
-
</d2l-list-item>
|
|
67
|
-
<d2l-list-item selectable key="L5-2" label="Label for L5-2">
|
|
68
|
-
<d2l-list-item-content>
|
|
69
|
-
<div>Topic 2 (L5)</div>
|
|
70
|
-
<div slot="supporting-info">Supporting Info</div>
|
|
71
|
-
</d2l-list-item-content>
|
|
72
|
-
<d2l-list slot="nested" separators="all">
|
|
73
|
-
<d2l-list-item selectable key="L6-1" label="Label for L6-1">
|
|
74
|
-
<d2l-list-item-content>
|
|
75
|
-
<div>Sub-Topic 1 (L6)</div>
|
|
76
|
-
<div slot="supporting-info">Supporting Info</div>
|
|
77
|
-
</d2l-list-item-content>
|
|
78
|
-
<d2l-list slot="nested" separators="all">
|
|
79
|
-
<d2l-list-item selectable key="L7-1" label="Label for L7-1">
|
|
80
|
-
<d2l-list-item-content>
|
|
81
|
-
<div>Sub-Topic 1 (L7)</div>
|
|
82
|
-
<div slot="supporting-info">Supporting Info</div>
|
|
83
|
-
</d2l-list-item-content>
|
|
84
|
-
<d2l-list slot="nested" separators="all">
|
|
85
|
-
<d2l-list-item selectable selected key="L8-1" label="Label for L8-1">
|
|
86
|
-
<d2l-list-item-content>
|
|
87
|
-
<div>Sub-Topic 1 (L8)</div>
|
|
88
|
-
<div slot="supporting-info">Supporting Info</div>
|
|
89
|
-
</d2l-list-item-content>
|
|
90
|
-
</d2l-list-item>
|
|
91
|
-
<d2l-list-item selectable key="L8-2" label="Label for L8-2">
|
|
92
|
-
<d2l-list-item-content>
|
|
93
|
-
<div>Sub-Topic 2 (L8)</div>
|
|
94
|
-
<div slot="supporting-info">Supporting Info</div>
|
|
95
|
-
</d2l-list-item-content>
|
|
96
|
-
</d2l-list-item>
|
|
97
|
-
</d2l-list>
|
|
98
|
-
</d2l-list-item>
|
|
99
|
-
<d2l-list-item selectable key="L7-2" label="Label for L7-2">
|
|
100
|
-
<d2l-list-item-content>
|
|
101
|
-
<div>Sub-Topic 2 (L7)</div>
|
|
102
|
-
<div slot="supporting-info">Supporting Info</div>
|
|
103
|
-
</d2l-list-item-content>
|
|
104
|
-
</d2l-list-item>
|
|
105
|
-
</d2l-list>
|
|
106
|
-
</d2l-list-item>
|
|
107
|
-
<d2l-list-item selectable key="L6-2" label="Label for L6-2">
|
|
108
|
-
<d2l-list-item-content>
|
|
109
|
-
<div>Sub-Topic 2 (L6)</div>
|
|
110
|
-
<div slot="supporting-info">Supporting Info</div>
|
|
111
|
-
</d2l-list-item-content>
|
|
112
|
-
</d2l-list-item>
|
|
113
|
-
</d2l-list>
|
|
114
|
-
</d2l-list-item>
|
|
115
|
-
</d2l-list>
|
|
116
60
|
</d2l-list-item>
|
|
117
61
|
<d2l-list-item selectable key="L4-2" label="Label for L4-2">
|
|
118
62
|
<d2l-list-item-content>
|
|
@@ -175,7 +119,7 @@
|
|
|
175
119
|
|
|
176
120
|
<d2l-demo-snippet>
|
|
177
121
|
<template>
|
|
178
|
-
<d2l-list>
|
|
122
|
+
<d2l-list grid>
|
|
179
123
|
<d2l-list-header slot="header">
|
|
180
124
|
<d2l-selection-action icon="tier1:bookmark-hollow" text="Bookmark" requires-selection></d2l-selection-action>
|
|
181
125
|
<d2l-selection-action icon="tier1:gear" text="Settings"></d2l-selection-action>
|
|
@@ -207,6 +207,7 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
207
207
|
_focusNextCell(num, forward = true) {
|
|
208
208
|
let cell = null;
|
|
209
209
|
let focusable = null;
|
|
210
|
+
|
|
210
211
|
do {
|
|
211
212
|
cell = this.shadowRoot.querySelector(`[data-cell-num="${num}"]`);
|
|
212
213
|
if (cell) {
|
|
@@ -215,26 +216,31 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
215
216
|
if (focusable) focusable.focus();
|
|
216
217
|
forward ? ++num : --num;
|
|
217
218
|
} while (cell && !focusable);
|
|
219
|
+
|
|
220
|
+
if (!cell) {
|
|
221
|
+
// wrap to first/last item
|
|
222
|
+
if (forward) this._focusNextCell(1);
|
|
223
|
+
else this._focusLastItem();
|
|
224
|
+
}
|
|
225
|
+
|
|
218
226
|
return focusable;
|
|
219
227
|
}
|
|
220
228
|
|
|
221
229
|
_focusNextRow(previous = false, num = 1) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
listItem = nextItem;
|
|
232
|
-
--num;
|
|
230
|
+
|
|
231
|
+
let listItem = findComposedAncestor(this, node => node.role === 'rowgroup');
|
|
232
|
+
|
|
233
|
+
while (num > 0) {
|
|
234
|
+
const tempListItem = (previous ? this._getPreviousFlattenedListItem(listItem) : this._getNextFlattenedListItem(listItem));
|
|
235
|
+
if (tempListItem) listItem = tempListItem;
|
|
236
|
+
else break;
|
|
237
|
+
num--;
|
|
233
238
|
}
|
|
234
|
-
const row = listItem.shadowRoot.querySelector('[role="gridrow"]');
|
|
235
|
-
if (!row) return;
|
|
236
239
|
|
|
237
|
-
|
|
240
|
+
if (!listItem) return;
|
|
241
|
+
const listItemRow = listItem.shadowRoot.querySelector('[role="gridrow"]');
|
|
242
|
+
listItemRow._focusCellItem(this._cellNum, this._cellFocusedItem);
|
|
243
|
+
|
|
238
244
|
}
|
|
239
245
|
|
|
240
246
|
_focusNextWithinCell(node, num = 1) {
|
|
@@ -280,6 +286,38 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
280
286
|
return position;
|
|
281
287
|
}
|
|
282
288
|
|
|
289
|
+
_getNextFlattenedListItem(listItem) {
|
|
290
|
+
|
|
291
|
+
// check for nested list first; this check needs to account for standard list-items as well as custom
|
|
292
|
+
const nestedList = listItem.querySelector('[slot="nested"]') || listItem.shadowRoot.querySelector('d2l-list');
|
|
293
|
+
if (nestedList) {
|
|
294
|
+
const nestedListItem = [...nestedList.children].find(node => node.role === 'rowgroup');
|
|
295
|
+
if (nestedListItem) return nestedListItem;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const getNextListItem = listItem => {
|
|
299
|
+
|
|
300
|
+
// check for sibling list-item
|
|
301
|
+
let nextElement = listItem.nextElementSibling;
|
|
302
|
+
while (nextElement) {
|
|
303
|
+
if (nextElement.role === 'rowgroup') return nextElement;
|
|
304
|
+
nextElement = nextElement.nextElementSibling;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// no sibling list-item was found so check for sibling of parent list-item if nested, recursively if necessary
|
|
308
|
+
const list = findComposedAncestor(listItem, node => node.tagName === 'D2L-LIST');
|
|
309
|
+
if (list.slot !== 'nested' && !(list.parentNode.tagName === 'SLOT' && list.parentNode.name === 'nested')) return;
|
|
310
|
+
|
|
311
|
+
const parentListItem = findComposedAncestor(list, node => node.role === 'rowgroup');
|
|
312
|
+
return getNextListItem(parentListItem);
|
|
313
|
+
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
// check for sibling list-item or ancestors sibling list-items
|
|
317
|
+
return getNextListItem(listItem);
|
|
318
|
+
|
|
319
|
+
}
|
|
320
|
+
|
|
283
321
|
_getNextSiblingInCell(node) {
|
|
284
322
|
const cell = findComposedAncestor(node, (parent) => parent.classList && parent.classList.contains('d2l-cell'));
|
|
285
323
|
if (!cell || cell.name === node.slot) return null;
|
|
@@ -289,6 +327,39 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
289
327
|
return isComposedAncestor(cell, sibling) ? sibling : null;
|
|
290
328
|
}
|
|
291
329
|
|
|
330
|
+
_getPreviousFlattenedListItem(listItem) {
|
|
331
|
+
|
|
332
|
+
let previousElement = listItem.previousElementSibling;
|
|
333
|
+
|
|
334
|
+
// try to get the previous list-item in the current list sub-tree including nested
|
|
335
|
+
while (previousElement) {
|
|
336
|
+
if (previousElement.role === 'rowgroup') {
|
|
337
|
+
|
|
338
|
+
// this check needs to account for standard list-items as well as custom
|
|
339
|
+
const nestedList = previousElement.querySelector('[slot="nested"]') || previousElement.shadowRoot.querySelector('d2l-list');
|
|
340
|
+
if (nestedList) {
|
|
341
|
+
const nestedListItems = [...nestedList.children].filter(node => node.role === 'rowgroup');
|
|
342
|
+
if (nestedListItems && nestedListItems.length > 0) {
|
|
343
|
+
return nestedListItems[nestedListItems.length - 1];
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return previousElement;
|
|
347
|
+
|
|
348
|
+
}
|
|
349
|
+
previousElement = previousElement.previousElementSibling;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// no previous list-item was found in the current list sub-tree so get the parent list item if currently in nested
|
|
353
|
+
const list = findComposedAncestor(listItem, node => node.tagName === 'D2L-LIST');
|
|
354
|
+
|
|
355
|
+
// this check needs to account for standard list-items as well as custom
|
|
356
|
+
if (list.slot === 'nested' || (list.parentNode.tagName === 'SLOT' && list.parentNode.name === 'nested')) {
|
|
357
|
+
const parentListItem = findComposedAncestor(list, node => node.role === 'rowgroup');
|
|
358
|
+
return parentListItem;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
}
|
|
362
|
+
|
|
292
363
|
_getPrevSiblingInCell(node) {
|
|
293
364
|
const cell = findComposedAncestor(node, (parent) => parent.classList && parent.classList.contains('d2l-cell'));
|
|
294
365
|
if (!cell || cell.name === node.slot) return null;
|