@brightspace-ui/core 2.175.1 → 2.176.1
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.
@@ -1,7 +1,8 @@
|
|
1
1
|
import { css, html } from 'lit';
|
2
2
|
import { bodySmallStyles } from '../typography/styles.js';
|
3
|
+
import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
|
3
4
|
|
4
|
-
export const InputInlineHelpMixin = superclass => class extends superclass {
|
5
|
+
export const InputInlineHelpMixin = superclass => class extends SkeletonMixin(superclass) {
|
5
6
|
|
6
7
|
static get properties() {
|
7
8
|
return {
|
@@ -37,7 +38,7 @@ export const InputInlineHelpMixin = superclass => class extends superclass {
|
|
37
38
|
|
38
39
|
_renderInlineHelp(id) {
|
39
40
|
return html`
|
40
|
-
<div id="${id}" class="d2l-body-small d2l-input-inline-help">
|
41
|
+
<div id="${id}" class="d2l-body-small d2l-input-inline-help d2l-skeletize">
|
41
42
|
<slot name="inline-help" @slotchange="${this._handleInlineHelpSlotChange}"></slot>
|
42
43
|
</div>
|
43
44
|
`;
|
@@ -69,7 +69,12 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
69
69
|
[control-end content-start] minmax(0, auto)
|
70
70
|
[content-end actions-start] minmax(0, min-content)
|
71
71
|
[end actions-end];
|
72
|
-
grid-template-rows:
|
72
|
+
grid-template-rows:
|
73
|
+
[start add-top-start] minmax(0, min-content)
|
74
|
+
[add-top-end main-start] minmax(0, min-content)
|
75
|
+
[main-end add-start] minmax(0, min-content)
|
76
|
+
[add-end nested-start] minmax(0, min-content)
|
77
|
+
[nested-end end];
|
73
78
|
}
|
74
79
|
|
75
80
|
:host([align-nested="control"]) ::slotted([slot="nested"]) {
|
@@ -92,7 +97,7 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
92
97
|
::slotted([slot="outside-control-container"]),
|
93
98
|
::slotted([slot="control-container"]),
|
94
99
|
::slotted([slot="drop-target"]) {
|
95
|
-
grid-row:
|
100
|
+
grid-row: 2 / 3;
|
96
101
|
}
|
97
102
|
|
98
103
|
::slotted([slot="outside-control"]) {
|
@@ -169,12 +174,19 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
169
174
|
|
170
175
|
::slotted([slot="nested"]) {
|
171
176
|
grid-column: content-start / end;
|
172
|
-
grid-row: nested
|
177
|
+
grid-row: nested;
|
173
178
|
}
|
179
|
+
|
174
180
|
::slotted([slot="add"]) {
|
175
|
-
grid-column: color-start / end;
|
176
181
|
grid-row: add;
|
177
182
|
}
|
183
|
+
::slotted([slot="add-top"]) {
|
184
|
+
grid-row: add-top;
|
185
|
+
}
|
186
|
+
::slotted([slot="add-top"]),
|
187
|
+
::slotted([slot="add"]) {
|
188
|
+
grid-column: color-start / end;
|
189
|
+
}
|
178
190
|
`;
|
179
191
|
}
|
180
192
|
|
@@ -208,6 +220,8 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
208
220
|
|
209
221
|
render() {
|
210
222
|
return html`
|
223
|
+
<slot name="add-top" class="d2l-cell" data-cell-num="10"></slot>
|
224
|
+
|
211
225
|
<slot name="control-container"></slot>
|
212
226
|
<slot name="outside-control-container"></slot>
|
213
227
|
|
@@ -60,6 +60,10 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
60
60
|
* @type {string}
|
61
61
|
*/
|
62
62
|
color: { type: String },
|
63
|
+
/**
|
64
|
+
* @ignore
|
65
|
+
*/
|
66
|
+
first: { type: Boolean, reflect: true },
|
63
67
|
/**
|
64
68
|
* Whether to allow the drag target to be the handle only rather than the entire cell
|
65
69
|
* @type {boolean}
|
@@ -143,6 +147,7 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
143
147
|
:host([selected]:not([selection-disabled]):not([skeleton])) [slot="control-container"]::before,
|
144
148
|
:host([selected]:not([selection-disabled]):not([skeleton])) [slot="control-container"]::after,
|
145
149
|
:host([_show-add-button]) [slot="control-container"]::after,
|
150
|
+
:host([_show-add-button]) [slot="control-container"]::before,
|
146
151
|
:host(:first-of-type[_nested]) [slot="control-container"]::before {
|
147
152
|
border-top-color: transparent;
|
148
153
|
}
|
@@ -380,7 +385,8 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
380
385
|
margin-right: -6px;
|
381
386
|
}
|
382
387
|
|
383
|
-
[slot="add"]
|
388
|
+
[slot="add"],
|
389
|
+
[slot="add-top"] {
|
384
390
|
margin-bottom: -4px;
|
385
391
|
margin-top: -3px;
|
386
392
|
}
|
@@ -399,6 +405,7 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
399
405
|
|
400
406
|
constructor() {
|
401
407
|
super();
|
408
|
+
this.first = false;
|
402
409
|
this.noPrimaryAction = false;
|
403
410
|
this.paddingType = 'normal';
|
404
411
|
this._contentId = getUniqueId();
|
@@ -553,9 +560,10 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
553
560
|
}
|
554
561
|
}
|
555
562
|
|
556
|
-
_handleButtonAddClick() {
|
563
|
+
_handleButtonAddClick(e) {
|
564
|
+
const position = e.target.hasAttribute('data-is-first') ? 'before' : 'after';
|
557
565
|
/** @ignore */
|
558
|
-
this.dispatchEvent(new CustomEvent('d2l-list-item-add-button-click', { bubbles: true }));
|
566
|
+
this.dispatchEvent(new CustomEvent('d2l-list-item-add-button-click', { bubbles: true, detail: { position } }));
|
559
567
|
}
|
560
568
|
|
561
569
|
_isListItem(node) {
|
@@ -608,6 +616,7 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
608
616
|
const nestedList = this._getNestedList();
|
609
617
|
if (this._hasNestedList !== !!nestedList) {
|
610
618
|
this._hasNestedList = !!nestedList;
|
619
|
+
this._hasNestedListAddButton = nestedList.hasAttribute('add-button');
|
611
620
|
/** @ignore */
|
612
621
|
this.dispatchEvent(new CustomEvent('d2l-list-item-nested-change', { bubbles: true, composed: true }));
|
613
622
|
}
|
@@ -640,6 +649,11 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
640
649
|
data-separators="${ifDefined(this._separators)}"
|
641
650
|
?grid-active="${this.role === 'rowgroup'}"
|
642
651
|
?no-primary-action="${this.noPrimaryAction}">
|
652
|
+
${this._showAddButton && this.first ? html`
|
653
|
+
<div slot="add-top">
|
654
|
+
<d2l-button-add text="${addButtonText}" mode="icon-when-interacted" @click="${this._handleButtonAddClick}" data-is-first></d2l-button-add>
|
655
|
+
</div>
|
656
|
+
` : nothing}
|
643
657
|
<div slot="outside-control-container"></div>
|
644
658
|
${this._renderDropTarget()}
|
645
659
|
${this._renderDragHandle(this._renderOutsideControl)}
|
@@ -682,7 +696,7 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
682
696
|
class="d2l-list-item-actions-container">
|
683
697
|
<slot name="actions" class="d2l-list-item-actions">${actions}</slot>
|
684
698
|
</div>
|
685
|
-
${this._showAddButton ? html`
|
699
|
+
${this._showAddButton && !this._hasNestedListAddButton ? html`
|
686
700
|
<div slot="add">
|
687
701
|
<d2l-button-add text="${addButtonText}" mode="icon-when-interacted" @click="${this._handleButtonAddClick}"></d2l-button-add>
|
688
702
|
</div>
|
package/components/list/list.js
CHANGED
@@ -120,6 +120,9 @@ class List extends PageableMixin(SelectionMixin(LitElement)) {
|
|
120
120
|
--d2l-list-item-color-border-radius: 3px;
|
121
121
|
--d2l-list-item-color-width: 3px;
|
122
122
|
}
|
123
|
+
:host([add-button]) ::slotted([slot="controls"]) {
|
124
|
+
margin-bottom: calc(6px + 0.4rem); /* controls section margin-bottom + spacing for add-button */
|
125
|
+
}
|
123
126
|
`;
|
124
127
|
}
|
125
128
|
|
@@ -319,8 +322,12 @@ class List extends PageableMixin(SelectionMixin(LitElement)) {
|
|
319
322
|
|
320
323
|
_handleListItemAddButtonClick(e) {
|
321
324
|
e.stopPropagation();
|
322
|
-
/**
|
323
|
-
|
325
|
+
/**
|
326
|
+
* Dispatched when the add button directly after the item is clicked. Event detail includes position ('before' or 'after') and key.
|
327
|
+
* The key belongs to the list item adjacent to where the new item should be positioned.
|
328
|
+
* The position represents where the new item should be positioned relative to the item with that key.
|
329
|
+
* */
|
330
|
+
this.dispatchEvent(new CustomEvent('d2l-list-add-button-click', { detail: { key: e.target.key, position: e.detail.position } }));
|
324
331
|
}
|
325
332
|
|
326
333
|
_handleListItemNestedChange(e) {
|
@@ -368,6 +375,10 @@ class List extends PageableMixin(SelectionMixin(LitElement)) {
|
|
368
375
|
|
369
376
|
_handleSlotChange() {
|
370
377
|
this._updateItemShowingCount();
|
378
|
+
this.getItems().forEach((item, i) => {
|
379
|
+
if (i === 0) item.first = true;
|
380
|
+
else item.first = false;
|
381
|
+
});
|
371
382
|
|
372
383
|
/** @ignore */
|
373
384
|
this.dispatchEvent(new CustomEvent('d2l-list-item-showing-count-change', {
|
package/custom-elements.json
CHANGED
@@ -4954,6 +4954,11 @@
|
|
4954
4954
|
"type": "'background'|'foreground'|'custom'",
|
4955
4955
|
"default": "\"end\""
|
4956
4956
|
},
|
4957
|
+
{
|
4958
|
+
"name": "skeleton",
|
4959
|
+
"description": "Render the component as a [skeleton loader](https://github.com/BrightspaceUI/core/tree/main/components/skeleton).",
|
4960
|
+
"type": "boolean"
|
4961
|
+
},
|
4957
4962
|
{
|
4958
4963
|
"name": "name",
|
4959
4964
|
"description": "Name of the form control. Submitted with the form as part of a name/value pair.",
|
@@ -5019,6 +5024,12 @@
|
|
5019
5024
|
"type": "'background'|'foreground'|'custom'",
|
5020
5025
|
"default": "\"end\""
|
5021
5026
|
},
|
5027
|
+
{
|
5028
|
+
"name": "skeleton",
|
5029
|
+
"attribute": "skeleton",
|
5030
|
+
"description": "Render the component as a [skeleton loader](https://github.com/BrightspaceUI/core/tree/main/components/skeleton).",
|
5031
|
+
"type": "boolean"
|
5032
|
+
},
|
5022
5033
|
{
|
5023
5034
|
"name": "name",
|
5024
5035
|
"attribute": "name",
|
@@ -8049,6 +8060,11 @@
|
|
8049
8060
|
"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).",
|
8050
8061
|
"type": "string"
|
8051
8062
|
},
|
8063
|
+
{
|
8064
|
+
"name": "first",
|
8065
|
+
"type": "boolean",
|
8066
|
+
"default": "false"
|
8067
|
+
},
|
8052
8068
|
{
|
8053
8069
|
"name": "noPrimaryAction",
|
8054
8070
|
"attribute": "no-primary-action",
|
@@ -8397,6 +8413,11 @@
|
|
8397
8413
|
"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).",
|
8398
8414
|
"type": "string"
|
8399
8415
|
},
|
8416
|
+
{
|
8417
|
+
"name": "first",
|
8418
|
+
"type": "boolean",
|
8419
|
+
"default": "false"
|
8420
|
+
},
|
8400
8421
|
{
|
8401
8422
|
"name": "noPrimaryAction",
|
8402
8423
|
"attribute": "no-primary-action",
|
@@ -8872,6 +8893,11 @@
|
|
8872
8893
|
"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).",
|
8873
8894
|
"type": "string"
|
8874
8895
|
},
|
8896
|
+
{
|
8897
|
+
"name": "first",
|
8898
|
+
"type": "boolean",
|
8899
|
+
"default": "false"
|
8900
|
+
},
|
8875
8901
|
{
|
8876
8902
|
"name": "noPrimaryAction",
|
8877
8903
|
"attribute": "no-primary-action",
|
@@ -9177,7 +9203,7 @@
|
|
9177
9203
|
},
|
9178
9204
|
{
|
9179
9205
|
"name": "d2l-list-add-button-click",
|
9180
|
-
"description": "Dispatched when the add button directly after the item is clicked. Event detail includes
|
9206
|
+
"description": "Dispatched when the add button directly after the item is clicked. Event detail includes position ('before' or 'after') and key.\nThe key belongs to the list item adjacent to where the new item should be positioned.\nThe position represents where the new item should be positioned relative to the item with that key."
|
9181
9207
|
}
|
9182
9208
|
],
|
9183
9209
|
"slots": [
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.176.1",
|
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",
|