@brightspace-ui/core 2.182.0 → 2.183.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.
@@ -32,10 +32,10 @@ Empty state components are used to convey that there is no data available to be
32
32
 
33
33
  <!-- docs: start best practices -->
34
34
  <!-- docs: start dos -->
35
- * Do make it clear that there is no data available to be displayed
36
- * Do include guidance on next steps if available, either as short instructions or as a Call to Action
37
- * Do use a link for navigation and a button for actions
38
- * Do replace the entire content with its empty state for accessibility
35
+ * Use clear language to indicate there is no data available
36
+ * Offer concise guidance about next steps
37
+ * Include an [Empty State Action](#d2l-empty-state-action-button) or [Link](#d2l-empty-state-action-link) if it can help the user
38
+ * Replace the entire content with its empty state; do not show an empty table or list header
39
39
  <!-- docs: end dos -->
40
40
 
41
41
  <!-- docs: start donts -->
@@ -84,7 +84,9 @@ The `illustration-name` property can be set to use one of the preset illustratio
84
84
 
85
85
  ## Empty State Action Button [d2l-empty-state-action-button]
86
86
 
87
- `d2l-empty-state-action-button` is an empty state action component that can be placed inside of the default slot of `empty-state-simple` or `empty-state-illustrated` to add a button action to the component. Only a single action can be placed within an empty state component.
87
+ Use a `d2l-empty-state-action-button` to add a button that provides users with an easy next step, assuming the next step is to perform an action. If the next step is to navigate to another page, consider using an [Empty State Action Link](#d2l-empty-state-action-link) instead.
88
+
89
+ To add the button, place a `d2l-empty-state-action-button` component inside of the default slot of `empty-state-simple` or `empty-state-illustrated`. Only a single action can be placed within an empty state component.
88
90
 
89
91
  The `primary` attribute can be set to render a primary button in place of the default subtle button. Note that the `primary` attribute is only valid when placed within `empty-state-illustrated` components and will have no effect on `empty-state-simple`.
90
92
 
@@ -117,7 +119,9 @@ The `primary` attribute can be set to render a primary button in place of the de
117
119
 
118
120
  ## Empty State Action Link [d2l-empty-state-action-link]
119
121
 
120
- `d2l-empty-state-action-link` is an empty state action component that can be placed inside of the default slot of `empty-state-simple` or `empty-state-illustrated` to add a link action to the component. Only a single action can be placed within an empty state component.
122
+ Use a `d2l-empty-state-action-link` to add a link that provides users with an easy next step, provided the next step is to navigate to another page. If the next step is actually an action, use an [Empty State Action Button](#d2l-empty-state-action-button) instead.
123
+
124
+ To add the link, place a `d2l-empty-state-action-link` component inside of the default slot of `empty-state-simple` or `empty-state-illustrated`. Only a single action can be placed within an empty state component.
121
125
 
122
126
  <!-- docs: demo code properties name:d2l-empty-state-action-link -->
123
127
  ```html
@@ -18,6 +18,25 @@ const keyCodes = {
18
18
  ENTER: 13,
19
19
  SPACE: 32
20
20
  };
21
+ let hasDisplayedKeyboardTooltip = false;
22
+ let tabPressed = false;
23
+ let tabListenerAdded = false;
24
+ function addTabListener() {
25
+ if (tabListenerAdded) return;
26
+ tabListenerAdded = true;
27
+ document.addEventListener('keydown', e => {
28
+ if (e.keyCode !== 9) return;
29
+ tabPressed = true;
30
+ });
31
+ document.addEventListener('keyup', e => {
32
+ if (e.keyCode !== 9) return;
33
+ tabPressed = false;
34
+ });
35
+ }
36
+
37
+ export function resetHasDisplayedKeyboardTooltip() {
38
+ hasDisplayedKeyboardTooltip = false;
39
+ }
21
40
 
22
41
  export const TagListItemMixin = superclass => class extends LocalizeCoreElement(PropertyRequiredMixin(RtlMixin(superclass))) {
23
42
 
@@ -37,10 +56,6 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
37
56
  * @ignore
38
57
  */
39
58
  keyboardTooltipItem: { type: Boolean, attribute: 'keyboard-tooltip-item' },
40
- /**
41
- * @ignore
42
- */
43
- keyboardTooltipShown: { type: Boolean, attribute: 'keyboard-tooltip-shown' },
44
59
  /**
45
60
  * @ignore
46
61
  */
@@ -49,7 +64,8 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
49
64
  required: {
50
65
  message: (_value, elem) => `TagListItemMixin: "${elem.tagName.toLowerCase()}" called "_renderTag()" with empty "plainText" option`
51
66
  }
52
- }
67
+ },
68
+ _displayKeyboardTooltip: { state: true }
53
69
  };
54
70
  }
55
71
 
@@ -143,11 +159,16 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
143
159
  this.clearable = false;
144
160
  /** @ignore */
145
161
  this.keyboardTooltipItem = false;
146
- this.keyboardTooltipShown = false;
162
+ this._displayKeyboardTooltip = false;
147
163
  this._id = getUniqueId();
148
164
  this._plainText = '';
149
165
  }
150
166
 
167
+ connectedCallback() {
168
+ super.connectedCallback();
169
+ addTabListener();
170
+ }
171
+
151
172
  firstUpdated(changedProperties) {
152
173
  super.firstUpdated(changedProperties);
153
174
 
@@ -157,7 +178,7 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
157
178
  // ignore focus events coming from inside the tag content
158
179
  if (e.composedPath()[0] !== this) return;
159
180
  const tagList = findComposedAncestor(this, elem => elem.tagName === 'D2L-TAG-LIST');
160
- if (this.keyboardTooltipItem && this.keyboardTooltipShown && !isComposedAncestor(tagList, e.relatedTarget)) {
181
+ if (this.keyboardTooltipItem && hasDisplayedKeyboardTooltip && !isComposedAncestor(tagList, e.relatedTarget)) {
161
182
  const arrows = this.localize('components.tag-list-item.tooltip-arrow-keys');
162
183
  const arrowsDescription = this.localize('components.tag-list-item.tooltip-arrow-keys-desc');
163
184
 
@@ -173,7 +194,10 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
173
194
 
174
195
  await this.updateComplete;
175
196
  // delay the focus to allow focusin to fire
176
- setTimeout(() => container.focus());
197
+ setTimeout(() => {
198
+ this._onFocusIn();
199
+ container.focus();
200
+ });
177
201
  });
178
202
 
179
203
  this.addEventListener('keydown', this._handleKeydown);
@@ -192,27 +216,22 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
192
216
  }
193
217
 
194
218
  _handleKeyboardTooltipHide() {
195
- this.keyboardTooltipShown = true;
196
- }
197
-
198
- _handleKeyboardTooltipShow() {
199
- /** @ignore */
200
- this.dispatchEvent(new CustomEvent(
201
- 'd2l-tag-list-item-tooltip-show',
202
- { bubbles: true, composed: true }
203
- ));
219
+ this._displayKeyboardTooltip = false;
204
220
  }
205
221
 
206
222
  _handleKeydown(e) {
207
- const openKeys = e.keyCode === keyCodes.SPACE || e.keyCode === keyCodes.ENTER;
208
- if (this.keyboardTooltipItem && !this.keyboardTooltipShown && openKeys) this.keyboardTooltipShown = true;
209
-
210
223
  const clearKeys = e.keyCode === keyCodes.BACKSPACE || e.keyCode === keyCodes.DELETE;
211
224
  if (!this.clearable || !clearKeys) return;
212
225
  e.preventDefault();
213
226
  this._handleClearItem();
214
227
  }
215
228
 
229
+ _onFocusIn() {
230
+ if (!tabPressed || hasDisplayedKeyboardTooltip || !this.keyboardTooltipItem) return;
231
+ this._displayKeyboardTooltip = true;
232
+ hasDisplayedKeyboardTooltip = true;
233
+ }
234
+
216
235
  _renderKeyboardTooltipContent() {
217
236
  return html`
218
237
  <div class="d2l-tag-list-item-tooltip-title-key">${this.localize('components.tag-list-item.tooltip-title')}</div>
@@ -233,13 +252,12 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
233
252
  const hasDescription = !!options.description;
234
253
 
235
254
  let tooltip = nothing;
236
- if (this.keyboardTooltipItem && !this.keyboardTooltipShown) {
255
+ if (this._displayKeyboardTooltip) {
237
256
  tooltip = html`
238
257
  <d2l-tooltip
239
258
  class="vdiff-target"
240
259
  align="start"
241
260
  @d2l-tooltip-hide="${this._handleKeyboardTooltipHide}"
242
- @d2l-tooltip-show="${this._handleKeyboardTooltipShow}"
243
261
  for="${this._id}">
244
262
  ${this._renderKeyboardTooltipContent()}
245
263
  </d2l-tooltip>`;
@@ -104,7 +104,6 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
104
104
  this._clearButtonWidth = 0;
105
105
  this._contentReady = false;
106
106
  this._hasResized = false;
107
- this._hasShownKeyboardTooltip = false;
108
107
  this._itemHeight = 0;
109
108
  this._listContainerObserver = null;
110
109
  this._resizeObserver = null;
@@ -196,8 +195,7 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
196
195
  class="${classMap(containerClasses)}"
197
196
  role="group"
198
197
  aria-roledescription="${this.localize('components.tag-list.role-description')}"
199
- @d2l-tag-list-item-clear="${this._handleItemDeleted}"
200
- @d2l-tag-list-item-tooltip-show="${this._handleKeyboardTooltipShown}">
198
+ @d2l-tag-list-item-clear="${this._handleItemDeleted}">
201
199
  <slot @slotchange="${this._handleSlotChange}" @focusout="${this._handleSlotFocusOut}" @focusin="${this._handleSlotFocusIn}"></slot>
202
200
  ${overflowButton}
203
201
  <d2l-button-subtle
@@ -359,10 +357,6 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
359
357
  }, this.clearFocusTimeout);
360
358
  }
361
359
 
362
- _handleKeyboardTooltipShown() {
363
- if (!this._hasShownKeyboardTooltip) this._hasShownKeyboardTooltip = true;
364
- }
365
-
366
360
  async _handleResize() {
367
361
  const refocus = getComposedActiveElement();
368
362
  this._contentReady = false;
@@ -408,7 +402,6 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
408
402
 
409
403
  this._contentReady = true;
410
404
  this._items[0].setAttribute('keyboard-tooltip-item', true);
411
- if (this._hasShownKeyboardTooltip) this._items[0].setAttribute('keyboard-tooltip-shown', true);
412
405
  await this.updateComplete;
413
406
  if (this._refocus?.classList.contains('d2l-tag-list-button')) {
414
407
  this._refocus = this.shadowRoot.querySelector('.d2l-tag-list-button');
@@ -12538,11 +12538,6 @@
12538
12538
  "type": "boolean",
12539
12539
  "default": "false"
12540
12540
  },
12541
- {
12542
- "name": "keyboardTooltipShown",
12543
- "type": "boolean",
12544
- "default": "false"
12545
- },
12546
12541
  {
12547
12542
  "name": "documentLocaleSettings",
12548
12543
  "default": "\"getDocumentLocaleSettings()\""
@@ -12659,11 +12654,6 @@
12659
12654
  "type": "boolean",
12660
12655
  "default": "false"
12661
12656
  },
12662
- {
12663
- "name": "keyboardTooltipShown",
12664
- "type": "boolean",
12665
- "default": "false"
12666
- },
12667
12657
  {
12668
12658
  "name": "documentLocaleSettings",
12669
12659
  "default": "\"getDocumentLocaleSettings()\""
package/lang/ar.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  "components.calendar.show": "إظهار {month}",
8
8
  "components.count-badge.plus": "{number}+",
9
9
  "components.dialog.close": "إغلاق مربع الحوار هذا",
10
- "components.dialog.critical": "Critical!",
10
+ "components.dialog.critical": "مهم!",
11
11
  "components.dropdown.close": "إغلاق",
12
12
  "components.filter.activeFilters": "عوامل تصفية نشطة:",
13
13
  "components.filter.clear": "مسح",
package/lang/cy.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  "components.calendar.show": "Dangos {month}",
8
8
  "components.count-badge.plus": "{number}+",
9
9
  "components.dialog.close": "Cau'r dialog hwn",
10
- "components.dialog.critical": "Critical!",
10
+ "components.dialog.critical": "Critigol!",
11
11
  "components.dropdown.close": "Cau",
12
12
  "components.filter.activeFilters": "Dim Hidlwyr Gweithredol:",
13
13
  "components.filter.clear": "Clirio",
package/lang/da.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  "components.calendar.show": "Vis {month}",
8
8
  "components.count-badge.plus": "{number}+",
9
9
  "components.dialog.close": "Luk denne dialogboks",
10
- "components.dialog.critical": "Critical!",
10
+ "components.dialog.critical": "Kritisk!",
11
11
  "components.dropdown.close": "Luk",
12
12
  "components.filter.activeFilters": "Aktive filtre:",
13
13
  "components.filter.clear": "Ryd",
package/lang/de.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  "components.calendar.show": "{month} anzeigen",
8
8
  "components.count-badge.plus": "{number}+",
9
9
  "components.dialog.close": "Dieses Dialogfeld schließen",
10
- "components.dialog.critical": "Critical!",
10
+ "components.dialog.critical": "Kritisch!",
11
11
  "components.dropdown.close": "Schließen",
12
12
  "components.filter.activeFilters": "Aktive Filter:",
13
13
  "components.filter.clear": "Löschen",
package/lang/es-es.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  "components.calendar.show": "Mostrar {month}",
8
8
  "components.count-badge.plus": "{number}+",
9
9
  "components.dialog.close": "Cerrar este cuadro de diálogo",
10
- "components.dialog.critical": "Critical!",
10
+ "components.dialog.critical": "¡Crítico!",
11
11
  "components.dropdown.close": "Cerrar",
12
12
  "components.filter.activeFilters": "Filtros activos:",
13
13
  "components.filter.clear": "Borrar",
package/lang/es.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  "components.calendar.show": "Mostrar {month}",
8
8
  "components.count-badge.plus": "{number}+",
9
9
  "components.dialog.close": "Cerrar este cuadro de diálogo",
10
- "components.dialog.critical": "Critical!",
10
+ "components.dialog.critical": "¡Crucial!",
11
11
  "components.dropdown.close": "Cerrar",
12
12
  "components.filter.activeFilters": "Filtros activos:",
13
13
  "components.filter.clear": "Borrar",
package/lang/fr-fr.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  "components.calendar.show": "Afficher {month}",
8
8
  "components.count-badge.plus": "{number}+",
9
9
  "components.dialog.close": "Fermer cette boîte de dialogue",
10
- "components.dialog.critical": "Critical!",
10
+ "components.dialog.critical": "Critique !",
11
11
  "components.dropdown.close": "Fermer",
12
12
  "components.filter.activeFilters": "Filtres actifs :",
13
13
  "components.filter.clear": "Effacer",
package/lang/fr.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  "components.calendar.show": "Afficher {month}",
8
8
  "components.count-badge.plus": "{number}+",
9
9
  "components.dialog.close": "Fermer cette boîte de dialogue",
10
- "components.dialog.critical": "Critical!",
10
+ "components.dialog.critical": "Essentiel!",
11
11
  "components.dropdown.close": "Fermer",
12
12
  "components.filter.activeFilters": "Filtres actifs :",
13
13
  "components.filter.clear": "Effacer",
package/lang/hi.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  "components.calendar.show": "{month} दिखाएँ",
8
8
  "components.count-badge.plus": "{number}+",
9
9
  "components.dialog.close": "यह संवाद बंद करें",
10
- "components.dialog.critical": "Critical!",
10
+ "components.dialog.critical": "महत्वपूर्ण!",
11
11
  "components.dropdown.close": "बंद करें",
12
12
  "components.filter.activeFilters": "सक्रिय फ़िल्टर्स:",
13
13
  "components.filter.clear": "साफ़ करें",
package/lang/ja.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  "components.calendar.show": "{month} を表示",
8
8
  "components.count-badge.plus": "{number}+",
9
9
  "components.dialog.close": "このダイアログを閉じる",
10
- "components.dialog.critical": "Critical!",
10
+ "components.dialog.critical": "重大です!",
11
11
  "components.dropdown.close": "閉じる",
12
12
  "components.filter.activeFilters": "アクティブフィルタ:",
13
13
  "components.filter.clear": "クリア",
package/lang/ko.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  "components.calendar.show": "{month} 표시",
8
8
  "components.count-badge.plus": "{number}+",
9
9
  "components.dialog.close": "이 대화 상자 닫기",
10
- "components.dialog.critical": "Critical!",
10
+ "components.dialog.critical": "중요!",
11
11
  "components.dropdown.close": "닫기",
12
12
  "components.filter.activeFilters": "활성 필터:",
13
13
  "components.filter.clear": "지우기",
package/lang/nl.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  "components.calendar.show": "{month} weergeven",
8
8
  "components.count-badge.plus": "{number}+",
9
9
  "components.dialog.close": "Dit dialoogvenster sluiten",
10
- "components.dialog.critical": "Critical!",
10
+ "components.dialog.critical": "Kritiek!",
11
11
  "components.dropdown.close": "Sluiten",
12
12
  "components.filter.activeFilters": "Actieve filters:",
13
13
  "components.filter.clear": "Wissen",
package/lang/pt.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  "components.calendar.show": "Mostrar {month}",
8
8
  "components.count-badge.plus": "{number}+",
9
9
  "components.dialog.close": "Fechar esta caixa de diálogo",
10
- "components.dialog.critical": "Critical!",
10
+ "components.dialog.critical": "Crítico!",
11
11
  "components.dropdown.close": "Fechar",
12
12
  "components.filter.activeFilters": "Filtros ativos:",
13
13
  "components.filter.clear": "Limpar",
package/lang/sv.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  "components.calendar.show": "Visa {month}",
8
8
  "components.count-badge.plus": "{number}+",
9
9
  "components.dialog.close": "Stäng dialogrutan",
10
- "components.dialog.critical": "Critical!",
10
+ "components.dialog.critical": "Viktigt!",
11
11
  "components.dropdown.close": "Stäng",
12
12
  "components.filter.activeFilters": "Aktiva filter:",
13
13
  "components.filter.clear": "Rensa",
package/lang/tr.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  "components.calendar.show": "{month} Göster",
8
8
  "components.count-badge.plus": "{number}+",
9
9
  "components.dialog.close": "Bu iletişim kutusunu kapat",
10
- "components.dialog.critical": "Critical!",
10
+ "components.dialog.critical": "Kritik!",
11
11
  "components.dropdown.close": "Kapat",
12
12
  "components.filter.activeFilters": "Etkin Filtreler:",
13
13
  "components.filter.clear": "Temizle",
package/lang/zh-cn.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  "components.calendar.show": "显示 {month}",
8
8
  "components.count-badge.plus": "{number}+",
9
9
  "components.dialog.close": "关闭此对话框",
10
- "components.dialog.critical": "Critical!",
10
+ "components.dialog.critical": "严重问题!",
11
11
  "components.dropdown.close": "关闭",
12
12
  "components.filter.activeFilters": "活动筛选器:",
13
13
  "components.filter.clear": "清除",
package/lang/zh-tw.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  "components.calendar.show": "顯示{month}",
8
8
  "components.count-badge.plus": "{number}+",
9
9
  "components.dialog.close": "關閉此對話方塊",
10
- "components.dialog.critical": "Critical!",
10
+ "components.dialog.critical": "重大!",
11
11
  "components.dropdown.close": "關閉",
12
12
  "components.filter.activeFilters": "啟用中的篩選器:",
13
13
  "components.filter.clear": "清除",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.182.0",
3
+ "version": "2.183.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",