@brightspace-ui/core 2.54.6 → 2.55.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.
@@ -118,6 +118,7 @@ The `d2l-dl-wrapper` component can be combined with `descriptionListStyles` to a
118
118
  | Property | Type | Description | Default Value
119
119
  |---|---|---|---|
120
120
  | `breakpoint` | Number | Width for component to use a stacked layout. | 240 |
121
+ | `force-stacked` | Boolean | Force the component to always use a stacked layout; will override breakpoint attribute | false |
121
122
 
122
123
  <!-- docs: end hidden content -->
123
124
 
@@ -11,6 +11,11 @@ class TestDescriptionList extends LitElement {
11
11
  * @type {number}
12
12
  */
13
13
  breakpoint: { type: Number, reflect: true },
14
+ /**
15
+ * Force the component to always use a stacked layout; will override breakpoint attribute
16
+ * @type {boolean}
17
+ */
18
+ forceStacked: { type: Boolean, reflect: true, attribute: 'force-stacked' },
14
19
  /**
15
20
  * @ignore
16
21
  */
@@ -47,7 +52,10 @@ class TestDescriptionList extends LitElement {
47
52
 
48
53
  render() {
49
54
  return html`
50
- <d2l-dl-wrapper breakpoint="${ifDefined(this.breakpoint)}">
55
+ <d2l-dl-wrapper
56
+ breakpoint="${ifDefined(this.breakpoint)}"
57
+ ?force-stacked="${this.forceStacked}"
58
+ >
51
59
  ${this._renderExample()}
52
60
  </d2l-dl-wrapper>
53
61
  `;
@@ -23,6 +23,11 @@
23
23
  <d2l-test-dl type="long" breakpoint="300"></d2l-test-dl>
24
24
  </d2l-demo-snippet>
25
25
 
26
+ <h2>Stacked</h2>
27
+ <d2l-demo-snippet fullscreen>
28
+ <d2l-test-dl type="long" force-stacked></d2l-test-dl>
29
+ </d2l-demo-snippet>
30
+
26
31
  <h2>Activity Display</h2>
27
32
  <d2l-demo-snippet fullscreen>
28
33
  <d2l-test-dl type="activity-display"></d2l-test-dl>
@@ -41,6 +41,11 @@ class DescriptionListWrapper extends LitElement {
41
41
  * @type {number}
42
42
  */
43
43
  breakpoint: { type: Number, reflect: true },
44
+ /**
45
+ * Force the component to always use a stacked layout; will override breakpoint attribute
46
+ * @type {boolean}
47
+ */
48
+ forceStacked: { type: Boolean, reflect: true, attribute: 'force-stacked' },
44
49
  _stacked: { state: true },
45
50
  };
46
51
  }
@@ -55,7 +60,7 @@ class DescriptionListWrapper extends LitElement {
55
60
  }
56
61
  .stacked {
57
62
  --d2l-dl-wrapper-dl-display: block;
58
- --d2l-dl-wrapper-dt-max-width: unset;
63
+ --d2l-dl-wrapper-dt-max-width: none;
59
64
  --d2l-dl-wrapper-dt-margin: 0 0 0.3rem 0;
60
65
  --d2l-dl-wrapper-dd-margin: 0 0 0.9rem 0;
61
66
  }
@@ -65,18 +70,16 @@ class DescriptionListWrapper extends LitElement {
65
70
  constructor() {
66
71
  super();
67
72
  this.breakpoint = 240;
68
- this._resizeObserver = new ResizeObserver(this._onResize.bind(this));
73
+ this.forceStacked = false;
69
74
  this._stacked = false;
70
75
  }
71
76
 
72
- connectedCallback() {
73
- super.connectedCallback();
74
- this._resizeObserver.observe(this);
75
- }
76
-
77
77
  disconnectedCallback() {
78
78
  super.disconnectedCallback();
79
- this._resizeObserver.disconnect();
79
+
80
+ if (this._resizeObserver) {
81
+ this._resizeObserver.disconnect();
82
+ }
80
83
  }
81
84
 
82
85
  render() {
@@ -86,6 +89,21 @@ class DescriptionListWrapper extends LitElement {
86
89
  return html`<slot class="${classMap(classes)}"></slot>`;
87
90
  }
88
91
 
92
+ updated(changedProperties) {
93
+ if (changedProperties.has('forceStacked')) {
94
+ if (!this.forceStacked) {
95
+ this._resizeObserver = new ResizeObserver(this._onResize.bind(this));
96
+ this._resizeObserver.observe(this);
97
+ } else {
98
+ if (this._resizeObserver) {
99
+ this._resizeObserver.disconnect();
100
+ this._resizeObserver = undefined;
101
+ }
102
+ this._stacked = true;
103
+ }
104
+ }
105
+ }
106
+
89
107
  _onResize(entries) {
90
108
  if (!entries || entries.length === 0) return;
91
109
  const entry = entries[0];
@@ -1473,6 +1473,11 @@
1473
1473
  "name": "breakpoint",
1474
1474
  "description": "Width for component to use a stacked layout",
1475
1475
  "type": "number"
1476
+ },
1477
+ {
1478
+ "name": "force-stacked",
1479
+ "description": "Force the component to always use a stacked layout; will override breakpoint attribute",
1480
+ "type": "boolean"
1476
1481
  }
1477
1482
  ],
1478
1483
  "properties": [
@@ -1482,6 +1487,12 @@
1482
1487
  "description": "Width for component to use a stacked layout",
1483
1488
  "type": "number"
1484
1489
  },
1490
+ {
1491
+ "name": "forceStacked",
1492
+ "attribute": "force-stacked",
1493
+ "description": "Force the component to always use a stacked layout; will override breakpoint attribute",
1494
+ "type": "boolean"
1495
+ },
1485
1496
  {
1486
1497
  "name": "type",
1487
1498
  "type": "string",
@@ -1499,6 +1510,12 @@
1499
1510
  "description": "Width for component to use a stacked layout",
1500
1511
  "type": "number",
1501
1512
  "default": "240"
1513
+ },
1514
+ {
1515
+ "name": "force-stacked",
1516
+ "description": "Force the component to always use a stacked layout; will override breakpoint attribute",
1517
+ "type": "boolean",
1518
+ "default": "false"
1502
1519
  }
1503
1520
  ],
1504
1521
  "properties": [
@@ -1508,6 +1525,13 @@
1508
1525
  "description": "Width for component to use a stacked layout",
1509
1526
  "type": "number",
1510
1527
  "default": "240"
1528
+ },
1529
+ {
1530
+ "name": "forceStacked",
1531
+ "attribute": "force-stacked",
1532
+ "description": "Force the component to always use a stacked layout; will override breakpoint attribute",
1533
+ "type": "boolean",
1534
+ "default": "false"
1511
1535
  }
1512
1536
  ],
1513
1537
  "slots": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.54.6",
3
+ "version": "2.55.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",