@brightspace-ui/core 2.120.0 → 2.121.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.
@@ -189,6 +189,7 @@ The `d2l-filter-dimension-set` component is the main dimension type that will wo
189
189
 
190
190
  | Property | Type | Description |
191
191
  |---|---|---|
192
+ | `header-text` | String | A heading displayed above the list items. This is usually unnecessary, but can be used to emphasize or promote something specific about the list of items to help orient users. |
192
193
  | `introductory-text` | String | The introductory text to display at the top of the filter dropdown |
193
194
  | `key` | String, required | Unique identifier for the dimension |
194
195
  | `loading` | Boolean | Whether the values for this dimension are still loading and a loading spinner should be displayed |
@@ -57,11 +57,30 @@
57
57
  </template>
58
58
  </d2l-demo-snippet>
59
59
 
60
+ <h2>Single Set Dimension - Header Text</h2>
61
+ <d2l-demo-snippet>
62
+ <template>
63
+ <d2l-filter id="filter-single">
64
+ <d2l-filter-dimension-set key="course" introductory-text="Filter content by courses. Start typing any course name to explore." header-text="Skills Promoted at Your Company" text="Course" select-all>
65
+ <d2l-filter-dimension-set-value key="art" text="Art" count="12"></d2l-filter-dimension-set-value>
66
+ <d2l-filter-dimension-set-value key="astronomy" text="Astronomy" count="2" selected></d2l-filter-dimension-set-value>
67
+ <d2l-filter-dimension-set-value key="biology" text="Biology" count="15"></d2l-filter-dimension-set-value>
68
+ <d2l-filter-dimension-set-value key="chemistry" text="Chemistry" count="1"disabled></d2l-filter-dimension-set-value>
69
+ <d2l-filter-dimension-set-value key="drama" text="Drama" count="23" disabled></d2l-filter-dimension-set-value>
70
+ <d2l-filter-dimension-set-value key="english" text="English" count="100"></d2l-filter-dimension-set-value>
71
+ <d2l-filter-dimension-set-value key="physics" text="Physics" count="23"></d2l-filter-dimension-set-value>
72
+ <d2l-filter-dimension-set-value key="stats" text="Statistics" count="333"></d2l-filter-dimension-set-value>
73
+ <d2l-filter-dimension-set-value key="writerscraft" text="Writer's Craft" count="2211"></d2l-filter-dimension-set-value>
74
+ </d2l-filter-dimension-set>
75
+ </d2l-filter>
76
+ </template>
77
+ </d2l-demo-snippet>
78
+
60
79
  <h2>Multiple Dimensions</h2>
61
80
  <d2l-demo-snippet>
62
81
  <template>
63
82
  <d2l-filter>
64
- <d2l-filter-dimension-set key="course" introductory-text="Filter content by courses. Start typing any course name to explore." text="Course" select-all>
83
+ <d2l-filter-dimension-set key="course" introductory-text="Filter content by courses. Start typing any course name to explore." header-text="Skills Promoted at Your Company" text="Course" select-all>
65
84
  <d2l-filter-dimension-set-value key="art" text="Art" count="0"></d2l-filter-dimension-set-value>
66
85
  <d2l-filter-dimension-set-value key="astronomy" text="Astronomy" count="1" selected></d2l-filter-dimension-set-value>
67
86
  <d2l-filter-dimension-set-value key="biology" text="Biology" count="-12"></d2l-filter-dimension-set-value>
@@ -11,6 +11,11 @@ class FilterDimensionSet extends LitElement {
11
11
 
12
12
  static get properties() {
13
13
  return {
14
+ /**
15
+ * A heading displayed above the list items. This is usually unnecessary, but can be used to emphasize or promote something specific about the list of items to help orient users.
16
+ * @type {string}
17
+ */
18
+ headerText: { type: String, attribute: 'header-text' },
14
19
  /**
15
20
  * The introductory text to display at the top of the filter dropdown
16
21
  * @type {string}
@@ -56,6 +61,7 @@ class FilterDimensionSet extends LitElement {
56
61
 
57
62
  constructor() {
58
63
  super();
64
+ this.headerText = '';
59
65
  this.introductoryText = '';
60
66
  this.loading = false;
61
67
  this.searchType = 'automatic';
@@ -18,7 +18,7 @@ import '../menu/menu-item.js';
18
18
  import '../selection/selection-select-all.js';
19
19
  import '../selection/selection-summary.js';
20
20
 
21
- import { bodyCompactStyles, bodySmallStyles, bodyStandardStyles } from '../typography/styles.js';
21
+ import { bodyCompactStyles, bodySmallStyles, bodyStandardStyles, heading4Styles } from '../typography/styles.js';
22
22
  import { css, html, LitElement, nothing } from 'lit';
23
23
  import { announce } from '../../helpers/announce.js';
24
24
  import { classMap } from 'lit/directives/class-map.js';
@@ -69,7 +69,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
69
69
  }
70
70
 
71
71
  static get styles() {
72
- return [bodyCompactStyles, bodySmallStyles, bodyStandardStyles, offscreenStyles, css`
72
+ return [bodyCompactStyles, bodySmallStyles, bodyStandardStyles, heading4Styles, offscreenStyles, css`
73
73
  [slot="header"] {
74
74
  padding: 0.9rem 0.3rem;
75
75
  }
@@ -164,6 +164,13 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
164
164
  padding: 0.9rem;
165
165
  }
166
166
 
167
+ .list-header-text {
168
+ color: var(--d2l-color-ferrite);
169
+ margin: 0;
170
+ padding-bottom: 0.05rem;
171
+ padding-top: 0.65rem;
172
+ }
173
+
167
174
  .d2l-filter-dimension-info-message {
168
175
  color: var(--d2l-color-ferrite);
169
176
  text-align: center;
@@ -487,6 +494,17 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
487
494
  if (count === 0) return searchResults;
488
495
  }
489
496
 
497
+ let listHeader = nothing;
498
+ let listLabel = undefined;
499
+ if (dimension.headerText && dimension.searchValue === '') {
500
+ listHeader = html`
501
+ <d2l-list-item>
502
+ <h4 class="d2l-heading-4 list-header-text" aria-hidden="true">${dimension.headerText}</h4>
503
+ </d2l-list-item>
504
+ `;
505
+ listLabel = dimension.headerText;
506
+ }
507
+
490
508
  return html`
491
509
  ${searchResults}
492
510
  <d2l-list
@@ -494,8 +512,10 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
494
512
  @d2l-list-selection-change="${this._handleChangeSetDimension}"
495
513
  extend-separators
496
514
  grid
515
+ label="${ifDefined(listLabel)}"
497
516
  ?selection-single="${dimension.selectionSingle}"
498
517
  separators="between">
518
+ ${listHeader}
499
519
  ${dimension.values.map(item => html`
500
520
  <d2l-list-item
501
521
  ?selection-disabled="${item.disabled}"
@@ -739,8 +759,10 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
739
759
 
740
760
  switch (type) {
741
761
  case 'd2l-filter-dimension-set': {
762
+ info.headerText = dimension.headerText;
742
763
  info.introductoryText = dimension.introductoryText;
743
764
  info.searchType = dimension.searchType;
765
+ info.searchValue = '';
744
766
  info.selectionSingle = dimension.selectionSingle;
745
767
  if (dimension.selectAll && !dimension.selectionSingle) info.selectAllIdPrefix = SET_DIMENSION_ID_PREFIX;
746
768
  info.searchEmptyState = dimension.getSearchEmptyState();
@@ -123,6 +123,9 @@ class InputDate extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixin(
123
123
  visibility: hidden;
124
124
  width: auto;
125
125
  }
126
+ .d2l-input-date-hidden-text > div {
127
+ padding-left: 2rem; /* simulates space taken up by the icon */
128
+ }
126
129
  d2l-calendar {
127
130
  padding: 0.25rem 0.6rem;
128
131
  }
@@ -268,9 +271,9 @@ class InputDate extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixin(
268
271
  </d2l-dropdown-content>` : null;
269
272
  return html`
270
273
  <div aria-hidden="true" class="d2l-input-date-hidden-text">
271
- <div><d2l-icon icon="tier1:calendar"></d2l-icon>${formattedWideDate}</div>
272
- <div><d2l-icon icon="tier1:calendar"></d2l-icon>${shortDateFormat}</div>
273
- <div><d2l-icon icon="tier1:calendar"></d2l-icon>${this.emptyText}</div>
274
+ <div>${formattedWideDate}</div>
275
+ <div>${shortDateFormat}</div>
276
+ <div>${this.emptyText}</div>
274
277
  </div>
275
278
  ${errorTooltip}
276
279
  ${infoTooltip}
@@ -0,0 +1,149 @@
1
+ import '../../colors/colors.js';
2
+ import '../list-item-content.js';
3
+ import '../list-item.js';
4
+ import '../list.js';
5
+ import { css, html, LitElement, nothing } from 'lit';
6
+
7
+ class ListNestedIterationsHelper extends LitElement {
8
+ static get properties() {
9
+ return {
10
+ draggable: { type: Boolean }
11
+ };
12
+ }
13
+
14
+ static get styles() {
15
+ return css`
16
+ :host {
17
+ display: block;
18
+ }
19
+ table {
20
+ border-collapse: collapse;
21
+ font-size: 0.8rem;
22
+ table-layout: fixed;
23
+ width: 100%;
24
+ }
25
+ table > * > tr > * {
26
+ border: 1px solid var(--d2l-color-mica);
27
+ font-weight: 400;
28
+ height: 41px;
29
+ padding: 0.5rem 1rem;
30
+ text-align: start;
31
+ vertical-align: middle;
32
+ }
33
+ table > * > tr > td {
34
+ vertical-align: top;
35
+ }
36
+ table > thead > tr > th,
37
+ table > * > tr.header > th {
38
+ background-color: var(--d2l-color-regolith);
39
+ font-size: 0.7rem;
40
+ height: 27px;
41
+ line-height: 0.9rem;
42
+ }
43
+
44
+ d2l-list:not([slot="nested"]) {
45
+ border: solid 1px black;
46
+ margin: 1rem;
47
+ padding: 1rem;
48
+ }
49
+ .minimize-width {
50
+ width: 4.5rem;
51
+ }
52
+ `;
53
+ }
54
+
55
+ constructor() {
56
+ super();
57
+ this.draggable = false;
58
+ }
59
+
60
+ render() {
61
+ const selectableOptions = [
62
+ { name: 'All are Selectable', parent: true, child: true },
63
+ { name: 'None are Selectable', parent: false, child: false },
64
+ { name: 'Children Selectable (Parent Not)', parent: false, child: true },
65
+ { name: 'Parent Selectable (Children Not)', parent: true, child: false }
66
+ ];
67
+
68
+ const tableRows = selectableOptions.map(option => html`
69
+ <tr class="header">
70
+ <th rowspan="2" scope="rowgroup">${option.name}</th>
71
+ <th scope="row">Exp/Collapsible Children</th>
72
+ <td>${this._createList([option.parent, true], [option.child, true])}</td>
73
+ <td>${this._createList([option.parent, false], [option.child, true])}</td>
74
+ </tr>
75
+ <tr class="header">
76
+ <th scope="row">Non-Exp/Collapsible Children</th>
77
+ <td>${this._createList([option.parent, true], [option.child, false])}</td>
78
+ <td>${this._createList([option.parent, false], [option.child, false])}</td>
79
+ </tr>
80
+ `);
81
+
82
+ return html`
83
+ <table>
84
+ <thead>
85
+ <tr>
86
+ <th class="minimize-width"></th>
87
+ <th class="minimize-width"></th>
88
+ <th scope="col">Exp/Collapsible Parent</th>
89
+ <th scope="col">Non-Exp/Collapsible Parent</th>
90
+ </tr>
91
+ </thead>
92
+ <tbody>
93
+ ${tableRows}
94
+ </tbody>
95
+ </table>
96
+ `;
97
+ }
98
+
99
+ _createList(parentOptions, childrenOptions) {
100
+ return html`
101
+ <d2l-list>
102
+ ${this._getParentItems(parentOptions, this._getChildItems(childrenOptions))}
103
+ </d2l-list>
104
+ `;
105
+ }
106
+
107
+ _getChildItems(childOptions) {
108
+ const childL2Text = 'L2 List Item';
109
+ const childL3Text = 'L3 List Item';
110
+ const items = [];
111
+
112
+ for (let i = 0; i < 3; i++) {
113
+ const childKey = `child-${i}-${childOptions[0]}-${childOptions[1]}`;
114
+ items.push(html`
115
+ <d2l-list-item key="${childKey}" label="${childL2Text}" ?selectable="${!!childOptions[0]}" ?draggable="${this.draggable}" ?expandable="${childOptions[1] && i !== 1}">
116
+ <d2l-list-item-content>${childL2Text}</d2l-list-item-content>
117
+ ${i === 1 || !childOptions[1] ? nothing : html`
118
+ <d2l-list slot="nested">
119
+ <d2l-list-item key="${`${childKey}-child`}" label="${childL3Text}" ?selectable="${!!childOptions[0]}" ?draggable="${this.draggable}">
120
+ <d2l-list-item-content>${childL3Text}</d2l-list-item-content>
121
+ </d2l-list-item>
122
+ </d2l-list>
123
+ `}
124
+ </d2l-list-item>
125
+ `);
126
+ }
127
+ return items;
128
+ }
129
+
130
+ _getParentItems(parentOptions, nested) {
131
+ const parentText = 'L1 List Item';
132
+ const items = [];
133
+
134
+ for (let i = 0; i < 3; i++) {
135
+ const parentKey = `parent-${i}-${parentOptions[0]}-${parentOptions[1]}`;
136
+ items.push(html`
137
+ <d2l-list-item key="${parentKey}" label="${parentText}" ?selectable="${!!parentOptions[0]}" ?draggable="${this.draggable}" ?expandable="${parentOptions[1] && i !== 1}" ?expanded="${parentOptions[1] && i === 0}">
138
+ <d2l-list-item-content>${parentText}</d2l-list-item-content>
139
+ ${i === 1 || (i === 2 && !parentOptions[1]) ? nothing : html`
140
+ <d2l-list slot="nested">${nested}</d2l-list>
141
+ `}
142
+ </d2l-list-item>
143
+ `);
144
+ }
145
+ return items;
146
+ }
147
+ }
148
+
149
+ customElements.define('d2l-demo-list-nested-iterations-helper', ListNestedIterationsHelper);
@@ -20,6 +20,9 @@
20
20
  import '../../menu/menu-item.js';
21
21
  import '../../paging/pager-load-more.js';
22
22
  import '../../selection/selection-action.js';
23
+ import '../../switch/switch.js';
24
+
25
+ import './demo-list-nested-iterations-helper.js';
23
26
  </script>
24
27
  </head>
25
28
  <body unresolved>
@@ -222,6 +225,15 @@
222
225
  </template>
223
226
  </d2l-demo-snippet>
224
227
 
228
+ <h2>All Iterations</h2>
229
+
230
+ <d2l-demo-snippet full-width>
231
+ <template>
232
+ <d2l-switch id="draggable-switch" text="Draggable"></d2l-switch>
233
+ <d2l-demo-list-nested-iterations-helper></d2l-demo-list-nested-iterations-helper>
234
+ </template>
235
+ </d2l-demo-snippet>
236
+
225
237
  </d2l-demo-page>
226
238
 
227
239
  <script>
@@ -238,6 +250,20 @@
238
250
  setTimeout(() => e.detail.complete(), 2000);
239
251
  });
240
252
  });
253
+
254
+ const setupSwitch = () => {
255
+ const draggableSwitch = document.querySelector('#draggable-switch');
256
+ if (!draggableSwitch) {
257
+ setTimeout(setupSwitch, 1000);
258
+ } else {
259
+ draggableSwitch.addEventListener('change', (e) => {
260
+ const listIterations = document.querySelector('d2l-demo-list-nested-iterations-helper');
261
+ listIterations.draggable = e.target.on;
262
+ });
263
+ }
264
+ };
265
+
266
+ setupSwitch();
241
267
  }, 1000);
242
268
  </script>
243
269
 
@@ -3766,6 +3766,12 @@
3766
3766
  "description": "REQUIRED: Unique key to represent this dimension in the filter",
3767
3767
  "type": "string"
3768
3768
  },
3769
+ {
3770
+ "name": "header-text",
3771
+ "description": "A heading displayed above the list items. This is usually unnecessary, but can be used to emphasize or promote something specific about the list of items to help orient users.",
3772
+ "type": "string",
3773
+ "default": "\"\""
3774
+ },
3769
3775
  {
3770
3776
  "name": "introductory-text",
3771
3777
  "description": "The introductory text to display at the top of the filter dropdown",
@@ -3816,6 +3822,13 @@
3816
3822
  "description": "REQUIRED: Unique key to represent this dimension in the filter",
3817
3823
  "type": "string"
3818
3824
  },
3825
+ {
3826
+ "name": "headerText",
3827
+ "attribute": "header-text",
3828
+ "description": "A heading displayed above the list items. This is usually unnecessary, but can be used to emphasize or promote something specific about the list of items to help orient users.",
3829
+ "type": "string",
3830
+ "default": "\"\""
3831
+ },
3819
3832
  {
3820
3833
  "name": "introductoryText",
3821
3834
  "attribute": "introductory-text",
@@ -7592,6 +7605,25 @@
7592
7605
  }
7593
7606
  ]
7594
7607
  },
7608
+ {
7609
+ "name": "d2l-demo-list-nested-iterations-helper",
7610
+ "path": "./components/list/demo/demo-list-nested-iterations-helper.js",
7611
+ "attributes": [
7612
+ {
7613
+ "name": "draggable",
7614
+ "type": "boolean",
7615
+ "default": "false"
7616
+ }
7617
+ ],
7618
+ "properties": [
7619
+ {
7620
+ "name": "draggable",
7621
+ "attribute": "draggable",
7622
+ "type": "boolean",
7623
+ "default": "false"
7624
+ }
7625
+ ]
7626
+ },
7595
7627
  {
7596
7628
  "name": "d2l-demo-list-nested-lazy-load",
7597
7629
  "path": "./components/list/demo/demo-list-nested-lazy-load.js"
@@ -9007,14 +9039,6 @@
9007
9039
  }
9008
9040
  ]
9009
9041
  },
9010
- {
9011
- "name": "d2l-nested-list-iterations-separate",
9012
- "path": "./components/list/test/nested-list-iterations-helper.js"
9013
- },
9014
- {
9015
- "name": "d2l-nested-list-iterations-combined",
9016
- "path": "./components/list/test/nested-list-iterations-helper.js"
9017
- },
9018
9042
  {
9019
9043
  "name": "d2l-loading-spinner-demo-override",
9020
9044
  "path": "./components/loading-spinner/demo/loading-spinner-override.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.120.0",
3
+ "version": "2.121.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",
@@ -61,7 +61,7 @@
61
61
  "glob-all": "^3",
62
62
  "lit-analyzer": "^1",
63
63
  "messageformat-validator": "^2",
64
- "node-sass": "^8",
64
+ "node-sass": "^9",
65
65
  "rollup": "^3",
66
66
  "rollup-plugin-copy": "^3",
67
67
  "rollup-plugin-delete": "^2",