@brightspace-ui/core 2.117.0 → 2.117.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.
@@ -115,6 +115,7 @@ The `d2l-collapsible-panel` element is a container that provides specific layout
115
115
 
116
116
  | Slot | Type | Description |
117
117
  |--|--|--|
118
+ | `before` | optional | Slot for content to be placed at the left side of the header, aligned with the title and header slot |
118
119
  | `header` | optional | Supporting header content |
119
120
  | `actions` | optional | Buttons and dropdown openers to be placed in top right corner of header |
120
121
  | `summary` | optional | Summary of the expanded content. Only accepts `d2l-collapsible-panel-summary-item` |
@@ -132,6 +133,7 @@ The `d2l-collapsible-panel` element is a container that provides specific layout
132
133
  | `no-sticky` | Boolean | Disables sticky positioning for the header |
133
134
  | `padding-type` | String | Optionally set horizontal padding of inline panels |
134
135
  | `panel-title` | String | The title of the panel |
136
+ | `skeleton` | Boolean | Renders the panel title and the expand/collapse icon as skeleton loaders |
135
137
  | `type` | String | The type of collapsible panel |
136
138
  <!-- docs: end hidden content -->
137
139
 
@@ -20,8 +20,8 @@ const defaultHeading = 3;
20
20
 
21
21
  /**
22
22
  * A container with a title that can be expanded/collapsed to show/hide content.
23
- * @slot header - Slot for supporting header content
24
23
  * @slot before - Slot for content to be placed at the left side of the header, aligned with the title and header slot
24
+ * @slot header - Slot for supporting header content
25
25
  * @slot summary - Slot for the summary of the expanded content. Only accepts `d2l-collapsible-panel-summary-item`
26
26
  * @slot default - Slot for the expanded content
27
27
  * @slot actions - Slot for buttons and dropdown openers to be placed in top right corner of header
@@ -24,6 +24,7 @@
24
24
  <d2l-demo-snippet>
25
25
  <template>
26
26
  <d2l-tabs>
27
+ <d2l-tab-panel text="All">Tab content for All</d2l-tab-panel>
27
28
  <d2l-tab-panel text="Biology">Tab content for Biology</d2l-tab-panel>
28
29
  <d2l-tab-panel text="Chemistry">Tab content for Chemistry</d2l-tab-panel>
29
30
  <d2l-tab-panel text="Earth &amp; Planetary Sciences">Tab content for Earth &amp; Planetary Sciences</d2l-tab-panel>
@@ -39,6 +40,7 @@
39
40
  <d2l-button-subtle id="add" text="Add"></d2l-button-subtle>
40
41
  <d2l-button-subtle id="add-selected" text="Add Selected"></d2l-button-subtle>
41
42
  <d2l-button-subtle id="remove" text="Remove"></d2l-button-subtle>
43
+ <d2l-button-subtle id="remove-multiple" text="Remove Multiple"></d2l-button-subtle>
42
44
  </div>
43
45
  <script>
44
46
  let newPanelId = 0;
@@ -58,10 +60,20 @@
58
60
  if (panels.length === 1) tabs.removeChild(panels[0]);
59
61
  else tabs.removeChild(panels[1]);
60
62
  };
63
+ const removePanels = (tabs) => {
64
+ const panels = [...tabs.querySelectorAll('d2l-tab-panel')];
65
+ if (panels.length === 0) return;
66
+ if (panels.length === 1) tabs.removeChild(panels[0]);
67
+ else {
68
+ tabs.removeChild(panels[1]);
69
+ tabs.removeChild(panels[0]);
70
+ }
71
+ };
61
72
 
62
73
  document.querySelector('#add').addEventListener('click', () => addPanel(false, document.querySelector('#withSlot').querySelector('d2l-tabs')));
63
74
  document.querySelector('#add-selected').addEventListener('click', () => addPanel(true, document.querySelector('#withSlot').querySelector('d2l-tabs')));
64
75
  document.querySelector('#remove').addEventListener('click', () => removePanel(document.querySelector('#withSlot').querySelector('d2l-tabs')));
76
+ document.querySelector('#remove-multiple').addEventListener('click', () => removePanels(document.querySelector('#withSlot').querySelector('d2l-tabs')));
65
77
  </script>
66
78
 
67
79
  <d2l-demo-snippet id="withSlot">
@@ -611,6 +611,7 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(SkeletonMixin(RtlMixin(Lit
611
611
  // if a tab was removed, include old info to animate it away
612
612
  if (newTabInfos.findIndex(newInfo => newInfo.id === info.id) === -1) {
613
613
  info.state = 'removing';
614
+ info.selected = false;
614
615
  newTabInfos.splice(index, 0, info);
615
616
  }
616
617
  });
@@ -618,9 +619,11 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(SkeletonMixin(RtlMixin(Lit
618
619
  this._tabInfos = newTabInfos;
619
620
 
620
621
  if (this._tabInfos.length > 0 && !selectedTabInfo) {
621
- this._tabInfos[0].activeFocusable = true;
622
- this._tabInfos[0].selected = true;
623
- selectedTabInfo = this._tabInfos[0];
622
+ selectedTabInfo = this._tabInfos.find(tabInfo => tabInfo.state !== 'removing');
623
+ if (selectedTabInfo) {
624
+ selectedTabInfo.activeFocusable = true;
625
+ selectedTabInfo.selected = true;
626
+ }
624
627
  }
625
628
 
626
629
  await this.updateComplete;
@@ -1313,14 +1313,14 @@
1313
1313
  }
1314
1314
  ],
1315
1315
  "slots": [
1316
- {
1317
- "name": "header",
1318
- "description": "Slot for supporting header content"
1319
- },
1320
1316
  {
1321
1317
  "name": "before",
1322
1318
  "description": "Slot for content to be placed at the left side of the header, aligned with the title and header slot"
1323
1319
  },
1320
+ {
1321
+ "name": "header",
1322
+ "description": "Slot for supporting header content"
1323
+ },
1324
1324
  {
1325
1325
  "name": "summary",
1326
1326
  "description": "Slot for the summary of the expanded content. Only accepts `d2l-collapsible-panel-summary-item`"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.117.0",
3
+ "version": "2.117.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",