@brightspace-ui/core 1.213.0 → 1.215.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/html-block/demo/html-block.html +31 -0
- package/components/html-block/html-block.js +18 -8
- package/components/list/README.md +91 -59
- package/components/list/demo/list-drag-and-drop.js +24 -16
- package/components/list/list-header.js +1 -0
- package/components/list/list-item-button.js +1 -0
- package/components/list/list-item-checkbox-mixin.js +3 -1
- package/components/list/list-item-drag-drop-mixin.js +2 -1
- package/components/list/list-item.js +1 -0
- package/components/list/list.js +7 -4
- package/{helpers → controllers/attributeObserver}/htmlAttributeObserverController.js +0 -0
- package/custom-elements.json +97 -69
- package/directives/animate/animate.js +35 -18
- package/package.json +5 -5
|
@@ -80,6 +80,37 @@
|
|
|
80
80
|
</template>
|
|
81
81
|
</d2l-demo-snippet>
|
|
82
82
|
|
|
83
|
+
<h2>HTML Block (compact)</h2>
|
|
84
|
+
|
|
85
|
+
<d2l-demo-snippet>
|
|
86
|
+
<template>
|
|
87
|
+
<d2l-html-block compact>
|
|
88
|
+
<template>
|
|
89
|
+
<h1>heading 1</h1>
|
|
90
|
+
<h2>heading 2</h2>
|
|
91
|
+
<h3>heading 3</h3>
|
|
92
|
+
<h4>heading 4</h4>
|
|
93
|
+
<h5>heading 5</h5>
|
|
94
|
+
<h6>heading 6</h6>
|
|
95
|
+
<div><strong>strong</strong></div>
|
|
96
|
+
<div><b>bold</b></div>
|
|
97
|
+
<div>text</div>
|
|
98
|
+
<pre>preformatted</pre>
|
|
99
|
+
<p>paragraph</p>
|
|
100
|
+
<ul>
|
|
101
|
+
<li>unordered item 1</li>
|
|
102
|
+
<li>unordered item 2</li>
|
|
103
|
+
</ul>
|
|
104
|
+
<ol>
|
|
105
|
+
<li>ordered item 1</li>
|
|
106
|
+
<li>ordered item 2</li>
|
|
107
|
+
</ol>
|
|
108
|
+
<div><a href="https://d2l.com">anchor</a></div>
|
|
109
|
+
</template>
|
|
110
|
+
</d2l-html-block>
|
|
111
|
+
</template>
|
|
112
|
+
</d2l-demo-snippet>
|
|
113
|
+
|
|
83
114
|
<h2>HTML Block (math)</h2>
|
|
84
115
|
|
|
85
116
|
<d2l-demo-snippet>
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import '../colors/colors.js';
|
|
2
2
|
import { css, LitElement } from 'lit-element/lit-element.js';
|
|
3
|
-
import { HtmlAttributeObserverController } from '../../
|
|
3
|
+
import { HtmlAttributeObserverController } from '../../controllers/attributeObserver/htmlAttributeObserverController.js';
|
|
4
4
|
import { HtmlBlockMathRenderer } from '../../helpers/mathjax.js';
|
|
5
5
|
import { requestInstance } from '../../mixins/provider-mixin.js';
|
|
6
6
|
|
|
7
7
|
export const htmlBlockContentStyles = css`
|
|
8
|
+
.d2l-html-block-compact {
|
|
9
|
+
font-size: 0.8rem;
|
|
10
|
+
font-weight: 400;
|
|
11
|
+
line-height: 1.2rem;
|
|
12
|
+
}
|
|
8
13
|
h1, h2, h3, h4, h5, h6, b, strong, b *, strong * {
|
|
9
14
|
font-weight: bold;
|
|
10
15
|
}
|
|
@@ -49,7 +54,11 @@ export const htmlBlockContentStyles = css`
|
|
|
49
54
|
ul, ol {
|
|
50
55
|
list-style-position: outside;
|
|
51
56
|
margin: 1em 0;
|
|
52
|
-
padding-
|
|
57
|
+
padding-inline-start: 3em;
|
|
58
|
+
}
|
|
59
|
+
.d2l-html-block-compact ul,
|
|
60
|
+
.d2l-html-block-compact ol {
|
|
61
|
+
padding-inline-start: 1.5em;
|
|
53
62
|
}
|
|
54
63
|
ul, ul[type="disc"] {
|
|
55
64
|
list-style-type: disc;
|
|
@@ -95,11 +104,6 @@ export const htmlBlockContentStyles = css`
|
|
|
95
104
|
:host([dir="rtl"]) {
|
|
96
105
|
text-align: right;
|
|
97
106
|
}
|
|
98
|
-
:host([dir="rtl"]) ul,
|
|
99
|
-
:host([dir="rtl"]) ol {
|
|
100
|
-
padding-left: 0;
|
|
101
|
-
padding-right: 3em;
|
|
102
|
-
}
|
|
103
107
|
`;
|
|
104
108
|
|
|
105
109
|
let renderers;
|
|
@@ -120,6 +124,11 @@ class HtmlBlock extends LitElement {
|
|
|
120
124
|
|
|
121
125
|
static get properties() {
|
|
122
126
|
return {
|
|
127
|
+
/**
|
|
128
|
+
* Whether compact styles should be applied
|
|
129
|
+
* @type {Boolean}
|
|
130
|
+
*/
|
|
131
|
+
compact: { type: Boolean },
|
|
123
132
|
/**
|
|
124
133
|
* Whether to disable deferred rendering of the user-authored HTML. Do *not* set this
|
|
125
134
|
* unless your HTML relies on script executions that may break upon stamping.
|
|
@@ -153,6 +162,7 @@ class HtmlBlock extends LitElement {
|
|
|
153
162
|
|
|
154
163
|
constructor() {
|
|
155
164
|
super();
|
|
165
|
+
this.compact = false;
|
|
156
166
|
this.noDeferredRendering = false;
|
|
157
167
|
|
|
158
168
|
const rendererContextAttributes = getRenderers().reduce((attrs, currentRenderer) => {
|
|
@@ -185,7 +195,7 @@ class HtmlBlock extends LitElement {
|
|
|
185
195
|
|
|
186
196
|
if (this._renderContainer) return;
|
|
187
197
|
|
|
188
|
-
this.shadowRoot.innerHTML +=
|
|
198
|
+
this.shadowRoot.innerHTML += `<div class="d2l-html-block-rendered${this.compact ? ' d2l-html-block-compact' : ''}"></div><slot></slot>`;
|
|
189
199
|
|
|
190
200
|
this.shadowRoot.querySelector('slot').addEventListener('slotchange', async e => await this._render(e.target));
|
|
191
201
|
this._renderContainer = this.shadowRoot.querySelector('.d2l-html-block-rendered');
|
|
@@ -137,6 +137,7 @@ The `d2l-list` is the container to create a styled list of items using `d2l-list
|
|
|
137
137
|
|
|
138
138
|
| Property | Type | Description |
|
|
139
139
|
|---|---|---|
|
|
140
|
+
| `drag-multiple` | Boolean | Whether the user can drag multiple items |
|
|
140
141
|
| `grid` | Boolean | Enables keyboard grid for supported list items. See [Accessibility](#accessibility). |
|
|
141
142
|
| `selection-single` | Boolean | Whether to render with single selection behaviour. If `selection-single` is specified, the list-items will render with radios instead of checkboxes, and the list component will maintain a single selected item. |
|
|
142
143
|
| `separators` | String | Display separators (`all` (default), `between`, `none`) |
|
|
@@ -150,18 +151,20 @@ The `d2l-list` is the container to create a styled list of items using `d2l-list
|
|
|
150
151
|
|
|
151
152
|
### Methods
|
|
152
153
|
|
|
153
|
-
- `
|
|
154
|
-
- `
|
|
155
|
-
- `
|
|
156
|
-
- `
|
|
154
|
+
- `getItems()` (Array): returns the list items within the list
|
|
155
|
+
- `getListItemByKey(key)` (ListItem): returns the list item element from the root or nested lists for the specified key
|
|
156
|
+
- `getListItemCount()` (Number): returns the number of items within the list
|
|
157
|
+
- `getListItemIndex(item)` (Object): returns the index of the given element within the list
|
|
158
|
+
- `getSelectedListItems(includeNested)` (Array): returns the selected items; pass `true` to include nested lists
|
|
159
|
+
- `getSelectionInfo(includeNested)` (Object): returns a `SelectionInfo` object containing the `state` (`none`, `some`, `all`), and the `keys` (Array) for the selected items
|
|
157
160
|
|
|
158
161
|
## Selection Lists
|
|
159
162
|
|
|
160
|
-
The `d2l-list` supports selectable items within a list, including both single and multi. Selection is enabled when
|
|
163
|
+
The `d2l-list` supports selectable items within a list, including both single and multi selection. Selection is enabled when `d2l-list-item`s have the `selectable` attribute. When items are selectable, multiple selection is the default behaviour, however the `selection-single` attribute can be applied to the `d2l-list` to enable single selection. A `d2l-list-header` component can be added to `d2l-list`'s `header` slot to provide select-all and bulk actions.
|
|
161
164
|
|
|
162
165
|
### Accessibility Properties
|
|
163
166
|
|
|
164
|
-
If a `d2l-list-item` is selectable then it should have a `label` attribute
|
|
167
|
+
If a `d2l-list-item` is selectable then it should have a `label` attribute that corresponds to the hidden label for the checkbox.
|
|
165
168
|
|
|
166
169
|
### Example
|
|
167
170
|
|
|
@@ -202,12 +205,15 @@ The `d2l-list` supports drag & drop.
|
|
|
202
205
|

|
|
203
206
|
<!-- docs: end hidden content -->
|
|
204
207
|
|
|
205
|
-
|
|
208
|
+
The `d2l-list` is simply a rendering component, so there is some light work involved in hooking up this behaviour. In order for items to be draggable, they must have their `draggable` and `key` attributes set. Optionally, the `drop-nested` attribute can be applied to items to indicate whether other items can be dropped as nested children on the item.
|
|
206
209
|
|
|
207
|
-
- `d2l-list-item`
|
|
208
|
-
- Reordering and re-rendering is the controlling component's responsibility
|
|
210
|
+
Reordering and re-rendering is the consuming component's responsibility. For a simple flat list, listen for the `d2l-list-item-position-change` event and call the `reorder` helper method. Alternatively, or for more complex lists such as those with nested lists, listen for the `d2l-list-items-move` event on the root list and update the consumer data using the provided source and target event detail.
|
|
209
211
|
|
|
210
|
-
|
|
212
|
+
### Accessibility Properties
|
|
213
|
+
|
|
214
|
+
If an item is draggable, the `drag-handle-text` attribute should be used to provide an accessible label for assistive technology in keyboard mode.
|
|
215
|
+
|
|
216
|
+
### Example
|
|
211
217
|
|
|
212
218
|
<!-- docs: demo code autoSize:false size:medium -->
|
|
213
219
|
```html
|
|
@@ -227,18 +233,9 @@ Here is a simple component example that adds drag 'n' drop to a list:
|
|
|
227
233
|
constructor() {
|
|
228
234
|
super();
|
|
229
235
|
this.list = [
|
|
230
|
-
{
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
key: '2',
|
|
236
|
-
content: 'Initially second list item'
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
key: '3',
|
|
240
|
-
content: 'Initially third list item'
|
|
241
|
-
}
|
|
236
|
+
{ key: '1', content: 'Initially first list item' },
|
|
237
|
+
{ key: '2', content: 'Initially second list item' },
|
|
238
|
+
{ key: '3', content: 'Initially third list item' }
|
|
242
239
|
];
|
|
243
240
|
}
|
|
244
241
|
|
|
@@ -319,7 +316,7 @@ The `d2l-list-header` component can be placed in the `d2l-list`'s `header` slot
|
|
|
319
316
|
|
|
320
317
|
## List Item [d2l-list-item]
|
|
321
318
|
|
|
322
|
-
The `d2l-list-item` provides the appropriate `listitem` semantics for children within a list. It also provides some basic layout, breakpoints for responsiveness, a navigation link for the primary action, and selection.
|
|
319
|
+
The `d2l-list-item` provides the appropriate `listitem` semantics for children within a list. It also provides some basic layout, breakpoints for responsiveness, a navigation link for the primary action, and selection.
|
|
323
320
|
|
|
324
321
|
<!-- docs: start hidden content -->
|
|
325
322
|

|
|
@@ -353,7 +350,20 @@ The `d2l-list-item` provides the appropriate `listitem` semantics for children w
|
|
|
353
350
|
|
|
354
351
|
| Property | Type | Description |
|
|
355
352
|
|---|---|---|
|
|
353
|
+
| `breakpoints` | Array | Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used. |
|
|
354
|
+
| `disabled` | Boolean | Disables the input |
|
|
355
|
+
| `draggable` | Boolean | Whether the item is draggable |
|
|
356
|
+
| `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. |
|
|
357
|
+
| `drop-nested` | Boolean | Whether nested items can be dropped on this item |
|
|
358
|
+
| `drop-text` | String | Text to drag and drop |
|
|
356
359
|
| `href` | String | Address of item link if navigable |
|
|
360
|
+
| `key` | String | Value to identify item if selectable or draggable |
|
|
361
|
+
| `label` | String | Explicitly defined label for the element |
|
|
362
|
+
| `labelled-by` | String | The id of element that provides the label for this element |
|
|
363
|
+
| `selectable` | Boolean | Indicates an input should be rendered for selecting the item |
|
|
364
|
+
| `selected` | Boolean | Whether the item is selected |
|
|
365
|
+
| `skeleton` | Boolean | Renders the input as a skeleton loader |
|
|
366
|
+
| `slim` | Boolean | Whether to render the list-item with reduced whitespace|
|
|
357
367
|
|
|
358
368
|
### Events
|
|
359
369
|
|
|
@@ -376,6 +386,56 @@ The `d2l-list-item` provides the appropriate `listitem` semantics for children w
|
|
|
376
386
|
- Image: max dimensions: `width: 216px` and `height: 120px` and has `20px margin` from the main content;
|
|
377
387
|
- default break: `843px < x` where `x` is the width of the component.
|
|
378
388
|
|
|
389
|
+
## Button List Item [d2l-list-item-button]
|
|
390
|
+
|
|
391
|
+
The `d2l-list-item-button` provides the same functionality as `d2l-list-item` except with button semantics for its primary action.
|
|
392
|
+
|
|
393
|
+
<!-- docs: start hidden content -->
|
|
394
|
+

|
|
395
|
+
<!-- docs: end hidden content -->
|
|
396
|
+
|
|
397
|
+
<!-- docs: demo live name:d2l-list-item-button -->
|
|
398
|
+
```html
|
|
399
|
+
<script type="module">
|
|
400
|
+
import '@brightspace-ui/core/components/list/list.js';
|
|
401
|
+
import '@brightspace-ui/core/components/list/list-item-button.js';
|
|
402
|
+
import '@brightspace-ui/core/components/list/list-item-content.js';
|
|
403
|
+
</script>
|
|
404
|
+
|
|
405
|
+
<d2l-list style="width: 100%">
|
|
406
|
+
<d2l-list-item-button href="http://www.d2l.com" selectable key="1" label="Geomorphology and GIS">
|
|
407
|
+
<d2l-list-item-content>
|
|
408
|
+
<div>Geomorphology and GIS </div>
|
|
409
|
+
<div slot="supporting-info">This course explores the geological processes of the Earth's interior and surface. These include volcanism, earthquakes, mountain...</div>
|
|
410
|
+
</d2l-list-item-content>
|
|
411
|
+
</d2l-list-item-button>
|
|
412
|
+
</d2l-list>
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
<!-- docs: start hidden content -->
|
|
416
|
+
### Properties
|
|
417
|
+
|
|
418
|
+
| Property | Type | Description |
|
|
419
|
+
|---|---|---|
|
|
420
|
+
| `breakpoints` | Array | Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used. |
|
|
421
|
+
| `disabled` | Boolean | Disables the input |
|
|
422
|
+
| `draggable` | Boolean | Whether the item is draggable |
|
|
423
|
+
| `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. |
|
|
424
|
+
| `drop-nested` | Boolean | Whether nested items can be dropped on this item |
|
|
425
|
+
| `drop-text` | String | Text to drag and drop |
|
|
426
|
+
| `key` | String | Value to identify item if selectable or draggable |
|
|
427
|
+
| `label` | String | Explicitly defined label for the element |
|
|
428
|
+
| `labelled-by` | String | The id of element that provides the label for this element |
|
|
429
|
+
| `selectable` | Boolean | Indicates an input should be rendered for selecting the item |
|
|
430
|
+
| `selected` | Boolean | Whether the item is selected |
|
|
431
|
+
| `skeleton` | Boolean | Renders the input as a skeleton loader |
|
|
432
|
+
| `slim` | Boolean | Whether to render the list-item with reduced whitespace|
|
|
433
|
+
|
|
434
|
+
### Events
|
|
435
|
+
|
|
436
|
+
- `d2l-list-item-button-click`: dispatched when the item's primary button action is clicked
|
|
437
|
+
<!-- docs: end hidden content -->
|
|
438
|
+
|
|
379
439
|
## ListItemMixin
|
|
380
440
|
|
|
381
441
|
Want to maintain consistency with `d2l-list-item` but need more modularity? This mixin is for you! This mixin allows you to make a component into a list item without requiring custom styling. All of the properties and functionality from `d2l-list-item` (listed above) will be added to your new component.
|
|
@@ -411,42 +471,7 @@ Where the parameters correspond to the slots of `d2l-list-item`:
|
|
|
411
471
|
- illustration (TemplateResult): Provide an illustration for your list item.
|
|
412
472
|
- content (TemplateResult): Core content of the list item, such as a d2l-list-item-content element.
|
|
413
473
|
- actions (TemplateResult): Secondary actions for the list item.
|
|
414
|
-
|
|
415
|
-
### Accessibility Properties
|
|
416
|
-
|
|
417
|
-
- `drag-handle-text`: 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.
|
|
418
|
-
|
|
419
|
-
## Button List Item [d2l-list-item-button]
|
|
420
|
-
|
|
421
|
-
The `d2l-list-item-button` provides the same functionality as `d2l-list-item` except with button semantics for its primary action. It extends `ListItemButtonMixin` and `ListItemMixin` and has all the same use cases as the mixin.
|
|
422
|
-
|
|
423
|
-
<!-- docs: start hidden content -->
|
|
424
|
-

|
|
425
|
-
<!-- docs: end hidden content -->
|
|
426
|
-
|
|
427
|
-
<!-- docs: demo live name:d2l-list-item-button -->
|
|
428
|
-
```html
|
|
429
|
-
<script type="module">
|
|
430
|
-
import '@brightspace-ui/core/components/list/list.js';
|
|
431
|
-
import '@brightspace-ui/core/components/list/list-item-button.js';
|
|
432
|
-
import '@brightspace-ui/core/components/list/list-item-content.js';
|
|
433
|
-
</script>
|
|
434
|
-
|
|
435
|
-
<d2l-list style="width: 100%">
|
|
436
|
-
<d2l-list-item-button href="http://www.d2l.com" selectable key="1" label="Geomorphology and GIS">
|
|
437
|
-
<d2l-list-item-content>
|
|
438
|
-
<div>Geomorphology and GIS </div>
|
|
439
|
-
<div slot="supporting-info">This course explores the geological processes of the Earth's interior and surface. These include volcanism, earthquakes, mountain...</div>
|
|
440
|
-
</d2l-list-item-content>
|
|
441
|
-
</d2l-list-item-button>
|
|
442
|
-
</d2l-list>
|
|
443
|
-
```
|
|
444
|
-
|
|
445
|
-
<!-- docs: start hidden content -->
|
|
446
|
-
### Events
|
|
447
|
-
|
|
448
|
-
- `d2l-list-item-button-click`: dispatched when the item's primary button action is clicked
|
|
449
|
-
<!-- docs: end hidden content -->
|
|
474
|
+
- nested (TemplateResult): Optional `d2l-list` for a nested list.
|
|
450
475
|
|
|
451
476
|
## List Item Content
|
|
452
477
|
|
|
@@ -494,6 +519,13 @@ This event includes a detail object with helper methods attached to it.
|
|
|
494
519
|
- `announceFn(any, Number) (optional)`: A callback function that takes a given item in the array and its index, and returns the text to announce
|
|
495
520
|
- `keyFn(any)`: A callback function that takes a given item in the array and returns its key
|
|
496
521
|
|
|
522
|
+
## Event Details: @d2l-list-items-move
|
|
523
|
+
|
|
524
|
+
**Properties**
|
|
525
|
+
|
|
526
|
+
- `keyboardActive`: (Boolean) Whether the drag handle is in keyboard mode
|
|
527
|
+
- `sourceItems`: (Array) Items being moved
|
|
528
|
+
- `target`: (Object) The target reference `item` where items are being moved, and the `location` (`moveLocations.above`, `moveLocations.below`, or `moveLocations.nest`)
|
|
497
529
|
|
|
498
530
|
<!-- docs: start hidden content -->
|
|
499
531
|
## Future Improvements
|
|
@@ -21,23 +21,27 @@ class ListDemoDragAndDrop extends LitElement {
|
|
|
21
21
|
primaryText: 'Introductory Earth Sciences',
|
|
22
22
|
supportingText: 'This course explores the geological processes of the Earth\'s interior and surface. These include volcanism, earthquakes, mountain building, glaciation and weathering.',
|
|
23
23
|
imgSrc: 'https://s.brightspace.com/course-images/images/63b162ab-b582-4bf9-8c1d-1dad04714121/tile-high-density-max-size.jpg',
|
|
24
|
+
dropNested: true,
|
|
24
25
|
items: [{
|
|
25
26
|
key: '1-1',
|
|
26
27
|
primaryText: 'Glaciation',
|
|
27
|
-
supportingText: '
|
|
28
|
-
imgSrc: '',
|
|
28
|
+
supportingText: 'Nesting Allowed',
|
|
29
|
+
imgSrc: 'https://s.brightspace.com/course-images/images/bf648978-6637-4fdc-815b-81572c436c0e/tile-high-density-max-size.jpg',
|
|
30
|
+
dropNested: true,
|
|
29
31
|
items: []
|
|
30
32
|
}, {
|
|
31
33
|
key: '1-2',
|
|
32
34
|
primaryText: 'Weathering',
|
|
33
|
-
supportingText: '
|
|
34
|
-
imgSrc: '',
|
|
35
|
+
supportingText: 'Nesting Allowed',
|
|
36
|
+
imgSrc: 'https://s.brightspace.com/course-images/images/50f91ba6-7c25-482a-bd71-1c4b7c8d2154/tile-high-density-min-size.jpg',
|
|
37
|
+
dropNested: true,
|
|
35
38
|
items: []
|
|
36
39
|
}, {
|
|
37
40
|
key: '1-3',
|
|
38
41
|
primaryText: 'Volcanism',
|
|
39
|
-
supportingText: '
|
|
40
|
-
imgSrc: '',
|
|
42
|
+
supportingText: 'Nesting Allowed',
|
|
43
|
+
imgSrc: 'https://s.brightspace.com/course-images/images/5eb2371d-6099-4c8d-8aad-075f357012a2/tile-high-density-min-size.jpg',
|
|
44
|
+
dropNested: true,
|
|
41
45
|
items: []
|
|
42
46
|
}]
|
|
43
47
|
}, {
|
|
@@ -48,14 +52,16 @@ class ListDemoDragAndDrop extends LitElement {
|
|
|
48
52
|
items: [{
|
|
49
53
|
key: '2-1',
|
|
50
54
|
primaryText: 'Contaminant Transport',
|
|
51
|
-
supportingText: '
|
|
52
|
-
imgSrc: '',
|
|
55
|
+
supportingText: 'No Nesting Allowed',
|
|
56
|
+
imgSrc: 'https://s.brightspace.com/course-images/images/824fffa1-86a6-4489-84ba-91edfbc1dcc4/tile-high-density-min-size.jpg',
|
|
57
|
+
dropNested: false,
|
|
53
58
|
items: []
|
|
54
59
|
}, {
|
|
55
60
|
key: '2-2',
|
|
56
61
|
primaryText: 'Modelling Flow in Fractured Media',
|
|
57
|
-
supportingText: '
|
|
58
|
-
imgSrc: '',
|
|
62
|
+
supportingText: 'No Nesting Allowed',
|
|
63
|
+
imgSrc: 'https://s.brightspace.com/course-images/images/e18c92a4-b996-444f-84b5-988874feccac/tile-high-density-min-size.jpg',
|
|
64
|
+
dropNested: false,
|
|
59
65
|
items: []
|
|
60
66
|
}]
|
|
61
67
|
}, {
|
|
@@ -66,14 +72,16 @@ class ListDemoDragAndDrop extends LitElement {
|
|
|
66
72
|
items: [{
|
|
67
73
|
key: '3-1',
|
|
68
74
|
primaryText: 'Carbon & Nitrogen Cycling',
|
|
69
|
-
supportingText: '
|
|
70
|
-
imgSrc: '',
|
|
75
|
+
supportingText: 'Nesting Allowed',
|
|
76
|
+
imgSrc: 'https://s.brightspace.com/course-images/images/623b420b-a305-4762-8af8-598f0e72e956/tile-high-density-min-size.jpg',
|
|
77
|
+
dropNested: true,
|
|
71
78
|
items: []
|
|
72
79
|
}, {
|
|
73
80
|
key: '3-2',
|
|
74
81
|
primaryText: 'Wetland Engineering',
|
|
75
|
-
supportingText: '
|
|
76
|
-
imgSrc: '',
|
|
82
|
+
supportingText: 'Nesting Allowed',
|
|
83
|
+
imgSrc: 'https://s.brightspace.com/course-images/images/26102577-8f2a-4e24-84b5-19d76decbc7a/tile-high-density-min-size.jpg',
|
|
84
|
+
dropNested: true,
|
|
77
85
|
items: []
|
|
78
86
|
}]
|
|
79
87
|
}];
|
|
@@ -88,11 +96,11 @@ class ListDemoDragAndDrop extends LitElement {
|
|
|
88
96
|
action-href="http://www.d2l.com"
|
|
89
97
|
draggable
|
|
90
98
|
drag-handle-text="${item.primaryText}"
|
|
91
|
-
drop-nested
|
|
99
|
+
?drop-nested="${item.dropNested}"
|
|
92
100
|
key="${item.key}"
|
|
93
101
|
label="${item.primaryText}"
|
|
94
102
|
selectable>
|
|
95
|
-
${
|
|
103
|
+
${item.imgSrc.length === 0 ? null : html`<img slot="illustration" src="${item.imgSrc}">`}
|
|
96
104
|
<d2l-list-item-content>
|
|
97
105
|
<div>${item.primaryText}</div>
|
|
98
106
|
<div slot="supporting-info">${item.supportingText}</div>
|
|
@@ -7,6 +7,7 @@ import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A header for list components containing select-all, etc.
|
|
10
|
+
* @slot - Responsive container using `d2l-overflow-group` for `d2l-selection-action` elements
|
|
10
11
|
*/
|
|
11
12
|
class ListHeader extends RtlMixin(LocalizeCoreElement(LitElement)) {
|
|
12
13
|
|
|
@@ -6,6 +6,7 @@ import { LitElement } from 'lit-element/lit-element.js';
|
|
|
6
6
|
* @slot - Default content placed inside of the component
|
|
7
7
|
* @slot illustration - Image associated with the list item located at the left of the item
|
|
8
8
|
* @slot actions - Actions (e.g., button icons) associated with the listen item located at the right of the item
|
|
9
|
+
* @slot nested - Nested d2l-list element
|
|
9
10
|
*/
|
|
10
11
|
class ListItemButton extends ListItemButtonMixin(LitElement) {
|
|
11
12
|
|
|
@@ -25,7 +25,7 @@ export const ListItemCheckboxMixin = superclass => class extends SkeletonMixin(L
|
|
|
25
25
|
*/
|
|
26
26
|
key: { type: String, reflect: true },
|
|
27
27
|
/**
|
|
28
|
-
* **Selection:** Indicates
|
|
28
|
+
* **Selection:** Indicates an input should be rendered for selecting the item
|
|
29
29
|
* @type {boolean}
|
|
30
30
|
*/
|
|
31
31
|
selectable: { type: Boolean },
|
|
@@ -60,6 +60,8 @@ export const ListItemCheckboxMixin = superclass => class extends SkeletonMixin(L
|
|
|
60
60
|
|
|
61
61
|
constructor() {
|
|
62
62
|
super();
|
|
63
|
+
this.disabled = false;
|
|
64
|
+
this.selectable = false;
|
|
63
65
|
this.selected = false;
|
|
64
66
|
this.selectionInfo = new SelectionInfo();
|
|
65
67
|
this._checkboxId = getUniqueId();
|
|
@@ -264,7 +264,7 @@ export const ListItemDragDropMixin = superclass => class extends superclass {
|
|
|
264
264
|
*/
|
|
265
265
|
dragHandleText: { type: String, attribute: 'drag-handle-text' },
|
|
266
266
|
/**
|
|
267
|
-
* **Drag & drop:** Whether
|
|
267
|
+
* **Drag & drop:** Whether nested items can be dropped on this item
|
|
268
268
|
* @type {boolean}
|
|
269
269
|
*/
|
|
270
270
|
dropNested: { type: Boolean, attribute: 'drop-nested' },
|
|
@@ -374,6 +374,7 @@ export const ListItemDragDropMixin = superclass => class extends superclass {
|
|
|
374
374
|
_dispatchListItemsMove(sourceItems, targetItem, moveLocation, keyboardActive) {
|
|
375
375
|
if (!keyboardActive) keyboardActive = false;
|
|
376
376
|
const rootList = this._getRootList();
|
|
377
|
+
/** @ignore */
|
|
377
378
|
rootList.dispatchEvent(new CustomEvent('d2l-list-items-move', {
|
|
378
379
|
detail: {
|
|
379
380
|
keyboardActive: keyboardActive,
|
|
@@ -6,6 +6,7 @@ import { LitElement } from 'lit-element/lit-element.js';
|
|
|
6
6
|
* @slot - Default content placed inside of the component
|
|
7
7
|
* @slot illustration - Image associated with the list item located at the left of the item
|
|
8
8
|
* @slot actions - Actions (e.g., button icons) associated with the listen item located at the right of the item
|
|
9
|
+
* @slot nested - Nested d2l-list element
|
|
9
10
|
*/
|
|
10
11
|
class ListItem extends ListItemLinkMixin(LitElement) {
|
|
11
12
|
|
package/components/list/list.js
CHANGED
|
@@ -10,17 +10,20 @@ export const listSelectionStates = SelectionInfo.states;
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* 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.
|
|
13
|
-
* @slot -
|
|
13
|
+
* @slot - Slot for list items (ex. `d2l-list-item`, `d2l-list-item-button`, or custom items)
|
|
14
|
+
* @slot header - Slot for `d2l-list-header` to be rendered above the list
|
|
15
|
+
* @fires d2l-list-items-move - Dispatched when one or more items are moved. See [Event Details: d2l-list-items-move](#event-details%3A-%40d2l-list-items-move).
|
|
14
16
|
*/
|
|
15
17
|
class List extends SelectionMixin(LitElement) {
|
|
16
18
|
|
|
17
19
|
static get properties() {
|
|
18
20
|
return {
|
|
19
21
|
/**
|
|
20
|
-
* Whether
|
|
22
|
+
* Not publicly available yet. Whether the user can drag multiple items
|
|
21
23
|
* @type {boolean}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
* @ignore
|
|
25
|
+
*/
|
|
26
|
+
dragMultiple: { type: Boolean, reflect: true, attribute: 'drag-multiple' },
|
|
24
27
|
/**
|
|
25
28
|
* Whether to extend the separators beyond the content's edge
|
|
26
29
|
* @type {boolean}
|
|
File without changes
|
package/custom-elements.json
CHANGED
|
@@ -3378,6 +3378,12 @@
|
|
|
3378
3378
|
"path": "./components/html-block/html-block.js",
|
|
3379
3379
|
"description": "A component for displaying user-authored HTML.",
|
|
3380
3380
|
"attributes": [
|
|
3381
|
+
{
|
|
3382
|
+
"name": "compact",
|
|
3383
|
+
"description": "Whether compact styles should be applied",
|
|
3384
|
+
"type": "Boolean",
|
|
3385
|
+
"default": "false"
|
|
3386
|
+
},
|
|
3381
3387
|
{
|
|
3382
3388
|
"name": "no-deferred-rendering",
|
|
3383
3389
|
"description": "Whether to disable deferred rendering of the user-authored HTML. Do *not* set this\nunless your HTML relies on script executions that may break upon stamping.",
|
|
@@ -3386,6 +3392,13 @@
|
|
|
3386
3392
|
}
|
|
3387
3393
|
],
|
|
3388
3394
|
"properties": [
|
|
3395
|
+
{
|
|
3396
|
+
"name": "compact",
|
|
3397
|
+
"attribute": "compact",
|
|
3398
|
+
"description": "Whether compact styles should be applied",
|
|
3399
|
+
"type": "Boolean",
|
|
3400
|
+
"default": "false"
|
|
3401
|
+
},
|
|
3389
3402
|
{
|
|
3390
3403
|
"name": "noDeferredRendering",
|
|
3391
3404
|
"attribute": "no-deferred-rendering",
|
|
@@ -6260,7 +6273,7 @@
|
|
|
6260
6273
|
{
|
|
6261
6274
|
"name": "items",
|
|
6262
6275
|
"type": "array",
|
|
6263
|
-
"default": "[{\"key\":\"1\",\"primaryText\":\"Introductory Earth Sciences\",\"supportingText\":\"This course explores the geological processes of the Earth's interior and surface. These include volcanism, earthquakes, mountain building, glaciation and weathering.\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/63b162ab-b582-4bf9-8c1d-1dad04714121/tile-high-density-max-size.jpg\",\"items\":[{\"key\":\"1-1\",\"primaryText\":\"Glaciation\",\"supportingText\":\"
|
|
6276
|
+
"default": "[{\"key\":\"1\",\"primaryText\":\"Introductory Earth Sciences\",\"supportingText\":\"This course explores the geological processes of the Earth's interior and surface. These include volcanism, earthquakes, mountain building, glaciation and weathering.\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/63b162ab-b582-4bf9-8c1d-1dad04714121/tile-high-density-max-size.jpg\",\"dropNested\":true,\"items\":[{\"key\":\"1-1\",\"primaryText\":\"Glaciation\",\"supportingText\":\"Nesting Allowed\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/bf648978-6637-4fdc-815b-81572c436c0e/tile-high-density-max-size.jpg\",\"dropNested\":true,\"items\":[]},{\"key\":\"1-2\",\"primaryText\":\"Weathering\",\"supportingText\":\"Nesting Allowed\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/50f91ba6-7c25-482a-bd71-1c4b7c8d2154/tile-high-density-min-size.jpg\",\"dropNested\":true,\"items\":[]},{\"key\":\"1-3\",\"primaryText\":\"Volcanism\",\"supportingText\":\"Nesting Allowed\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/5eb2371d-6099-4c8d-8aad-075f357012a2/tile-high-density-min-size.jpg\",\"dropNested\":true,\"items\":[]}]},{\"key\":\"2\",\"primaryText\":\"Flow and Transport Through Fractured Rocks\",\"supportingText\":\"Fractures are ubiquitous in geologic media and important in disciplines such as physical and contaminant hydrogeology, geotechnical engineering, civil and environmental engineering, petroleum engineering among other areas.\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/e5fd575a-bc14-4a80-89e1-46f349a76178/tile-high-density-max-size.jpg\",\"items\":[{\"key\":\"2-1\",\"primaryText\":\"Contaminant Transport\",\"supportingText\":\"No Nesting Allowed\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/824fffa1-86a6-4489-84ba-91edfbc1dcc4/tile-high-density-min-size.jpg\",\"dropNested\":false,\"items\":[]},{\"key\":\"2-2\",\"primaryText\":\"Modelling Flow in Fractured Media\",\"supportingText\":\"No Nesting Allowed\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/e18c92a4-b996-444f-84b5-988874feccac/tile-high-density-min-size.jpg\",\"dropNested\":false,\"items\":[]}]},{\"key\":\"3\",\"primaryText\":\"Applied Wetland Science\",\"supportingText\":\"Advanced concepts on wetland ecosystems in the context of regional and global earth systems processes such as carbon and nitrogen cycling and climate change, applications of wetland paleoecology, use of isotopes and other geochemical tools in wetland science, and wetland engineering in landscape rehabilitation and ecotechnology.\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/38e839b1-37fa-470c-8830-b189ce4ae134/tile-high-density-max-size.jpg\",\"items\":[{\"key\":\"3-1\",\"primaryText\":\"Carbon & Nitrogen Cycling\",\"supportingText\":\"Nesting Allowed\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/623b420b-a305-4762-8af8-598f0e72e956/tile-high-density-min-size.jpg\",\"dropNested\":true,\"items\":[]},{\"key\":\"3-2\",\"primaryText\":\"Wetland Engineering\",\"supportingText\":\"Nesting Allowed\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/26102577-8f2a-4e24-84b5-19d76decbc7a/tile-high-density-min-size.jpg\",\"dropNested\":true,\"items\":[]}]}]"
|
|
6264
6277
|
}
|
|
6265
6278
|
],
|
|
6266
6279
|
"properties": [
|
|
@@ -6268,7 +6281,7 @@
|
|
|
6268
6281
|
"name": "items",
|
|
6269
6282
|
"attribute": "items",
|
|
6270
6283
|
"type": "array",
|
|
6271
|
-
"default": "[{\"key\":\"1\",\"primaryText\":\"Introductory Earth Sciences\",\"supportingText\":\"This course explores the geological processes of the Earth's interior and surface. These include volcanism, earthquakes, mountain building, glaciation and weathering.\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/63b162ab-b582-4bf9-8c1d-1dad04714121/tile-high-density-max-size.jpg\",\"items\":[{\"key\":\"1-1\",\"primaryText\":\"Glaciation\",\"supportingText\":\"
|
|
6284
|
+
"default": "[{\"key\":\"1\",\"primaryText\":\"Introductory Earth Sciences\",\"supportingText\":\"This course explores the geological processes of the Earth's interior and surface. These include volcanism, earthquakes, mountain building, glaciation and weathering.\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/63b162ab-b582-4bf9-8c1d-1dad04714121/tile-high-density-max-size.jpg\",\"dropNested\":true,\"items\":[{\"key\":\"1-1\",\"primaryText\":\"Glaciation\",\"supportingText\":\"Nesting Allowed\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/bf648978-6637-4fdc-815b-81572c436c0e/tile-high-density-max-size.jpg\",\"dropNested\":true,\"items\":[]},{\"key\":\"1-2\",\"primaryText\":\"Weathering\",\"supportingText\":\"Nesting Allowed\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/50f91ba6-7c25-482a-bd71-1c4b7c8d2154/tile-high-density-min-size.jpg\",\"dropNested\":true,\"items\":[]},{\"key\":\"1-3\",\"primaryText\":\"Volcanism\",\"supportingText\":\"Nesting Allowed\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/5eb2371d-6099-4c8d-8aad-075f357012a2/tile-high-density-min-size.jpg\",\"dropNested\":true,\"items\":[]}]},{\"key\":\"2\",\"primaryText\":\"Flow and Transport Through Fractured Rocks\",\"supportingText\":\"Fractures are ubiquitous in geologic media and important in disciplines such as physical and contaminant hydrogeology, geotechnical engineering, civil and environmental engineering, petroleum engineering among other areas.\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/e5fd575a-bc14-4a80-89e1-46f349a76178/tile-high-density-max-size.jpg\",\"items\":[{\"key\":\"2-1\",\"primaryText\":\"Contaminant Transport\",\"supportingText\":\"No Nesting Allowed\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/824fffa1-86a6-4489-84ba-91edfbc1dcc4/tile-high-density-min-size.jpg\",\"dropNested\":false,\"items\":[]},{\"key\":\"2-2\",\"primaryText\":\"Modelling Flow in Fractured Media\",\"supportingText\":\"No Nesting Allowed\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/e18c92a4-b996-444f-84b5-988874feccac/tile-high-density-min-size.jpg\",\"dropNested\":false,\"items\":[]}]},{\"key\":\"3\",\"primaryText\":\"Applied Wetland Science\",\"supportingText\":\"Advanced concepts on wetland ecosystems in the context of regional and global earth systems processes such as carbon and nitrogen cycling and climate change, applications of wetland paleoecology, use of isotopes and other geochemical tools in wetland science, and wetland engineering in landscape rehabilitation and ecotechnology.\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/38e839b1-37fa-470c-8830-b189ce4ae134/tile-high-density-max-size.jpg\",\"items\":[{\"key\":\"3-1\",\"primaryText\":\"Carbon & Nitrogen Cycling\",\"supportingText\":\"Nesting Allowed\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/623b420b-a305-4762-8af8-598f0e72e956/tile-high-density-min-size.jpg\",\"dropNested\":true,\"items\":[]},{\"key\":\"3-2\",\"primaryText\":\"Wetland Engineering\",\"supportingText\":\"Nesting Allowed\",\"imgSrc\":\"https://s.brightspace.com/course-images/images/26102577-8f2a-4e24-84b5-19d76decbc7a/tile-high-density-min-size.jpg\",\"dropNested\":true,\"items\":[]}]}]"
|
|
6272
6285
|
}
|
|
6273
6286
|
]
|
|
6274
6287
|
},
|
|
@@ -6306,23 +6319,24 @@
|
|
|
6306
6319
|
},
|
|
6307
6320
|
{
|
|
6308
6321
|
"name": "drop-nested",
|
|
6309
|
-
"description": "**Drag & drop:** Whether
|
|
6322
|
+
"description": "**Drag & drop:** Whether nested items can be dropped on this item",
|
|
6310
6323
|
"type": "boolean",
|
|
6311
6324
|
"default": "false"
|
|
6312
6325
|
},
|
|
6313
|
-
{
|
|
6314
|
-
"name": "disabled",
|
|
6315
|
-
"description": "**Selection:** Disables the input",
|
|
6316
|
-
"type": "boolean"
|
|
6317
|
-
},
|
|
6318
6326
|
{
|
|
6319
6327
|
"name": "key",
|
|
6320
6328
|
"description": "Value to identify item if selectable",
|
|
6321
6329
|
"type": "string"
|
|
6322
6330
|
},
|
|
6331
|
+
{
|
|
6332
|
+
"name": "disabled",
|
|
6333
|
+
"description": "**Selection:** Disables the input",
|
|
6334
|
+
"type": "boolean",
|
|
6335
|
+
"default": "false"
|
|
6336
|
+
},
|
|
6323
6337
|
{
|
|
6324
6338
|
"name": "selectable",
|
|
6325
|
-
"description": "**Selection:** Indicates
|
|
6339
|
+
"description": "**Selection:** Indicates an input should be rendered for selecting the item",
|
|
6326
6340
|
"type": "boolean",
|
|
6327
6341
|
"default": "true"
|
|
6328
6342
|
},
|
|
@@ -6386,26 +6400,27 @@
|
|
|
6386
6400
|
{
|
|
6387
6401
|
"name": "dropNested",
|
|
6388
6402
|
"attribute": "drop-nested",
|
|
6389
|
-
"description": "**Drag & drop:** Whether
|
|
6403
|
+
"description": "**Drag & drop:** Whether nested items can be dropped on this item",
|
|
6390
6404
|
"type": "boolean",
|
|
6391
6405
|
"default": "false"
|
|
6392
6406
|
},
|
|
6393
|
-
{
|
|
6394
|
-
"name": "disabled",
|
|
6395
|
-
"attribute": "disabled",
|
|
6396
|
-
"description": "**Selection:** Disables the input",
|
|
6397
|
-
"type": "boolean"
|
|
6398
|
-
},
|
|
6399
6407
|
{
|
|
6400
6408
|
"name": "key",
|
|
6401
6409
|
"attribute": "key",
|
|
6402
6410
|
"description": "Value to identify item if selectable",
|
|
6403
6411
|
"type": "string"
|
|
6404
6412
|
},
|
|
6413
|
+
{
|
|
6414
|
+
"name": "disabled",
|
|
6415
|
+
"attribute": "disabled",
|
|
6416
|
+
"description": "**Selection:** Disables the input",
|
|
6417
|
+
"type": "boolean",
|
|
6418
|
+
"default": "false"
|
|
6419
|
+
},
|
|
6405
6420
|
{
|
|
6406
6421
|
"name": "selectable",
|
|
6407
6422
|
"attribute": "selectable",
|
|
6408
|
-
"description": "**Selection:** Indicates
|
|
6423
|
+
"description": "**Selection:** Indicates an input should be rendered for selecting the item",
|
|
6409
6424
|
"type": "boolean",
|
|
6410
6425
|
"default": "true"
|
|
6411
6426
|
},
|
|
@@ -6449,9 +6464,6 @@
|
|
|
6449
6464
|
"name": "d2l-list-item-position-change",
|
|
6450
6465
|
"description": "Dispatched when a draggable list item's position changes in the list. See [Event Details: d2l-list-item-position-change](#event-details%3A-d2l-list-item-position-change)."
|
|
6451
6466
|
},
|
|
6452
|
-
{
|
|
6453
|
-
"name": "d2l-list-items-move"
|
|
6454
|
-
},
|
|
6455
6467
|
{
|
|
6456
6468
|
"name": "d2l-list-item-selected",
|
|
6457
6469
|
"description": "Dispatched when the component item is selected"
|
|
@@ -6478,6 +6490,12 @@
|
|
|
6478
6490
|
"type": "boolean",
|
|
6479
6491
|
"default": "false"
|
|
6480
6492
|
}
|
|
6493
|
+
],
|
|
6494
|
+
"slots": [
|
|
6495
|
+
{
|
|
6496
|
+
"name": "",
|
|
6497
|
+
"description": "Responsive container using `d2l-overflow-group` for `d2l-selection-action` elements"
|
|
6498
|
+
}
|
|
6481
6499
|
]
|
|
6482
6500
|
},
|
|
6483
6501
|
{
|
|
@@ -6515,24 +6533,26 @@
|
|
|
6515
6533
|
},
|
|
6516
6534
|
{
|
|
6517
6535
|
"name": "drop-nested",
|
|
6518
|
-
"description": "**Drag & drop:** Whether
|
|
6536
|
+
"description": "**Drag & drop:** Whether nested items can be dropped on this item",
|
|
6519
6537
|
"type": "boolean",
|
|
6520
6538
|
"default": "false"
|
|
6521
6539
|
},
|
|
6522
|
-
{
|
|
6523
|
-
"name": "disabled",
|
|
6524
|
-
"description": "**Selection:** Disables the input",
|
|
6525
|
-
"type": "boolean"
|
|
6526
|
-
},
|
|
6527
6540
|
{
|
|
6528
6541
|
"name": "key",
|
|
6529
6542
|
"description": "Value to identify item if selectable",
|
|
6530
6543
|
"type": "string"
|
|
6531
6544
|
},
|
|
6545
|
+
{
|
|
6546
|
+
"name": "disabled",
|
|
6547
|
+
"description": "**Selection:** Disables the input",
|
|
6548
|
+
"type": "boolean",
|
|
6549
|
+
"default": "false"
|
|
6550
|
+
},
|
|
6532
6551
|
{
|
|
6533
6552
|
"name": "selectable",
|
|
6534
|
-
"description": "**Selection:** Indicates
|
|
6535
|
-
"type": "boolean"
|
|
6553
|
+
"description": "**Selection:** Indicates an input should be rendered for selecting the item",
|
|
6554
|
+
"type": "boolean",
|
|
6555
|
+
"default": "false"
|
|
6536
6556
|
},
|
|
6537
6557
|
{
|
|
6538
6558
|
"name": "selected",
|
|
@@ -6594,27 +6614,29 @@
|
|
|
6594
6614
|
{
|
|
6595
6615
|
"name": "dropNested",
|
|
6596
6616
|
"attribute": "drop-nested",
|
|
6597
|
-
"description": "**Drag & drop:** Whether
|
|
6617
|
+
"description": "**Drag & drop:** Whether nested items can be dropped on this item",
|
|
6598
6618
|
"type": "boolean",
|
|
6599
6619
|
"default": "false"
|
|
6600
6620
|
},
|
|
6601
|
-
{
|
|
6602
|
-
"name": "disabled",
|
|
6603
|
-
"attribute": "disabled",
|
|
6604
|
-
"description": "**Selection:** Disables the input",
|
|
6605
|
-
"type": "boolean"
|
|
6606
|
-
},
|
|
6607
6621
|
{
|
|
6608
6622
|
"name": "key",
|
|
6609
6623
|
"attribute": "key",
|
|
6610
6624
|
"description": "Value to identify item if selectable",
|
|
6611
6625
|
"type": "string"
|
|
6612
6626
|
},
|
|
6627
|
+
{
|
|
6628
|
+
"name": "disabled",
|
|
6629
|
+
"attribute": "disabled",
|
|
6630
|
+
"description": "**Selection:** Disables the input",
|
|
6631
|
+
"type": "boolean",
|
|
6632
|
+
"default": "false"
|
|
6633
|
+
},
|
|
6613
6634
|
{
|
|
6614
6635
|
"name": "selectable",
|
|
6615
6636
|
"attribute": "selectable",
|
|
6616
|
-
"description": "**Selection:** Indicates
|
|
6617
|
-
"type": "boolean"
|
|
6637
|
+
"description": "**Selection:** Indicates an input should be rendered for selecting the item",
|
|
6638
|
+
"type": "boolean",
|
|
6639
|
+
"default": "false"
|
|
6618
6640
|
},
|
|
6619
6641
|
{
|
|
6620
6642
|
"name": "selected",
|
|
@@ -6660,9 +6682,6 @@
|
|
|
6660
6682
|
"name": "d2l-list-item-position-change",
|
|
6661
6683
|
"description": "Dispatched when a draggable list item's position changes in the list. See [Event Details: d2l-list-item-position-change](#event-details%3A-d2l-list-item-position-change)."
|
|
6662
6684
|
},
|
|
6663
|
-
{
|
|
6664
|
-
"name": "d2l-list-items-move"
|
|
6665
|
-
},
|
|
6666
6685
|
{
|
|
6667
6686
|
"name": "d2l-list-item-selected",
|
|
6668
6687
|
"description": "Dispatched when the component item is selected"
|
|
@@ -6680,6 +6699,10 @@
|
|
|
6680
6699
|
{
|
|
6681
6700
|
"name": "actions",
|
|
6682
6701
|
"description": "Actions (e.g., button icons) associated with the listen item located at the right of the item"
|
|
6702
|
+
},
|
|
6703
|
+
{
|
|
6704
|
+
"name": "nested",
|
|
6705
|
+
"description": "Nested d2l-list element"
|
|
6683
6706
|
}
|
|
6684
6707
|
]
|
|
6685
6708
|
},
|
|
@@ -6850,24 +6873,26 @@
|
|
|
6850
6873
|
},
|
|
6851
6874
|
{
|
|
6852
6875
|
"name": "drop-nested",
|
|
6853
|
-
"description": "**Drag & drop:** Whether
|
|
6876
|
+
"description": "**Drag & drop:** Whether nested items can be dropped on this item",
|
|
6854
6877
|
"type": "boolean",
|
|
6855
6878
|
"default": "false"
|
|
6856
6879
|
},
|
|
6857
|
-
{
|
|
6858
|
-
"name": "disabled",
|
|
6859
|
-
"description": "**Selection:** Disables the input",
|
|
6860
|
-
"type": "boolean"
|
|
6861
|
-
},
|
|
6862
6880
|
{
|
|
6863
6881
|
"name": "key",
|
|
6864
6882
|
"description": "Value to identify item if selectable",
|
|
6865
6883
|
"type": "string"
|
|
6866
6884
|
},
|
|
6885
|
+
{
|
|
6886
|
+
"name": "disabled",
|
|
6887
|
+
"description": "**Selection:** Disables the input",
|
|
6888
|
+
"type": "boolean",
|
|
6889
|
+
"default": "false"
|
|
6890
|
+
},
|
|
6867
6891
|
{
|
|
6868
6892
|
"name": "selectable",
|
|
6869
|
-
"description": "**Selection:** Indicates
|
|
6870
|
-
"type": "boolean"
|
|
6893
|
+
"description": "**Selection:** Indicates an input should be rendered for selecting the item",
|
|
6894
|
+
"type": "boolean",
|
|
6895
|
+
"default": "false"
|
|
6871
6896
|
},
|
|
6872
6897
|
{
|
|
6873
6898
|
"name": "selected",
|
|
@@ -6941,27 +6966,29 @@
|
|
|
6941
6966
|
{
|
|
6942
6967
|
"name": "dropNested",
|
|
6943
6968
|
"attribute": "drop-nested",
|
|
6944
|
-
"description": "**Drag & drop:** Whether
|
|
6969
|
+
"description": "**Drag & drop:** Whether nested items can be dropped on this item",
|
|
6945
6970
|
"type": "boolean",
|
|
6946
6971
|
"default": "false"
|
|
6947
6972
|
},
|
|
6948
|
-
{
|
|
6949
|
-
"name": "disabled",
|
|
6950
|
-
"attribute": "disabled",
|
|
6951
|
-
"description": "**Selection:** Disables the input",
|
|
6952
|
-
"type": "boolean"
|
|
6953
|
-
},
|
|
6954
6973
|
{
|
|
6955
6974
|
"name": "key",
|
|
6956
6975
|
"attribute": "key",
|
|
6957
6976
|
"description": "Value to identify item if selectable",
|
|
6958
6977
|
"type": "string"
|
|
6959
6978
|
},
|
|
6979
|
+
{
|
|
6980
|
+
"name": "disabled",
|
|
6981
|
+
"attribute": "disabled",
|
|
6982
|
+
"description": "**Selection:** Disables the input",
|
|
6983
|
+
"type": "boolean",
|
|
6984
|
+
"default": "false"
|
|
6985
|
+
},
|
|
6960
6986
|
{
|
|
6961
6987
|
"name": "selectable",
|
|
6962
6988
|
"attribute": "selectable",
|
|
6963
|
-
"description": "**Selection:** Indicates
|
|
6964
|
-
"type": "boolean"
|
|
6989
|
+
"description": "**Selection:** Indicates an input should be rendered for selecting the item",
|
|
6990
|
+
"type": "boolean",
|
|
6991
|
+
"default": "false"
|
|
6965
6992
|
},
|
|
6966
6993
|
{
|
|
6967
6994
|
"name": "selected",
|
|
@@ -7007,9 +7034,6 @@
|
|
|
7007
7034
|
"name": "d2l-list-item-position-change",
|
|
7008
7035
|
"description": "Dispatched when a draggable list item's position changes in the list. See [Event Details: d2l-list-item-position-change](#event-details%3A-d2l-list-item-position-change)."
|
|
7009
7036
|
},
|
|
7010
|
-
{
|
|
7011
|
-
"name": "d2l-list-items-move"
|
|
7012
|
-
},
|
|
7013
7037
|
{
|
|
7014
7038
|
"name": "d2l-list-item-selected",
|
|
7015
7039
|
"description": "Dispatched when the component item is selected"
|
|
@@ -7027,6 +7051,10 @@
|
|
|
7027
7051
|
{
|
|
7028
7052
|
"name": "actions",
|
|
7029
7053
|
"description": "Actions (e.g., button icons) associated with the listen item located at the right of the item"
|
|
7054
|
+
},
|
|
7055
|
+
{
|
|
7056
|
+
"name": "nested",
|
|
7057
|
+
"description": "Nested d2l-list element"
|
|
7030
7058
|
}
|
|
7031
7059
|
]
|
|
7032
7060
|
},
|
|
@@ -7041,12 +7069,6 @@
|
|
|
7041
7069
|
"type": "'all'|'between'|'none'",
|
|
7042
7070
|
"default": "\"\\\"all\\\"\""
|
|
7043
7071
|
},
|
|
7044
|
-
{
|
|
7045
|
-
"name": "drag-multiple",
|
|
7046
|
-
"description": "Whether to the user can drag multiple items",
|
|
7047
|
-
"type": "boolean",
|
|
7048
|
-
"default": "false"
|
|
7049
|
-
},
|
|
7050
7072
|
{
|
|
7051
7073
|
"name": "extend-separators",
|
|
7052
7074
|
"description": "Whether to extend the separators beyond the content's edge",
|
|
@@ -7076,8 +7098,6 @@
|
|
|
7076
7098
|
},
|
|
7077
7099
|
{
|
|
7078
7100
|
"name": "dragMultiple",
|
|
7079
|
-
"attribute": "drag-multiple",
|
|
7080
|
-
"description": "Whether to the user can drag multiple items",
|
|
7081
7101
|
"type": "boolean",
|
|
7082
7102
|
"default": "false"
|
|
7083
7103
|
},
|
|
@@ -7104,6 +7124,10 @@
|
|
|
7104
7124
|
}
|
|
7105
7125
|
],
|
|
7106
7126
|
"events": [
|
|
7127
|
+
{
|
|
7128
|
+
"name": "d2l-list-items-move",
|
|
7129
|
+
"description": "Dispatched when one or more items are moved. See [Event Details: d2l-list-items-move](#event-details%3A-%40d2l-list-items-move)."
|
|
7130
|
+
},
|
|
7107
7131
|
{
|
|
7108
7132
|
"name": "d2l-list-selection-changes",
|
|
7109
7133
|
"description": "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"
|
|
@@ -7116,7 +7140,11 @@
|
|
|
7116
7140
|
"slots": [
|
|
7117
7141
|
{
|
|
7118
7142
|
"name": "",
|
|
7119
|
-
"description": "
|
|
7143
|
+
"description": "Slot for list items (ex. `d2l-list-item`, `d2l-list-item-button`, or custom items)"
|
|
7144
|
+
},
|
|
7145
|
+
{
|
|
7146
|
+
"name": "header",
|
|
7147
|
+
"description": "Slot for `d2l-list-header` to be rendered above the list"
|
|
7120
7148
|
}
|
|
7121
7149
|
]
|
|
7122
7150
|
},
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { directive,
|
|
1
|
+
import { directive, PartType } from 'lit-html/directive.js';
|
|
2
2
|
import { getComposedActiveElement, getNextFocusable } from '../../helpers/focus.js';
|
|
3
|
+
import { AsyncDirective } from 'lit-html/async-directive.js';
|
|
3
4
|
import { isComposedAncestor } from '../../helpers/dom.js';
|
|
5
|
+
import { noChange } from 'lit-html';
|
|
4
6
|
|
|
5
7
|
const stateMap = new WeakMap();
|
|
6
8
|
const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
@@ -10,15 +12,13 @@ const moveYValue = 20;
|
|
|
10
12
|
|
|
11
13
|
class AnimationState {
|
|
12
14
|
|
|
13
|
-
constructor(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
throw new Error('animation directives must be used with "animate" property');
|
|
15
|
+
constructor(partInfo) {
|
|
16
|
+
if (!(partInfo.type === PartType.PROPERTY) || partInfo.name !== 'animate') {
|
|
17
|
+
throw new Error('animate directives must be used with "animate" property');
|
|
17
18
|
}
|
|
18
|
-
|
|
19
19
|
this.id = 0;
|
|
20
20
|
this.clone = null;
|
|
21
|
-
this.elem =
|
|
21
|
+
this.elem = partInfo.element;
|
|
22
22
|
this.state = 'unknown';
|
|
23
23
|
this.styleAttr = null;
|
|
24
24
|
this.styleAttrUse = false;
|
|
@@ -289,20 +289,37 @@ class AnimationState {
|
|
|
289
289
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
state = new AnimationState(part);
|
|
296
|
-
stateMap.set(part, state);
|
|
292
|
+
class Hide extends AsyncDirective {
|
|
293
|
+
render() {
|
|
294
|
+
return noChange;
|
|
297
295
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
state.
|
|
301
|
-
|
|
296
|
+
update(part, [opts]) {
|
|
297
|
+
opts = opts || {};
|
|
298
|
+
let state = stateMap.get(part.element);
|
|
299
|
+
if (state === undefined) {
|
|
300
|
+
state = new AnimationState(part);
|
|
301
|
+
stateMap.set(part.element, state);
|
|
302
|
+
}
|
|
302
303
|
state.hide(opts);
|
|
304
|
+
return this.render();
|
|
303
305
|
}
|
|
304
306
|
}
|
|
305
307
|
|
|
306
|
-
|
|
308
|
+
class Show extends AsyncDirective {
|
|
309
|
+
render() {
|
|
310
|
+
return noChange;
|
|
311
|
+
}
|
|
312
|
+
update(part, [opts]) {
|
|
313
|
+
opts = opts || {};
|
|
314
|
+
let state = stateMap.get(part.element);
|
|
315
|
+
if (state === undefined) {
|
|
316
|
+
state = new AnimationState(part);
|
|
317
|
+
stateMap.set(part.element, state);
|
|
318
|
+
}
|
|
319
|
+
state.show(opts);
|
|
320
|
+
return this.render();
|
|
321
|
+
}
|
|
322
|
+
}
|
|
307
323
|
|
|
308
|
-
export const
|
|
324
|
+
export const hide = directive(Hide);
|
|
325
|
+
export const show = directive(Show);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.215.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",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"@open-wc/testing": "^2",
|
|
49
49
|
"@web/dev-server": "^0.1",
|
|
50
50
|
"@web/test-runner": "^0.13",
|
|
51
|
-
"@web/test-runner-playwright": "^0.8
|
|
51
|
+
"@web/test-runner-playwright": "^0.8",
|
|
52
52
|
"axe-core": "^4",
|
|
53
53
|
"chalk": "^5",
|
|
54
|
-
"eslint": "^
|
|
54
|
+
"eslint": "^8",
|
|
55
55
|
"eslint-config-brightspace": "^0.16",
|
|
56
56
|
"eslint-plugin-html": "^6",
|
|
57
57
|
"eslint-plugin-import": "^2",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"node-sass": "^7",
|
|
62
62
|
"sinon": "^12",
|
|
63
63
|
"stylelint": "^14",
|
|
64
|
-
"web-test-runner-performance": "^0.1
|
|
64
|
+
"web-test-runner-performance": "^0.1"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@brightspace-ui/intl": "^3",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"ifrau": "^0.39",
|
|
72
72
|
"intl-messageformat": "^7",
|
|
73
73
|
"lit-element": "^2",
|
|
74
|
-
"lit-html": "^1
|
|
74
|
+
"lit-html": "^1",
|
|
75
75
|
"prismjs": "^1",
|
|
76
76
|
"resize-observer-polyfill": "^1"
|
|
77
77
|
}
|