@brightspace-ui/core 2.86.6 → 2.88.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.
@@ -188,6 +188,7 @@ The `d2l-filter-dimension-set` component is the main dimension type that will wo
188
188
 
189
189
  | Property | Type | Description |
190
190
  |---|---|---|
191
+ | `introductory-text` | String | The introductory text to display at the top of the filter dropdown |
191
192
  | `key` | String, required | Unique identifier for the dimension |
192
193
  | `loading` | Boolean | Whether the values for this dimension are still loading and a loading spinner should be displayed |
193
194
  | `search-type` | String, default: `automatic` | `automatic` provides basic case-insensitive text comparison searching, `none` disables the search input, and `manual` fires an event for the consumer to handle the search and pass the keys of the values to be displayed |
@@ -23,7 +23,7 @@
23
23
  <d2l-demo-snippet>
24
24
  <template>
25
25
  <d2l-filter>
26
- <d2l-filter-dimension-set key="course" text="Course" select-all>
26
+ <d2l-filter-dimension-set key="course" introductory-text="Filter content by courses. Start typing any course name to explore." text="Course" select-all>
27
27
  <d2l-filter-dimension-set-value key="art" text="Art" count="12"></d2l-filter-dimension-set-value>
28
28
  <d2l-filter-dimension-set-value key="astronomy" text="Astronomy" count="2" selected></d2l-filter-dimension-set-value>
29
29
  <d2l-filter-dimension-set-value key="biology" text="Biology" count="15"></d2l-filter-dimension-set-value>
@@ -58,7 +58,7 @@
58
58
  <d2l-demo-snippet>
59
59
  <template>
60
60
  <d2l-filter>
61
- <d2l-filter-dimension-set key="course" text="Course" select-all>
61
+ <d2l-filter-dimension-set key="course" introductory-text="Filter content by courses. Start typing any course name to explore." text="Course" select-all>
62
62
  <d2l-filter-dimension-set-value key="art" text="Art" count="0"></d2l-filter-dimension-set-value>
63
63
  <d2l-filter-dimension-set-value key="astronomy" text="Astronomy" count="1" selected></d2l-filter-dimension-set-value>
64
64
  <d2l-filter-dimension-set-value key="biology" text="Biology" count="-12"></d2l-filter-dimension-set-value>
@@ -34,6 +34,11 @@ class FilterDimensionSet extends LitElement {
34
34
  * @type {boolean}
35
35
  */
36
36
  selectionSingle: { type: Boolean, attribute: 'selection-single' },
37
+ /**
38
+ * The introductory text to display at the top of the filter dropdown
39
+ * @type {string}
40
+ */
41
+ introductoryText: { type: String, attribute: 'introductory-text' },
37
42
  /**
38
43
  * REQUIRED: The text that is displayed for the dimension title
39
44
  * @type {string}
@@ -49,6 +54,7 @@ class FilterDimensionSet extends LitElement {
49
54
 
50
55
  constructor() {
51
56
  super();
57
+ this.introductoryText = '';
52
58
  this.loading = false;
53
59
  this.searchType = 'automatic';
54
60
  this.selectAll = false;
@@ -5,6 +5,7 @@ import '../button/button-subtle.js';
5
5
  import '../dropdown/dropdown-button-subtle.js';
6
6
  import '../dropdown/dropdown-content.js';
7
7
  import '../dropdown/dropdown-menu.js';
8
+ import '../empty-state/empty-state-simple.js';
8
9
  import '../hierarchical-view/hierarchical-view.js';
9
10
  import '../inputs/input-search.js';
10
11
  import '../list/list.js';
@@ -74,6 +75,10 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
74
75
  padding-bottom: 0.9rem;
75
76
  }
76
77
 
78
+ .d2l-filter-dimension-header.with-intro {
79
+ padding-bottom: 0.6rem;
80
+ }
81
+
77
82
  .d2l-filter-dimension-header,
78
83
  .d2l-filter-dimension-header-actions {
79
84
  align-items: center;
@@ -142,8 +147,22 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
142
147
  color: var(--d2l-color-chromite);
143
148
  }
144
149
 
150
+ .d2l-filter-dimension-intro-text {
151
+ margin: 0;
152
+ padding: 0.6rem 1.5rem 1.5rem;
153
+ text-align: center;
154
+ }
155
+
156
+ .d2l-filter-dimension-intro-text.multi-dimension {
157
+ padding: 0 1.5rem 1.5rem;
158
+ }
159
+
160
+ .d2l-empty-state-container {
161
+ padding: 0.9rem;
162
+ }
163
+
145
164
  .d2l-filter-dimension-info-message {
146
- padding: 0.9rem 0;
165
+ color: var(--d2l-color-ferrite);
147
166
  text-align: center;
148
167
  }
149
168
 
@@ -269,7 +288,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
269
288
  switch (dimension.type) {
270
289
  case 'd2l-filter-dimension-set':
271
290
  dimensionHTML = html`
272
- <div aria-live="polite" class="d2l-filter-container">
291
+ <div class="d2l-filter-container">
273
292
  ${this._createSetDimension(dimension)}
274
293
  </div>`;
275
294
  break;
@@ -322,6 +341,14 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
322
341
 
323
342
  const dimension = this._getActiveDimension();
324
343
 
344
+ const introductoryTextClasses = {
345
+ 'd2l-body-compact': true,
346
+ 'd2l-filter-dimension-intro-text': true,
347
+ 'multi-dimension': !singleDimension
348
+ };
349
+ const introductoryText = !dimension.introductoryText ? nothing : html`
350
+ <p class="${classMap(introductoryTextClasses)}">${dimension.introductoryText}</p>`;
351
+
325
352
  const clear = html`
326
353
  <d2l-button-subtle
327
354
  @click="${this._handleClear}"
@@ -331,7 +358,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
331
358
  </d2l-button-subtle>
332
359
  `;
333
360
 
334
- const search = dimension.searchType === 'none' ? null : html`
361
+ const search = dimension.searchType === 'none' ? nothing : html`
335
362
  <d2l-input-search
336
363
  @d2l-input-search-searched="${this._handleSearch}"
337
364
  ?disabled="${this._isDimensionEmpty(dimension)}"
@@ -360,8 +387,12 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
360
387
  </div>
361
388
  `;
362
389
 
363
- const header = singleDimension ? null : html`
364
- <div class="d2l-filter-dimension-header">
390
+ const headerClasses = {
391
+ 'd2l-filter-dimension-header': true,
392
+ 'with-intro': dimension.introductoryText
393
+ };
394
+ const header = singleDimension ? nothing : html`
395
+ <div class="${classMap(headerClasses)}">
365
396
  <d2l-button-icon
366
397
  @click="${this._handleDimensionHide}"
367
398
  icon="tier1:chevron-left"
@@ -374,6 +405,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
374
405
  return html`
375
406
  <div slot="header" @keydown="${this._handleDimensionHideKeyDown}">
376
407
  ${header}
408
+ ${introductoryText}
377
409
  ${actions}
378
410
  </div>
379
411
  `;
@@ -389,9 +421,12 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
389
421
 
390
422
  if (this._isDimensionEmpty(dimension)) {
391
423
  return html`
392
- <p class="d2l-filter-dimension-info-message d2l-body-small" role="alert">
393
- ${this.localize('components.filter.noFilters')}
394
- </p>
424
+ <div class="d2l-empty-state-container" role="alert">
425
+ <d2l-empty-state-simple
426
+ class="d2l-filter-dimension-info-message"
427
+ description="${this.localize('components.filter.noFilters')}">
428
+ </d2l-empty-state-simple>
429
+ </div>
395
430
  `;
396
431
  }
397
432
 
@@ -399,15 +434,17 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
399
434
  if (dimension.searchValue && dimension.searchValue !== '') {
400
435
  const count = dimension.values.reduce((total, value) => { return !value.hidden ? total + 1 : total; }, 0);
401
436
  const classes = {
402
- 'd2l-filter-dimension-info-message': true,
403
- 'd2l-body-small': true,
437
+ 'd2l-empty-state-container': true,
404
438
  'd2l-offscreen': count !== 0
405
439
  };
406
440
 
407
441
  searchResults = html`
408
- <p class="${classMap(classes)}" role="alert">
409
- ${this.localize('components.filter.searchResults', { number: count })}
410
- </p>
442
+ <div class="${classMap(classes)}" role="alert">
443
+ <d2l-empty-state-simple
444
+ class="d2l-filter-dimension-info-message"
445
+ description="${this.localize('components.filter.searchResults', { number: count })}">
446
+ </d2l-empty-state-simple>
447
+ </div>
411
448
  `;
412
449
 
413
450
  if (count === 0) return searchResults;
@@ -654,6 +691,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
654
691
 
655
692
  switch (type) {
656
693
  case 'd2l-filter-dimension-set': {
694
+ info.introductoryText = dimension.introductoryText;
657
695
  info.searchType = dimension.searchType;
658
696
  info.selectionSingle = dimension.selectionSingle;
659
697
  if (dimension.selectAll && !dimension.selectionSingle) info.selectAllIdPrefix = SET_DIMENSION_ID_PREFIX;
@@ -3573,6 +3573,12 @@
3573
3573
  "description": "REQUIRED: Unique key to represent this dimension in the filter",
3574
3574
  "type": "string"
3575
3575
  },
3576
+ {
3577
+ "name": "introductory-text",
3578
+ "description": "The introductory text to display at the top of the filter dropdown",
3579
+ "type": "string",
3580
+ "default": "\"\""
3581
+ },
3576
3582
  {
3577
3583
  "name": "loading",
3578
3584
  "description": "Whether the values for this dimension are still loading and a loading spinner should be displayed",
@@ -3617,6 +3623,13 @@
3617
3623
  "description": "REQUIRED: Unique key to represent this dimension in the filter",
3618
3624
  "type": "string"
3619
3625
  },
3626
+ {
3627
+ "name": "introductoryText",
3628
+ "attribute": "introductory-text",
3629
+ "description": "The introductory text to display at the top of the filter dropdown",
3630
+ "type": "string",
3631
+ "default": "\"\""
3632
+ },
3620
3633
  {
3621
3634
  "name": "loading",
3622
3635
  "attribute": "loading",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.86.6",
3
+ "version": "2.88.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",