@nys-cui/cui-section 0.2.17 → 0.2.18

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/section.js +14 -5
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.17",
9
+ "version": "0.2.18",
10
10
  "scripts": {
11
11
  "clean": "rm -rf ./dist",
12
12
  "build": "npm run clean && cui --dep",
package/src/section.js CHANGED
@@ -31,8 +31,8 @@ export default class CUI_SECTION extends HTMLElement {
31
31
  "hideControls": "bHideControls",
32
32
  "collapsed": "bCollapsed",
33
33
  "styles": "asStyles",
34
- "label": "sTitle"
35
-
34
+ "label": "sTitle",
35
+ "instructions": "oInstructions"
36
36
  }
37
37
  }
38
38
 
@@ -201,9 +201,10 @@ export default class CUI_SECTION extends HTMLElement {
201
201
 
202
202
  this.state = {
203
203
  sTitle: this.state.sTitle || this.getAttribute('sectiontitle') || "SECTION TITLE",
204
- bHideControls: this.hasAttribute("hideControls") ? true : false,
205
- bCollapsed: (this.getAttribute('collapsed') === "true") ? true : false,
206
- asStyles: (this.getAttribute('styles')) ? this.getAttribute('styles').split(',') : null
204
+ bHideControls: this.state.bHideControls || this.hasAttribute("hideControls") ? true : false,
205
+ bCollapsed: this.state.bCollapsed || (this.getAttribute('collapsed') === "true") ? true : false,
206
+ asStyles: this.state.asStyles || (this.getAttribute('styles')) ? this.getAttribute('styles').split(',') : null,
207
+ oInstructions: this.state.oInstructions || null
207
208
  }
208
209
 
209
210
  this.sIconBasePath = this.getAttribute('iconbase') || null;
@@ -290,6 +291,14 @@ export default class CUI_SECTION extends HTMLElement {
290
291
  })
291
292
  })
292
293
 
294
+ if(this.state.oInstructions && (this.state.oInstructions.text || this.state.oInstructions.html)) {
295
+ let dSectionInstructions = document.createElement("div");
296
+ dSectionInstructions.innerHTML = this.state.oInstructions.html || this.state.oInstructions.text;
297
+ dSectionInstructions.classList.add("section-instructions");
298
+ dSectionInstructions.setAttribute('slot', 'section-text');
299
+ this.appendChild(dSectionInstructions);
300
+ }
301
+
293
302
  }
294
303
 
295
304
  get messages() {