@nys-cui/cui-section 0.2.7 → 0.2.9

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.
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "main": "./dist/js/section.js",
8
8
  "type": "module",
9
- "version": "0.2.7",
9
+ "version": "0.2.9",
10
10
  "scripts": {
11
11
  "clean": "rm -rf ./dist",
12
12
  "build": "npm run clean && cui --dep",
package/src/section.js CHANGED
@@ -97,6 +97,8 @@ export default class CUI_SECTION extends HTMLElement {
97
97
  dContainer.style.height = sectionHeight + 'px';
98
98
  dContainer.style.overflow = "hidden";
99
99
 
100
+ this.sdSection.style.removeProperty('height');
101
+
100
102
  // when the next css transition finishes (which should be the one we just triggered)
101
103
  dContainer.addEventListener('transitionend', transitionEnd, true);
102
104
 
@@ -126,6 +128,15 @@ export default class CUI_SECTION extends HTMLElement {
126
128
  var dContainerTransition = dContainer.style.transition;
127
129
  dContainer.style.transition = '';
128
130
 
131
+ let sdSection = this.sdSection;
132
+
133
+ //sdSection.style.transition = '';
134
+ let header = sdSection.querySelector("header");
135
+ let headerStyle = getComputedStyle(header);
136
+ let sectionStyle = getComputedStyle(sdSection);
137
+ let collapseSectionHeight = header.offsetHeight + parseInt(headerStyle.marginBottom) + parseInt(headerStyle.marginTop);
138
+ collapseSectionHeight += parseInt(sectionStyle.borderBottom) + parseInt(sectionStyle.borderTop);
139
+
129
140
  // on the next frame (as soon as the previous style change has taken effect),
130
141
  // explicitly set the dContainer's height to its current pixel height, so we
131
142
  // aren't transitioning out of 'auto'
@@ -134,12 +145,16 @@ export default class CUI_SECTION extends HTMLElement {
134
145
  dContainer.style.transition = dContainerTransition;
135
146
  dContainer.style.overflow = "hidden";
136
147
 
148
+ sdSection.style.setProperty("height", sdSection.offsetHeight + 'px', "important");
149
+
137
150
  // on the next frame (as soon as the previous style change has taken effect),
138
151
  // have the dContainer transition to height: 0
139
152
  requestAnimationFrame(function () {
140
153
 
141
154
  dContainer.style.height = 0 + 'px';
142
155
 
156
+ sdSection.style.setProperty("height", collapseSectionHeight + 'px', "important");
157
+
143
158
  dContainer.addEventListener('transitionend', transitionEnd, true);
144
159
 
145
160
  });
@@ -190,6 +205,7 @@ export default class CUI_SECTION extends HTMLElement {
190
205
 
191
206
  this.sdSectionCollapseControl.classList.add('collapsed');
192
207
  this.sdContentsContainer.setAttribute('data-collapsed', "true");
208
+ this.sdSection.style.setProperty("height", 'auto', "important");
193
209
  }
194
210
 
195
211
  this.sdSectionCollapseControl.addEventListener('click', () => {
@@ -259,24 +275,4 @@ export default class CUI_SECTION extends HTMLElement {
259
275
  }
260
276
  }
261
277
 
262
- setMessages(aoMessages) {
263
- for (let i = 0; i < aoMessages.length; i++) {
264
- if (this.messages) {
265
- this.messages.add(aoMessages[i]);
266
- }
267
- }
268
- }
269
-
270
- removeMessages() {
271
- this.messages.removeAll();
272
- }
273
-
274
- removeMessage(id) {
275
- this.messages.removeMessageWithId(id);
276
- }
277
-
278
- removeMessageIndex(index) {
279
- this.messages.removeMessageAtIndex(index);
280
- }
281
-
282
278
  }
package/src/section.scss CHANGED
@@ -89,6 +89,7 @@
89
89
  section {
90
90
  border: 1px solid var(--section-header-border-color);
91
91
  box-shadow: none;
92
+ transition: height 0.5s ease;
92
93
 
93
94
  header {
94
95
  margin: 0 0 20px;