@brightspace-ui/core 2.132.1 → 2.132.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -35,6 +35,15 @@ export const ListItemButtonMixin = superclass => class extends ListItemMixin(sup
|
|
|
35
35
|
outline: none;
|
|
36
36
|
width: 100%;
|
|
37
37
|
}
|
|
38
|
+
:host(:not([button-disabled]):not([no-primary-action])) [slot="content"],
|
|
39
|
+
:host(:not([no-primary-action])) [slot="control-action"] ~ [slot="content"],
|
|
40
|
+
:host(:not([no-primary-action])) [slot="outside-control-action"] ~ [slot="content"] {
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
}
|
|
43
|
+
:host(:not([button-disabled])) [slot="control-action"],
|
|
44
|
+
:host(:not([button-disabled])) [slot="outside-control-action"] {
|
|
45
|
+
grid-column-end: control-end;
|
|
46
|
+
}
|
|
38
47
|
` ];
|
|
39
48
|
|
|
40
49
|
super.styles && styles.unshift(super.styles);
|
|
@@ -68,33 +68,27 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
68
68
|
[content-end actions-start] minmax(0, min-content)
|
|
69
69
|
[end actions-end];
|
|
70
70
|
grid-template-rows: [main-start] [main-end nested-start] [nested-end];
|
|
71
|
-
position: relative;
|
|
72
71
|
}
|
|
73
72
|
|
|
74
|
-
::slotted([slot="nested"]) {
|
|
75
|
-
grid-column: content-start / end;
|
|
76
|
-
grid-row: nested-start / nested-end;
|
|
77
|
-
}
|
|
78
73
|
:host([align-nested="control"]) ::slotted([slot="nested"]) {
|
|
79
74
|
grid-column: control-start / end;
|
|
80
75
|
}
|
|
81
|
-
:host(.d2l-dragging-over) ::slotted([slot="nested"]) {
|
|
82
|
-
order: 7; /* must be greater than item's drop-target to allow dropping onto items within nested list */
|
|
83
|
-
}
|
|
84
76
|
|
|
85
77
|
::slotted([slot="drop-target"]) {
|
|
86
|
-
|
|
87
|
-
order: 6;
|
|
88
|
-
position: absolute;
|
|
89
|
-
top: 0;
|
|
90
|
-
width: 100%;
|
|
78
|
+
grid-column: start / end;
|
|
91
79
|
}
|
|
92
80
|
|
|
93
81
|
::slotted([slot="outside-control"]),
|
|
94
82
|
::slotted([slot="expand-collapse"]),
|
|
95
83
|
::slotted([slot="control"]),
|
|
96
84
|
::slotted([slot="content"]),
|
|
97
|
-
::slotted([slot="actions"])
|
|
85
|
+
::slotted([slot="actions"]),
|
|
86
|
+
::slotted([slot="outside-control-action"]),
|
|
87
|
+
::slotted([slot="control-action"]),
|
|
88
|
+
::slotted([slot="content-action"]),
|
|
89
|
+
::slotted([slot="outside-control-container"]),
|
|
90
|
+
::slotted([slot="control-container"]),
|
|
91
|
+
::slotted([slot="drop-target"]) {
|
|
98
92
|
grid-row: 1 / 2;
|
|
99
93
|
}
|
|
100
94
|
::slotted([slot="outside-control"]) {
|
|
@@ -104,7 +98,6 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
104
98
|
::slotted([slot="expand-collapse"]) {
|
|
105
99
|
cursor: pointer;
|
|
106
100
|
grid-column: expand-collapse-start / expand-collapse-end;
|
|
107
|
-
order: 2;
|
|
108
101
|
}
|
|
109
102
|
|
|
110
103
|
::slotted([slot="control"]) {
|
|
@@ -116,6 +109,16 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
116
109
|
grid-column: content-start / content-end;
|
|
117
110
|
}
|
|
118
111
|
|
|
112
|
+
::slotted([slot="control"]),
|
|
113
|
+
::slotted([slot="outside-control"]) {
|
|
114
|
+
pointer-events: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
::slotted([slot="control-action"]) ~ ::slotted([slot="content"]),
|
|
118
|
+
::slotted([slot="outside-control-action"]) ~ ::slotted([slot="content"]) {
|
|
119
|
+
pointer-events: unset;
|
|
120
|
+
}
|
|
121
|
+
|
|
119
122
|
slot[name="actions"] {
|
|
120
123
|
white-space: nowrap;
|
|
121
124
|
}
|
|
@@ -123,45 +126,42 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
123
126
|
::slotted([slot="actions"]) {
|
|
124
127
|
grid-column: actions-start / actions-end;
|
|
125
128
|
justify-self: end;
|
|
126
|
-
order: 5;
|
|
127
129
|
}
|
|
128
130
|
|
|
129
|
-
::slotted([slot="outside-control-action"]),
|
|
130
|
-
::slotted([slot="control-action"]),
|
|
131
|
-
::slotted([slot="content-action"]) {
|
|
132
|
-
grid-row: 1 / 2;
|
|
133
|
-
}
|
|
134
131
|
::slotted([slot="outside-control-action"]) {
|
|
135
132
|
grid-column: start / end;
|
|
136
|
-
order: 1;
|
|
137
133
|
}
|
|
138
134
|
:host([no-primary-action]) ::slotted([slot="outside-control-action"]) {
|
|
139
135
|
grid-column: start / outside-control-end;
|
|
140
136
|
}
|
|
141
|
-
|
|
142
|
-
grid-column: control-start / end;
|
|
143
|
-
height: 100%;
|
|
144
|
-
order: 3;
|
|
145
|
-
width: 100%;
|
|
146
|
-
}
|
|
147
|
-
:host([no-primary-action]) ::slotted([slot="control-action"]) {
|
|
148
|
-
grid-column: control-start / control-end;
|
|
149
|
-
}
|
|
137
|
+
|
|
150
138
|
::slotted([slot="content-action"]) {
|
|
151
139
|
grid-column: content-start / end;
|
|
152
|
-
order: 4;
|
|
153
140
|
}
|
|
141
|
+
|
|
154
142
|
:host([no-primary-action]) ::slotted([slot="content-action"]) {
|
|
155
143
|
display: none;
|
|
156
144
|
}
|
|
157
145
|
|
|
146
|
+
::slotted([slot="control-action"]) {
|
|
147
|
+
grid-column-start: control-start;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
:host(:not([no-primary-action])) ::slotted([slot="control-action"]),
|
|
151
|
+
:host(:not([no-primary-action])) ::slotted([slot="outside-control-action"]) {
|
|
152
|
+
grid-column-end: end;
|
|
153
|
+
}
|
|
154
|
+
|
|
158
155
|
::slotted([slot="outside-control-container"]) {
|
|
159
156
|
grid-column: start / end;
|
|
160
|
-
grid-row: 1 / 2;
|
|
161
157
|
}
|
|
162
158
|
::slotted([slot="control-container"]) {
|
|
163
159
|
grid-column: expand-collapse-start / end;
|
|
164
|
-
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
::slotted([slot="nested"]) {
|
|
163
|
+
grid-column: content-start / end;
|
|
164
|
+
grid-row: nested-start / nested-end;
|
|
165
165
|
}
|
|
166
166
|
`;
|
|
167
167
|
}
|
|
@@ -181,6 +181,7 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
181
181
|
},
|
|
182
182
|
capture: true
|
|
183
183
|
};
|
|
184
|
+
|
|
184
185
|
}
|
|
185
186
|
|
|
186
187
|
connectedCallback() {
|
|
@@ -197,20 +198,22 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
197
198
|
return html`
|
|
198
199
|
<slot name="control-container"></slot>
|
|
199
200
|
<slot name="outside-control-container"></slot>
|
|
200
|
-
|
|
201
|
+
|
|
201
202
|
<slot name="content-action" class="d2l-cell" data-cell-num="6"></slot>
|
|
202
203
|
<slot name="outside-control-action" class="d2l-cell" data-cell-num="1"></slot>
|
|
203
204
|
<slot name="outside-control" class="d2l-cell" data-cell-num="2"></slot>
|
|
204
|
-
<slot name="control-action" class="d2l-cell" data-cell-num="3"></slot>
|
|
205
205
|
<slot name="expand-collapse" class="d2l-cell" data-cell-num="4"></slot>
|
|
206
|
+
<slot name="content" class="d2l-cell" data-cell-num="8" @focus="${!this.noPrimaryAction ? this._preventFocus : null}"></slot>
|
|
207
|
+
<slot name="control-action" class="d2l-cell" data-cell-num="3"></slot>
|
|
206
208
|
<slot name="control" class="d2l-cell" data-cell-num="5"></slot>
|
|
207
209
|
<slot name="actions" class="d2l-cell" data-cell-num="7"></slot>
|
|
208
|
-
|
|
210
|
+
|
|
211
|
+
<slot name="drop-target"></slot>
|
|
209
212
|
<slot name="nested"></slot>
|
|
210
213
|
`;
|
|
211
214
|
}
|
|
212
215
|
|
|
213
|
-
_focusCellItem(
|
|
216
|
+
_focusCellItem(num, itemNum) {
|
|
214
217
|
const cell = this.shadowRoot && this.shadowRoot.querySelector(`[data-cell-num="${num}"]`);
|
|
215
218
|
if (!cell) return;
|
|
216
219
|
|
|
@@ -225,17 +228,21 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
225
228
|
}
|
|
226
229
|
}
|
|
227
230
|
|
|
231
|
+
_focusFirstCell() {
|
|
232
|
+
this._focusNextCell(1);
|
|
233
|
+
}
|
|
234
|
+
|
|
228
235
|
_focusFirstRow() {
|
|
229
236
|
const list = findComposedAncestor(this, (node) => node.tagName === 'D2L-LIST');
|
|
230
237
|
const row = list.firstElementChild.shadowRoot.querySelector('[role="gridrow"]');
|
|
231
238
|
if (this.dir === 'rtl') {
|
|
232
|
-
row.
|
|
239
|
+
row._focusLastCell();
|
|
233
240
|
} else {
|
|
234
|
-
row.
|
|
241
|
+
row._focusFirstCell();
|
|
235
242
|
}
|
|
236
243
|
}
|
|
237
244
|
|
|
238
|
-
|
|
245
|
+
_focusLastCell() {
|
|
239
246
|
let cell = null;
|
|
240
247
|
let focusable = null;
|
|
241
248
|
let num = 1;
|
|
@@ -252,9 +259,9 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
252
259
|
const list = findComposedAncestor(this, (node) => node.tagName === 'D2L-LIST');
|
|
253
260
|
const row = list.lastElementChild.shadowRoot.querySelector('[role="gridrow"]');
|
|
254
261
|
if (this.dir === 'rtl') {
|
|
255
|
-
row.
|
|
262
|
+
row._focusFirstCell();
|
|
256
263
|
} else {
|
|
257
|
-
row.
|
|
264
|
+
row._focusLastCell();
|
|
258
265
|
}
|
|
259
266
|
}
|
|
260
267
|
|
|
@@ -273,8 +280,8 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
273
280
|
|
|
274
281
|
if (!cell) {
|
|
275
282
|
// wrap to first/last item
|
|
276
|
-
if (forward) this.
|
|
277
|
-
else this.
|
|
283
|
+
if (forward) this._focusFirstCell();
|
|
284
|
+
else this._focusLastCell();
|
|
278
285
|
}
|
|
279
286
|
|
|
280
287
|
return focusable;
|
|
@@ -294,7 +301,7 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
294
301
|
|
|
295
302
|
if (!listItem) return;
|
|
296
303
|
const listItemRow = listItem.shadowRoot.querySelector('[role="gridrow"]');
|
|
297
|
-
const focusedCellItem = listItemRow._focusCellItem(
|
|
304
|
+
const focusedCellItem = listItemRow._focusCellItem(this._cellNum, this._cellFocusedItem);
|
|
298
305
|
|
|
299
306
|
if (!focusedCellItem) {
|
|
300
307
|
// could not focus on same cell in adjacent list-item so try general focus on item
|
|
@@ -492,16 +499,16 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
492
499
|
if (event.ctrlKey) {
|
|
493
500
|
this._focusFirstRow();
|
|
494
501
|
} else {
|
|
495
|
-
// focus last
|
|
496
|
-
this.
|
|
502
|
+
// focus last cell
|
|
503
|
+
this._focusLastCell();
|
|
497
504
|
}
|
|
498
505
|
} else {
|
|
499
506
|
if (event.ctrlKey) {
|
|
500
507
|
// focus first item of first row
|
|
501
508
|
this._focusFirstRow();
|
|
502
509
|
} else {
|
|
503
|
-
// focus first
|
|
504
|
-
this.
|
|
510
|
+
// focus first cell
|
|
511
|
+
this._focusFirstCell();
|
|
505
512
|
}
|
|
506
513
|
}
|
|
507
514
|
break;
|
|
@@ -511,16 +518,16 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
511
518
|
// focus first item of last row
|
|
512
519
|
this._focusLastRow();
|
|
513
520
|
} else {
|
|
514
|
-
// focus first
|
|
515
|
-
this.
|
|
521
|
+
// focus first cell
|
|
522
|
+
this._focusFirstCell();
|
|
516
523
|
}
|
|
517
524
|
} else {
|
|
518
525
|
if (event.ctrlKey) {
|
|
519
526
|
// focus last item of last row
|
|
520
527
|
this._focusLastRow();
|
|
521
528
|
} else {
|
|
522
|
-
// focus last
|
|
523
|
-
this.
|
|
529
|
+
// focus last cell
|
|
530
|
+
this._focusLastCell();
|
|
524
531
|
}
|
|
525
532
|
}
|
|
526
533
|
break;
|
|
@@ -543,10 +550,12 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
543
550
|
|
|
544
551
|
_setFocusInfo(e) {
|
|
545
552
|
e.stopPropagation();
|
|
553
|
+
|
|
546
554
|
if (!this.gridActive) return;
|
|
547
555
|
const slot = (e.path || e.composedPath()).find(node =>
|
|
548
556
|
node.nodeName === 'SLOT' && node.classList.contains('d2l-cell'));
|
|
549
557
|
if (!slot) return;
|
|
558
|
+
|
|
550
559
|
this._cellNum = parseInt(slot.getAttribute('data-cell-num'));
|
|
551
560
|
this._cellFocusedItem = this._getFocusedItemPosition(e.target);
|
|
552
561
|
}
|
|
@@ -27,6 +27,15 @@ export const ListItemLinkMixin = superclass => class extends ListItemMixin(super
|
|
|
27
27
|
outline: none;
|
|
28
28
|
width: 100%;
|
|
29
29
|
}
|
|
30
|
+
:host([action-href]:not([action-href=""])) [slot="content"],
|
|
31
|
+
:host(:not([no-primary-action])) [slot="control-action"] ~ [slot="content"],
|
|
32
|
+
:host(:not([no-primary-action])) [slot="outside-control-action"] ~ [slot="content"] {
|
|
33
|
+
pointer-events: none;
|
|
34
|
+
}
|
|
35
|
+
:host([action-href]:not([action-href=""])) [slot="control-action"],
|
|
36
|
+
:host([action-href]:not([action-href=""])) [slot="outside-control-action"] {
|
|
37
|
+
grid-column-end: control-end;
|
|
38
|
+
}
|
|
30
39
|
` ];
|
|
31
40
|
|
|
32
41
|
super.styles && styles.unshift(super.styles);
|
|
@@ -86,7 +86,6 @@ export const SwitchMixin = superclass => class extends FocusMixin(RtlMixin(super
|
|
|
86
86
|
.d2l-switch-toggle {
|
|
87
87
|
position: relative;
|
|
88
88
|
transition: transform 150ms ease-out;
|
|
89
|
-
z-index: 1;
|
|
90
89
|
}
|
|
91
90
|
.d2l-switch-toggle > div {
|
|
92
91
|
background-color: #ffffff;
|
|
@@ -97,7 +96,7 @@ export const SwitchMixin = superclass => class extends FocusMixin(RtlMixin(super
|
|
|
97
96
|
height: 1.1rem;
|
|
98
97
|
left: -0.1rem;
|
|
99
98
|
position: absolute;
|
|
100
|
-
top: -0.
|
|
99
|
+
top: -0.95rem;
|
|
101
100
|
width: 1.1rem;
|
|
102
101
|
}
|
|
103
102
|
:host([on]) .d2l-switch-toggle > div {
|
|
@@ -211,9 +210,9 @@ export const SwitchMixin = superclass => class extends FocusMixin(RtlMixin(super
|
|
|
211
210
|
role="switch"
|
|
212
211
|
tabindex="${ifDefined(tabindex)}">
|
|
213
212
|
<div class="${classMap(innerSwitchClasses)}">
|
|
214
|
-
<div class="d2l-switch-toggle"><div></div></div>
|
|
215
213
|
<div class="d2l-switch-icon-on">${this.onIcon}</div>
|
|
216
214
|
<div class="d2l-switch-icon-off">${this.offIcon}</div>
|
|
215
|
+
<div class="d2l-switch-toggle"><div></div></div>
|
|
217
216
|
</div>
|
|
218
217
|
</div>
|
|
219
218
|
${textPosition === 'end' || textPosition === 'hidden' ? switchLabel : ''}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.132.
|
|
3
|
+
"version": "2.132.3",
|
|
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",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@babel/eslint-parser": "^7",
|
|
47
47
|
"@brightspace-ui/stylelint-config": "^0.8",
|
|
48
|
-
"@brightspace-ui/testing": "^0.
|
|
48
|
+
"@brightspace-ui/testing": "^0.15",
|
|
49
49
|
"@open-wc/semantic-dom-diff": "^0.20",
|
|
50
50
|
"@rollup/plugin-dynamic-import-vars": "^2",
|
|
51
51
|
"@rollup/plugin-node-resolve": "^15",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getComposedChildren } from '../helpers/dom.js';
|
|
2
2
|
|
|
3
|
-
export function keyDown(element, keyCode
|
|
3
|
+
export function keyDown(element, keyCode) {
|
|
4
4
|
const event = new CustomEvent('keydown', {
|
|
5
5
|
detail: 0,
|
|
6
6
|
bubbles: true,
|
|
@@ -9,7 +9,6 @@ export function keyDown(element, keyCode, ctrlKey) {
|
|
|
9
9
|
});
|
|
10
10
|
event.keyCode = keyCode;
|
|
11
11
|
event.code = keyCode;
|
|
12
|
-
if (ctrlKey !== undefined) event.ctrlKey = ctrlKey;
|
|
13
12
|
element.dispatchEvent(event);
|
|
14
13
|
}
|
|
15
14
|
|