@brightspace-ui/core 3.124.2 → 3.125.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.
@@ -66,6 +66,16 @@ A list displays a collection of objects of the same type. A list is primarily us
|
|
66
66
|
|
67
67
|
## Accessibility
|
68
68
|
|
69
|
+
The list components are fairly complex and aim to be usable by all our users. Interesting details of note includes:
|
70
|
+
|
71
|
+
* When the `grid` attribute is used on the `d2l-list` component, it enables the list to follow the [Grid Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/grid/). More details on this are [below](#aria-layout-grid).
|
72
|
+
|
73
|
+
* When using the `d2l-list-item-nav-button` component and/or mixin, usage of the `current` attribute adds the `aria-current` attribute to "page" for the `current` item and "location" for any parent and ancestors of the item. The components work together to keep these attributes up-to-date on subsequent selection.
|
74
|
+
|
75
|
+
* Usage of the new `current` attribute over the existing `selected` attribute corresponds to `aria-current` and also leaves open the possibility of using both `current` and selection behavior together.
|
76
|
+
|
77
|
+
### ARIA Layout Grid
|
78
|
+
|
69
79
|
If your list items are selectable or have secondary action buttons, use the ARIA layout grid on `d2l-list` to make it easy to navigate between items. This makes the entire list a single tab stop, and then the user can use the arrow keys to navigate between various list rows and actions in the list item.
|
70
80
|
|
71
81
|
**Benefits of the ARIA layout grid:**
|
@@ -599,6 +609,84 @@ The `d2l-list-item-button` provides the same functionality as `d2l-list-item` ex
|
|
599
609
|
- `d2l-list-item-expand-collapse-toggled`: dispatched when the item's expand/collapse toggle is clicked
|
600
610
|
<!-- docs: end hidden content -->
|
601
611
|
|
612
|
+
## Navigational Button List Item [d2l-list-item-nav-button]
|
613
|
+
|
614
|
+
Use a `d2l-list-item-nav-button` if your list serves as a table of contents or is part of a master/details workflow. It provides the same functionality as `d2l-list-item-button` while adding navigation semantics and behaviours. Use the `current` attribute to indicate the currently selected item — see more about this in [Accessibility](#accessibility).
|
615
|
+
|
616
|
+
The example below also includes expand/collapse behavior in order to expand or collapse the items on subsequent clicks.
|
617
|
+
|
618
|
+
<!-- docs: demo code properties name:d2l-list-item-nav-button sandboxTitle:'List Item Nav Button' display:block -->
|
619
|
+
```html
|
620
|
+
<script type="module">
|
621
|
+
import '@brightspace-ui/core/components/list/list.js';
|
622
|
+
import '@brightspace-ui/core/components/list/list-item-nav-button.js';
|
623
|
+
import '@brightspace-ui/core/components/list/list-item-content.js';
|
624
|
+
</script>
|
625
|
+
<script>
|
626
|
+
let currentItem = document.querySelector('d2l-list-item-nav-button[current]');
|
627
|
+
document.addEventListener('d2l-list-item-button-click', (e) => {
|
628
|
+
console.log('d2l-list-item-nav-button: click event');
|
629
|
+
|
630
|
+
if (!e.target.expandable) {
|
631
|
+
currentItem = e.target;
|
632
|
+
return;
|
633
|
+
}
|
634
|
+
|
635
|
+
if (currentItem !== e.target) {
|
636
|
+
e.target.expanded = true;
|
637
|
+
currentItem = e.target;
|
638
|
+
} else {
|
639
|
+
e.target.expanded = !e.target.expanded;
|
640
|
+
}
|
641
|
+
});
|
642
|
+
</script>
|
643
|
+
|
644
|
+
<d2l-list>
|
645
|
+
<d2l-list-item-nav-button key="L1-1" label="Geomorphology and GIS" color="#006fbf" expandable expanded>
|
646
|
+
<d2l-list-item-content>
|
647
|
+
<div>Geomorphology and GIS </div>
|
648
|
+
<div slot="supporting-info">This course explores the geological processes of the Earth's interior and surface. These include volcanism, earthquakes, mountain...</div>
|
649
|
+
</d2l-list-item-content>
|
650
|
+
<d2l-list slot="nested" grid>
|
651
|
+
<d2l-list-item-nav-button key="L2-1" label="Syallabus Confirmation">
|
652
|
+
<d2l-list-item-content>
|
653
|
+
<div><d2l-icon style="margin-right: 0.7rem;" icon="tier2:file-document"></d2l-icon>Syallabus Confirmation</div>
|
654
|
+
<div slot="secondary"><d2l-tooltip-help text="Due: May 2, 2023 at 2 pm">Due: May 2, 2023</d2l-tooltip-help></div>
|
655
|
+
</d2l-list-item-content>
|
656
|
+
</d2l-list-item-nav-button>
|
657
|
+
</d2l-list>
|
658
|
+
</d2l-list-item-nav-button>
|
659
|
+
</d2l-list>
|
660
|
+
```
|
661
|
+
|
662
|
+
<!-- docs: start hidden content -->
|
663
|
+
### Properties
|
664
|
+
|
665
|
+
| Property | Type | Description |
|
666
|
+
|---|---|---|
|
667
|
+
| `button-disabled` | Boolean | Disables the primary action button |
|
668
|
+
| `current` | Boolean | Whether the list item is the current page in a navigation context. At most one list item should have the `current` attribute at any time; this will be managed by the `list` after initial render. |
|
669
|
+
| `draggable` | Boolean | Whether the item is draggable |
|
670
|
+
| `drag-handle-text` | String | The drag-handle label for assistive technology. If implementing drag & drop, you should change this to dynamically announce what the drag-handle is moving for assistive technology in keyboard mode. |
|
671
|
+
| `drop-nested` | Boolean | Whether nested items can be dropped on this item |
|
672
|
+
| `drop-text` | String | Text to drag and drop |
|
673
|
+
| `expandable` | Boolean | Whether or not to show the expand/collapse toggle. |
|
674
|
+
| `expanded` | Boolean | Whether the item is expanded. Requires `expandable` to be set. |
|
675
|
+
| `key` | String | Value to identify item if selectable or draggable |
|
676
|
+
| `label` | String | Explicitly defined label for the element |
|
677
|
+
| `labelled-by` | String | The id of element that provides the label for this element |
|
678
|
+
| `padding-type` | String | List item whitespace (`normal` (default), `none`)|
|
679
|
+
| `selectable` | Boolean | Indicates an input should be rendered for selecting the item |
|
680
|
+
| `selected` | Boolean | Whether the item is selected |
|
681
|
+
| `selection-disabled` | Boolean | Disables selection |
|
682
|
+
| `skeleton` | Boolean | Renders the input as a skeleton loader |
|
683
|
+
|
684
|
+
### Events
|
685
|
+
|
686
|
+
- `d2l-list-item-button-click`: dispatched when the item's primary button action is clicked
|
687
|
+
- `d2l-list-item-expand-collapse-toggled`: dispatched when the item's expand/collapse toggle is clicked
|
688
|
+
<!-- docs: end hidden content -->
|
689
|
+
|
602
690
|
## ListItemMixin
|
603
691
|
|
604
692
|
Want to maintain consistency with `d2l-list-item` but need more modularity? This mixin is for you! This mixin allows you to make a component into a list item without requiring custom styling. All of the properties and functionality from `d2l-list-item` (listed above) will be added to your new component.
|
@@ -607,7 +695,7 @@ Want to maintain consistency with `d2l-list-item` but need more modularity? This
|
|
607
695
|
|
608
696
|
Import
|
609
697
|
```javascript
|
610
|
-
import { ListItemMixin } from '
|
698
|
+
import { ListItemMixin } from '@brightspace-ui/core/components/list/list-item-mixin.js';
|
611
699
|
|
612
700
|
class ListItem extends ListItemMixin(LitElement) {
|
613
701
|
...
|
@@ -636,6 +724,22 @@ Where the parameters correspond to the slots of `d2l-list-item`:
|
|
636
724
|
- actions (TemplateResult): Secondary actions for the list item.
|
637
725
|
- nested (TemplateResult): Optional `d2l-list` for a nested list.
|
638
726
|
|
727
|
+
## ListItemNavButtonMixin
|
728
|
+
|
729
|
+
This mixin allows you to make a component into a navigational list item without requiring custom styling. All of the properties and functionality from `d2l-list-item-nav-button` (listed above) will be added to your new component.
|
730
|
+
|
731
|
+
### How to use
|
732
|
+
|
733
|
+
Import
|
734
|
+
```javascript
|
735
|
+
import { ListItemNavButtonMixin } from '@brightspace-ui/core/components/list/list-item-nav-button-mixin.js';
|
736
|
+
|
737
|
+
class ListItem extends ListItemNavButtonMixin(LitElement) {
|
738
|
+
...
|
739
|
+
```
|
740
|
+
|
741
|
+
The remainder works the same as above in [ListItemMixin](#listitemmixin)
|
742
|
+
|
639
743
|
## List Item Content
|
640
744
|
|
641
745
|
The `d2l-list-item-content` provides additional consistent layout for primary and secondary text in item content. It may be used with or without the `illustration` and `action` slots mentioned above.
|
@@ -7,7 +7,7 @@ export const ListItemNavButtonMixin = superclass => class extends ListItemButton
|
|
7
7
|
static get properties() {
|
8
8
|
return {
|
9
9
|
/**
|
10
|
-
* Whether the list item is the current page in a navigation context
|
10
|
+
* Whether the list item is the current page in a navigation context. At most one list item should have the `current` attribute at any time; this will be managed by the `list` after initial render.
|
11
11
|
* @type {boolean}
|
12
12
|
*/
|
13
13
|
current: { type: Boolean, reflect: true },
|
package/custom-elements.json
CHANGED
@@ -9418,7 +9418,7 @@
|
|
9418
9418
|
"attributes": [
|
9419
9419
|
{
|
9420
9420
|
"name": "current",
|
9421
|
-
"description": "Whether the list item is the current page in a navigation context",
|
9421
|
+
"description": "Whether the list item is the current page in a navigation context. At most one list item should have the `current` attribute at any time; this will be managed by the `list` after initial render.",
|
9422
9422
|
"type": "boolean",
|
9423
9423
|
"default": "false"
|
9424
9424
|
},
|
@@ -9525,7 +9525,7 @@
|
|
9525
9525
|
{
|
9526
9526
|
"name": "current",
|
9527
9527
|
"attribute": "current",
|
9528
|
-
"description": "Whether the list item is the current page in a navigation context",
|
9528
|
+
"description": "Whether the list item is the current page in a navigation context. At most one list item should have the `current` attribute at any time; this will be managed by the `list` after initial render.",
|
9529
9529
|
"type": "boolean",
|
9530
9530
|
"default": "false"
|
9531
9531
|
},
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.125.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",
|