@brightspace-ui/core 1.235.2 → 1.236.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.
- package/README.md +1 -0
- package/components/button/button-mixin.js +4 -6
- package/components/card/card.js +4 -7
- package/components/filter/filter.js +4 -6
- package/components/focus-trap/focus-trap.js +4 -6
- package/components/inputs/input-checkbox.js +4 -6
- package/components/inputs/input-date-range.js +4 -6
- package/components/inputs/input-date-time-range.js +4 -6
- package/components/inputs/input-date-time.js +4 -6
- package/components/inputs/input-date.js +4 -5
- package/components/inputs/input-number.js +4 -11
- package/components/inputs/input-percent.js +4 -6
- package/components/inputs/input-search.js +4 -6
- package/components/inputs/input-text.js +4 -11
- package/components/inputs/input-textarea.js +4 -11
- package/components/inputs/input-time-range.js +4 -6
- package/components/inputs/input-time.js +4 -6
- package/components/link/link.js +4 -5
- package/components/list/list-item-mixin.js +11 -0
- package/components/overflow-group/demo/overflow-group.html +9 -11
- package/components/overflow-group/overflow-group.js +28 -28
- package/components/selection/selection-action-dropdown.js +4 -6
- package/components/selection/selection-action.js +4 -6
- package/components/selection/selection-select-all-pages.js +4 -6
- package/components/selection/selection-select-all.js +4 -6
- package/components/switch/switch-mixin.js +4 -6
- package/components/table/table-col-sort-button.js +4 -6
- package/custom-elements.json +130 -0
- package/mixins/focus-mixin.js +41 -0
- package/mixins/focus-mixin.md +24 -0
- package/package.json +1 -1
package/custom-elements.json
CHANGED
|
@@ -408,6 +408,11 @@
|
|
|
408
408
|
"type": "boolean",
|
|
409
409
|
"default": "false"
|
|
410
410
|
},
|
|
411
|
+
{
|
|
412
|
+
"name": "focusElementSelector",
|
|
413
|
+
"type": "string",
|
|
414
|
+
"default": "\"button\""
|
|
415
|
+
},
|
|
411
416
|
{
|
|
412
417
|
"name": "visibleOnAncestor",
|
|
413
418
|
"type": "boolean",
|
|
@@ -502,6 +507,11 @@
|
|
|
502
507
|
"description": "Disables the button",
|
|
503
508
|
"type": "boolean",
|
|
504
509
|
"default": "false"
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
"name": "focusElementSelector",
|
|
513
|
+
"type": "string",
|
|
514
|
+
"default": "\"button\""
|
|
505
515
|
}
|
|
506
516
|
],
|
|
507
517
|
"slots": [
|
|
@@ -565,6 +575,11 @@
|
|
|
565
575
|
"description": "Disables the button",
|
|
566
576
|
"type": "boolean",
|
|
567
577
|
"default": "false"
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
"name": "focusElementSelector",
|
|
581
|
+
"type": "string",
|
|
582
|
+
"default": "\"button\""
|
|
568
583
|
}
|
|
569
584
|
],
|
|
570
585
|
"slots": [
|
|
@@ -979,6 +994,11 @@
|
|
|
979
994
|
"description": "Subtle aesthetic on non-white backgrounds",
|
|
980
995
|
"type": "boolean",
|
|
981
996
|
"default": "false"
|
|
997
|
+
},
|
|
998
|
+
{
|
|
999
|
+
"name": "focusElementSelector",
|
|
1000
|
+
"type": "string",
|
|
1001
|
+
"default": "\"a\""
|
|
982
1002
|
}
|
|
983
1003
|
],
|
|
984
1004
|
"slots": [
|
|
@@ -3137,6 +3157,11 @@
|
|
|
3137
3157
|
"description": "Indicates if the filter is open",
|
|
3138
3158
|
"type": "boolean",
|
|
3139
3159
|
"default": "false"
|
|
3160
|
+
},
|
|
3161
|
+
{
|
|
3162
|
+
"name": "focusElementSelector",
|
|
3163
|
+
"type": "string",
|
|
3164
|
+
"default": "\"d2l-dropdown-button-subtle\""
|
|
3140
3165
|
}
|
|
3141
3166
|
],
|
|
3142
3167
|
"events": [
|
|
@@ -3179,6 +3204,11 @@
|
|
|
3179
3204
|
"description": "Whether the component should trap user focus.",
|
|
3180
3205
|
"type": "boolean",
|
|
3181
3206
|
"default": "false"
|
|
3207
|
+
},
|
|
3208
|
+
{
|
|
3209
|
+
"name": "focusElementSelector",
|
|
3210
|
+
"type": "string",
|
|
3211
|
+
"default": "\".d2l-focus-trap-start\""
|
|
3182
3212
|
}
|
|
3183
3213
|
],
|
|
3184
3214
|
"events": [
|
|
@@ -3759,6 +3789,11 @@
|
|
|
3759
3789
|
"type": "string",
|
|
3760
3790
|
"default": "\"on\""
|
|
3761
3791
|
},
|
|
3792
|
+
{
|
|
3793
|
+
"name": "focusElementSelector",
|
|
3794
|
+
"type": "string",
|
|
3795
|
+
"default": "\"input.d2l-input-checkbox\""
|
|
3796
|
+
},
|
|
3762
3797
|
{
|
|
3763
3798
|
"name": "skeleton",
|
|
3764
3799
|
"attribute": "skeleton",
|
|
@@ -3983,6 +4018,11 @@
|
|
|
3983
4018
|
"type": "boolean",
|
|
3984
4019
|
"default": "false"
|
|
3985
4020
|
},
|
|
4021
|
+
{
|
|
4022
|
+
"name": "focusElementSelector",
|
|
4023
|
+
"type": "string",
|
|
4024
|
+
"default": "\"d2l-input-date\""
|
|
4025
|
+
},
|
|
3986
4026
|
{
|
|
3987
4027
|
"name": "skeleton",
|
|
3988
4028
|
"attribute": "skeleton",
|
|
@@ -4280,6 +4320,11 @@
|
|
|
4280
4320
|
"type": "boolean",
|
|
4281
4321
|
"default": "false"
|
|
4282
4322
|
},
|
|
4323
|
+
{
|
|
4324
|
+
"name": "focusElementSelector",
|
|
4325
|
+
"type": "string",
|
|
4326
|
+
"default": "\"d2l-input-date-time\""
|
|
4327
|
+
},
|
|
4283
4328
|
{
|
|
4284
4329
|
"name": "skeleton",
|
|
4285
4330
|
"attribute": "skeleton",
|
|
@@ -4450,6 +4495,11 @@
|
|
|
4450
4495
|
"type": "string",
|
|
4451
4496
|
"default": "\"startOfDay\""
|
|
4452
4497
|
},
|
|
4498
|
+
{
|
|
4499
|
+
"name": "focusElementSelector",
|
|
4500
|
+
"type": "string",
|
|
4501
|
+
"default": "\"d2l-input-date\""
|
|
4502
|
+
},
|
|
4453
4503
|
{
|
|
4454
4504
|
"name": "labelledBy",
|
|
4455
4505
|
"attribute": "labelled-by",
|
|
@@ -4616,6 +4666,11 @@
|
|
|
4616
4666
|
"type": "string",
|
|
4617
4667
|
"default": "\"\""
|
|
4618
4668
|
},
|
|
4669
|
+
{
|
|
4670
|
+
"name": "focusElementSelector",
|
|
4671
|
+
"type": "string",
|
|
4672
|
+
"default": "\"d2l-input-text\""
|
|
4673
|
+
},
|
|
4619
4674
|
{
|
|
4620
4675
|
"name": "labelledBy",
|
|
4621
4676
|
"attribute": "labelled-by",
|
|
@@ -4955,6 +5010,11 @@
|
|
|
4955
5010
|
"type": "boolean",
|
|
4956
5011
|
"default": "false"
|
|
4957
5012
|
},
|
|
5013
|
+
{
|
|
5014
|
+
"name": "focusElementSelector",
|
|
5015
|
+
"type": "string",
|
|
5016
|
+
"default": "\"d2l-input-text\""
|
|
5017
|
+
},
|
|
4958
5018
|
{
|
|
4959
5019
|
"name": "labelledBy",
|
|
4960
5020
|
"attribute": "labelled-by",
|
|
@@ -5153,6 +5213,11 @@
|
|
|
5153
5213
|
"type": "boolean",
|
|
5154
5214
|
"default": "false"
|
|
5155
5215
|
},
|
|
5216
|
+
{
|
|
5217
|
+
"name": "focusElementSelector",
|
|
5218
|
+
"type": "string",
|
|
5219
|
+
"default": "\"d2l-input-number\""
|
|
5220
|
+
},
|
|
5156
5221
|
{
|
|
5157
5222
|
"name": "labelledBy",
|
|
5158
5223
|
"attribute": "labelled-by",
|
|
@@ -5290,6 +5355,11 @@
|
|
|
5290
5355
|
"description": "Value of the input",
|
|
5291
5356
|
"type": "string",
|
|
5292
5357
|
"default": "\"\""
|
|
5358
|
+
},
|
|
5359
|
+
{
|
|
5360
|
+
"name": "focusElementSelector",
|
|
5361
|
+
"type": "string",
|
|
5362
|
+
"default": "\"d2l-input-text\""
|
|
5293
5363
|
}
|
|
5294
5364
|
],
|
|
5295
5365
|
"events": [
|
|
@@ -5629,6 +5699,11 @@
|
|
|
5629
5699
|
"type": "'text'|'email'|'number'|'password'|'search'|'tel'|'url'",
|
|
5630
5700
|
"default": "\"text\""
|
|
5631
5701
|
},
|
|
5702
|
+
{
|
|
5703
|
+
"name": "focusElementSelector",
|
|
5704
|
+
"type": "string",
|
|
5705
|
+
"default": "\".d2l-input\""
|
|
5706
|
+
},
|
|
5632
5707
|
{
|
|
5633
5708
|
"name": "labelledBy",
|
|
5634
5709
|
"attribute": "labelled-by",
|
|
@@ -5868,6 +5943,11 @@
|
|
|
5868
5943
|
"type": "string",
|
|
5869
5944
|
"default": "\"\""
|
|
5870
5945
|
},
|
|
5946
|
+
{
|
|
5947
|
+
"name": "focusElementSelector",
|
|
5948
|
+
"type": "string",
|
|
5949
|
+
"default": "\"textarea\""
|
|
5950
|
+
},
|
|
5871
5951
|
{
|
|
5872
5952
|
"name": "labelledBy",
|
|
5873
5953
|
"attribute": "labelled-by",
|
|
@@ -6117,6 +6197,11 @@
|
|
|
6117
6197
|
"type": "'five'|'ten'|'fifteen'|'twenty'|'thirty'|'sixty'",
|
|
6118
6198
|
"default": "\"thirty\""
|
|
6119
6199
|
},
|
|
6200
|
+
{
|
|
6201
|
+
"name": "focusElementSelector",
|
|
6202
|
+
"type": "string",
|
|
6203
|
+
"default": "\"d2l-input-time\""
|
|
6204
|
+
},
|
|
6120
6205
|
{
|
|
6121
6206
|
"name": "skeleton",
|
|
6122
6207
|
"attribute": "skeleton",
|
|
@@ -6277,6 +6362,11 @@
|
|
|
6277
6362
|
"type": "'five'|'ten'|'fifteen'|'twenty'|'thirty'|'sixty'",
|
|
6278
6363
|
"default": "\"thirty\""
|
|
6279
6364
|
},
|
|
6365
|
+
{
|
|
6366
|
+
"name": "focusElementSelector",
|
|
6367
|
+
"type": "string",
|
|
6368
|
+
"default": "\".d2l-input\""
|
|
6369
|
+
},
|
|
6280
6370
|
{
|
|
6281
6371
|
"name": "labelledBy",
|
|
6282
6372
|
"attribute": "labelled-by",
|
|
@@ -6393,6 +6483,11 @@
|
|
|
6393
6483
|
"description": "Whether to apply the \"small\" link style",
|
|
6394
6484
|
"type": "boolean",
|
|
6395
6485
|
"default": "false"
|
|
6486
|
+
},
|
|
6487
|
+
{
|
|
6488
|
+
"name": "focusElementSelector",
|
|
6489
|
+
"type": "string",
|
|
6490
|
+
"default": "\".d2l-link\""
|
|
6396
6491
|
}
|
|
6397
6492
|
],
|
|
6398
6493
|
"slots": [
|
|
@@ -8518,6 +8613,11 @@
|
|
|
8518
8613
|
"description": "REQUIRED: Text for the dropdown opener button",
|
|
8519
8614
|
"type": "string"
|
|
8520
8615
|
},
|
|
8616
|
+
{
|
|
8617
|
+
"name": "focusElementSelector",
|
|
8618
|
+
"type": "string",
|
|
8619
|
+
"default": "\"d2l-button-subtle\""
|
|
8620
|
+
},
|
|
8521
8621
|
{
|
|
8522
8622
|
"name": "requiresSelection",
|
|
8523
8623
|
"attribute": "requires-selection",
|
|
@@ -8751,6 +8851,11 @@
|
|
|
8751
8851
|
"description": "Disables the button",
|
|
8752
8852
|
"type": "boolean",
|
|
8753
8853
|
"default": "false"
|
|
8854
|
+
},
|
|
8855
|
+
{
|
|
8856
|
+
"name": "focusElementSelector",
|
|
8857
|
+
"type": "string",
|
|
8858
|
+
"default": "\"d2l-button-subtle\""
|
|
8754
8859
|
}
|
|
8755
8860
|
],
|
|
8756
8861
|
"events": [
|
|
@@ -8870,6 +8975,11 @@
|
|
|
8870
8975
|
}
|
|
8871
8976
|
],
|
|
8872
8977
|
"properties": [
|
|
8978
|
+
{
|
|
8979
|
+
"name": "focusElementSelector",
|
|
8980
|
+
"type": "string",
|
|
8981
|
+
"default": "\"d2l-button-subtle\""
|
|
8982
|
+
},
|
|
8873
8983
|
{
|
|
8874
8984
|
"name": "selectionFor",
|
|
8875
8985
|
"attribute": "selection-for",
|
|
@@ -8912,6 +9022,11 @@
|
|
|
8912
9022
|
"type": "boolean",
|
|
8913
9023
|
"default": "false"
|
|
8914
9024
|
},
|
|
9025
|
+
{
|
|
9026
|
+
"name": "focusElementSelector",
|
|
9027
|
+
"type": "string",
|
|
9028
|
+
"default": "\"d2l-input-checkbox\""
|
|
9029
|
+
},
|
|
8915
9030
|
{
|
|
8916
9031
|
"name": "selectionFor",
|
|
8917
9032
|
"attribute": "selection-for",
|
|
@@ -9334,6 +9449,11 @@
|
|
|
9334
9449
|
"description": "Determines where text should be positioned relative to the switch.",
|
|
9335
9450
|
"type": "'start'|'end'|'hidden'",
|
|
9336
9451
|
"default": "\"end\""
|
|
9452
|
+
},
|
|
9453
|
+
{
|
|
9454
|
+
"name": "focusElementSelector",
|
|
9455
|
+
"type": "string",
|
|
9456
|
+
"default": "\".d2l-switch-container\""
|
|
9337
9457
|
}
|
|
9338
9458
|
],
|
|
9339
9459
|
"events": [
|
|
@@ -9423,6 +9543,11 @@
|
|
|
9423
9543
|
"description": "Determines where text should be positioned relative to the switch.",
|
|
9424
9544
|
"type": "'start'|'end'|'hidden'",
|
|
9425
9545
|
"default": "\"end\""
|
|
9546
|
+
},
|
|
9547
|
+
{
|
|
9548
|
+
"name": "focusElementSelector",
|
|
9549
|
+
"type": "string",
|
|
9550
|
+
"default": "\".d2l-switch-container\""
|
|
9426
9551
|
}
|
|
9427
9552
|
],
|
|
9428
9553
|
"events": [
|
|
@@ -9516,6 +9641,11 @@
|
|
|
9516
9641
|
"description": "Whether sort direction is descending",
|
|
9517
9642
|
"type": "boolean",
|
|
9518
9643
|
"default": "false"
|
|
9644
|
+
},
|
|
9645
|
+
{
|
|
9646
|
+
"name": "focusElementSelector",
|
|
9647
|
+
"type": "string",
|
|
9648
|
+
"default": "\"button\""
|
|
9519
9649
|
}
|
|
9520
9650
|
],
|
|
9521
9651
|
"slots": [
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { dedupeMixin } from '@open-wc/dedupe-mixin';
|
|
2
|
+
|
|
3
|
+
export const FocusMixin = dedupeMixin(superclass => class extends superclass {
|
|
4
|
+
|
|
5
|
+
static focusElementSelector = null;
|
|
6
|
+
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this._focusOnFirstRender = false;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
firstUpdated(changedProperties) {
|
|
13
|
+
super.firstUpdated(changedProperties);
|
|
14
|
+
if (this._focusOnFirstRender) {
|
|
15
|
+
this._focusOnFirstRender = false;
|
|
16
|
+
this.focus();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
focus() {
|
|
21
|
+
|
|
22
|
+
const selector = this.constructor.focusElementSelector;
|
|
23
|
+
if (!selector) {
|
|
24
|
+
throw new Error(`FocusMixin: no static focusElementSelector provided for "${this.tagName}"`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!this.hasUpdated) {
|
|
28
|
+
this._focusOnFirstRender = true;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const elem = this.shadowRoot.querySelector(selector);
|
|
33
|
+
if (!elem) {
|
|
34
|
+
throw new Error(`FocusMixin: selector "${selector}" yielded no element for "${this.tagName}"`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
elem.focus();
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# FocusMixin
|
|
2
|
+
|
|
3
|
+
The `FocusMixin` can be used to delegate focus to an element within a component's shadow root when its `focus()` method is called.
|
|
4
|
+
|
|
5
|
+
If the component has yet to render, focus will automatically be applied after `firstUpdated`.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Apply the mixin and set the static `focusElementSelector` to a CSS query selector which will match the element to which focus should be delegated.
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { FocusMixin } from '@brightspace-ui/core/mixins/focus-mixin.js';
|
|
13
|
+
|
|
14
|
+
class MyComponent extends FocusMixin(LitElement) {
|
|
15
|
+
|
|
16
|
+
// delegate focus to the underlying input
|
|
17
|
+
static focusElementSelector = 'input';
|
|
18
|
+
|
|
19
|
+
render() {
|
|
20
|
+
return html`<input type="text">`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.236.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",
|