@ucd-lib/theme-elements 0.0.12 → 0.0.13

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.
@@ -55,6 +55,22 @@ export default class UcdThemeBrandTextbox extends LitElement {
55
55
  return out;
56
56
  }
57
57
 
58
+ /**
59
+ * @method _onSlotchange
60
+ * @param {Event} e
61
+ * @description fires when a slot value changes.
62
+ * assigns category-brand__background class so that slotted children are correct color
63
+ * @private
64
+ */
65
+ _onSlotchange(e){
66
+ const childNodes = e.target.assignedNodes({flatten: true});
67
+ childNodes.forEach(child => {
68
+ if ( child.nodeType === Node.ELEMENT_NODE ){
69
+ child.classList.add('category-brand__background');
70
+ }
71
+ });
72
+ }
73
+
58
74
  }
59
75
 
60
76
  customElements.define('ucd-theme-brand-textbox', UcdThemeBrandTextbox);
@@ -35,7 +35,7 @@ export function render() {
35
35
  return html`
36
36
  <section class=${classMap(this._getBaseClasses())}>
37
37
  <div class="brand-textbox__content">
38
- <slot></slot>
38
+ <slot @slotchange=${this._onSlotchange}></slot>
39
39
  </div>
40
40
  <button
41
41
  class="brand-textbox__button"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucd-lib/theme-elements",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "Custom elements for the UCD brand theme",
5
5
  "main": "index.js",
6
6
  "scripts": {