@nys-cui/cui-section 0.2.16 → 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 +15 -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.16",
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
@@ -30,8 +30,9 @@ export default class CUI_SECTION extends HTMLElement {
30
30
  "sectiontitle": "sTitle",
31
31
  "hideControls": "bHideControls",
32
32
  "collapsed": "bCollapsed",
33
- "styles": "asStyles"
34
-
33
+ "styles": "asStyles",
34
+ "label": "sTitle",
35
+ "instructions": "oInstructions"
35
36
  }
36
37
  }
37
38
 
@@ -200,9 +201,10 @@ export default class CUI_SECTION extends HTMLElement {
200
201
 
201
202
  this.state = {
202
203
  sTitle: this.state.sTitle || this.getAttribute('sectiontitle') || "SECTION TITLE",
203
- bHideControls: this.hasAttribute("hideControls") ? true : false,
204
- bCollapsed: (this.getAttribute('collapsed') === "true") ? true : false,
205
- 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
206
208
  }
207
209
 
208
210
  this.sIconBasePath = this.getAttribute('iconbase') || null;
@@ -289,6 +291,14 @@ export default class CUI_SECTION extends HTMLElement {
289
291
  })
290
292
  })
291
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
+
292
302
  }
293
303
 
294
304
  get messages() {