@everymatrix/helper-accordion 1.85.17 → 1.85.19
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.
|
@@ -56,6 +56,8 @@ function setClientStyling(stylingContainer, clientStyling) {
|
|
|
56
56
|
* @param {string} clientStylingUrl The URL of the style content
|
|
57
57
|
*/
|
|
58
58
|
function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
59
|
+
if (!stylingContainer || !clientStylingUrl) return;
|
|
60
|
+
|
|
59
61
|
const url = new URL(clientStylingUrl);
|
|
60
62
|
|
|
61
63
|
fetch(url.href)
|
|
@@ -52,6 +52,8 @@ function setClientStyling(stylingContainer, clientStyling) {
|
|
|
52
52
|
* @param {string} clientStylingUrl The URL of the style content
|
|
53
53
|
*/
|
|
54
54
|
function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
55
|
+
if (!stylingContainer || !clientStylingUrl) return;
|
|
56
|
+
|
|
55
57
|
const url = new URL(clientStylingUrl);
|
|
56
58
|
|
|
57
59
|
fetch(url.href)
|
|
@@ -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){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ć"}};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}
|