@brightspace-ui/core 2.150.2 → 2.151.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/list/README.md +19 -20
- package/components/list/demo/list.html +23 -0
- package/components/list/list-item-mixin.js +5 -109
- package/components/list/list.js +82 -1
- package/custom-elements.json +13 -39
- package/package.json +1 -1
@@ -100,7 +100,7 @@ When using `d2l-list`, the `grid` attribute will enable the table-like keyboard
|
|
100
100
|
|
101
101
|
## List [d2l-list]
|
102
102
|
|
103
|
-
The `d2l-list` is the container to create a styled list of items using `d2l-list-item` or `d2l-list-item-button`. It provides the appropriate `list` semantics as well as options for displaying separators, etc.
|
103
|
+
The `d2l-list` is the container to create a styled list of items using `d2l-list-item` or `d2l-list-item-button`. It provides the appropriate `list` semantics as well as options for displaying separators, breakpoints for responsiveness, etc.
|
104
104
|
|
105
105
|
<!-- docs: demo code properties name:d2l-list display:block autoSize:false size:medium -->
|
106
106
|
```html
|
@@ -133,6 +133,7 @@ The `d2l-list` is the container to create a styled list of items using `d2l-list
|
|
133
133
|
|
134
134
|
| Property | Type | Description |
|
135
135
|
|---|---|---|
|
136
|
+
| `breakpoints` | Array | Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used. |
|
136
137
|
| `drag-multiple` | Boolean | Whether the user can drag multiple items |
|
137
138
|
| `grid` | Boolean | Enables keyboard grid for supported list items. See [Accessibility](#accessibility). |
|
138
139
|
| `label` | String | Sets an accessible label. For use when the list context is unclear. This property is only valid on top-level lists and will have no effect on nested lists. |
|
@@ -146,6 +147,22 @@ The `d2l-list` is the container to create a styled list of items using `d2l-list
|
|
146
147
|
- `d2l-list-selection-changes`: dispatched once for a set of selection state changes (ex. select-all); event detail includes an array of objects where each object contains the `key` and `selected` state for each changed item
|
147
148
|
<!-- docs: end hidden content -->
|
148
149
|
|
150
|
+
### Breakpoints Property
|
151
|
+
|
152
|
+
- `breakpoints` (Array): Breakpoints for responsiveness (`[842, 636, 580, 0]`), in pixels. There are four different breakpoints and only the four largest breakpoints will be used. If less breakpoints are used, then skip a middle breakpoint so that the first and last breakpoints will map to the largest and smallest layouts.
|
153
|
+
- Breakpoint 0
|
154
|
+
- Image: max dimensions: `width: 90px` and `height: 52px` and has `18px margin` from the main content;
|
155
|
+
- default break: `x < 580px` where `x` is the width of the component.
|
156
|
+
- Breakpoint 1
|
157
|
+
- Image: max dimensions: `width: 120px` and `height: 71px` and has `20px margin` from the main content;
|
158
|
+
- default break: `581px < x < 636px` where `x` is the width of the component.
|
159
|
+
- Breakpoint 2
|
160
|
+
- Image: max dimensions: `width: 180px` and `height: 102px` and has `20px margin` from the main content;
|
161
|
+
- default break: `637px < x < 842px` where `x` is the width of the component.
|
162
|
+
- Breakpoint 3
|
163
|
+
- Image: max dimensions: `width: 216px` and `height: 120px` and has `20px margin` from the main content;
|
164
|
+
- default break: `843px < x` where `x` is the width of the component.
|
165
|
+
|
149
166
|
### Methods
|
150
167
|
|
151
168
|
- `getItems()` (Array): returns the list items within the list
|
@@ -380,7 +397,7 @@ The `d2l-list-controls` component can be placed in the `d2l-list`'s `controls` s
|
|
380
397
|
|
381
398
|
## List Item [d2l-list-item]
|
382
399
|
|
383
|
-
The `d2l-list-item` provides the appropriate `listitem` semantics for children within a list. It also provides some basic layout,
|
400
|
+
The `d2l-list-item` provides the appropriate `listitem` semantics for children within a list. It also provides some basic layout, a navigation link for the primary action, and selection.
|
384
401
|
|
385
402
|
<!-- docs: demo code properties name:d2l-list-item autoSize:false size:small -->
|
386
403
|
```html
|
@@ -410,7 +427,6 @@ The `d2l-list-item` provides the appropriate `listitem` semantics for children w
|
|
410
427
|
|
411
428
|
| Property | Type | Description |
|
412
429
|
|---|---|---|
|
413
|
-
| `breakpoints` | Array | Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used. |
|
414
430
|
| `draggable` | Boolean | Whether the item is draggable |
|
415
431
|
| `drag-handle-text` | String | The drag-handle label for assistive technology. If implementing drag & drop, you should change this to dynamically announce what the drag-handle is moving for assistive technology in keyboard mode. |
|
416
432
|
| `drag-target-handle-only` | Boolean | Make the drag target the drag handle only. |
|
@@ -441,22 +457,6 @@ The `d2l-list-item` provides the appropriate `listitem` semantics for children w
|
|
441
457
|
- `d2l-list-item-expand-collapse-toggled`: dispatched when the item's expand/collapse toggle is clicked
|
442
458
|
<!-- docs: end hidden content -->
|
443
459
|
|
444
|
-
### Breakpoints Property
|
445
|
-
|
446
|
-
- `breakpoints` (Array): Breakpoints for responsiveness (`[842, 636, 580, 0]`), in pixels. There are four different breakpoints and only the four largest breakpoints will be used. If less breakpoints are used, then skip a middle breakpoint so that the first and last breakpoints will map to the largest and smallest layouts.
|
447
|
-
- Breakpoint 0
|
448
|
-
- Image: max dimensions: `width: 90px` and `height: 52px` and has `18px margin` from the main content;
|
449
|
-
- default break: `x < 580px` where `x` is the width of the component.
|
450
|
-
- Breakpoint 1
|
451
|
-
- Image: max dimensions: `width: 120px` and `height: 71px` and has `20px margin` from the main content;
|
452
|
-
- default break: `581px < x < 636px` where `x` is the width of the component.
|
453
|
-
- Breakpoint 2
|
454
|
-
- Image: max dimensions: `width: 180px` and `height: 102px` and has `20px margin` from the main content;
|
455
|
-
- default break: `637px < x < 842px` where `x` is the width of the component.
|
456
|
-
- Breakpoint 3
|
457
|
-
- Image: max dimensions: `width: 216px` and `height: 120px` and has `20px margin` from the main content;
|
458
|
-
- default break: `843px < x` where `x` is the width of the component.
|
459
|
-
|
460
460
|
## Button List Item [d2l-list-item-button]
|
461
461
|
|
462
462
|
The `d2l-list-item-button` provides the same functionality as `d2l-list-item` except with button semantics for its primary action.
|
@@ -484,7 +484,6 @@ The `d2l-list-item-button` provides the same functionality as `d2l-list-item` ex
|
|
484
484
|
|
485
485
|
| Property | Type | Description |
|
486
486
|
|---|---|---|
|
487
|
-
| `breakpoints` | Array | Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used. |
|
488
487
|
| `button-disabled` | Boolean | Disables the primary action button |
|
489
488
|
| `draggable` | Boolean | Whether the item is draggable |
|
490
489
|
| `drag-handle-text` | String | The drag-handle label for assistive technology. If implementing drag & drop, you should change this to dynamically announce what the drag-handle is moving for assistive technology in keyboard mode. |
|
@@ -162,6 +162,29 @@
|
|
162
162
|
</template>
|
163
163
|
</d2l-demo-snippet>
|
164
164
|
|
165
|
+
<h2>Breakpoints on List</h2>
|
166
|
+
|
167
|
+
<d2l-demo-snippet>
|
168
|
+
<template>
|
169
|
+
<d2l-list breakpoints="[1170, 391, 0, 0]">
|
170
|
+
<d2l-list-item color="#00ff00">
|
171
|
+
<div style="background: blue; height: 400px; width: 400px;" slot="illustration"></div>
|
172
|
+
<d2l-list-item-content>
|
173
|
+
<div>Introductory Pirate Ipsum</div>
|
174
|
+
<div slot="supporting-info">Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters.</div>
|
175
|
+
</d2l-list-item-content>
|
176
|
+
</d2l-list-item>
|
177
|
+
<d2l-list-item>
|
178
|
+
<div style="background: blue; height: 400px; width: 400px;" slot="illustration"></div>
|
179
|
+
<d2l-list-item-content>
|
180
|
+
<div>Introductory Pirate Ipsum</div>
|
181
|
+
<div slot="supporting-info">Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters.</div>
|
182
|
+
</d2l-list-item-content>
|
183
|
+
</d2l-list-item>
|
184
|
+
</d2l-list>
|
185
|
+
</template>
|
186
|
+
</d2l-demo-snippet>
|
187
|
+
|
165
188
|
</d2l-demo-page>
|
166
189
|
|
167
190
|
</body>
|
@@ -17,7 +17,6 @@ import { ListItemDragDropMixin } from './list-item-drag-drop-mixin.js';
|
|
17
17
|
import { ListItemExpandCollapseMixin } from './list-item-expand-collapse-mixin.js';
|
18
18
|
import { ListItemRoleMixin } from './list-item-role-mixin.js';
|
19
19
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
20
|
-
import ResizeObserver from 'resize-observer-polyfill';
|
21
20
|
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
22
21
|
import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
|
23
22
|
import { styleMap } from 'lit-html/directives/style-map.js';
|
@@ -39,18 +38,6 @@ function addTabListener() {
|
|
39
38
|
|
40
39
|
let hasDisplayedKeyboardTooltip = false;
|
41
40
|
|
42
|
-
const ro = new ResizeObserver(entries => {
|
43
|
-
entries.forEach(entry => {
|
44
|
-
if (!entry || !entry.target || !entry.target.resizedCallback) {
|
45
|
-
return;
|
46
|
-
}
|
47
|
-
entry.target.resizedCallback(entry.contentRect && entry.contentRect.width);
|
48
|
-
});
|
49
|
-
});
|
50
|
-
|
51
|
-
const defaultBreakpoints = [842, 636, 580, 0];
|
52
|
-
const SLIM_COLOR_BREAKPOINT = 400;
|
53
|
-
|
54
41
|
/**
|
55
42
|
* @property label - The hidden label for the checkbox and expand collapse control
|
56
43
|
*/
|
@@ -67,11 +54,6 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
67
54
|
|
68
55
|
static get properties() {
|
69
56
|
return {
|
70
|
-
/**
|
71
|
-
* Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used.
|
72
|
-
* @type {array}
|
73
|
-
*/
|
74
|
-
breakpoints: { type: Array },
|
75
57
|
/**
|
76
58
|
* A color indicator to appear at the beginning of a list item. Expected value is a valid 3, 4, 6, or 8 character CSS color hex code (e.g., #006fbf).
|
77
59
|
* @type {string}
|
@@ -92,7 +74,6 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
92
74
|
* @type {'normal'|'none'}
|
93
75
|
*/
|
94
76
|
paddingType: { type: String, attribute: 'padding-type' },
|
95
|
-
_breakpoint: { type: Number },
|
96
77
|
_displayKeyboardTooltip: { type: Boolean },
|
97
78
|
_hasColorSlot: { type: Boolean, reflect: true, attribute: '_has-color-slot' },
|
98
79
|
_hovering: { type: Boolean, reflect: true },
|
@@ -103,7 +84,6 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
103
84
|
_highlighting: { type: Boolean, reflect: true },
|
104
85
|
_hasNestedList: { state: true },
|
105
86
|
_siblingHasColor: { state: true },
|
106
|
-
_slimColor: { state: true }
|
107
87
|
};
|
108
88
|
}
|
109
89
|
|
@@ -219,16 +199,11 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
219
199
|
border-radius: 6px;
|
220
200
|
flex-grow: 0;
|
221
201
|
flex-shrink: 0;
|
222
|
-
margin-
|
223
|
-
max-height: 2.6rem;
|
224
|
-
max-width: 4.5rem;
|
202
|
+
margin-inline-end: var(--d2l-list-item-illustration-margin-inline-end, 0.9rem);
|
203
|
+
max-height: var(--d2l-list-item-illustration-max-height, 2.6rem);
|
204
|
+
max-width: var(--d2l-list-item-illustration-max-width, 4.5rem);
|
225
205
|
overflow: hidden;
|
226
206
|
}
|
227
|
-
:host([dir="rtl"]) [slot="content"] ::slotted([slot="illustration"]),
|
228
|
-
:host([dir="rtl"]) [slot="content"] .d2l-list-item-illustration > * {
|
229
|
-
margin-left: 0.9rem;
|
230
|
-
margin-right: 0;
|
231
|
-
}
|
232
207
|
[slot="content"] ::slotted(d2l-icon[slot="illustration"]),
|
233
208
|
[slot="content"] .d2l-list-item-illustration d2l-icon {
|
234
209
|
border-radius: 0;
|
@@ -257,40 +232,6 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
257
232
|
margin-right: 0;
|
258
233
|
}
|
259
234
|
|
260
|
-
[data-breakpoint="1"] ::slotted([slot="illustration"]),
|
261
|
-
[data-breakpoint="1"] .d2l-list-item-illustration > * {
|
262
|
-
margin-right: 1rem;
|
263
|
-
max-height: 3.55rem;
|
264
|
-
max-width: 6rem;
|
265
|
-
}
|
266
|
-
:host([dir="rtl"]) [data-breakpoint="1"] ::slotted([slot="illustration"]),
|
267
|
-
:host([dir="rtl"]) [data-breakpoint="1"] .d2l-list-item-illustration > * {
|
268
|
-
margin-left: 1rem;
|
269
|
-
margin-right: 0;
|
270
|
-
}
|
271
|
-
[data-breakpoint="2"] ::slotted([slot="illustration"]),
|
272
|
-
[data-breakpoint="2"] .d2l-list-item-illustration > * {
|
273
|
-
margin-right: 1rem;
|
274
|
-
max-height: 5.1rem;
|
275
|
-
max-width: 9rem;
|
276
|
-
}
|
277
|
-
:host([dir="rtl"]) [data-breakpoint="2"] ::slotted([slot="illustration"]),
|
278
|
-
:host([dir="rtl"]) [data-breakpoint="2"] .d2l-list-item-illustration > * {
|
279
|
-
margin-left: 1rem;
|
280
|
-
margin-right: 0;
|
281
|
-
}
|
282
|
-
[data-breakpoint="3"] ::slotted([slot="illustration"]),
|
283
|
-
[data-breakpoint="3"] .d2l-list-item-illustration > * {
|
284
|
-
margin-right: 1rem;
|
285
|
-
max-height: 6rem;
|
286
|
-
max-width: 10.8rem;
|
287
|
-
}
|
288
|
-
:host([dir="rtl"]) [data-breakpoint="3"] ::slotted([slot="illustration"]),
|
289
|
-
:host([dir="rtl"]) [data-breakpoint="3"] .d2l-list-item-illustration > * {
|
290
|
-
margin-left: 1rem;
|
291
|
-
margin-right: 0;
|
292
|
-
}
|
293
|
-
|
294
235
|
d2l-selection-input {
|
295
236
|
margin: 0.55rem 0.55rem 0.55rem 0;
|
296
237
|
}
|
@@ -394,13 +335,9 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
394
335
|
}
|
395
336
|
|
396
337
|
.d2l-list-item-color-inner {
|
397
|
-
border-radius: 6px;
|
338
|
+
border-radius: var(--d2l-list-item-color-border-radius, 6px);
|
398
339
|
height: 100%;
|
399
|
-
width: 6px;
|
400
|
-
}
|
401
|
-
.d2l-list-item-color-inner.d2l-list-item-color-slim {
|
402
|
-
border-radius: 3px;
|
403
|
-
width: 3px;
|
340
|
+
width: var(--d2l-list-item-color-width, 6px);
|
404
341
|
}
|
405
342
|
.d2l-list-item-color-outer {
|
406
343
|
padding: 2px 12px 1px 0;
|
@@ -437,27 +374,13 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
437
374
|
|
438
375
|
constructor() {
|
439
376
|
super();
|
440
|
-
this.breakpoints = defaultBreakpoints;
|
441
377
|
this.noPrimaryAction = false;
|
442
378
|
this.paddingType = 'normal';
|
443
|
-
this._breakpoint = 0;
|
444
379
|
this._contentId = getUniqueId();
|
445
380
|
this._displayKeyboardTooltip = false;
|
446
381
|
this._hasColorSlot = false;
|
447
382
|
this._hasNestedList = false;
|
448
383
|
this._siblingHasColor = false;
|
449
|
-
this._slimColor = false;
|
450
|
-
}
|
451
|
-
|
452
|
-
get breakpoints() {
|
453
|
-
return this._breakpoints;
|
454
|
-
}
|
455
|
-
|
456
|
-
set breakpoints(value) {
|
457
|
-
const oldValue = this._breakpoints;
|
458
|
-
if (value !== defaultBreakpoints) this._breakpoints = value.sort((a, b) => b - a).slice(0, 4);
|
459
|
-
else this._breakpoints = defaultBreakpoints;
|
460
|
-
this.requestUpdate('breakpoints', oldValue);
|
461
384
|
}
|
462
385
|
|
463
386
|
get color() {
|
@@ -474,7 +397,6 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
474
397
|
|
475
398
|
connectedCallback() {
|
476
399
|
super.connectedCallback();
|
477
|
-
ro.observe(this);
|
478
400
|
if (this.role === 'rowgroup') {
|
479
401
|
addTabListener();
|
480
402
|
}
|
@@ -483,18 +405,6 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
483
405
|
}
|
484
406
|
}
|
485
407
|
|
486
|
-
disconnectedCallback() {
|
487
|
-
super.disconnectedCallback();
|
488
|
-
ro.unobserve(this);
|
489
|
-
}
|
490
|
-
|
491
|
-
updated(changedProperties) {
|
492
|
-
super.updated(changedProperties);
|
493
|
-
if (changedProperties.has('breakpoints')) {
|
494
|
-
this.resizedCallback(this.offsetWidth);
|
495
|
-
}
|
496
|
-
}
|
497
|
-
|
498
408
|
focus() {
|
499
409
|
this._tryFocus();
|
500
410
|
}
|
@@ -524,18 +434,6 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
524
434
|
this._highlighting = true;
|
525
435
|
}
|
526
436
|
|
527
|
-
resizedCallback(width) {
|
528
|
-
this._slimColor = (width < SLIM_COLOR_BREAKPOINT);
|
529
|
-
|
530
|
-
const lastBreakpointIndexToCheck = 3;
|
531
|
-
this.breakpoints.some((breakpoint, index) => {
|
532
|
-
if (width >= breakpoint || index > lastBreakpointIndexToCheck) {
|
533
|
-
this._breakpoint = lastBreakpointIndexToCheck - index - (lastBreakpointIndexToCheck - this.breakpoints.length + 1) * index;
|
534
|
-
return true;
|
535
|
-
}
|
536
|
-
});
|
537
|
-
}
|
538
|
-
|
539
437
|
scrollToAndHighlight(alignToTop = true) {
|
540
438
|
this.scrollToItem(alignToTop);
|
541
439
|
setTimeout(() => {
|
@@ -691,7 +589,6 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
691
589
|
};
|
692
590
|
const colorClasses = {
|
693
591
|
'd2l-list-item-color-inner': true,
|
694
|
-
'd2l-list-item-color-slim': this._slimColor,
|
695
592
|
'd2l-skeletize': this.color
|
696
593
|
};
|
697
594
|
|
@@ -704,7 +601,6 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
704
601
|
@focusin="${this._onFocusIn}"
|
705
602
|
@focusout="${this._onFocusOut}"
|
706
603
|
class="${classMap(classes)}"
|
707
|
-
data-breakpoint="${this._breakpoint}"
|
708
604
|
data-separators="${ifDefined(this._separators)}"
|
709
605
|
?grid-active="${this.role === 'rowgroup'}"
|
710
606
|
?no-primary-action="${this.noPrimaryAction}">
|
package/components/list/list.js
CHANGED
@@ -3,6 +3,7 @@ import { getNextFocusable, getPreviousFocusable } from '../../helpers/focus.js';
|
|
3
3
|
import { SelectionInfo, SelectionMixin } from '../selection/selection-mixin.js';
|
4
4
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
5
5
|
import { PageableMixin } from '../paging/pageable-mixin.js';
|
6
|
+
import ResizeObserver from 'resize-observer-polyfill';
|
6
7
|
import { SubscriberRegistryController } from '../../controllers/subscriber/subscriberControllers.js';
|
7
8
|
|
8
9
|
const keyCodes = {
|
@@ -10,6 +11,15 @@ const keyCodes = {
|
|
10
11
|
};
|
11
12
|
|
12
13
|
export const listSelectionStates = SelectionInfo.states;
|
14
|
+
const DEFAULT_BREAKPOINTS = [842, 636, 580, 0];
|
15
|
+
const SLIM_COLOR_BREAKPOINT = 400;
|
16
|
+
|
17
|
+
const ro = new ResizeObserver(entries => {
|
18
|
+
entries.forEach(entry => {
|
19
|
+
if (!entry?.target?.resizedCallback) return;
|
20
|
+
entry.target.resizedCallback(entry.contentRect?.width);
|
21
|
+
});
|
22
|
+
});
|
13
23
|
|
14
24
|
/**
|
15
25
|
* A container for a styled list of items ("d2l-list-item"). It provides the appropriate "list" semantics as well as options for displaying separators, etc.
|
@@ -22,6 +32,11 @@ class List extends PageableMixin(SelectionMixin(LitElement)) {
|
|
22
32
|
|
23
33
|
static get properties() {
|
24
34
|
return {
|
35
|
+
/**
|
36
|
+
* Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used.
|
37
|
+
* @type {array}
|
38
|
+
*/
|
39
|
+
breakpoints: { type: Array },
|
25
40
|
/**
|
26
41
|
* Whether the user can drag multiple items
|
27
42
|
* @type {boolean}
|
@@ -47,13 +62,20 @@ class List extends PageableMixin(SelectionMixin(LitElement)) {
|
|
47
62
|
* @type {'all'|'between'|'none'}
|
48
63
|
* @default "all"
|
49
64
|
*/
|
50
|
-
separators: { type: String, reflect: true }
|
65
|
+
separators: { type: String, reflect: true },
|
66
|
+
_breakpoint: { type: Number, reflect: true },
|
67
|
+
_slimColor: { type: Boolean, reflect: true, attribute: '_slim-color' }
|
51
68
|
};
|
52
69
|
}
|
53
70
|
|
54
71
|
static get styles() {
|
55
72
|
return css`
|
56
73
|
:host {
|
74
|
+
--d2l-list-item-color-border-radius: 6px;
|
75
|
+
--d2l-list-item-color-width: 6px;
|
76
|
+
--d2l-list-item-illustration-margin-inline-end: 0.9rem;
|
77
|
+
--d2l-list-item-illustration-max-height: 2.6rem;
|
78
|
+
--d2l-list-item-illustration-max-width: 4.5rem;
|
57
79
|
display: block;
|
58
80
|
}
|
59
81
|
:host(:not([slot="nested"])) > .d2l-list-content {
|
@@ -69,11 +91,31 @@ class List extends PageableMixin(SelectionMixin(LitElement)) {
|
|
69
91
|
margin-left: 0.9rem;
|
70
92
|
margin-right: 0.9rem;
|
71
93
|
}
|
94
|
+
:host([_breakpoint="1"]) {
|
95
|
+
--d2l-list-item-illustration-margin-inline-end: 1rem;
|
96
|
+
--d2l-list-item-illustration-max-height: 3.55rem;
|
97
|
+
--d2l-list-item-illustration-max-width: 6rem;
|
98
|
+
}
|
99
|
+
:host([_breakpoint="2"]) {
|
100
|
+
--d2l-list-item-illustration-margin-inline-end: 1rem;
|
101
|
+
--d2l-list-item-illustration-max-height: 5.1rem;
|
102
|
+
--d2l-list-item-illustration-max-width: 9rem;
|
103
|
+
}
|
104
|
+
:host([_breakpoint="3"]) {
|
105
|
+
--d2l-list-item-illustration-margin-inline-end: 1rem;
|
106
|
+
--d2l-list-item-illustration-max-height: 6rem;
|
107
|
+
--d2l-list-item-illustration-max-width: 10.8rem;
|
108
|
+
}
|
109
|
+
:host([_slim-color]) {
|
110
|
+
--d2l-list-item-color-border-radius: 3px;
|
111
|
+
--d2l-list-item-color-width: 3px;
|
112
|
+
}
|
72
113
|
`;
|
73
114
|
}
|
74
115
|
|
75
116
|
constructor() {
|
76
117
|
super();
|
118
|
+
this.breakpoints = DEFAULT_BREAKPOINTS;
|
77
119
|
this.dragMultiple = false;
|
78
120
|
this.extendSeparators = false;
|
79
121
|
this.grid = false;
|
@@ -81,22 +123,39 @@ class List extends PageableMixin(SelectionMixin(LitElement)) {
|
|
81
123
|
this._childHasColor = false;
|
82
124
|
this._childHasExpandCollapseToggle = false;
|
83
125
|
|
126
|
+
this._breakpoint = 0;
|
127
|
+
this._slimColor = false;
|
128
|
+
this._width = 0;
|
129
|
+
|
84
130
|
this._listChildrenUpdatedSubscribers = new SubscriberRegistryController(this, 'list-child-status', {
|
85
131
|
onSubscribe: this._updateActiveSubscriber.bind(this),
|
86
132
|
updateSubscribers: this._updateActiveSubscribers.bind(this)
|
87
133
|
});
|
88
134
|
}
|
89
135
|
|
136
|
+
get breakpoints() {
|
137
|
+
return this._breakpoints;
|
138
|
+
}
|
139
|
+
|
140
|
+
set breakpoints(value) {
|
141
|
+
const oldValue = this._breakpoints;
|
142
|
+
if (value !== DEFAULT_BREAKPOINTS) this._breakpoints = value.sort((a, b) => b - a).slice(0, 4);
|
143
|
+
else this._breakpoints = DEFAULT_BREAKPOINTS;
|
144
|
+
this.requestUpdate('breakpoints', oldValue);
|
145
|
+
}
|
146
|
+
|
90
147
|
connectedCallback() {
|
91
148
|
super.connectedCallback();
|
92
149
|
this.addEventListener('d2l-list-item-showing-count-change', this._handleListItemShowingCountChange);
|
93
150
|
this.addEventListener('d2l-list-item-nested-change', (e) => this._handleListIemNestedChange(e));
|
94
151
|
this.addEventListener('d2l-list-item-property-change', (e) => this._handleListItemPropertyChange(e));
|
152
|
+
ro.observe(this);
|
95
153
|
}
|
96
154
|
|
97
155
|
disconnectedCallback() {
|
98
156
|
super.disconnectedCallback();
|
99
157
|
if (this._intersectionObserver) this._intersectionObserver.disconnect();
|
158
|
+
ro.unobserve(this);
|
100
159
|
}
|
101
160
|
|
102
161
|
firstUpdated(changedProperties) {
|
@@ -143,6 +202,13 @@ class List extends PageableMixin(SelectionMixin(LitElement)) {
|
|
143
202
|
`;
|
144
203
|
}
|
145
204
|
|
205
|
+
updated(changedProperties) {
|
206
|
+
super.updated(changedProperties);
|
207
|
+
if (changedProperties.has('breakpoints') && changedProperties.get('breakpoints') !== undefined) {
|
208
|
+
this.resizedCallback(this.offsetWidth, true);
|
209
|
+
}
|
210
|
+
}
|
211
|
+
|
146
212
|
getItems(slot) {
|
147
213
|
if (!this.shadowRoot) return;
|
148
214
|
if (!slot) slot = this.shadowRoot.querySelector('slot:not([name])');
|
@@ -198,6 +264,21 @@ class List extends PageableMixin(SelectionMixin(LitElement)) {
|
|
198
264
|
return new SelectionInfo(keys, selectionInfo.state);
|
199
265
|
}
|
200
266
|
|
267
|
+
resizedCallback(width, breakpointsChanged) {
|
268
|
+
if (this._width === width && !breakpointsChanged) return;
|
269
|
+
this._width = width;
|
270
|
+
|
271
|
+
this._slimColor = (width < SLIM_COLOR_BREAKPOINT);
|
272
|
+
|
273
|
+
const lastBreakpointIndexToCheck = 3;
|
274
|
+
this.breakpoints.some((breakpoint, index) => {
|
275
|
+
if (width >= breakpoint || index > lastBreakpointIndexToCheck) {
|
276
|
+
this._breakpoint = lastBreakpointIndexToCheck - index - (lastBreakpointIndexToCheck - this.breakpoints.length + 1) * index;
|
277
|
+
return true;
|
278
|
+
}
|
279
|
+
});
|
280
|
+
}
|
281
|
+
|
201
282
|
_getItemByIndex(index) {
|
202
283
|
const items = this.getItems() || [];
|
203
284
|
return items[index];
|
package/custom-elements.json
CHANGED
@@ -7904,12 +7904,6 @@
|
|
7904
7904
|
"description": "A color indicator to appear at the beginning of a list item. Expected value is a valid 3, 4, 6, or 8 character CSS color hex code (e.g., #006fbf).",
|
7905
7905
|
"type": "string"
|
7906
7906
|
},
|
7907
|
-
{
|
7908
|
-
"name": "breakpoints",
|
7909
|
-
"description": "Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used.",
|
7910
|
-
"type": "array",
|
7911
|
-
"default": "[842,636,580,0]"
|
7912
|
-
},
|
7913
7907
|
{
|
7914
7908
|
"name": "no-primary-action",
|
7915
7909
|
"description": "Whether to disable rendering the entire item as the primary action. Required if slotted content is interactive.",
|
@@ -8006,13 +8000,6 @@
|
|
8006
8000
|
"description": "A color indicator to appear at the beginning of a list item. Expected value is a valid 3, 4, 6, or 8 character CSS color hex code (e.g., #006fbf).",
|
8007
8001
|
"type": "string"
|
8008
8002
|
},
|
8009
|
-
{
|
8010
|
-
"name": "breakpoints",
|
8011
|
-
"attribute": "breakpoints",
|
8012
|
-
"description": "Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used.",
|
8013
|
-
"type": "array",
|
8014
|
-
"default": "[842,636,580,0]"
|
8015
|
-
},
|
8016
8003
|
{
|
8017
8004
|
"name": "noPrimaryAction",
|
8018
8005
|
"attribute": "no-primary-action",
|
@@ -8258,12 +8245,6 @@
|
|
8258
8245
|
"description": "A color indicator to appear at the beginning of a list item. Expected value is a valid 3, 4, 6, or 8 character CSS color hex code (e.g., #006fbf).",
|
8259
8246
|
"type": "string"
|
8260
8247
|
},
|
8261
|
-
{
|
8262
|
-
"name": "breakpoints",
|
8263
|
-
"description": "Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used.",
|
8264
|
-
"type": "array",
|
8265
|
-
"default": "[842,636,580,0]"
|
8266
|
-
},
|
8267
8248
|
{
|
8268
8249
|
"name": "no-primary-action",
|
8269
8250
|
"description": "Whether to disable rendering the entire item as the primary action. Required if slotted content is interactive.",
|
@@ -8367,13 +8348,6 @@
|
|
8367
8348
|
"description": "A color indicator to appear at the beginning of a list item. Expected value is a valid 3, 4, 6, or 8 character CSS color hex code (e.g., #006fbf).",
|
8368
8349
|
"type": "string"
|
8369
8350
|
},
|
8370
|
-
{
|
8371
|
-
"name": "breakpoints",
|
8372
|
-
"attribute": "breakpoints",
|
8373
|
-
"description": "Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used.",
|
8374
|
-
"type": "array",
|
8375
|
-
"default": "[842,636,580,0]"
|
8376
|
-
},
|
8377
8351
|
{
|
8378
8352
|
"name": "noPrimaryAction",
|
8379
8353
|
"attribute": "no-primary-action",
|
@@ -8741,12 +8715,6 @@
|
|
8741
8715
|
"description": "A color indicator to appear at the beginning of a list item. Expected value is a valid 3, 4, 6, or 8 character CSS color hex code (e.g., #006fbf).",
|
8742
8716
|
"type": "string"
|
8743
8717
|
},
|
8744
|
-
{
|
8745
|
-
"name": "breakpoints",
|
8746
|
-
"description": "Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used.",
|
8747
|
-
"type": "array",
|
8748
|
-
"default": "[842,636,580,0]"
|
8749
|
-
},
|
8750
8718
|
{
|
8751
8719
|
"name": "no-primary-action",
|
8752
8720
|
"description": "Whether to disable rendering the entire item as the primary action. Required if slotted content is interactive.",
|
@@ -8855,13 +8823,6 @@
|
|
8855
8823
|
"description": "A color indicator to appear at the beginning of a list item. Expected value is a valid 3, 4, 6, or 8 character CSS color hex code (e.g., #006fbf).",
|
8856
8824
|
"type": "string"
|
8857
8825
|
},
|
8858
|
-
{
|
8859
|
-
"name": "breakpoints",
|
8860
|
-
"attribute": "breakpoints",
|
8861
|
-
"description": "Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used.",
|
8862
|
-
"type": "array",
|
8863
|
-
"default": "[842,636,580,0]"
|
8864
|
-
},
|
8865
8826
|
{
|
8866
8827
|
"name": "noPrimaryAction",
|
8867
8828
|
"attribute": "no-primary-action",
|
@@ -9025,6 +8986,12 @@
|
|
9025
8986
|
"type": "'all'|'between'|'none'",
|
9026
8987
|
"default": "\"\\\"all\\\"\""
|
9027
8988
|
},
|
8989
|
+
{
|
8990
|
+
"name": "breakpoints",
|
8991
|
+
"description": "Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used.",
|
8992
|
+
"type": "array",
|
8993
|
+
"default": "[842,636,580,0]"
|
8994
|
+
},
|
9028
8995
|
{
|
9029
8996
|
"name": "drag-multiple",
|
9030
8997
|
"description": "Whether the user can drag multiple items",
|
@@ -9074,6 +9041,13 @@
|
|
9074
9041
|
"type": "'all'|'between'|'none'",
|
9075
9042
|
"default": "\"\\\"all\\\"\""
|
9076
9043
|
},
|
9044
|
+
{
|
9045
|
+
"name": "breakpoints",
|
9046
|
+
"attribute": "breakpoints",
|
9047
|
+
"description": "Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used.",
|
9048
|
+
"type": "array",
|
9049
|
+
"default": "[842,636,580,0]"
|
9050
|
+
},
|
9077
9051
|
{
|
9078
9052
|
"name": "dragMultiple",
|
9079
9053
|
"attribute": "drag-multiple",
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.151.0",
|
4
4
|
"description": "A collection of accessible, free, open-source web components for building Brightspace applications",
|
5
5
|
"type": "module",
|
6
6
|
"repository": "https://github.com/BrightspaceUI/core.git",
|