@brightspace-ui/core 2.120.1 → 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();
@@ -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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.120.1",
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",