@brightspace-ui/core 2.130.0 → 2.131.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.
@@ -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>
@@ -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
  {
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.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",
@@ -45,7 +45,7 @@
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
50
  "@open-wc/testing": "^3",
51
51
  "@rollup/plugin-dynamic-import-vars": "^2",