@brightspace-ui/core 2.132.1 → 2.132.2

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
- height: 100%;
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
- ::slotted([slot="control-action"]) {
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
- grid-row: 1 / 2;
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
- <slot name="drop-target"></slot>
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
- <slot name="content" class="d2l-cell" data-cell-num="8" @focus="${!this.noPrimaryAction ? this._preventFocus : null}"></slot>
210
+
211
+ <slot name="drop-target"></slot>
209
212
  <slot name="nested"></slot>
210
213
  `;
211
214
  }
212
215
 
213
- _focusCellItem(previous, num, itemNum) {
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._focusLastItem();
239
+ row._focusLastCell();
233
240
  } else {
234
- row._focusNextCell(1);
241
+ row._focusFirstCell();
235
242
  }
236
243
  }
237
244
 
238
- _focusLastItem() {
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._focusNextCell(1);
262
+ row._focusFirstCell();
256
263
  } else {
257
- row._focusLastItem();
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._focusNextCell(1);
277
- else this._focusLastItem();
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(previous, this._cellNum, this._cellFocusedItem);
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 item
496
- this._focusLastItem();
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 item
504
- this._focusNextCell(1);
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 item
515
- this._focusNextCell(1);
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 item
523
- this._focusLastItem();
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.132.1",
3
+ "version": "2.132.2",
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",
@@ -1,6 +1,6 @@
1
1
  import { getComposedChildren } from '../helpers/dom.js';
2
2
 
3
- export function keyDown(element, keyCode, ctrlKey) {
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