@brightspace-ui/core 3.5.2 → 3.6.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.
@@ -60,8 +60,11 @@ class ButtonSubtle extends ButtonMixin(LitElement) {
60
60
  return [ labelStyles, buttonStyles,
61
61
  css`
62
62
  :host {
63
+ --d2l-count-badge-background-color: var(--d2l-color-celestine);
64
+ --d2l-count-badge-foreground-color: #ffffff;
63
65
  display: inline-block;
64
66
  }
67
+
65
68
  :host([hidden]) {
66
69
  display: none;
67
70
  }
@@ -103,11 +106,13 @@ class ButtonSubtle extends ButtonMixin(LitElement) {
103
106
  button::-moz-focus-inner {
104
107
  border: 0;
105
108
  }
109
+
106
110
  button[disabled]:hover,
107
111
  button[disabled]:focus,
108
112
  :host([active]) button[disabled] {
109
113
  background-color: transparent;
110
114
  }
115
+
111
116
  button:hover,
112
117
  button:focus,
113
118
  :host([active]) button {
@@ -117,14 +122,24 @@ class ButtonSubtle extends ButtonMixin(LitElement) {
117
122
  .d2l-button-subtle-content {
118
123
  color: var(--d2l-color-celestine);
119
124
  }
125
+
120
126
  button:hover:not([disabled]) .d2l-button-subtle-content,
121
127
  button:focus:not([disabled]) .d2l-button-subtle-content,
122
128
  :host([active]:not([disabled])) button .d2l-button-subtle-content {
123
129
  color: var(--d2l-color-celestine-minus-1);
124
130
  }
131
+
132
+ button:hover:not([disabled]),
133
+ button:focus:not([disabled]),
134
+ :host([active]:not([disabled])) {
135
+ --d2l-count-badge-background-color: var(--d2l-color-celestine-minus-1);
136
+ }
137
+
138
+
125
139
  .d2l-button-subtle-has-icon .d2l-button-subtle-content-wrapper {
126
140
  padding-inline: 1.2rem 0;
127
141
  }
142
+
128
143
  :host([icon-right]) .d2l-button-subtle-has-icon .d2l-button-subtle-content-wrapper {
129
144
  padding-inline: 0 1.2rem;
130
145
  }
@@ -106,26 +106,26 @@ export const CountBadgeMixin = superclass => class extends LocalizeCoreElement(S
106
106
  :host([hidden]) {
107
107
  display: none;
108
108
  }
109
-
109
+
110
110
  :host {
111
111
  display: inline-block;
112
112
  min-width: 0.9rem;
113
113
  }
114
-
114
+
115
115
  .d2l-count-badge-number {
116
116
  font-weight: bold;
117
117
  }
118
-
118
+
119
119
  :host([type="notification"]) .d2l-count-badge-number {
120
120
  background-color: var(--d2l-color-carnelian-minus-1);
121
121
  color: white;
122
122
  }
123
-
123
+
124
124
  :host([type="count"]) .d2l-count-badge-number {
125
- background-color: var(--d2l-color-gypsum);
126
- color: var(--d2l-color-ferrite);
125
+ background-color: var(--d2l-count-badge-background-color, var(--d2l-color-gypsum));
126
+ color: var(--d2l-count-badge-foreground-color, var(--d2l-color-ferrite));
127
127
  }
128
-
128
+
129
129
  :host([size="small"]) .d2l-count-badge-number {
130
130
  border-radius: 0.55rem;
131
131
  font-size: 0.6rem;
@@ -133,7 +133,7 @@ export const CountBadgeMixin = superclass => class extends LocalizeCoreElement(S
133
133
  padding-left: 0.3rem;
134
134
  padding-right: 0.3rem;
135
135
  }
136
-
136
+
137
137
  :host([size="large"]) .d2l-count-badge-number {
138
138
  border-radius: 0.7rem;
139
139
  font-size: 0.8rem;
@@ -203,7 +203,7 @@ export const CountBadgeMixin = superclass => class extends LocalizeCoreElement(S
203
203
  }
204
204
  return html`
205
205
  <div class="d2l-count-badge-number" style=${styleMap(numberStyles)}>
206
- <div aria-hidden="true">${this.getNumberString()}</div>
206
+ <div aria-hidden="true">${this.getNumberString()}</div>
207
207
  </div>
208
208
  `;
209
209
  }
@@ -41,6 +41,19 @@
41
41
  </template>
42
42
  </d2l-demo-snippet>
43
43
 
44
+ <h2>Override Colorway of Count Badge</h2>
45
+ <d2l-demo-snippet>
46
+ <template>
47
+ <d2l-count-badge id="colorway-override" size="large" text="1 new notification." type="count" number="1"></d2l-count-badge>
48
+ <style>
49
+ #colorway-override {
50
+ --d2l-count-badge-background-color: purple;
51
+ --d2l-count-badge-foreground-color: #ffffff;
52
+ }
53
+ </style>
54
+ </template>
55
+ </d2l-demo-snippet>
56
+
44
57
  <h2>Small Notification Badge with Tooltip</h2>
45
58
  <d2l-demo-snippet>
46
59
  <template>
@@ -2,7 +2,7 @@ import '../colors/colors.js';
2
2
  import '../count-badge/count-badge.js';
3
3
  import '../button/button-icon.js';
4
4
  import '../button/button-subtle.js';
5
- import '../dropdown/dropdown-button-subtle.js';
5
+ import '../dropdown/dropdown.js';
6
6
  import '../dropdown/dropdown-content.js';
7
7
  import '../dropdown/dropdown-menu.js';
8
8
  import '../empty-state/empty-state-action-button.js';
@@ -208,7 +208,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
208
208
  }
209
209
 
210
210
  static get focusElementSelector() {
211
- return 'd2l-dropdown-button-subtle';
211
+ return 'd2l-button-subtle';
212
212
  }
213
213
 
214
214
  firstUpdated(changedProperties) {
@@ -228,9 +228,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
228
228
  const header = this._buildHeader(singleDimension);
229
229
  const dimensions = this._buildDimensions(singleDimension);
230
230
 
231
- const filterCount = this._formatFilterCount(this._totalAppliedCount);
232
- let buttonText = singleDimension ? this._dimensions[0].text : (this.text || this.localize('components.filter.filters'));
233
- if (filterCount) buttonText = `${buttonText} (${filterCount})`;
231
+ const buttonText = singleDimension ? this._dimensions[0].text : (this.text || this.localize('components.filter.filters'));
234
232
 
235
233
  let description = singleDimension ? this.localize('components.filter.singleDimensionDescription', { filterName: this._dimensions[0].text }) : this.localize('components.filter.filters');
236
234
  description += `. ${this.localize('components.filter.filterCountDescription', { number: this._totalAppliedCount })}`;
@@ -266,17 +264,34 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
266
264
  </d2l-dropdown-menu>
267
265
  `;
268
266
 
267
+ const countBadgeTemplate = this._totalAppliedCount ?
268
+ html`
269
+ <d2l-count-badge
270
+ aria-hidden="true"
271
+ max-digits="2"
272
+ type="count"
273
+ number="${this._totalAppliedCount}">
274
+ </d2l-count-badge>`
275
+ : nothing;
276
+
269
277
  return html`
270
- <d2l-dropdown-button-subtle
271
- class="vdiff-target"
278
+ <d2l-dropdown
272
279
  @d2l-dropdown-close="${this._handleDropdownClose}"
273
280
  @d2l-dropdown-open="${this._handleDropdownOpen}"
274
281
  @d2l-dropdown-position="${this._stopPropagation}"
275
- text="${buttonText}"
276
- description="${description}"
282
+ class="vdiff-target"
277
283
  ?disabled="${this.disabled}">
284
+ <d2l-button-subtle
285
+ class="d2l-dropdown-opener"
286
+ description="${description}"
287
+ text="${buttonText}"
288
+ icon="tier1:chevron-down"
289
+ icon-right
290
+ ?disabled="${this.disabled}">
291
+ ${countBadgeTemplate}
292
+ </d2l-button-subtle>
278
293
  ${dropdownContent}
279
- </d2l-dropdown-button-subtle>
294
+ </d2l-dropdown>
280
295
  <slot @slotchange="${this._handleSlotChange}"></slot>
281
296
  `;
282
297
  }
@@ -608,12 +623,6 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
608
623
  }
609
624
  }
610
625
 
611
- _formatFilterCount(count) {
612
- if (count === 0) return;
613
- else if (count >= 100) return '99+';
614
- else return `${count}`;
615
- }
616
-
617
626
  _getActiveDimension() {
618
627
  return !this._activeDimensionKey ? this._dimensions[0] : this._getDimensionByKey(this._activeDimensionKey);
619
628
  }
@@ -241,3 +241,4 @@ class MyComponent extends HierarchicalViewMixin(LitElement) {
241
241
  - `d2l-hierarchical-view-show-complete`: dispatched when child view is shown (when animation ends)
242
242
  - `d2l-hierarchical-view-hide-start`: dispatched when child view will be hidden (before animation begins)
243
243
  - `d2l-hierarchical-view-hide-complete`: dispatched when child view is hidden (when animation ends)
244
+ - `d2l-hierarchical-view-resize`: dispatched when child view is resized
@@ -1,6 +1,13 @@
1
1
  import { css, html, LitElement } from 'lit';
2
2
  import { HierarchicalViewMixin } from '../hierarchical-view/hierarchical-view-mixin.js';
3
3
 
4
+ /**
5
+ * @fires d2l-hierarchical-view-show-start - Dispatched when child view will be shown (before animation begins)
6
+ * @fires d2l-hierarchical-view-show-complete - Dispatched when child view is shown (when animation ends)
7
+ * @fires d2l-hierarchical-view-hide-start - Dispatched when child view will be hidden (before animation begins)
8
+ * @fires d2l-hierarchical-view-hide-complete - Dispatched when child view is hidden (when animation ends)
9
+ * @fires d2l-hierarchical-view-resize - Dispatched when child view is resized
10
+ */
4
11
  class HierarchicalView extends HierarchicalViewMixin(LitElement) {
5
12
 
6
13
  static get styles() {
@@ -4564,7 +4564,29 @@
4564
4564
  },
4565
4565
  {
4566
4566
  "name": "d2l-hierarchical-view",
4567
- "path": "./components/hierarchical-view/hierarchical-view.js"
4567
+ "path": "./components/hierarchical-view/hierarchical-view.js",
4568
+ "events": [
4569
+ {
4570
+ "name": "d2l-hierarchical-view-show-start",
4571
+ "description": "Dispatched when child view will be shown (before animation begins)"
4572
+ },
4573
+ {
4574
+ "name": "d2l-hierarchical-view-show-complete",
4575
+ "description": "Dispatched when child view is shown (when animation ends)"
4576
+ },
4577
+ {
4578
+ "name": "d2l-hierarchical-view-hide-start",
4579
+ "description": "Dispatched when child view will be hidden (before animation begins)"
4580
+ },
4581
+ {
4582
+ "name": "d2l-hierarchical-view-hide-complete",
4583
+ "description": "Dispatched when child view is hidden (when animation ends)"
4584
+ },
4585
+ {
4586
+ "name": "d2l-hierarchical-view-resize",
4587
+ "description": "Dispatched when child view is resized"
4588
+ }
4589
+ ]
4568
4590
  },
4569
4591
  {
4570
4592
  "name": "d2l-html-block",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.5.2",
3
+ "version": "3.6.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",