@brightspace-ui/core 2.130.0 → 2.131.1

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.
@@ -463,8 +463,7 @@ class Calendar extends LocalizeCoreElement(RtlMixin(LitElement)) {
463
463
  const month = day.getMonth();
464
464
  const date = day.getDate();
465
465
  const weekday = calendarData.descriptor.calendar.days.long[calendarData.daysOfWeekIndex[index]];
466
- const description = `${weekday} ${date}. ${selected ? this.localize(`${this._namespace}.selected`) : this.localize(`${this._namespace}.notSelected`)} ${formatDate(day, { format: 'monthYear' })}`;
467
- // role="gridcell" used for screen reader (e.g., JAWS and VoiceOver) behavior to work properly
466
+ const description = `${weekday} ${date} ${formatDate(day, { format: 'monthYear' })}`;
468
467
  return html`
469
468
  <td
470
469
  aria-selected="${selected ? 'true' : 'false'}"
@@ -519,7 +518,7 @@ class Calendar extends LocalizeCoreElement(RtlMixin(LitElement)) {
519
518
  icon="tier1:chevron-right">
520
519
  </d2l-button-icon>
521
520
  </div>
522
- <table aria-labelledby="${labelId}" role="presentation">
521
+ <table aria-labelledby="${labelId}">
523
522
  ${summary}
524
523
  <thead aria-hidden="true">
525
524
  <tr>${weekdayHeaders}</tr>
@@ -9,13 +9,20 @@ import { offscreenStyles } from '../offscreen/offscreen.js';
9
9
  import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
10
10
  import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
11
11
 
12
- const normalizeHeadingNumber = (number) => {
12
+ const normalizeHeadingStyle = (number) => {
13
13
  number = parseInt(number);
14
14
  if (number < 1) { return 1; }
15
15
  if (number > 4) { return 4; }
16
16
  return number;
17
17
  };
18
18
 
19
+ const normalizeHeadingLevel = (number) => {
20
+ number = parseInt(number);
21
+ if (number < 1) { return 1; }
22
+ if (number > 6) { return 6; }
23
+ return number;
24
+ };
25
+
19
26
  const defaultHeading = 3;
20
27
 
21
28
  /**
@@ -38,8 +45,8 @@ class CollapsiblePanel extends SkeletonMixin(FocusMixin(RtlMixin(LitElement))) {
38
45
  */
39
46
  panelTitle: { attribute: 'panel-title', type: String, reflect: true },
40
47
  /**
41
- * The semantic heading level (h1-h4)
42
- * @type {'1'|'2'|'3'|'4'}
48
+ * The semantic heading level (h1-h6)
49
+ * @type {'1'|'2'|'3'|'4'|'5'|'6'}
43
50
  * @default "3"
44
51
  */
45
52
  headingLevel: { attribute: 'heading-level', type: String, reflect: true },
@@ -453,7 +460,7 @@ class CollapsiblePanel extends SkeletonMixin(FocusMixin(RtlMixin(LitElement))) {
453
460
 
454
461
  _renderPanelTitle() {
455
462
  let headingStyle = (this.headingStyle === defaultHeading && this.headingLevel !== this.headingStyle) ? this.headingLevel : this.headingStyle;
456
- headingStyle = normalizeHeadingNumber(headingStyle);
463
+ headingStyle = normalizeHeadingStyle(headingStyle);
457
464
 
458
465
  const titleClasses = {
459
466
  'd2l-collapsible-panel-title': true,
@@ -461,12 +468,14 @@ class CollapsiblePanel extends SkeletonMixin(FocusMixin(RtlMixin(LitElement))) {
461
468
  [`d2l-heading-${headingStyle}`]: true,
462
469
  };
463
470
 
464
- const headingLevel = normalizeHeadingNumber(this.headingLevel);
471
+ const headingLevel = normalizeHeadingLevel(this.headingLevel);
465
472
  switch (headingLevel) {
466
473
  case 1: return html`<h1 class="${classMap(titleClasses)}">${this.panelTitle}</h1>`;
467
474
  case 2: return html`<h2 class="${classMap(titleClasses)}">${this.panelTitle}</h2>`;
468
475
  case 3: return html`<h3 class="${classMap(titleClasses)}">${this.panelTitle}</h3>`;
469
476
  case 4: return html`<h4 class="${classMap(titleClasses)}">${this.panelTitle}</h4>`;
477
+ case 5: return html`<h5 class="${classMap(titleClasses)}">${this.panelTitle}</h5>`;
478
+ case 6: return html`<h6 class="${classMap(titleClasses)}">${this.panelTitle}</h6>`;
470
479
  }
471
480
  }
472
481
 
@@ -153,7 +153,8 @@
153
153
  </d2l-demo-snippet>
154
154
 
155
155
  <h2>Headings</h2>
156
- <d2l-demo-snippet class="spacer">
156
+ <d2l-demo-snippet>
157
+ <d2l-collapsible-panel-group>
157
158
  <d2l-collapsible-panel heading-level="1" panel-title="Heading Level 1">
158
159
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas odio ligula, aliquam efficitur sollicitudin non, dignissim quis nisl. Nullam rutrum, lectus sed finibus consectetur, dolor leo blandit lorem, vitae consectetur arcu enim ornare tortor.
159
160
  </d2l-collapsible-panel>
@@ -170,6 +171,14 @@
170
171
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas odio ligula, aliquam efficitur sollicitudin non, dignissim quis nisl. Nullam rutrum, lectus sed finibus consectetur, dolor leo blandit lorem, vitae consectetur arcu enim ornare tortor.
171
172
  </d2l-collapsible-panel>
172
173
 
174
+ <d2l-collapsible-panel heading-level="5" panel-title="Heading Level 5">
175
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas odio ligula, aliquam efficitur sollicitudin non, dignissim quis nisl. Nullam rutrum, lectus sed finibus consectetur, dolor leo blandit lorem, vitae consectetur arcu enim ornare tortor.
176
+ </d2l-collapsible-panel>
177
+
178
+ <d2l-collapsible-panel heading-level="6" panel-title="Heading Level 6">
179
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas odio ligula, aliquam efficitur sollicitudin non, dignissim quis nisl. Nullam rutrum, lectus sed finibus consectetur, dolor leo blandit lorem, vitae consectetur arcu enim ornare tortor.
180
+ </d2l-collapsible-panel>
181
+
173
182
  <d2l-collapsible-panel heading-style="2" panel-title="Heading Style 2">
174
183
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas odio ligula, aliquam efficitur sollicitudin non, dignissim quis nisl. Nullam rutrum, lectus sed finibus consectetur, dolor leo blandit lorem, vitae consectetur arcu enim ornare tortor.
175
184
  </d2l-collapsible-panel>
@@ -177,6 +186,7 @@
177
186
  <d2l-collapsible-panel heading-style="4" heading-level="2" panel-title="Heading Style 4">
178
187
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas odio ligula, aliquam efficitur sollicitudin non, dignissim quis nisl. Nullam rutrum, lectus sed finibus consectetur, dolor leo blandit lorem, vitae consectetur arcu enim ornare tortor.
179
188
  </d2l-collapsible-panel>
189
+ </d2l-collapsible-panel-group>
180
190
  </d2l-demo-snippet>
181
191
 
182
192
  <h2>Loooooong</h2>
@@ -11,7 +11,6 @@ import { styleMap } from 'lit/directives/style-map.js';
11
11
  /**
12
12
  * A component used to minimize the display of long content, while providing a way to reveal the full content.
13
13
  * @slot - Default content placed inside of the component
14
- * @fires d2l-more-less-render - Dispatched when the component finishes rendering
15
14
  */
16
15
  class MoreLess extends LocalizeCoreElement(LitElement) {
17
16
 
@@ -147,12 +146,6 @@ class MoreLess extends LocalizeCoreElement(LitElement) {
147
146
  }
148
147
 
149
148
  render() {
150
- requestAnimationFrame(
151
- () => this.dispatchEvent(new CustomEvent('d2l-more-less-render', {
152
- bubbles: false,
153
- composed: false
154
- }))
155
- );
156
149
  const contentClasses = {
157
150
  'd2l-more-less-content': true,
158
151
  'd2l-more-less-transition': this.__transitionAdded
@@ -1215,8 +1215,8 @@
1215
1215
  },
1216
1216
  {
1217
1217
  "name": "heading-level",
1218
- "description": "The semantic heading level (h1-h4)",
1219
- "type": "'1'|'2'|'3'|'4'",
1218
+ "description": "The semantic heading level (h1-h6)",
1219
+ "type": "'1'|'2'|'3'|'4'|'5'|'6'",
1220
1220
  "default": "\"\\\"3\\\"\""
1221
1221
  },
1222
1222
  {
@@ -1273,8 +1273,8 @@
1273
1273
  {
1274
1274
  "name": "headingLevel",
1275
1275
  "attribute": "heading-level",
1276
- "description": "The semantic heading level (h1-h4)",
1277
- "type": "'1'|'2'|'3'|'4'",
1276
+ "description": "The semantic heading level (h1-h6)",
1277
+ "type": "'1'|'2'|'3'|'4'|'5'|'6'",
1278
1278
  "default": "\"\\\"3\\\"\""
1279
1279
  },
1280
1280
  {
@@ -9875,12 +9875,6 @@
9875
9875
  "default": "\"getDocumentLocaleSettings()\""
9876
9876
  }
9877
9877
  ],
9878
- "events": [
9879
- {
9880
- "name": "d2l-more-less-render",
9881
- "description": "Dispatched when the component finishes rendering"
9882
- }
9883
- ],
9884
9878
  "slots": [
9885
9879
  {
9886
9880
  "name": "",
@@ -126,6 +126,16 @@ export const LabelledMixin = superclass => class extends superclass {
126
126
 
127
127
  }
128
128
 
129
+ _dispatchChangeEvent() {
130
+ /** @ignore */
131
+ this.dispatchEvent(new CustomEvent(
132
+ 'd2l-labelled-mixin-label-change', {
133
+ bubbles: false,
134
+ composed: false
135
+ }
136
+ ));
137
+ }
138
+
129
139
  _throwError(err) {
130
140
  if (!this.labelRequired || this._missingLabelErrorHasBeenThrown) return;
131
141
  this._missingLabelErrorHasBeenThrown = true;
@@ -134,9 +144,14 @@ export const LabelledMixin = superclass => class extends superclass {
134
144
 
135
145
  _updateLabelElem(labelElem) {
136
146
 
147
+ const oldLabelVal = this.label;
148
+
137
149
  // setting textContent doesn't change labelElem but we do need to refetch the label
138
150
  if (labelElem === this._labelElem && this._labelElem) {
139
151
  this.label = getLabel(this._labelElem);
152
+ if (oldLabelVal !== this.label) {
153
+ this._dispatchChangeEvent();
154
+ }
140
155
  return;
141
156
  }
142
157
 
@@ -180,13 +195,9 @@ export const LabelledMixin = superclass => class extends superclass {
180
195
  }
181
196
 
182
197
  this.label = getLabel(this._labelElem);
183
- /** @ignore */
184
- this.dispatchEvent(new CustomEvent(
185
- 'd2l-labelled-mixin-label-elem-change', {
186
- bubbles: false,
187
- composed: false
188
- }
189
- ));
198
+ if (oldLabelVal !== this.label) {
199
+ this._dispatchChangeEvent();
200
+ }
190
201
 
191
202
  }
192
203
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.130.0",
3
+ "version": "2.131.1",
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",
@@ -45,9 +45,8 @@
45
45
  "devDependencies": {
46
46
  "@babel/eslint-parser": "^7",
47
47
  "@brightspace-ui/stylelint-config": "^0.8",
48
- "@brightspace-ui/testing": "^0.7",
48
+ "@brightspace-ui/testing": "^0.9",
49
49
  "@open-wc/semantic-dom-diff": "^0.20",
50
- "@open-wc/testing": "^3",
51
50
  "@rollup/plugin-dynamic-import-vars": "^2",
52
51
  "@rollup/plugin-node-resolve": "^15",
53
52
  "@rollup/plugin-replace": "^5",
@@ -1,4 +1,4 @@
1
- import { expect } from '@open-wc/testing';
1
+ import { expect } from '@brightspace-ui/testing';
2
2
 
3
3
  export function runConstructor(nodeName) {
4
4
  const ctor = customElements.get(nodeName);