@brightspace-ui/core 3.21.4 → 3.22.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.
@@ -19,6 +19,7 @@ import '../menu/menu-item.js';
19
19
  import '../paging/pager-load-more.js';
20
20
  import '../selection/selection-select-all.js';
21
21
  import '../selection/selection-summary.js';
22
+ import '../tooltip/tooltip.js';
22
23
 
23
24
  import { bodyCompactStyles, bodySmallStyles, bodyStandardStyles, heading4Styles } from '../typography/styles.js';
24
25
  import { css, html, LitElement, nothing } from 'lit';
@@ -37,6 +38,26 @@ const ESCAPE_KEY_CODE = 27;
37
38
  const FILTER_CONTENT_CLASS = 'd2l-filter-dropdown-content';
38
39
  const SET_DIMENSION_ID_PREFIX = 'list-';
39
40
 
41
+ let hasDisplayedKeyboardTooltip = false;
42
+
43
+ export function resetHasDisplayedKeyboardTooltip() {
44
+ hasDisplayedKeyboardTooltip = false;
45
+ }
46
+ let spacePressed = false;
47
+ let spaceListenerAdded = false;
48
+ function addSpaceListener() {
49
+ if (spaceListenerAdded) return;
50
+ spaceListenerAdded = true;
51
+ document.addEventListener('keydown', e => {
52
+ if (e.keyCode !== 32) return;
53
+ spacePressed = true;
54
+ });
55
+ document.addEventListener('keyup', e => {
56
+ if (e.keyCode !== 32) return;
57
+ spacePressed = false;
58
+ });
59
+ }
60
+
40
61
  /**
41
62
  * A filter component that contains one or more dimensions a user can filter by.
42
63
  * This component is in charge of all rendering.
@@ -68,6 +89,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
68
89
  text: { type: String },
69
90
  _activeDimensionKey: { type: String, attribute: false },
70
91
  _dimensions: { type: Array, attribute: false },
92
+ _displayKeyboardTooltip: { state: true },
71
93
  _minWidth: { type: Number, attribute: false },
72
94
  _totalAppliedCount: { type: Number, attribute: false }
73
95
  };
@@ -211,6 +233,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
211
233
  this.opened = false;
212
234
  this._changeEventsToDispatch = new Map();
213
235
  this._dimensions = [];
236
+ this._displayKeyboardTooltip = false;
214
237
  this._minWidth = 285;
215
238
  this._openedDimensions = [];
216
239
  this._totalAppliedCount = 0;
@@ -226,6 +249,11 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
226
249
  return 'd2l-button-subtle';
227
250
  }
228
251
 
252
+ connectedCallback() {
253
+ super.connectedCallback();
254
+ addSpaceListener();
255
+ }
256
+
229
257
  firstUpdated(changedProperties) {
230
258
  super.firstUpdated(changedProperties);
231
259
  this.addEventListener('d2l-filter-dimension-data-change', this._handleDimensionDataChange);
@@ -590,8 +618,11 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
590
618
  }
591
619
 
592
620
  _createSetDimensionItem(item) {
621
+ const itemId = `list-item-${item.key}`;
593
622
  return html`
594
623
  <d2l-list-item
624
+ id="${itemId}"
625
+ @d2l-list-item-selected="${ifDefined(item.additionalContent ? this._handleListItemSelelcted : undefined)}"
595
626
  ?selection-disabled="${item.disabled}"
596
627
  ?hidden="${item.hidden}"
597
628
  key="${item.key}"
@@ -617,6 +648,9 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
617
648
  ` : nothing}
618
649
  </div>
619
650
  </d2l-list-item>
651
+ ${item.additionalContent && item.selected && this._displayKeyboardTooltip
652
+ ? html`<d2l-tooltip align="start" announced for="${itemId}" for-type="descriptor" @d2l-tooltip-hide="${this._handleTooltipHide}">${this.localizeHTML('components.filter.additionalContentTooltip')}</d2l-tooltip>`
653
+ : nothing}
620
654
  `;
621
655
  }
622
656
 
@@ -856,6 +890,12 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
856
890
  parentListItem.classList.remove('expanding-content');
857
891
  }
858
892
 
893
+ _handleListItemSelelcted() {
894
+ if (hasDisplayedKeyboardTooltip || !spacePressed) return;
895
+ this._displayKeyboardTooltip = true;
896
+ hasDisplayedKeyboardTooltip = true;
897
+ }
898
+
859
899
  _handleSearch(e) {
860
900
  const dimension = this._getActiveDimension();
861
901
  const searchValue = e.detail.value.trim();
@@ -903,6 +943,11 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
903
943
  this._activeFiltersSubscribers.updateSubscribers();
904
944
  }
905
945
 
946
+ _handleTooltipHide() {
947
+ this._displayKeyboardTooltip = false;
948
+ hasDisplayedKeyboardTooltip = true;
949
+ }
950
+
906
951
  _isDimensionEmpty(dimension) {
907
952
  switch (dimension.type) {
908
953
  case 'd2l-filter-dimension-set':
package/lang/ar.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "مهم!",
11
11
  "components.dropdown.close": "إغلاق",
12
12
  "components.filter.activeFilters": "عوامل تصفية نشطة:",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "مسح",
14
15
  "components.filter.clearAll": "مسح الكل",
15
16
  "components.filter.clearAllAnnounce": "جارٍ مسح كل عوامل التصفية",
package/lang/cy.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "Critigol!",
11
11
  "components.dropdown.close": "Cau",
12
12
  "components.filter.activeFilters": "Dim Hidlwyr Gweithredol:",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "Clirio",
14
15
  "components.filter.clearAll": "Clirio’r Cyfan",
15
16
  "components.filter.clearAllAnnounce": "Wrthi’n clirio’r holl hidlwyr",
package/lang/da.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "Kritisk!",
11
11
  "components.dropdown.close": "Luk",
12
12
  "components.filter.activeFilters": "Aktive filtre:",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "Ryd",
14
15
  "components.filter.clearAll": "Ryd alle",
15
16
  "components.filter.clearAllAnnounce": "Rydder alle filtre",
package/lang/de.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "Kritisch!",
11
11
  "components.dropdown.close": "Schließen",
12
12
  "components.filter.activeFilters": "Aktive Filter:",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "Löschen",
14
15
  "components.filter.clearAll": "Alle löschen",
15
16
  "components.filter.clearAllAnnounce": "Alle Filter werden gelöscht",
package/lang/en-gb.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "Critical!",
11
11
  "components.dropdown.close": "Close",
12
12
  "components.filter.activeFilters": "Active Filters:",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "Clear",
14
15
  "components.filter.clearAll": "Clear All",
15
16
  "components.filter.clearAllAnnounce": "Clearing all filters",
package/lang/en.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "Critical!",
11
11
  "components.dropdown.close": "Close",
12
12
  "components.filter.activeFilters": "Active Filters:",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "Clear",
14
15
  "components.filter.clearAll": "Clear All",
15
16
  "components.filter.clearAllAnnounce": "Clearing all filters",
package/lang/es-es.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "¡Crítico!",
11
11
  "components.dropdown.close": "Cerrar",
12
12
  "components.filter.activeFilters": "Filtros activos:",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "Borrar",
14
15
  "components.filter.clearAll": "Borrar todo",
15
16
  "components.filter.clearAllAnnounce": "Borrando todos los filtros",
package/lang/es.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "¡Crucial!",
11
11
  "components.dropdown.close": "Cerrar",
12
12
  "components.filter.activeFilters": "Filtros activos:",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "Borrar",
14
15
  "components.filter.clearAll": "Borrar todo",
15
16
  "components.filter.clearAllAnnounce": "Borrando todos los filtros",
package/lang/fr-fr.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "Critique !",
11
11
  "components.dropdown.close": "Fermer",
12
12
  "components.filter.activeFilters": "Filtres actifs :",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "Effacer",
14
15
  "components.filter.clearAll": "Tout effacer",
15
16
  "components.filter.clearAllAnnounce": "Suppression de tous les filtres",
package/lang/fr.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "Essentiel!",
11
11
  "components.dropdown.close": "Fermer",
12
12
  "components.filter.activeFilters": "Filtres actifs :",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "Effacer",
14
15
  "components.filter.clearAll": "Effacer tout",
15
16
  "components.filter.clearAllAnnounce": "Effacement de tous les filtres en cours",
package/lang/hi.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "महत्वपूर्ण!",
11
11
  "components.dropdown.close": "बंद करें",
12
12
  "components.filter.activeFilters": "सक्रिय फ़िल्टर्स:",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "साफ़ करें",
14
15
  "components.filter.clearAll": "सभी साफ़ करें",
15
16
  "components.filter.clearAllAnnounce": "सभी फिल्टर साफ़ किए जा रहे हैं",
package/lang/ja.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "重大です!",
11
11
  "components.dropdown.close": "閉じる",
12
12
  "components.filter.activeFilters": "アクティブフィルタ:",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "クリア",
14
15
  "components.filter.clearAll": "すべてをクリア",
15
16
  "components.filter.clearAllAnnounce": "すべてのフィルタのクリア",
package/lang/ko.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "중요!",
11
11
  "components.dropdown.close": "닫기",
12
12
  "components.filter.activeFilters": "활성 필터:",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "지우기",
14
15
  "components.filter.clearAll": "모두 지우기",
15
16
  "components.filter.clearAllAnnounce": "모든 필터 지우기",
package/lang/nl.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "Kritiek!",
11
11
  "components.dropdown.close": "Sluiten",
12
12
  "components.filter.activeFilters": "Actieve filters:",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "Wissen",
14
15
  "components.filter.clearAll": "Alles wissen",
15
16
  "components.filter.clearAllAnnounce": "Alle filters wissen",
package/lang/pt.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "Crítico!",
11
11
  "components.dropdown.close": "Fechar",
12
12
  "components.filter.activeFilters": "Filtros ativos:",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "Limpar",
14
15
  "components.filter.clearAll": "Limpar tudo",
15
16
  "components.filter.clearAllAnnounce": "Limpando todos os filtros",
package/lang/sv.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "Viktigt!",
11
11
  "components.dropdown.close": "Stäng",
12
12
  "components.filter.activeFilters": "Aktiva filter:",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "Rensa",
14
15
  "components.filter.clearAll": "Rensa alla",
15
16
  "components.filter.clearAllAnnounce": "Rensar alla filter",
package/lang/tr.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "Kritik!",
11
11
  "components.dropdown.close": "Kapat",
12
12
  "components.filter.activeFilters": "Etkin Filtreler:",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "Temizle",
14
15
  "components.filter.clearAll": "Tümünü Temizle",
15
16
  "components.filter.clearAllAnnounce": "Tüm filtreler temizleniyor",
package/lang/zh-cn.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "严重问题!",
11
11
  "components.dropdown.close": "关闭",
12
12
  "components.filter.activeFilters": "活动筛选器:",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "清除",
14
15
  "components.filter.clearAll": "全部清除",
15
16
  "components.filter.clearAllAnnounce": "清除所有筛选器",
package/lang/zh-tw.js CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  "components.dialog.critical": "重大!",
11
11
  "components.dropdown.close": "關閉",
12
12
  "components.filter.activeFilters": "啟用中的篩選器:",
13
+ "components.filter.additionalContentTooltip": "Use <b>left/right arrow keys</b> to move focus inside this list item",
13
14
  "components.filter.clear": "清除",
14
15
  "components.filter.clearAll": "全部清除",
15
16
  "components.filter.clearAllAnnounce": "正在清除所有篩選器",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.21.4",
3
+ "version": "3.22.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",