@brightspace-ui/core 1.242.0 → 2.0.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/button/button-mixin.js +4 -2
- package/components/card/card.js +4 -2
- package/components/filter/filter.js +2 -10
- package/components/focus-trap/focus-trap.js +4 -2
- package/components/html-block/html-block.js +0 -2
- package/components/inputs/input-checkbox.js +4 -2
- package/components/inputs/input-date-range.js +4 -2
- package/components/inputs/input-date-time-range.js +4 -2
- package/components/inputs/input-date-time.js +4 -2
- package/components/inputs/input-date.js +4 -2
- package/components/inputs/input-number.js +4 -2
- package/components/inputs/input-percent.js +4 -2
- package/components/inputs/input-search.js +4 -2
- package/components/inputs/input-text.js +4 -2
- package/components/inputs/input-textarea.js +4 -2
- package/components/inputs/input-time-range.js +4 -2
- package/components/inputs/input-time.js +4 -2
- package/components/link/link.js +4 -2
- package/components/list/list-item-drag-drop-mixin.js +5 -0
- package/components/selection/selection-action-dropdown.js +3 -1
- package/components/selection/selection-action.js +3 -1
- package/components/selection/selection-select-all-pages.js +3 -1
- package/components/selection/selection-select-all.js +4 -2
- package/components/switch/switch-mixin.js +4 -2
- package/components/table/table-col-sort-button.js +4 -2
- package/controllers/attributeObserver/htmlAttributeObserverController.js +1 -0
- package/controllers/subscriber/README.md +1 -18
- package/controllers/subscriber/subscriberControllers.js +9 -2
- package/custom-elements.json +4 -134
- package/mixins/focus-mixin.js +4 -2
- package/mixins/focus-mixin.md +2 -1
- package/package.json +4 -4
|
@@ -66,8 +66,6 @@ export const ButtonMixin = superclass => class extends FocusMixin(FocusVisiblePo
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
static focusElementSelector = 'button';
|
|
70
|
-
|
|
71
69
|
constructor() {
|
|
72
70
|
super();
|
|
73
71
|
this.disabled = false;
|
|
@@ -100,6 +98,10 @@ export const ButtonMixin = superclass => class extends FocusMixin(FocusVisiblePo
|
|
|
100
98
|
this.requestUpdate('disabledTooltip', oldValue);
|
|
101
99
|
}
|
|
102
100
|
|
|
101
|
+
static get focusElementSelector() {
|
|
102
|
+
return 'button';
|
|
103
|
+
}
|
|
104
|
+
|
|
103
105
|
connectedCallback() {
|
|
104
106
|
super.connectedCallback();
|
|
105
107
|
this.addEventListener('click', this._handleClick, true);
|
package/components/card/card.js
CHANGED
|
@@ -235,8 +235,6 @@ class Card extends FocusMixin(RtlMixin(LitElement)) {
|
|
|
235
235
|
`];
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
static focusElementSelector = 'a';
|
|
239
|
-
|
|
240
238
|
constructor() {
|
|
241
239
|
super();
|
|
242
240
|
this.alignCenter = false;
|
|
@@ -251,6 +249,10 @@ class Card extends FocusMixin(RtlMixin(LitElement)) {
|
|
|
251
249
|
this._onFooterResize = this._onFooterResize.bind(this);
|
|
252
250
|
}
|
|
253
251
|
|
|
252
|
+
static get focusElementSelector() {
|
|
253
|
+
return 'a';
|
|
254
|
+
}
|
|
255
|
+
|
|
254
256
|
firstUpdated(changedProperties) {
|
|
255
257
|
super.firstUpdated(changedProperties);
|
|
256
258
|
const badgeObserver = new ResizeObserver(this._onBadgeResize);
|
|
@@ -137,8 +137,6 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
|
|
|
137
137
|
`];
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
static focusElementSelector = 'd2l-dropdown-button-subtle';
|
|
141
|
-
|
|
142
140
|
constructor() {
|
|
143
141
|
super();
|
|
144
142
|
this.disabled = false;
|
|
@@ -155,14 +153,8 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
|
|
|
155
153
|
);
|
|
156
154
|
}
|
|
157
155
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
this._activeFiltersSubscribers.hostConnected();
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
disconnectedCallback() {
|
|
164
|
-
super.disconnectedCallback();
|
|
165
|
-
this._activeFiltersSubscribers.hostDisconnected();
|
|
156
|
+
static get focusElementSelector() {
|
|
157
|
+
return 'd2l-dropdown-button-subtle';
|
|
166
158
|
}
|
|
167
159
|
|
|
168
160
|
firstUpdated(changedProperties) {
|
|
@@ -31,14 +31,16 @@ class FocusTrap extends FocusMixin(LitElement) {
|
|
|
31
31
|
`;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
static focusElementSelector = '.d2l-focus-trap-start';
|
|
35
|
-
|
|
36
34
|
constructor() {
|
|
37
35
|
super();
|
|
38
36
|
this.trap = false;
|
|
39
37
|
this._handleBodyFocus = this._handleBodyFocus.bind(this);
|
|
40
38
|
}
|
|
41
39
|
|
|
40
|
+
static get focusElementSelector() {
|
|
41
|
+
return '.d2l-focus-trap-start';
|
|
42
|
+
}
|
|
43
|
+
|
|
42
44
|
connectedCallback() {
|
|
43
45
|
super.connectedCallback();
|
|
44
46
|
document.body.addEventListener('focus', this._handleBodyFocus, true);
|
|
@@ -174,7 +174,6 @@ class HtmlBlock extends RtlMixin(LitElement) {
|
|
|
174
174
|
|
|
175
175
|
connectedCallback() {
|
|
176
176
|
super.connectedCallback();
|
|
177
|
-
if (this._contextObserverController) this._contextObserverController.hostConnected();
|
|
178
177
|
|
|
179
178
|
if (!this._contentObserver || this.noDeferredRendering) return;
|
|
180
179
|
|
|
@@ -188,7 +187,6 @@ class HtmlBlock extends RtlMixin(LitElement) {
|
|
|
188
187
|
|
|
189
188
|
disconnectedCallback() {
|
|
190
189
|
super.disconnectedCallback();
|
|
191
|
-
if (this._contextObserverController) this._contextObserverController.hostDisconnected();
|
|
192
190
|
if (this._contentObserver) this._contentObserver.disconnect();
|
|
193
191
|
}
|
|
194
192
|
|
|
@@ -164,8 +164,6 @@ class InputCheckbox extends FocusMixin(SkeletonMixin(RtlMixin(LitElement))) {
|
|
|
164
164
|
];
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
static focusElementSelector = 'input.d2l-input-checkbox';
|
|
168
|
-
|
|
169
167
|
constructor() {
|
|
170
168
|
super();
|
|
171
169
|
this.checked = false;
|
|
@@ -177,6 +175,10 @@ class InputCheckbox extends FocusMixin(SkeletonMixin(RtlMixin(LitElement))) {
|
|
|
177
175
|
this._descriptionId = getUniqueId();
|
|
178
176
|
}
|
|
179
177
|
|
|
178
|
+
static get focusElementSelector() {
|
|
179
|
+
return 'input.d2l-input-checkbox';
|
|
180
|
+
}
|
|
181
|
+
|
|
180
182
|
render() {
|
|
181
183
|
const tabindex = this.notTabbable ? -1 : undefined;
|
|
182
184
|
const textClasses = {
|
|
@@ -129,8 +129,6 @@ class InputDateRange extends FocusMixin(SkeletonMixin(FormElementMixin(RtlMixin(
|
|
|
129
129
|
`];
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
static focusElementSelector = 'd2l-input-date';
|
|
133
|
-
|
|
134
132
|
constructor() {
|
|
135
133
|
super();
|
|
136
134
|
|
|
@@ -147,6 +145,10 @@ class InputDateRange extends FocusMixin(SkeletonMixin(FormElementMixin(RtlMixin(
|
|
|
147
145
|
this._endInputId = getUniqueId();
|
|
148
146
|
}
|
|
149
147
|
|
|
148
|
+
static get focusElementSelector() {
|
|
149
|
+
return 'd2l-input-date';
|
|
150
|
+
}
|
|
151
|
+
|
|
150
152
|
/** @ignore */
|
|
151
153
|
get validationMessage() {
|
|
152
154
|
if (this.validity.badInput) {
|
|
@@ -172,8 +172,6 @@ class InputDateTimeRange extends FocusMixin(SkeletonMixin(FormElementMixin(RtlMi
|
|
|
172
172
|
`];
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
static focusElementSelector = 'd2l-input-date-time';
|
|
176
|
-
|
|
177
175
|
constructor() {
|
|
178
176
|
super();
|
|
179
177
|
|
|
@@ -193,6 +191,10 @@ class InputDateTimeRange extends FocusMixin(SkeletonMixin(FormElementMixin(RtlMi
|
|
|
193
191
|
this._slotOccupied = false;
|
|
194
192
|
}
|
|
195
193
|
|
|
194
|
+
static get focusElementSelector() {
|
|
195
|
+
return 'd2l-input-date-time';
|
|
196
|
+
}
|
|
197
|
+
|
|
196
198
|
/** @ignore */
|
|
197
199
|
get validationMessage() {
|
|
198
200
|
if (this.validity.badInput) {
|
|
@@ -113,8 +113,6 @@ class InputDateTime extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMi
|
|
|
113
113
|
`];
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
static focusElementSelector = 'd2l-input-date';
|
|
117
|
-
|
|
118
116
|
constructor() {
|
|
119
117
|
super();
|
|
120
118
|
this.disabled = false;
|
|
@@ -179,6 +177,10 @@ class InputDateTime extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMi
|
|
|
179
177
|
this.requestUpdate('value', oldValue);
|
|
180
178
|
}
|
|
181
179
|
|
|
180
|
+
static get focusElementSelector() {
|
|
181
|
+
return 'd2l-input-date';
|
|
182
|
+
}
|
|
183
|
+
|
|
182
184
|
/** @ignore */
|
|
183
185
|
get validationMessage() {
|
|
184
186
|
if (this.validity.rangeOverflow || this.validity.rangeUnderflow) {
|
|
@@ -138,8 +138,6 @@ class InputDate extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixin(
|
|
|
138
138
|
`];
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
static focusElementSelector = 'd2l-input-text';
|
|
142
|
-
|
|
143
141
|
constructor() {
|
|
144
142
|
super();
|
|
145
143
|
|
|
@@ -170,6 +168,10 @@ class InputDate extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixin(
|
|
|
170
168
|
this._dateTimeDescriptor = getDateTimeDescriptorShared();
|
|
171
169
|
}
|
|
172
170
|
|
|
171
|
+
static get focusElementSelector() {
|
|
172
|
+
return 'd2l-input-text';
|
|
173
|
+
}
|
|
174
|
+
|
|
173
175
|
/** @ignore */
|
|
174
176
|
get validationMessage() {
|
|
175
177
|
if (this.validity.rangeOverflow || this.validity.rangeUnderflow) {
|
|
@@ -192,8 +192,6 @@ class InputNumber extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixi
|
|
|
192
192
|
];
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
static focusElementSelector = 'd2l-input-text';
|
|
196
|
-
|
|
197
195
|
constructor() {
|
|
198
196
|
super();
|
|
199
197
|
this.autofocus = false;
|
|
@@ -288,6 +286,10 @@ class InputNumber extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixi
|
|
|
288
286
|
this._updateFormattedValue();
|
|
289
287
|
}
|
|
290
288
|
|
|
289
|
+
static get focusElementSelector() {
|
|
290
|
+
return 'd2l-input-text';
|
|
291
|
+
}
|
|
292
|
+
|
|
291
293
|
/** @ignore */
|
|
292
294
|
get validationMessage() {
|
|
293
295
|
if (this.validity.rangeOverflow || this.validity.rangeUnderflow) {
|
|
@@ -86,8 +86,6 @@ class InputPercent extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMix
|
|
|
86
86
|
];
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
static focusElementSelector = 'd2l-input-number';
|
|
90
|
-
|
|
91
89
|
constructor() {
|
|
92
90
|
super();
|
|
93
91
|
this.autofocus = false;
|
|
@@ -105,6 +103,10 @@ class InputPercent extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMix
|
|
|
105
103
|
this.requestUpdate('value', oldValue);
|
|
106
104
|
}
|
|
107
105
|
|
|
106
|
+
static get focusElementSelector() {
|
|
107
|
+
return 'd2l-input-number';
|
|
108
|
+
}
|
|
109
|
+
|
|
108
110
|
render() {
|
|
109
111
|
return html`
|
|
110
112
|
<d2l-input-number
|
|
@@ -74,8 +74,6 @@ class InputSearch extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement)))
|
|
|
74
74
|
];
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
static focusElementSelector = 'd2l-input-text';
|
|
78
|
-
|
|
79
77
|
constructor() {
|
|
80
78
|
super();
|
|
81
79
|
this._lastSearchValue = '';
|
|
@@ -88,6 +86,10 @@ class InputSearch extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement)))
|
|
|
88
86
|
get lastSearchValue() { return this._lastSearchValue; }
|
|
89
87
|
set lastSearchValue(val) {}
|
|
90
88
|
|
|
89
|
+
static get focusElementSelector() {
|
|
90
|
+
return 'd2l-input-text';
|
|
91
|
+
}
|
|
92
|
+
|
|
91
93
|
connectedCallback() {
|
|
92
94
|
super.connectedCallback();
|
|
93
95
|
if (this.value !== undefined && this.value !== null) {
|
|
@@ -235,8 +235,6 @@ class InputText extends FocusMixin(LabelledMixin(FormElementMixin(SkeletonMixin(
|
|
|
235
235
|
];
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
static focusElementSelector = '.d2l-input';
|
|
239
|
-
|
|
240
238
|
constructor() {
|
|
241
239
|
super();
|
|
242
240
|
this.autofocus = false;
|
|
@@ -272,6 +270,10 @@ class InputText extends FocusMixin(LabelledMixin(FormElementMixin(SkeletonMixin(
|
|
|
272
270
|
this._setValue(val, true);
|
|
273
271
|
}
|
|
274
272
|
|
|
273
|
+
static get focusElementSelector() {
|
|
274
|
+
return '.d2l-input';
|
|
275
|
+
}
|
|
276
|
+
|
|
275
277
|
/** @ignore */
|
|
276
278
|
get selectionEnd() {
|
|
277
279
|
const elem = this.shadowRoot && this.shadowRoot.querySelector('.d2l-input');
|
|
@@ -150,8 +150,6 @@ class InputTextArea extends FocusMixin(LabelledMixin(FormElementMixin(SkeletonMi
|
|
|
150
150
|
`];
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
static focusElementSelector = 'textarea';
|
|
154
|
-
|
|
155
153
|
constructor() {
|
|
156
154
|
super();
|
|
157
155
|
this.disabled = false;
|
|
@@ -165,6 +163,10 @@ class InputTextArea extends FocusMixin(LabelledMixin(FormElementMixin(SkeletonMi
|
|
|
165
163
|
this._textareaId = getUniqueId();
|
|
166
164
|
}
|
|
167
165
|
|
|
166
|
+
static get focusElementSelector() {
|
|
167
|
+
return 'textarea';
|
|
168
|
+
}
|
|
169
|
+
|
|
168
170
|
/** @ignore */
|
|
169
171
|
get textarea() {
|
|
170
172
|
// temporary until consumers are updated
|
|
@@ -137,8 +137,6 @@ class InputTimeRange extends FocusMixin(SkeletonMixin(FormElementMixin(RtlMixin(
|
|
|
137
137
|
`];
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
static focusElementSelector = 'd2l-input-time';
|
|
141
|
-
|
|
142
140
|
constructor() {
|
|
143
141
|
super();
|
|
144
142
|
|
|
@@ -178,6 +176,10 @@ class InputTimeRange extends FocusMixin(SkeletonMixin(FormElementMixin(RtlMixin(
|
|
|
178
176
|
this.requestUpdate('startValue', oldValue);
|
|
179
177
|
}
|
|
180
178
|
|
|
179
|
+
static get focusElementSelector() {
|
|
180
|
+
return 'd2l-input-time';
|
|
181
|
+
}
|
|
182
|
+
|
|
181
183
|
/** @ignore */
|
|
182
184
|
get validationMessage() {
|
|
183
185
|
if (this.validity.badInput) {
|
|
@@ -215,8 +215,6 @@ class InputTime extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixin(
|
|
|
215
215
|
];
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
static focusElementSelector = '.d2l-input';
|
|
219
|
-
|
|
220
218
|
constructor() {
|
|
221
219
|
super();
|
|
222
220
|
this.disabled = false;
|
|
@@ -254,6 +252,10 @@ class InputTime extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixin(
|
|
|
254
252
|
this.requestUpdate('value', oldValue);
|
|
255
253
|
}
|
|
256
254
|
|
|
255
|
+
static get focusElementSelector() {
|
|
256
|
+
return '.d2l-input';
|
|
257
|
+
}
|
|
258
|
+
|
|
257
259
|
disconnectedCallback() {
|
|
258
260
|
super.disconnectedCallback();
|
|
259
261
|
if (this._hiddenContentResizeObserver) this._hiddenContentResizeObserver.disconnect();
|
package/components/link/link.js
CHANGED
|
@@ -97,8 +97,6 @@ class Link extends FocusMixin(LitElement) {
|
|
|
97
97
|
];
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
static focusElementSelector = '.d2l-link';
|
|
101
|
-
|
|
102
100
|
constructor() {
|
|
103
101
|
super();
|
|
104
102
|
this.download = false;
|
|
@@ -106,6 +104,10 @@ class Link extends FocusMixin(LitElement) {
|
|
|
106
104
|
this.small = false;
|
|
107
105
|
}
|
|
108
106
|
|
|
107
|
+
static get focusElementSelector() {
|
|
108
|
+
return '.d2l-link';
|
|
109
|
+
}
|
|
110
|
+
|
|
109
111
|
render() {
|
|
110
112
|
const linkClasses = {
|
|
111
113
|
'd2l-link': true,
|
|
@@ -679,8 +679,13 @@ export const ListItemDragDropMixin = superclass => class extends superclass {
|
|
|
679
679
|
const invalidDropTarget = dragState.dragTargets.find(dragTarget => {
|
|
680
680
|
return isComposedAncestor(dragTarget, this);
|
|
681
681
|
});
|
|
682
|
+
|
|
682
683
|
if (invalidDropTarget) return;
|
|
683
684
|
|
|
685
|
+
// assert that both the source and target are from the same list - may allow this in the future
|
|
686
|
+
const targetRoot = dragState.dragTargets[0] && dragState.dragTargets[0]._getRootList();
|
|
687
|
+
if (this._getRootList() !== targetRoot) return;
|
|
688
|
+
|
|
684
689
|
dragState.addDropTarget(this);
|
|
685
690
|
this._draggingOver = true;
|
|
686
691
|
e.dataTransfer.dropEffect = 'move';
|
|
@@ -28,7 +28,9 @@ class ActionDropdown extends FocusMixin(LocalizeCoreElement(SelectionActionMixin
|
|
|
28
28
|
return dropdownOpenerStyles;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
static focusElementSelector
|
|
31
|
+
static get focusElementSelector() {
|
|
32
|
+
return 'd2l-button-subtle';
|
|
33
|
+
}
|
|
32
34
|
|
|
33
35
|
render() {
|
|
34
36
|
return html`
|
|
@@ -40,7 +40,9 @@ class Action extends FocusMixin(LocalizeCoreElement(SelectionActionMixin(ButtonM
|
|
|
40
40
|
`;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
static focusElementSelector
|
|
43
|
+
static get focusElementSelector() {
|
|
44
|
+
return 'd2l-button-subtle';
|
|
45
|
+
}
|
|
44
46
|
|
|
45
47
|
connectedCallback() {
|
|
46
48
|
super.connectedCallback();
|
|
@@ -22,7 +22,9 @@ class SelectAllPages extends FocusMixin(LocalizeCoreElement(SelectionObserverMix
|
|
|
22
22
|
`;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
static focusElementSelector
|
|
25
|
+
static get focusElementSelector() {
|
|
26
|
+
return 'd2l-button-subtle';
|
|
27
|
+
}
|
|
26
28
|
|
|
27
29
|
render() {
|
|
28
30
|
if (!this._provider) return;
|
|
@@ -34,13 +34,15 @@ class SelectAll extends FocusMixin(LocalizeCoreElement(SelectionObserverMixin(Li
|
|
|
34
34
|
`;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
static focusElementSelector = 'd2l-input-checkbox';
|
|
38
|
-
|
|
39
37
|
constructor() {
|
|
40
38
|
super();
|
|
41
39
|
this.disabled = false;
|
|
42
40
|
}
|
|
43
41
|
|
|
42
|
+
static get focusElementSelector() {
|
|
43
|
+
return 'd2l-input-checkbox';
|
|
44
|
+
}
|
|
45
|
+
|
|
44
46
|
render() {
|
|
45
47
|
if (this._provider && this._provider.selectionSingle) return;
|
|
46
48
|
|
|
@@ -166,8 +166,6 @@ export const SwitchMixin = superclass => class extends FocusMixin(RtlMixin(Focus
|
|
|
166
166
|
`;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
static focusElementSelector = '.d2l-switch-container';
|
|
170
|
-
|
|
171
169
|
constructor() {
|
|
172
170
|
super();
|
|
173
171
|
this.disabled = false;
|
|
@@ -178,6 +176,10 @@ export const SwitchMixin = superclass => class extends FocusMixin(RtlMixin(Focus
|
|
|
178
176
|
this._textId = getUniqueId();
|
|
179
177
|
}
|
|
180
178
|
|
|
179
|
+
static get focusElementSelector() {
|
|
180
|
+
return '.d2l-switch-container';
|
|
181
|
+
}
|
|
182
|
+
|
|
181
183
|
firstUpdated(changedProperties) {
|
|
182
184
|
super.firstUpdated(changedProperties);
|
|
183
185
|
if (!this.text || this.text.length === 0) {
|
|
@@ -58,14 +58,16 @@ export class TableColSortButton extends FocusMixin(LitElement) {
|
|
|
58
58
|
`;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
static focusElementSelector = 'button';
|
|
62
|
-
|
|
63
61
|
constructor() {
|
|
64
62
|
super();
|
|
65
63
|
this.nosort = false;
|
|
66
64
|
this.desc = false;
|
|
67
65
|
}
|
|
68
66
|
|
|
67
|
+
static get focusElementSelector() {
|
|
68
|
+
return 'button';
|
|
69
|
+
}
|
|
70
|
+
|
|
69
71
|
render() {
|
|
70
72
|
const iconView = !this.nosort ?
|
|
71
73
|
html`<d2l-icon icon="${this.desc ? 'tier1:arrow-toggle-down' : 'tier1:arrow-toggle-up'}"></d2l-icon>` :
|
|
@@ -136,24 +136,7 @@ An example of what this could look like altogether:
|
|
|
136
136
|
<younger-viewer for="rogers"></younger-viewer>
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
```js
|
|
141
|
-
connectedCallback() {
|
|
142
|
-
super.connectedCallback();
|
|
143
|
-
if (this._subscriptionController) this._subscriptionController.hostConnected();
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
disconnectedCallback() {
|
|
147
|
-
super.disconnectedCallback();
|
|
148
|
-
if (this._subscriptionController) this._subscriptionController.hostDisconnected();
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
updated(changedProperties) {
|
|
152
|
-
super.updated(changedProperties);
|
|
153
|
-
if (this._subscriptionController) this._subscriptionController.hostUpdated(changedProperties);
|
|
154
|
-
}
|
|
155
|
-
```
|
|
156
|
-
|
|
139
|
+
As of the Lit 2 upgrade, the lifecycle methods `hostConnected`, `hostDisconnected`, and `hostUpdated` will be called automatically.
|
|
157
140
|
## Available Callbacks
|
|
158
141
|
|
|
159
142
|
### SubscriberRegistryController
|
|
@@ -4,6 +4,7 @@ export class SubscriberRegistryController {
|
|
|
4
4
|
|
|
5
5
|
constructor(host, callbacks, options) {
|
|
6
6
|
this._host = host;
|
|
7
|
+
host.addController(this);
|
|
7
8
|
this._callbacks = callbacks || {};
|
|
8
9
|
this._eventName = options && options.eventName;
|
|
9
10
|
this._subscribers = new Map();
|
|
@@ -60,6 +61,7 @@ export class EventSubscriberController {
|
|
|
60
61
|
|
|
61
62
|
constructor(host, callbacks, options) {
|
|
62
63
|
this._host = host;
|
|
64
|
+
host.addController(this);
|
|
63
65
|
this._callbacks = callbacks || {};
|
|
64
66
|
this._eventName = options && options.eventName;
|
|
65
67
|
this._controllerId = options && options.controllerId;
|
|
@@ -99,8 +101,10 @@ export class IdSubscriberController {
|
|
|
99
101
|
|
|
100
102
|
constructor(host, callbacks, options) {
|
|
101
103
|
this._host = host;
|
|
104
|
+
host.addController(this);
|
|
102
105
|
this._callbacks = callbacks || {};
|
|
103
106
|
this._idPropertyName = options && options.idPropertyName;
|
|
107
|
+
this._idPropertyValue = this._idPropertyName ? this._host[this._idPropertyName] : undefined;
|
|
104
108
|
this._controllerId = options && options.controllerId;
|
|
105
109
|
this._registries = new Map();
|
|
106
110
|
this._timeouts = new Set();
|
|
@@ -118,8 +122,11 @@ export class IdSubscriberController {
|
|
|
118
122
|
});
|
|
119
123
|
}
|
|
120
124
|
|
|
121
|
-
hostUpdated(
|
|
122
|
-
|
|
125
|
+
hostUpdated() {
|
|
126
|
+
const propertyValue = this._host[this._idPropertyName];
|
|
127
|
+
if (propertyValue === this._idPropertyValue) return;
|
|
128
|
+
|
|
129
|
+
this._idPropertyValue = propertyValue;
|
|
123
130
|
|
|
124
131
|
if (this._registryObserver) this._registryObserver.disconnect();
|
|
125
132
|
this._registries.forEach(registry => {
|
package/custom-elements.json
CHANGED
|
@@ -419,11 +419,6 @@
|
|
|
419
419
|
"type": "boolean",
|
|
420
420
|
"default": "false"
|
|
421
421
|
},
|
|
422
|
-
{
|
|
423
|
-
"name": "focusElementSelector",
|
|
424
|
-
"type": "string",
|
|
425
|
-
"default": "\"button\""
|
|
426
|
-
},
|
|
427
422
|
{
|
|
428
423
|
"name": "visibleOnAncestor",
|
|
429
424
|
"type": "boolean",
|
|
@@ -518,11 +513,6 @@
|
|
|
518
513
|
"description": "Disables the button",
|
|
519
514
|
"type": "boolean",
|
|
520
515
|
"default": "false"
|
|
521
|
-
},
|
|
522
|
-
{
|
|
523
|
-
"name": "focusElementSelector",
|
|
524
|
-
"type": "string",
|
|
525
|
-
"default": "\"button\""
|
|
526
516
|
}
|
|
527
517
|
],
|
|
528
518
|
"slots": [
|
|
@@ -586,11 +576,6 @@
|
|
|
586
576
|
"description": "Disables the button",
|
|
587
577
|
"type": "boolean",
|
|
588
578
|
"default": "false"
|
|
589
|
-
},
|
|
590
|
-
{
|
|
591
|
-
"name": "focusElementSelector",
|
|
592
|
-
"type": "string",
|
|
593
|
-
"default": "\"button\""
|
|
594
579
|
}
|
|
595
580
|
],
|
|
596
581
|
"slots": [
|
|
@@ -1005,11 +990,6 @@
|
|
|
1005
990
|
"description": "Subtle aesthetic on non-white backgrounds",
|
|
1006
991
|
"type": "boolean",
|
|
1007
992
|
"default": "false"
|
|
1008
|
-
},
|
|
1009
|
-
{
|
|
1010
|
-
"name": "focusElementSelector",
|
|
1011
|
-
"type": "string",
|
|
1012
|
-
"default": "\"a\""
|
|
1013
993
|
}
|
|
1014
994
|
],
|
|
1015
995
|
"slots": [
|
|
@@ -3168,11 +3148,6 @@
|
|
|
3168
3148
|
"description": "Indicates if the filter is open",
|
|
3169
3149
|
"type": "boolean",
|
|
3170
3150
|
"default": "false"
|
|
3171
|
-
},
|
|
3172
|
-
{
|
|
3173
|
-
"name": "focusElementSelector",
|
|
3174
|
-
"type": "string",
|
|
3175
|
-
"default": "\"d2l-dropdown-button-subtle\""
|
|
3176
3151
|
}
|
|
3177
3152
|
],
|
|
3178
3153
|
"events": [
|
|
@@ -3215,11 +3190,6 @@
|
|
|
3215
3190
|
"description": "Whether the component should trap user focus.",
|
|
3216
3191
|
"type": "boolean",
|
|
3217
3192
|
"default": "false"
|
|
3218
|
-
},
|
|
3219
|
-
{
|
|
3220
|
-
"name": "focusElementSelector",
|
|
3221
|
-
"type": "string",
|
|
3222
|
-
"default": "\".d2l-focus-trap-start\""
|
|
3223
3193
|
}
|
|
3224
3194
|
],
|
|
3225
3195
|
"events": [
|
|
@@ -3800,11 +3770,6 @@
|
|
|
3800
3770
|
"type": "string",
|
|
3801
3771
|
"default": "\"on\""
|
|
3802
3772
|
},
|
|
3803
|
-
{
|
|
3804
|
-
"name": "focusElementSelector",
|
|
3805
|
-
"type": "string",
|
|
3806
|
-
"default": "\"input.d2l-input-checkbox\""
|
|
3807
|
-
},
|
|
3808
3773
|
{
|
|
3809
3774
|
"name": "skeleton",
|
|
3810
3775
|
"attribute": "skeleton",
|
|
@@ -4029,11 +3994,6 @@
|
|
|
4029
3994
|
"type": "boolean",
|
|
4030
3995
|
"default": "false"
|
|
4031
3996
|
},
|
|
4032
|
-
{
|
|
4033
|
-
"name": "focusElementSelector",
|
|
4034
|
-
"type": "string",
|
|
4035
|
-
"default": "\"d2l-input-date\""
|
|
4036
|
-
},
|
|
4037
3997
|
{
|
|
4038
3998
|
"name": "skeleton",
|
|
4039
3999
|
"attribute": "skeleton",
|
|
@@ -4331,11 +4291,6 @@
|
|
|
4331
4291
|
"type": "boolean",
|
|
4332
4292
|
"default": "false"
|
|
4333
4293
|
},
|
|
4334
|
-
{
|
|
4335
|
-
"name": "focusElementSelector",
|
|
4336
|
-
"type": "string",
|
|
4337
|
-
"default": "\"d2l-input-date-time\""
|
|
4338
|
-
},
|
|
4339
4294
|
{
|
|
4340
4295
|
"name": "skeleton",
|
|
4341
4296
|
"attribute": "skeleton",
|
|
@@ -4506,11 +4461,6 @@
|
|
|
4506
4461
|
"type": "string",
|
|
4507
4462
|
"default": "\"startOfDay\""
|
|
4508
4463
|
},
|
|
4509
|
-
{
|
|
4510
|
-
"name": "focusElementSelector",
|
|
4511
|
-
"type": "string",
|
|
4512
|
-
"default": "\"d2l-input-date\""
|
|
4513
|
-
},
|
|
4514
4464
|
{
|
|
4515
4465
|
"name": "labelledBy",
|
|
4516
4466
|
"attribute": "labelled-by",
|
|
@@ -4677,11 +4627,6 @@
|
|
|
4677
4627
|
"type": "string",
|
|
4678
4628
|
"default": "\"\""
|
|
4679
4629
|
},
|
|
4680
|
-
{
|
|
4681
|
-
"name": "focusElementSelector",
|
|
4682
|
-
"type": "string",
|
|
4683
|
-
"default": "\"d2l-input-text\""
|
|
4684
|
-
},
|
|
4685
4630
|
{
|
|
4686
4631
|
"name": "labelledBy",
|
|
4687
4632
|
"attribute": "labelled-by",
|
|
@@ -5021,11 +4966,6 @@
|
|
|
5021
4966
|
"type": "boolean",
|
|
5022
4967
|
"default": "false"
|
|
5023
4968
|
},
|
|
5024
|
-
{
|
|
5025
|
-
"name": "focusElementSelector",
|
|
5026
|
-
"type": "string",
|
|
5027
|
-
"default": "\"d2l-input-text\""
|
|
5028
|
-
},
|
|
5029
4969
|
{
|
|
5030
4970
|
"name": "labelledBy",
|
|
5031
4971
|
"attribute": "labelled-by",
|
|
@@ -5224,11 +5164,6 @@
|
|
|
5224
5164
|
"type": "boolean",
|
|
5225
5165
|
"default": "false"
|
|
5226
5166
|
},
|
|
5227
|
-
{
|
|
5228
|
-
"name": "focusElementSelector",
|
|
5229
|
-
"type": "string",
|
|
5230
|
-
"default": "\"d2l-input-number\""
|
|
5231
|
-
},
|
|
5232
5167
|
{
|
|
5233
5168
|
"name": "labelledBy",
|
|
5234
5169
|
"attribute": "labelled-by",
|
|
@@ -5366,11 +5301,6 @@
|
|
|
5366
5301
|
"description": "Value of the input",
|
|
5367
5302
|
"type": "string",
|
|
5368
5303
|
"default": "\"\""
|
|
5369
|
-
},
|
|
5370
|
-
{
|
|
5371
|
-
"name": "focusElementSelector",
|
|
5372
|
-
"type": "string",
|
|
5373
|
-
"default": "\"d2l-input-text\""
|
|
5374
5304
|
}
|
|
5375
5305
|
],
|
|
5376
5306
|
"events": [
|
|
@@ -5710,11 +5640,6 @@
|
|
|
5710
5640
|
"type": "'text'|'email'|'number'|'password'|'search'|'tel'|'url'",
|
|
5711
5641
|
"default": "\"text\""
|
|
5712
5642
|
},
|
|
5713
|
-
{
|
|
5714
|
-
"name": "focusElementSelector",
|
|
5715
|
-
"type": "string",
|
|
5716
|
-
"default": "\".d2l-input\""
|
|
5717
|
-
},
|
|
5718
5643
|
{
|
|
5719
5644
|
"name": "labelledBy",
|
|
5720
5645
|
"attribute": "labelled-by",
|
|
@@ -5954,11 +5879,6 @@
|
|
|
5954
5879
|
"type": "string",
|
|
5955
5880
|
"default": "\"\""
|
|
5956
5881
|
},
|
|
5957
|
-
{
|
|
5958
|
-
"name": "focusElementSelector",
|
|
5959
|
-
"type": "string",
|
|
5960
|
-
"default": "\"textarea\""
|
|
5961
|
-
},
|
|
5962
5882
|
{
|
|
5963
5883
|
"name": "labelledBy",
|
|
5964
5884
|
"attribute": "labelled-by",
|
|
@@ -6208,11 +6128,6 @@
|
|
|
6208
6128
|
"type": "'five'|'ten'|'fifteen'|'twenty'|'thirty'|'sixty'",
|
|
6209
6129
|
"default": "\"thirty\""
|
|
6210
6130
|
},
|
|
6211
|
-
{
|
|
6212
|
-
"name": "focusElementSelector",
|
|
6213
|
-
"type": "string",
|
|
6214
|
-
"default": "\"d2l-input-time\""
|
|
6215
|
-
},
|
|
6216
6131
|
{
|
|
6217
6132
|
"name": "skeleton",
|
|
6218
6133
|
"attribute": "skeleton",
|
|
@@ -6373,11 +6288,6 @@
|
|
|
6373
6288
|
"type": "'five'|'ten'|'fifteen'|'twenty'|'thirty'|'sixty'",
|
|
6374
6289
|
"default": "\"thirty\""
|
|
6375
6290
|
},
|
|
6376
|
-
{
|
|
6377
|
-
"name": "focusElementSelector",
|
|
6378
|
-
"type": "string",
|
|
6379
|
-
"default": "\".d2l-input\""
|
|
6380
|
-
},
|
|
6381
6291
|
{
|
|
6382
6292
|
"name": "labelledBy",
|
|
6383
6293
|
"attribute": "labelled-by",
|
|
@@ -6494,11 +6404,6 @@
|
|
|
6494
6404
|
"description": "Whether to apply the \"small\" link style",
|
|
6495
6405
|
"type": "boolean",
|
|
6496
6406
|
"default": "false"
|
|
6497
|
-
},
|
|
6498
|
-
{
|
|
6499
|
-
"name": "focusElementSelector",
|
|
6500
|
-
"type": "string",
|
|
6501
|
-
"default": "\".d2l-link\""
|
|
6502
6407
|
}
|
|
6503
6408
|
],
|
|
6504
6409
|
"slots": [
|
|
@@ -8624,11 +8529,6 @@
|
|
|
8624
8529
|
"description": "REQUIRED: Text for the dropdown opener button",
|
|
8625
8530
|
"type": "string"
|
|
8626
8531
|
},
|
|
8627
|
-
{
|
|
8628
|
-
"name": "focusElementSelector",
|
|
8629
|
-
"type": "string",
|
|
8630
|
-
"default": "\"d2l-button-subtle\""
|
|
8631
|
-
},
|
|
8632
8532
|
{
|
|
8633
8533
|
"name": "requiresSelection",
|
|
8634
8534
|
"attribute": "requires-selection",
|
|
@@ -8862,11 +8762,6 @@
|
|
|
8862
8762
|
"description": "Disables the button",
|
|
8863
8763
|
"type": "boolean",
|
|
8864
8764
|
"default": "false"
|
|
8865
|
-
},
|
|
8866
|
-
{
|
|
8867
|
-
"name": "focusElementSelector",
|
|
8868
|
-
"type": "string",
|
|
8869
|
-
"default": "\"d2l-button-subtle\""
|
|
8870
8765
|
}
|
|
8871
8766
|
],
|
|
8872
8767
|
"events": [
|
|
@@ -8986,11 +8881,6 @@
|
|
|
8986
8881
|
}
|
|
8987
8882
|
],
|
|
8988
8883
|
"properties": [
|
|
8989
|
-
{
|
|
8990
|
-
"name": "focusElementSelector",
|
|
8991
|
-
"type": "string",
|
|
8992
|
-
"default": "\"d2l-button-subtle\""
|
|
8993
|
-
},
|
|
8994
8884
|
{
|
|
8995
8885
|
"name": "selectionFor",
|
|
8996
8886
|
"attribute": "selection-for",
|
|
@@ -9033,11 +8923,6 @@
|
|
|
9033
8923
|
"type": "boolean",
|
|
9034
8924
|
"default": "false"
|
|
9035
8925
|
},
|
|
9036
|
-
{
|
|
9037
|
-
"name": "focusElementSelector",
|
|
9038
|
-
"type": "string",
|
|
9039
|
-
"default": "\"d2l-input-checkbox\""
|
|
9040
|
-
},
|
|
9041
8926
|
{
|
|
9042
8927
|
"name": "selectionFor",
|
|
9043
8928
|
"attribute": "selection-for",
|
|
@@ -9417,11 +9302,11 @@
|
|
|
9417
9302
|
"properties": [
|
|
9418
9303
|
{
|
|
9419
9304
|
"name": "offIcon",
|
|
9420
|
-
"type": "TemplateResult"
|
|
9305
|
+
"type": "TemplateResult<1>"
|
|
9421
9306
|
},
|
|
9422
9307
|
{
|
|
9423
9308
|
"name": "onIcon",
|
|
9424
|
-
"type": "TemplateResult"
|
|
9309
|
+
"type": "TemplateResult<1>"
|
|
9425
9310
|
},
|
|
9426
9311
|
{
|
|
9427
9312
|
"name": "text",
|
|
@@ -9460,11 +9345,6 @@
|
|
|
9460
9345
|
"description": "Determines where text should be positioned relative to the switch.",
|
|
9461
9346
|
"type": "'start'|'end'|'hidden'",
|
|
9462
9347
|
"default": "\"end\""
|
|
9463
|
-
},
|
|
9464
|
-
{
|
|
9465
|
-
"name": "focusElementSelector",
|
|
9466
|
-
"type": "string",
|
|
9467
|
-
"default": "\".d2l-switch-container\""
|
|
9468
9348
|
}
|
|
9469
9349
|
],
|
|
9470
9350
|
"events": [
|
|
@@ -9511,11 +9391,11 @@
|
|
|
9511
9391
|
"properties": [
|
|
9512
9392
|
{
|
|
9513
9393
|
"name": "offIcon",
|
|
9514
|
-
"type": "TemplateResult"
|
|
9394
|
+
"type": "TemplateResult<1>"
|
|
9515
9395
|
},
|
|
9516
9396
|
{
|
|
9517
9397
|
"name": "onIcon",
|
|
9518
|
-
"type": "TemplateResult"
|
|
9398
|
+
"type": "TemplateResult<1>"
|
|
9519
9399
|
},
|
|
9520
9400
|
{
|
|
9521
9401
|
"name": "text",
|
|
@@ -9554,11 +9434,6 @@
|
|
|
9554
9434
|
"description": "Determines where text should be positioned relative to the switch.",
|
|
9555
9435
|
"type": "'start'|'end'|'hidden'",
|
|
9556
9436
|
"default": "\"end\""
|
|
9557
|
-
},
|
|
9558
|
-
{
|
|
9559
|
-
"name": "focusElementSelector",
|
|
9560
|
-
"type": "string",
|
|
9561
|
-
"default": "\".d2l-switch-container\""
|
|
9562
9437
|
}
|
|
9563
9438
|
],
|
|
9564
9439
|
"events": [
|
|
@@ -9652,11 +9527,6 @@
|
|
|
9652
9527
|
"description": "Whether sort direction is descending",
|
|
9653
9528
|
"type": "boolean",
|
|
9654
9529
|
"default": "false"
|
|
9655
|
-
},
|
|
9656
|
-
{
|
|
9657
|
-
"name": "focusElementSelector",
|
|
9658
|
-
"type": "string",
|
|
9659
|
-
"default": "\"button\""
|
|
9660
9530
|
}
|
|
9661
9531
|
],
|
|
9662
9532
|
"slots": [
|
package/mixins/focus-mixin.js
CHANGED
|
@@ -2,13 +2,15 @@ import { dedupeMixin } from '@open-wc/dedupe-mixin';
|
|
|
2
2
|
|
|
3
3
|
export const FocusMixin = dedupeMixin(superclass => class extends superclass {
|
|
4
4
|
|
|
5
|
-
static focusElementSelector = null;
|
|
6
|
-
|
|
7
5
|
constructor() {
|
|
8
6
|
super();
|
|
9
7
|
this._focusOnFirstRender = false;
|
|
10
8
|
}
|
|
11
9
|
|
|
10
|
+
static get focusElementSelector() {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
|
|
12
14
|
firstUpdated(changedProperties) {
|
|
13
15
|
super.firstUpdated(changedProperties);
|
|
14
16
|
if (this._focusOnFirstRender) {
|
package/mixins/focus-mixin.md
CHANGED
|
@@ -14,7 +14,8 @@ import { FocusMixin } from '@brightspace-ui/core/mixins/focus-mixin.js';
|
|
|
14
14
|
class MyComponent extends FocusMixin(LitElement) {
|
|
15
15
|
|
|
16
16
|
// delegate focus to the underlying input
|
|
17
|
-
static focusElementSelector
|
|
17
|
+
static get focusElementSelector() {
|
|
18
|
+
return 'input';
|
|
18
19
|
|
|
19
20
|
render() {
|
|
20
21
|
return html`<input type="text">`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.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",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@babel/eslint-parser": "^7",
|
|
47
47
|
"@brightspace-ui/stylelint-config": "^0.4",
|
|
48
|
-
"@open-wc/testing": "^
|
|
48
|
+
"@open-wc/testing": "^3",
|
|
49
49
|
"@web/dev-server": "^0.1",
|
|
50
50
|
"@web/test-runner": "^0.13",
|
|
51
51
|
"@web/test-runner-playwright": "^0.8",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"focus-visible": "^5",
|
|
71
71
|
"ifrau": "^0.39",
|
|
72
72
|
"intl-messageformat": "^7",
|
|
73
|
-
"lit-element": "^
|
|
74
|
-
"lit-html": "^
|
|
73
|
+
"lit-element": "^3",
|
|
74
|
+
"lit-html": "^2",
|
|
75
75
|
"prismjs": "^1",
|
|
76
76
|
"resize-observer-polyfill": "^1"
|
|
77
77
|
}
|