@everymatrix/helper-accordion 1.87.26 → 1.87.27

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.
@@ -35,6 +35,8 @@ const getTranslations = (data) => {
35
35
  });
36
36
  };
37
37
 
38
+ const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
39
+
38
40
  /**
39
41
  * @name setClientStyling
40
42
  * @description Method used to create and append to the passed element of the widget a style element with the content received
@@ -80,18 +82,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
80
82
  * @param {HTMLElement} stylingContainer The highest element of the widget
81
83
  * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
82
84
  * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
85
+ * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
83
86
  */
84
- function setStreamStyling(stylingContainer, domain, subscription) {
85
- if (window.emMessageBus) {
86
- const sheet = document.createElement('style');
87
+ function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
88
+ if (!window.emMessageBus) return;
87
89
 
88
- window.emMessageBus.subscribe(domain, (data) => {
89
- sheet.innerHTML = data;
90
- if (stylingContainer) {
91
- stylingContainer.appendChild(sheet);
92
- }
93
- });
90
+ const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
91
+
92
+ if (!supportAdoptStyle || !useAdoptedStyleSheets) {
93
+ subscription = getStyleTagSubscription(stylingContainer, domain);
94
+
95
+ return subscription;
96
+ }
97
+
98
+ if (!window[StyleCacheKey]) {
99
+ window[StyleCacheKey] = {};
94
100
  }
101
+ subscription = getAdoptStyleSubscription(stylingContainer, domain);
102
+
103
+ const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
104
+ const wrappedUnsubscribe = () => {
105
+ if (window[StyleCacheKey][domain]) {
106
+ const cachedObject = window[StyleCacheKey][domain];
107
+ cachedObject.refCount > 1
108
+ ? (cachedObject.refCount = cachedObject.refCount - 1)
109
+ : delete window[StyleCacheKey][domain];
110
+ }
111
+
112
+ originalUnsubscribe();
113
+ };
114
+ subscription.unsubscribe = wrappedUnsubscribe;
115
+
116
+ return subscription;
117
+ }
118
+
119
+ function getStyleTagSubscription(stylingContainer, domain) {
120
+ const sheet = document.createElement('style');
121
+
122
+ return window.emMessageBus.subscribe(domain, (data) => {
123
+ if (stylingContainer) {
124
+ sheet.innerHTML = data;
125
+ stylingContainer.appendChild(sheet);
126
+ }
127
+ });
128
+ }
129
+
130
+ function getAdoptStyleSubscription(stylingContainer, domain) {
131
+ return window.emMessageBus.subscribe(domain, (data) => {
132
+ if (!stylingContainer) return;
133
+
134
+ const shadowRoot = stylingContainer.getRootNode();
135
+ const cacheStyleObject = window[StyleCacheKey];
136
+ let cachedStyle = cacheStyleObject[domain]?.sheet;
137
+
138
+ if (!cachedStyle) {
139
+ cachedStyle = new CSSStyleSheet();
140
+ cachedStyle.replaceSync(data);
141
+ cacheStyleObject[domain] = {
142
+ sheet: cachedStyle,
143
+ refCount: 1
144
+ };
145
+ } else {
146
+ cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
147
+ }
148
+
149
+ const currentSheets = shadowRoot.adoptedStyleSheets || [];
150
+ if (!currentSheets.includes(cachedStyle)) {
151
+ shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
152
+ }
153
+ });
95
154
  }
96
155
 
97
156
  const helperAccordionCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Header{border-radius:5px;background:var(--emw--color-primary, #009993);display:flex;gap:30px;border:1px solid var(--emw--color-primary, #009993);padding:8px 10px;user-select:none;margin-bottom:1px;cursor:pointer}.Header:hover{background:var(--emw--color-secondary, #00aba4)}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:var(--emw--color-typography-inverse, rgb(255, 255, 255));text-transform:capitalize}.Header .Expand{margin-left:auto;color:var(--emw--color-typography-inverse, rgb(255, 255, 255));width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.HeaderTicketHistory{border-radius:4px;background:var(--emw--color-background, #fff);display:flex;gap:30px;border:1px solid var(--emw--color-primary, #009993);padding:8px 10px;user-select:none;margin-bottom:5px;cursor:pointer}.HeaderTicketHistory:hover{background:var(--emw--color-secondary, #00aba4)}.HeaderTicketHistory .Title,.HeaderTicketHistory .Subtitle,.HeaderTicketHistory .Description{margin:0;font-size:14px;color:var(--emw--color-typography, #000)}.HeaderTicketHistory .Expand{margin-left:auto;color:var(--emw--color-typography-inverse, rgb(255, 255, 255));width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:0 0 4px 4px;background:var(--emw--color-background, #fff);border:1px solid var(--emw--color-primary, #009993);padding:10px 15px;user-select:none;color:var(--emw--color-typography, #000);margin-bottom:10px}.ActionButton{cursor:pointer;display:inline-block;border-radius:var(--emw--button-border-radius, 4px);margin:20px 0 10px;text-transform:uppercase;font-size:12px;text-align:center;padding:8px 20px;min-width:80px;background:var(--emw--color-error, #ff3d00);border:1px solid var(--emw--color-error, #ff3d00);color:var(--emw--color-background, #fff)}.ActionButton:hover{background:var(--emw--color-secondary, #ff6536);border:1px solid var(--emw--color-error, #ff3d00)}";
@@ -130,13 +189,13 @@ const HelperAccordion = class {
130
189
  }
131
190
  handleMbSourceChange(newValue, oldValue) {
132
191
  if (newValue != oldValue) {
133
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
192
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
134
193
  }
135
194
  }
136
195
  componentDidLoad() {
137
196
  if (this.stylingContainer) {
138
197
  if (this.mbSource)
139
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
198
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
140
199
  if (this.clientStyling)
141
200
  setClientStyling(this.stylingContainer, this.clientStyling);
142
201
  if (this.clientStylingUrl)
@@ -31,6 +31,8 @@ const getTranslations = (data) => {
31
31
  });
32
32
  };
33
33
 
34
+ const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
35
+
34
36
  /**
35
37
  * @name setClientStyling
36
38
  * @description Method used to create and append to the passed element of the widget a style element with the content received
@@ -76,18 +78,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
76
78
  * @param {HTMLElement} stylingContainer The highest element of the widget
77
79
  * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
78
80
  * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
81
+ * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
79
82
  */
80
- function setStreamStyling(stylingContainer, domain, subscription) {
81
- if (window.emMessageBus) {
82
- const sheet = document.createElement('style');
83
+ function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
84
+ if (!window.emMessageBus) return;
83
85
 
84
- window.emMessageBus.subscribe(domain, (data) => {
85
- sheet.innerHTML = data;
86
- if (stylingContainer) {
87
- stylingContainer.appendChild(sheet);
88
- }
89
- });
86
+ const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
87
+
88
+ if (!supportAdoptStyle || !useAdoptedStyleSheets) {
89
+ subscription = getStyleTagSubscription(stylingContainer, domain);
90
+
91
+ return subscription;
92
+ }
93
+
94
+ if (!window[StyleCacheKey]) {
95
+ window[StyleCacheKey] = {};
90
96
  }
97
+ subscription = getAdoptStyleSubscription(stylingContainer, domain);
98
+
99
+ const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
100
+ const wrappedUnsubscribe = () => {
101
+ if (window[StyleCacheKey][domain]) {
102
+ const cachedObject = window[StyleCacheKey][domain];
103
+ cachedObject.refCount > 1
104
+ ? (cachedObject.refCount = cachedObject.refCount - 1)
105
+ : delete window[StyleCacheKey][domain];
106
+ }
107
+
108
+ originalUnsubscribe();
109
+ };
110
+ subscription.unsubscribe = wrappedUnsubscribe;
111
+
112
+ return subscription;
113
+ }
114
+
115
+ function getStyleTagSubscription(stylingContainer, domain) {
116
+ const sheet = document.createElement('style');
117
+
118
+ return window.emMessageBus.subscribe(domain, (data) => {
119
+ if (stylingContainer) {
120
+ sheet.innerHTML = data;
121
+ stylingContainer.appendChild(sheet);
122
+ }
123
+ });
124
+ }
125
+
126
+ function getAdoptStyleSubscription(stylingContainer, domain) {
127
+ return window.emMessageBus.subscribe(domain, (data) => {
128
+ if (!stylingContainer) return;
129
+
130
+ const shadowRoot = stylingContainer.getRootNode();
131
+ const cacheStyleObject = window[StyleCacheKey];
132
+ let cachedStyle = cacheStyleObject[domain]?.sheet;
133
+
134
+ if (!cachedStyle) {
135
+ cachedStyle = new CSSStyleSheet();
136
+ cachedStyle.replaceSync(data);
137
+ cacheStyleObject[domain] = {
138
+ sheet: cachedStyle,
139
+ refCount: 1
140
+ };
141
+ } else {
142
+ cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
143
+ }
144
+
145
+ const currentSheets = shadowRoot.adoptedStyleSheets || [];
146
+ if (!currentSheets.includes(cachedStyle)) {
147
+ shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
148
+ }
149
+ });
91
150
  }
92
151
 
93
152
  const helperAccordionCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Header{border-radius:5px;background:var(--emw--color-primary, #009993);display:flex;gap:30px;border:1px solid var(--emw--color-primary, #009993);padding:8px 10px;user-select:none;margin-bottom:1px;cursor:pointer}.Header:hover{background:var(--emw--color-secondary, #00aba4)}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:var(--emw--color-typography-inverse, rgb(255, 255, 255));text-transform:capitalize}.Header .Expand{margin-left:auto;color:var(--emw--color-typography-inverse, rgb(255, 255, 255));width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.HeaderTicketHistory{border-radius:4px;background:var(--emw--color-background, #fff);display:flex;gap:30px;border:1px solid var(--emw--color-primary, #009993);padding:8px 10px;user-select:none;margin-bottom:5px;cursor:pointer}.HeaderTicketHistory:hover{background:var(--emw--color-secondary, #00aba4)}.HeaderTicketHistory .Title,.HeaderTicketHistory .Subtitle,.HeaderTicketHistory .Description{margin:0;font-size:14px;color:var(--emw--color-typography, #000)}.HeaderTicketHistory .Expand{margin-left:auto;color:var(--emw--color-typography-inverse, rgb(255, 255, 255));width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:0 0 4px 4px;background:var(--emw--color-background, #fff);border:1px solid var(--emw--color-primary, #009993);padding:10px 15px;user-select:none;color:var(--emw--color-typography, #000);margin-bottom:10px}.ActionButton{cursor:pointer;display:inline-block;border-radius:var(--emw--button-border-radius, 4px);margin:20px 0 10px;text-transform:uppercase;font-size:12px;text-align:center;padding:8px 20px;min-width:80px;background:var(--emw--color-error, #ff3d00);border:1px solid var(--emw--color-error, #ff3d00);color:var(--emw--color-background, #fff)}.ActionButton:hover{background:var(--emw--color-secondary, #ff6536);border:1px solid var(--emw--color-error, #ff3d00)}";
@@ -126,13 +185,13 @@ const HelperAccordion = class {
126
185
  }
127
186
  handleMbSourceChange(newValue, oldValue) {
128
187
  if (newValue != oldValue) {
129
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
188
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
130
189
  }
131
190
  }
132
191
  componentDidLoad() {
133
192
  if (this.stylingContainer) {
134
193
  if (this.mbSource)
135
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
194
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
136
195
  if (this.clientStyling)
137
196
  setClientStyling(this.stylingContainer, this.clientStyling);
138
197
  if (this.clientStylingUrl)
@@ -1 +1 @@
1
- import{r as e,c as t,h as r}from"./index-d6f3c92e.js";const o=["ro","en","hr"],i={en:{deleteTicket:"Delete ticket"},ro:{deleteTicket:"Sterge biletul"},fr:{deleteTicket:"Supprimer le billet"},ar:{deleteTicket:"حذف التذكرة"},hr:{deleteTicket:"Izbriši listić"}};function a(e,t){if(e){const r=document.createElement("style");r.innerHTML=t,e.appendChild(r)}}function s(e,t){if(!e||!t)return;const r=new URL(t);fetch(r.href).then((e=>e.text())).then((t=>{const r=document.createElement("style");r.innerHTML=t,e&&e.appendChild(r)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}function n(e,t){if(window.emMessageBus){const r=document.createElement("style");window.emMessageBus.subscribe(t,(t=>{r.innerHTML=t,e&&e.appendChild(r)}))}}const c=class{constructor(r){e(this,r),this.accordionEvent=t(this,"helperAccordionAction",7),this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.ticketHistoryFlag=!1,this.headerTitle="",this.headerSubtitle="",this.description="",this.footer=!1,this.deleteTab=!1,this.postMessage=!1,this.eventName="helperAccordionAction",this.collapsed=!0,this.language="en",this.translationUrl=void 0,this.showContent=void 0}handleClientStylingChange(e,t){e!=t&&a(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(e,t){e!=t&&s(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(e,t){e!=t&&n(this.stylingContainer,`${this.mbSource}.Style`)}componentDidLoad(){this.stylingContainer&&(this.mbSource&&n(this.stylingContainer,`${this.mbSource}.Style`),this.clientStyling&&a(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&s(this.stylingContainer,this.clientStylingUrl))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}connectedCallback(){this.showContent=!this.collapsed}componentWillLoad(){var e;this.translationUrl&&(e=JSON.parse(this.translationUrl),Object.keys(e).forEach((t=>{for(let r in e[t])i[t][r]=e[t][r]})))}toggleContent(){this.showContent=!this.showContent}deleteAction(){this.postMessage&&window.postMessage({type:this.eventName},window.location.href),this.accordionEvent.emit()}render(){return r("div",{key:"58cd507e7d1dc8de1e3b049936a2d6acb355e83d",class:"Wrapper",ref:e=>this.stylingContainer=e},r("div",{key:"70c6453ca4c4d40738edb1ae7e91f8954eebd3eb",class:!0===this.ticketHistoryFlag?"HeaderTicketHistory":"Header",onClick:()=>this.toggleContent()},r("p",{key:"cf543e01c0baa833bea27aa4effb19734e234ed1",class:"Title"},this.headerTitle),r("p",{key:"365a05cabda273796e9d9689e514566ecc2aadcc",class:"Subtitle"},this.headerSubtitle),r("p",{key:"f30680b6c9d2d65fdb607a7293d6ce4b56c6b20f",class:"Subtitle Description"},this.description),r("span",{key:"a47718e90743d53b31968f67b002a3e427e193bc",class:"Expand"},this.showContent?"<":">")),this.showContent&&r("div",{key:"bb34d51602f9397c427d79141a38aca7a64bf206"},r("div",{key:"64171a30185b88bbafaa4ea555aeb9e2e33c46d6",class:"Content"},r("slot",{key:"6def0d44f3881196255f3329184053fb3d5a3cfd",name:"accordionContent"}),this.footer&&this.showContent&&r("div",{key:"08bfb5b017055788ba55b149e3bee23964f11ccf"},this.deleteTab&&r("span",{key:"b7b03fc6329a37841a2cf2b6a34780349341a0d5",class:"ActionButton",onClick:()=>this.deleteAction()},(()=>{const e=this.language;return i[void 0!==e&&o.includes(e)?e:"en"].deleteTicket})())))))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};c.style='@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap");:host{display:block;font-family:"Roboto", sans-serif}.Header{border-radius:5px;background:var(--emw--color-primary, #009993);display:flex;gap:30px;border:1px solid var(--emw--color-primary, #009993);padding:8px 10px;user-select:none;margin-bottom:1px;cursor:pointer}.Header:hover{background:var(--emw--color-secondary, #00aba4)}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:var(--emw--color-typography-inverse, rgb(255, 255, 255));text-transform:capitalize}.Header .Expand{margin-left:auto;color:var(--emw--color-typography-inverse, rgb(255, 255, 255));width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.HeaderTicketHistory{border-radius:4px;background:var(--emw--color-background, #fff);display:flex;gap:30px;border:1px solid var(--emw--color-primary, #009993);padding:8px 10px;user-select:none;margin-bottom:5px;cursor:pointer}.HeaderTicketHistory:hover{background:var(--emw--color-secondary, #00aba4)}.HeaderTicketHistory .Title,.HeaderTicketHistory .Subtitle,.HeaderTicketHistory .Description{margin:0;font-size:14px;color:var(--emw--color-typography, #000)}.HeaderTicketHistory .Expand{margin-left:auto;color:var(--emw--color-typography-inverse, rgb(255, 255, 255));width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:0 0 4px 4px;background:var(--emw--color-background, #fff);border:1px solid var(--emw--color-primary, #009993);padding:10px 15px;user-select:none;color:var(--emw--color-typography, #000);margin-bottom:10px}.ActionButton{cursor:pointer;display:inline-block;border-radius:var(--emw--button-border-radius, 4px);margin:20px 0 10px;text-transform:uppercase;font-size:12px;text-align:center;padding:8px 20px;min-width:80px;background:var(--emw--color-error, #ff3d00);border:1px solid var(--emw--color-error, #ff3d00);color:var(--emw--color-background, #fff)}.ActionButton:hover{background:var(--emw--color-secondary, #ff6536);border:1px solid var(--emw--color-error, #ff3d00)}';export{c as helper_accordion}
1
+ import{r as e,c as t,h as r}from"./index-d6f3c92e.js";const o=["ro","en","hr"],i={en:{deleteTicket:"Delete ticket"},ro:{deleteTicket:"Sterge biletul"},fr:{deleteTicket:"Supprimer le billet"},ar:{deleteTicket:"حذف التذكرة"},hr:{deleteTicket:"Izbriši listić"}},n="__WIDGET_GLOBAL_STYLE_CACHE__";function a(e,t){if(e){const r=document.createElement("style");r.innerHTML=t,e.appendChild(r)}}function s(e,t){if(!e||!t)return;const r=new URL(t);fetch(r.href).then((e=>e.text())).then((t=>{const r=document.createElement("style");r.innerHTML=t,e&&e.appendChild(r)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}function c(e,t,r,o=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!o)return r=function(e,t){const r=document.createElement("style");return window.emMessageBus.subscribe(t,(t=>{e&&(r.innerHTML=t,e.appendChild(r))}))}(e,t),r;window[n]||(window[n]={}),r=function(e,t){return window.emMessageBus.subscribe(t,(r=>{if(!e)return;const o=e.getRootNode(),i=window[n];let a=i[t]?.sheet;a?i[t].refCount=i[t].refCount+1:(a=new CSSStyleSheet,a.replaceSync(r),i[t]={sheet:a,refCount:1});const s=o.adoptedStyleSheets||[];s.includes(a)||(o.adoptedStyleSheets=[...s,a])}))}(e,t);const i=r.unsubscribe.bind(r);return r.unsubscribe=()=>{if(window[n][t]){const e=window[n][t];e.refCount>1?e.refCount=e.refCount-1:delete window[n][t]}i()},r}const d=class{constructor(r){e(this,r),this.accordionEvent=t(this,"helperAccordionAction",7),this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.ticketHistoryFlag=!1,this.headerTitle="",this.headerSubtitle="",this.description="",this.footer=!1,this.deleteTab=!1,this.postMessage=!1,this.eventName="helperAccordionAction",this.collapsed=!0,this.language="en",this.translationUrl=void 0,this.showContent=void 0}handleClientStylingChange(e,t){e!=t&&a(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(e,t){e!=t&&s(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(e,t){e!=t&&c(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription)}componentDidLoad(){this.stylingContainer&&(this.mbSource&&c(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription),this.clientStyling&&a(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&s(this.stylingContainer,this.clientStylingUrl))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}connectedCallback(){this.showContent=!this.collapsed}componentWillLoad(){var e;this.translationUrl&&(e=JSON.parse(this.translationUrl),Object.keys(e).forEach((t=>{for(let r in e[t])i[t][r]=e[t][r]})))}toggleContent(){this.showContent=!this.showContent}deleteAction(){this.postMessage&&window.postMessage({type:this.eventName},window.location.href),this.accordionEvent.emit()}render(){return r("div",{key:"58cd507e7d1dc8de1e3b049936a2d6acb355e83d",class:"Wrapper",ref:e=>this.stylingContainer=e},r("div",{key:"70c6453ca4c4d40738edb1ae7e91f8954eebd3eb",class:!0===this.ticketHistoryFlag?"HeaderTicketHistory":"Header",onClick:()=>this.toggleContent()},r("p",{key:"cf543e01c0baa833bea27aa4effb19734e234ed1",class:"Title"},this.headerTitle),r("p",{key:"365a05cabda273796e9d9689e514566ecc2aadcc",class:"Subtitle"},this.headerSubtitle),r("p",{key:"f30680b6c9d2d65fdb607a7293d6ce4b56c6b20f",class:"Subtitle Description"},this.description),r("span",{key:"a47718e90743d53b31968f67b002a3e427e193bc",class:"Expand"},this.showContent?"<":">")),this.showContent&&r("div",{key:"bb34d51602f9397c427d79141a38aca7a64bf206"},r("div",{key:"64171a30185b88bbafaa4ea555aeb9e2e33c46d6",class:"Content"},r("slot",{key:"6def0d44f3881196255f3329184053fb3d5a3cfd",name:"accordionContent"}),this.footer&&this.showContent&&r("div",{key:"08bfb5b017055788ba55b149e3bee23964f11ccf"},this.deleteTab&&r("span",{key:"b7b03fc6329a37841a2cf2b6a34780349341a0d5",class:"ActionButton",onClick:()=>this.deleteAction()},(()=>{const e=this.language;return i[void 0!==e&&o.includes(e)?e:"en"].deleteTicket})())))))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};d.style='@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap");:host{display:block;font-family:"Roboto", sans-serif}.Header{border-radius:5px;background:var(--emw--color-primary, #009993);display:flex;gap:30px;border:1px solid var(--emw--color-primary, #009993);padding:8px 10px;user-select:none;margin-bottom:1px;cursor:pointer}.Header:hover{background:var(--emw--color-secondary, #00aba4)}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:var(--emw--color-typography-inverse, rgb(255, 255, 255));text-transform:capitalize}.Header .Expand{margin-left:auto;color:var(--emw--color-typography-inverse, rgb(255, 255, 255));width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.HeaderTicketHistory{border-radius:4px;background:var(--emw--color-background, #fff);display:flex;gap:30px;border:1px solid var(--emw--color-primary, #009993);padding:8px 10px;user-select:none;margin-bottom:5px;cursor:pointer}.HeaderTicketHistory:hover{background:var(--emw--color-secondary, #00aba4)}.HeaderTicketHistory .Title,.HeaderTicketHistory .Subtitle,.HeaderTicketHistory .Description{margin:0;font-size:14px;color:var(--emw--color-typography, #000)}.HeaderTicketHistory .Expand{margin-left:auto;color:var(--emw--color-typography-inverse, rgb(255, 255, 255));width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:0 0 4px 4px;background:var(--emw--color-background, #fff);border:1px solid var(--emw--color-primary, #009993);padding:10px 15px;user-select:none;color:var(--emw--color-typography, #000);margin-bottom:10px}.ActionButton{cursor:pointer;display:inline-block;border-radius:var(--emw--button-border-radius, 4px);margin:20px 0 10px;text-transform:uppercase;font-size:12px;text-align:center;padding:8px 20px;min-width:80px;background:var(--emw--color-error, #ff3d00);border:1px solid var(--emw--color-error, #ff3d00);color:var(--emw--color-background, #fff)}.ActionButton:hover{background:var(--emw--color-secondary, #ff6536);border:1px solid var(--emw--color-error, #ff3d00)}';export{d as helper_accordion}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/helper-accordion",
3
- "version": "1.87.26",
3
+ "version": "1.87.27",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",