@brightspace-ui/core 3.112.3 → 3.113.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/demo/list.html +26 -7
- package/components/list/list-item-button-mixin.js +2 -3
- package/components/list/list-item-checkbox-mixin.js +4 -0
- package/components/list/list-item-expand-collapse-mixin.js +13 -2
- package/components/list/list-item-generic-layout.js +4 -1
- package/components/list/list-item-link-mixin.js +2 -3
- package/components/list/list-item-mixin.js +28 -19
- package/package.json +1 -1
@@ -209,7 +209,7 @@
|
|
209
209
|
<d2l-demo-snippet>
|
210
210
|
<template>
|
211
211
|
<d2l-list grid>
|
212
|
-
<d2l-list-item expandable key="expand-1" label="Expandable item #1"
|
212
|
+
<d2l-list-item expandable key="expand-1" label="Expandable item #1">
|
213
213
|
<d2l-list-item-content>
|
214
214
|
<div>Week 1: Introduction</div>
|
215
215
|
<div slot="secondary" style="padding: 5px;"><d2l-tooltip-help text="Due: Jan 30, 2023">Available: Aug 11, 2023</d2l-tooltip-help></div>
|
@@ -217,12 +217,29 @@
|
|
217
217
|
</d2l-list-item-content>
|
218
218
|
<d2l-list grid slot="nested">
|
219
219
|
<d2l-list-item selectable key="nested-1" label="Nested 1">
|
220
|
-
<d2l-list-item-content
|
220
|
+
<d2l-list-item-content>
|
221
|
+
<div>Nested item #1</div>
|
222
|
+
<div slot="secondary"><d2l-button-subtle style="padding: 5px;" text="Bookmark" icon="tier1:bookmark-hollow"></d2l-button-subtle></div>
|
223
|
+
</d2l-list-item-content>
|
221
224
|
</d2l-list-item>
|
222
|
-
<d2l-list-item selectable key="nested-2" label="Nested 2">
|
223
|
-
<d2l-list-item-content
|
225
|
+
<d2l-list-item selectable key="nested-2" label="Nested 2" expandable>
|
226
|
+
<d2l-list-item-content>
|
227
|
+
<div>Nested item #2</div>
|
228
|
+
<div slot="secondary"><d2l-button-subtle style="padding: 5px;" text="Bookmark" icon="tier1:bookmark-hollow"></d2l-button-subtle></div>
|
229
|
+
</d2l-list-item-content>
|
230
|
+
<d2l-list grid slot="nested">
|
231
|
+
<d2l-list-item selectable key="nested-1-1" label="Nested 1">
|
232
|
+
<d2l-list-item-content>
|
233
|
+
<div>Nested item #1</div>
|
234
|
+
<div slot="secondary"><d2l-button-subtle style="padding: 5px;" text="Bookmark" icon="tier1:bookmark-hollow"></d2l-button-subtle></div>
|
235
|
+
</d2l-list-item-content>
|
236
|
+
</d2l-list-item>
|
237
|
+
<d2l-list-item selectable key="nested--1" label="Nested 2">
|
238
|
+
<d2l-list-item-content><div>Nested item #2</div></d2l-list-item-content>
|
239
|
+
</d2l-list-item>
|
240
|
+
</d2l-list>
|
224
241
|
</d2l-list-item>
|
225
|
-
|
242
|
+
</d2l-list>
|
226
243
|
</d2l-list-item>
|
227
244
|
<d2l-list-item href="http://www.d2l.com">
|
228
245
|
<d2l-list-item-content>
|
@@ -240,8 +257,10 @@
|
|
240
257
|
</template>
|
241
258
|
<script type="module">
|
242
259
|
requestAnimationFrame(() => {
|
243
|
-
document.
|
244
|
-
|
260
|
+
document.querySelectorAll('d2l-button-subtle').forEach((button) => {
|
261
|
+
button.addEventListener('click', () => {
|
262
|
+
console.log('d2l-button: click event');
|
263
|
+
});
|
245
264
|
});
|
246
265
|
});
|
247
266
|
</script>
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import '../colors/colors.js';
|
2
2
|
import { css, html } from 'lit';
|
3
|
-
import {
|
3
|
+
import { isInteractiveInListItemComposedPath, ListItemMixin } from './list-item-mixin.js';
|
4
4
|
import { getUniqueId } from '../../helpers/uniqueId.js';
|
5
|
-
import { isInteractiveInComposedPath } from '../../helpers/interactive.js';
|
6
5
|
|
7
6
|
export const ListItemButtonMixin = superclass => class extends ListItemMixin(superclass) {
|
8
7
|
static get properties() {
|
@@ -67,7 +66,7 @@ export const ListItemButtonMixin = superclass => class extends ListItemMixin(sup
|
|
67
66
|
|
68
67
|
_getDescendantClicked(e) {
|
69
68
|
const isPrimaryAction = (elem) => elem === this.shadowRoot.querySelector(`#${this._primaryActionId}`);
|
70
|
-
return
|
69
|
+
return isInteractiveInListItemComposedPath(e, isPrimaryAction);
|
71
70
|
}
|
72
71
|
|
73
72
|
_onButtonClick(e) {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import '../selection/selection-input.js';
|
2
2
|
import { css, html, nothing } from 'lit';
|
3
3
|
import { getUniqueId } from '../../helpers/uniqueId.js';
|
4
|
+
import { isInteractiveInListItemComposedPath } from './list-item-mixin.js';
|
4
5
|
import { SelectionInfo } from '../selection/selection-mixin.js';
|
5
6
|
import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
|
6
7
|
|
@@ -119,6 +120,9 @@ export const ListItemCheckboxMixin = superclass => class extends SkeletonMixin(s
|
|
119
120
|
_onCheckboxActionClick(event) {
|
120
121
|
event.preventDefault();
|
121
122
|
if (this.selectionDisabled) return;
|
123
|
+
const isPrimaryAction = (elem) => elem === this.shadowRoot.querySelector('div.d2l-checkbox-action');
|
124
|
+
if (isInteractiveInListItemComposedPath(event, isPrimaryAction)) return;
|
125
|
+
|
122
126
|
this.setSelected(!this.selected);
|
123
127
|
const checkbox = this.shadowRoot && this.shadowRoot.querySelector(`#${this._checkboxId}`);
|
124
128
|
if (checkbox) checkbox.focus();
|
@@ -2,6 +2,7 @@ import '../button/button-icon.js';
|
|
2
2
|
import '../loading-spinner/loading-spinner.js';
|
3
3
|
import { css, html, nothing } from 'lit';
|
4
4
|
import { EventSubscriberController } from '../../controllers/subscriber/subscriberControllers.js';
|
5
|
+
import { isInteractiveInListItemComposedPath } from './list-item-mixin.js';
|
5
6
|
import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
|
6
7
|
|
7
8
|
const dragIntervalDelay = 100;
|
@@ -136,12 +137,12 @@ export const ListItemExpandCollapseMixin = superclass => class extends SkeletonM
|
|
136
137
|
@click="${this._toggleExpandCollapse}"></d2l-button-icon>`;
|
137
138
|
}
|
138
139
|
|
139
|
-
_renderExpandCollapseAction() {
|
140
|
+
_renderExpandCollapseAction(content) {
|
140
141
|
if (this.selectable || !this.expandable || this.noPrimaryAction) {
|
141
142
|
return nothing;
|
142
143
|
}
|
143
144
|
|
144
|
-
return html`<div class="d2l-list-expand-collapse-action" @click="${this.
|
145
|
+
return html`<div class="d2l-list-expand-collapse-action" @click="${this._toggleExpandCollapseAction}">${content || nothing}</div>`;
|
145
146
|
}
|
146
147
|
|
147
148
|
_renderNestedLoadingSpinner() {
|
@@ -168,4 +169,14 @@ export const ListItemExpandCollapseMixin = superclass => class extends SkeletonM
|
|
168
169
|
bubbles: true
|
169
170
|
}));
|
170
171
|
}
|
172
|
+
|
173
|
+
_toggleExpandCollapseAction(e = null) {
|
174
|
+
const isPrimaryAction = (elem) => elem === this.shadowRoot.querySelector('div.d2l-list-expand-collapse-action');
|
175
|
+
if (e && isInteractiveInListItemComposedPath(e, isPrimaryAction)) {
|
176
|
+
e.preventDefault();
|
177
|
+
return;
|
178
|
+
}
|
179
|
+
|
180
|
+
this._toggleExpandCollapse(e);
|
181
|
+
}
|
171
182
|
};
|
@@ -165,10 +165,13 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
165
165
|
grid-column-start: control-start;
|
166
166
|
}
|
167
167
|
|
168
|
-
:host(:not([no-primary-action])) ::slotted([slot="control-action"]),
|
169
168
|
:host(:not([no-primary-action])) ::slotted([slot="outside-control-action"]) {
|
170
169
|
grid-column-end: end;
|
171
170
|
}
|
171
|
+
|
172
|
+
:host(:not([no-primary-action])) ::slotted([slot="control-action"]) {
|
173
|
+
grid-column-end: actions-start;
|
174
|
+
}
|
172
175
|
|
173
176
|
::slotted([slot="outside-control-container"]) {
|
174
177
|
grid-column: start / end;
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import '../colors/colors.js';
|
2
2
|
import { css, html } from 'lit';
|
3
|
-
import {
|
3
|
+
import { isInteractiveInListItemComposedPath, ListItemMixin } from './list-item-mixin.js';
|
4
4
|
import { getUniqueId } from '../../helpers/uniqueId.js';
|
5
|
-
import { isInteractiveInComposedPath } from '../../helpers/interactive.js';
|
6
5
|
|
7
6
|
export const ListItemLinkMixin = superclass => class extends ListItemMixin(superclass) {
|
8
7
|
|
@@ -53,7 +52,7 @@ export const ListItemLinkMixin = superclass => class extends ListItemMixin(super
|
|
53
52
|
|
54
53
|
_getDescendantClicked(e) {
|
55
54
|
const isPrimaryAction = (elem) => elem === this.shadowRoot.querySelector(`#${this._primaryActionId}`);
|
56
|
-
return
|
55
|
+
return isInteractiveInListItemComposedPath(e, isPrimaryAction);
|
57
56
|
}
|
58
57
|
|
59
58
|
_handleLinkClick(e) {
|
@@ -6,13 +6,13 @@ import '../tooltip/tooltip.js';
|
|
6
6
|
import '../expand-collapse/expand-collapse-content.js';
|
7
7
|
import { css, html, nothing } from 'lit';
|
8
8
|
import { findComposedAncestor, getComposedParent } from '../../helpers/dom.js';
|
9
|
+
import { interactiveElements, isInteractiveInComposedPath } from '../../helpers/interactive.js';
|
9
10
|
import { classMap } from 'lit/directives/class-map.js';
|
10
11
|
import { composeMixins } from '../../helpers/composeMixins.js';
|
11
12
|
import { getFirstFocusableDescendant } from '../../helpers/focus.js';
|
12
13
|
import { getUniqueId } from '../../helpers/uniqueId.js';
|
13
14
|
import { getValidHexColor } from '../../helpers/color.js';
|
14
15
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
15
|
-
import { interactiveElements } from '../../helpers/interactive.js';
|
16
16
|
import { LabelledMixin } from '../../mixins/labelled/labelled-mixin.js';
|
17
17
|
import { ListItemCheckboxMixin } from './list-item-checkbox-mixin.js';
|
18
18
|
import { ListItemDragDropMixin } from './list-item-drag-drop-mixin.js';
|
@@ -40,11 +40,14 @@ function addTabListener() {
|
|
40
40
|
|
41
41
|
let hasDisplayedKeyboardTooltip = false;
|
42
42
|
|
43
|
-
export
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
43
|
+
export function isInteractiveInListItemComposedPath(e, isPrimaryAction) {
|
44
|
+
const listInteractiveElems = {
|
45
|
+
...interactiveElements,
|
46
|
+
'd2l-button': true,
|
47
|
+
'd2l-tooltip-help': true
|
48
|
+
};
|
49
|
+
return isInteractiveInComposedPath(e.composedPath(), isPrimaryAction, { elements: listInteractiveElems });
|
50
|
+
}
|
48
51
|
|
49
52
|
/**
|
50
53
|
* @property label - The hidden label for the checkbox and expand collapse control
|
@@ -177,17 +180,14 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
177
180
|
:host(:not([_render-expand-collapse-slot])) .d2l-list-item-content-extend-separators > [slot="control"] {
|
178
181
|
width: 3rem;
|
179
182
|
}
|
180
|
-
:host(:not([
|
181
|
-
|
182
|
-
padding-left: 0.9rem;
|
183
|
-
padding-right: 0.9rem;
|
183
|
+
:host(:not([_render-expand-collapse-slot])) .d2l-list-item-content-extend-separators > [slot="control"] ~ [slot="control-action"] [slot="content"] {
|
184
|
+
padding-inline-start: 3rem;
|
184
185
|
}
|
185
|
-
:host([
|
186
|
-
padding-
|
186
|
+
:host(:not([_has-color-slot])) .d2l-list-item-content-extend-separators [slot="content"] {
|
187
|
+
padding-inline: 0.9rem;
|
187
188
|
}
|
188
|
-
:host([
|
189
|
-
padding-
|
190
|
-
padding-right: 0;
|
189
|
+
:host([selectable]) .d2l-list-item-content-extend-separators > [slot="content"] {
|
190
|
+
padding-inline-start: 0;
|
191
191
|
}
|
192
192
|
|
193
193
|
:host([_hovering-primary-action]) .d2l-list-item-content,
|
@@ -220,6 +220,10 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
220
220
|
padding-top: 0;
|
221
221
|
}
|
222
222
|
|
223
|
+
[slot="control"] ~ [slot="control-action"] [slot="content"] {
|
224
|
+
padding-inline-start: 2.2rem; /* width of "control" slot set in generic-layout */
|
225
|
+
}
|
226
|
+
|
223
227
|
[slot="content"] ::slotted([slot="illustration"]),
|
224
228
|
[slot="content"] .d2l-list-item-illustration > * {
|
225
229
|
border-radius: 6px;
|
@@ -685,7 +689,7 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
685
689
|
'hide-bottom-border': this._showAddButton && (!this._hasNestedList || this._hasNestedListAddButton)
|
686
690
|
};
|
687
691
|
|
688
|
-
const alignNested = ((this.draggable && this.selectable) || (this.expandable && this.selectable && this.color)) ? 'control' : undefined;
|
692
|
+
const alignNested = ((this.draggable && this.selectable) || (this.expandable && this.selectable && this.color) || (this.expandable && !this.selectable)) ? 'control' : undefined;
|
689
693
|
const contentAreaContent = html`
|
690
694
|
<div slot="content"
|
691
695
|
class="d2l-list-item-content"
|
@@ -696,7 +700,11 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
696
700
|
<slot>${content}</slot>
|
697
701
|
</div>
|
698
702
|
`;
|
703
|
+
|
699
704
|
const primaryAction = ((!this.noPrimaryAction && this._renderPrimaryAction) ? this._renderPrimaryAction(this._contentId, contentAreaContent) : null);
|
705
|
+
const renderExpandableAction = !primaryAction && !this.selectable && this.expandable && !this.noPrimaryAction;
|
706
|
+
const renderCheckboxAction = !primaryAction && this.selectable && !this.noPrimaryAction;
|
707
|
+
|
700
708
|
let tooltipForId = null;
|
701
709
|
if (this._showAddButton) {
|
702
710
|
tooltipForId = this._addButtonTopId;
|
@@ -748,8 +756,8 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
748
756
|
<div slot="control-action"
|
749
757
|
@mouseenter="${this._onMouseEnter}"
|
750
758
|
@mouseleave="${this._onMouseLeave}">
|
751
|
-
${this._renderCheckboxAction('')}
|
752
|
-
${this._renderExpandCollapseAction()}
|
759
|
+
${this._renderCheckboxAction(renderCheckboxAction ? contentAreaContent : '')}
|
760
|
+
${this._renderExpandCollapseAction(renderExpandableAction ? contentAreaContent : null)}
|
753
761
|
</div>` : nothing }
|
754
762
|
${primaryAction ? html`
|
755
763
|
<div slot="content-action"
|
@@ -758,7 +766,8 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
758
766
|
@mouseenter="${this._onMouseEnterPrimaryAction}"
|
759
767
|
@mouseleave="${this._onMouseLeavePrimaryAction}">
|
760
768
|
${primaryAction}
|
761
|
-
</div>` :
|
769
|
+
</div>` : nothing}
|
770
|
+
${!primaryAction && !renderExpandableAction && !renderCheckboxAction ? contentAreaContent : nothing}
|
762
771
|
<div slot="actions"
|
763
772
|
@mouseenter="${this._onMouseEnter}"
|
764
773
|
@mouseleave="${this._onMouseLeave}"
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.113.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",
|