mealz-components 2.7.0 → 2.7.1
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.
- package/dist/modal/modal.min.js +2 -2
- package/dist/planner/helpers/get-planner-onboarding-modal-config.min.js +1 -1
- package/dist/planner/planner-abandon-modal/planner-abandon-modal.min.js +1 -1
- package/dist/planner/planner-budget-edit-modal/planner-budget-edit-modal.min.js +1 -1
- package/dist/planner/planner-current-menu-modal/planner-current-menu-modal.min.js +1 -1
- package/dist/planner/planner-open-catalog-modal/planner-open-catalog-modal.min.js +1 -1
- package/dist/planner/planner-welcome-modal/planner-welcome-modal.min.js +2 -2
- package/package.json +1 -1
package/dist/modal/modal.min.js
CHANGED
|
@@ -2,7 +2,7 @@ import{R as u,N as p,D as b,k as f}from"../assets/no-shadow-element-CXVMZH9n.js"
|
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2018 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const h="important",E=" !"+h,k=v(class extends y{constructor(
|
|
5
|
+
*/const h="important",E=" !"+h,k=v(class extends y{constructor(l){var e;if(super(l),l.type!==C.ATTRIBUTE||l.name!=="style"||((e=l.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(l){return Object.keys(l).reduce((e,s)=>{const t=l[s];return t==null?e:e+`${s=s.includes("-")?s:s.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(l,[e]){const{style:s}=l.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const t of this.ft)e[t]==null&&(this.ft.delete(t),t.includes("-")?s.removeProperty(t):s[t]=null);for(const t in e){const o=e[t];if(o!=null){this.ft.add(t);const i=typeof o=="string"&&o.endsWith(E);t.includes("-")||i?s.setProperty(t,i?o.slice(0,-11):o,i?h:""):s[t]=o}}return u}});var S=Object.defineProperty,r=(l,e,s,t)=>{for(var o=void 0,i=l.length-1,c;i>=0;i--)(c=l[i])&&(o=c(e,s,o)||o);return o&&S(e,s,o),o};class n extends p{constructor(){super(),this.titleSlot="",this.contentSlot="",this.disableMobileBottomSheet=!1,this.modalClickHandlers=[],this.boundHandleOnboardingConfirmed=()=>{this.closeByUser("action")},this.styleURL=new URL("./modal/modal.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.createCloseEvent(),this.addEventListener("onboardingConfirmed",this.boundHandleOnboardingConfirmed),this.wireCloseTargets()}disconnectedCallback(){this.removeEventListener("onboardingConfirmed",this.boundHandleOnboardingConfirmed),this.cleanupModalClickHandlers(),super.disconnectedCallback()}createCloseEvent(){this.closeEvent=new CustomEvent(m,{bubbles:!0,composed:!0})}render(){const e=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 600px)").matches,s=this.disableMobileBottomSheet&&e?k({top:"50%",bottom:"unset",right:"unset",borderRadius:"16px",margin:"0 16px",transform:"translate(0, -50%)"}):b;return f`
|
|
6
6
|
<div @click=${()=>this.closeByUser("overlay")} class="mealz-shadow-overlay"></div>
|
|
7
7
|
<div class="mealz-modal" style=${s}>
|
|
8
8
|
<div class="mealz-modal__header">
|
|
@@ -19,4 +19,4 @@ import{R as u,N as p,D as b,k as f}from"../assets/no-shadow-element-CXVMZH9n.js"
|
|
|
19
19
|
${typeof this.contentSlot=="string"?d(this.contentSlot):this.contentSlot}
|
|
20
20
|
</div>
|
|
21
21
|
</div>
|
|
22
|
-
`}close(){this.dispatchEvent(this.closeEvent),this.remove()}closeByUser(e="action"){const s=new CustomEvent(g,{bubbles:!0,composed:!0,cancelable:!0,detail:{origin:e}});if(!this.dispatchEvent(s))return;const o=new CustomEvent(m,{bubbles:!0,composed:!0,detail:{origin:e}});this.dispatchEvent(o),this.remove()}wireCloseTargets(){if(!this.closeTargets)return;const{closeOverlay:e,closeButton:s}=this.closeTargets;if(e){const t=this.querySelector(e);t&&this.addModalClickListener(t,()=>this.closeByUser("overlay"))}if(s){const t=this.querySelector(s);t&&this.addModalClickListener(t,()=>this.closeByUser("x"))}}addModalClickListener(e,s){const t=s;e.addEventListener("click",t),this.modalClickHandlers.push({element:e,handler:t})}cleanupModalClickHandlers(){this.modalClickHandlers.forEach(({element:e,handler:s})=>{e.removeEventListener("click",s)}),this.modalClickHandlers=[]}}r([a({type:String})],n.prototype,"titleSlot");r([a({type:String})],n.prototype,"contentSlot");r([a({attribute:!1})],n.prototype,"closeTargets");r([a({type:Boolean,attribute:"disable-mobile-bottom-sheet"})],n.prototype,"disableMobileBottomSheet");customElements.get("mealz-modal")||customElements.define("mealz-modal",n);export{
|
|
22
|
+
`}close(){this.dispatchEvent(this.closeEvent),this.remove()}closeByUser(e="action"){const s=new CustomEvent(g,{bubbles:!0,composed:!0,cancelable:!0,detail:{origin:e}});if(!this.dispatchEvent(s))return;const o=new CustomEvent(m,{bubbles:!0,composed:!0,detail:{origin:e}});this.dispatchEvent(o),this.remove()}wireCloseTargets(){if(!this.closeTargets)return;const{closeOverlay:e,closeButton:s}=this.closeTargets;if(e){const t=this.querySelector(e);t&&this.addModalClickListener(t,()=>this.closeByUser("overlay"))}if(s){const t=this.querySelector(s);t&&this.addModalClickListener(t,()=>this.closeByUser("x"))}}addModalClickListener(e,s){const t=s;e.addEventListener("click",t),this.modalClickHandlers.push({element:e,handler:t})}cleanupModalClickHandlers(){this.modalClickHandlers.forEach(({element:e,handler:s})=>{e.removeEventListener("click",s)}),this.modalClickHandlers=[]}}r([a({type:String})],n.prototype,"titleSlot");r([a({type:String})],n.prototype,"contentSlot");r([a({attribute:!1})],n.prototype,"closeTargets");r([a({type:Boolean,attribute:"disable-mobile-bottom-sheet"})],n.prototype,"disableMobileBottomSheet");customElements.get("mealz-modal")||customElements.define("mealz-modal",n);function B(){return document.createElement("mealz-modal")}export{B as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as a}from"../../assets/no-shadow-element-CXVMZH9n.js";import{
|
|
1
|
+
import{k as a}from"../../assets/no-shadow-element-CXVMZH9n.js";import{c as r}from"../../modal/modal.min.js";import"../../assets/mealz-sdk-CnvUgy3V.js";import"../../assets/property-BXpY_hgs.js";import"../../assets/unsafe-html-LLTnDXid.js";import"../../onboarding/events.min.js";function c(){var e;const n=(e=document.querySelector("mealz-planner-onboarding-modal"))==null?void 0:e.closest("mealz-modal");if(n)return n;const o=r();return o.titleSlot="Comment faire un menu ?",o.contentSlot=a`<mealz-planner-onboarding-modal></mealz-planner-onboarding-modal>`,o}export{c as g};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{N as a,k as e}from"../../assets/no-shadow-element-CXVMZH9n.js";import{
|
|
1
|
+
import{N as a,k as e}from"../../assets/no-shadow-element-CXVMZH9n.js";import{c as t}from"../../modal/modal.min.js";import"../../assets/mealz-sdk-CnvUgy3V.js";import"../../assets/property-BXpY_hgs.js";import"../../assets/unsafe-html-LLTnDXid.js";import"../../onboarding/events.min.js";class o extends a{constructor(){super(),this.styleURL=new URL("./planner/planner-abandon-modal/planner-abandon-modal.css",this.getBaseURL())}displayPlannerAbandonModal(){const n=t();document.body.appendChild(this),n.titleSlot=e`<span>Abandonner le menu</span>`,n.contentSlot=this.renderModal(),this.appendChild(n),n.addEventListener("modalClosed",()=>{this.remove()})}abandonMenu(){const n=new CustomEvent("resetMenu");this.dispatchEvent(n),this.remove()}renderModal(){return e`
|
|
2
2
|
<div class="mealz-planner-abandon-modal__content">
|
|
3
3
|
<div class="mealz-planner-abandon-modal__description">
|
|
4
4
|
<span class="mealz-ds-text size-m">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{N as r,k as s}from"../../assets/no-shadow-element-CXVMZH9n.js";import{r as m}from"../../assets/state-BjFDUoQX.js";import{
|
|
1
|
+
import{N as r,k as s}from"../../assets/no-shadow-element-CXVMZH9n.js";import{r as m}from"../../assets/state-BjFDUoQX.js";import{c as u}from"../../modal/modal.min.js";import"../../assets/mealz-sdk-CnvUgy3V.js";import"../../assets/property-BXpY_hgs.js";import"../../assets/unsafe-html-LLTnDXid.js";import"../../onboarding/events.min.js";var p=Object.defineProperty,g=(a,e,t,n)=>{for(var i=void 0,d=a.length-1,l;d>=0;d--)(l=a[d])&&(i=l(e,t,i)||i);return i&&p(e,t,i),i};class o extends r{constructor(){super(),this.budgetLimit=0,this.styleURL=new URL("./planner/planner-budget-edit-modal/planner-budget-edit-modal.css",this.getBaseURL())}displayPlannerBudgetEditModal(e=0){this.budgetLimit=e>0?e:null;const t=u();document.body.appendChild(this),t.titleSlot=s`<span>Modifier votre budget</span>`,t.contentSlot=this.renderModal(),this.appendChild(t),t.addEventListener("modalClosed",()=>this.remove())}onBudgetChange(e){const t=e.target;if(t.value===""){this.budgetLimit=0;return}const n=Number(t.value);this.budgetLimit=Number.isFinite(n)?Math.max(0,n):null}onKeyDown(e){e.key==="Enter"&&(e.preventDefault(),this.confirmEdit())}confirmEdit(){this.dispatchEvent(new CustomEvent("budgetUpdated",{detail:{budgetLimit:this.budgetLimit},bubbles:!0,composed:!0})),this.remove()}renderModal(){return s`
|
|
2
2
|
<div class="mealz-planner-budget-edit-modal__content">
|
|
3
3
|
<label class="mealz-planner-budget-edit-modal__field">
|
|
4
4
|
<input
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{N as t,k as n}from"../../assets/no-shadow-element-CXVMZH9n.js";import{
|
|
1
|
+
import{N as t,k as n}from"../../assets/no-shadow-element-CXVMZH9n.js";import{c as a}from"../../modal/modal.min.js";import"../../assets/mealz-sdk-CnvUgy3V.js";import"../../assets/property-BXpY_hgs.js";import"../../assets/unsafe-html-LLTnDXid.js";import"../../onboarding/events.min.js";class s extends t{constructor(){super(),this.styleURL=new URL("./planner/planner-current-menu-modal/planner-current-menu-modal.css",this.getBaseURL())}displayPlannerCurrentMenuModal(){const e=a();document.body.appendChild(this),e.titleSlot=n`<span>Menu déjà en cours</span>`,e.contentSlot=this.renderModal(),this.appendChild(e),e.addEventListener("modalClosed",()=>this.remove())}replaceMenu(){const e=new CustomEvent("replaceMenu");this.dispatchEvent(e),this.remove()}keepMenu(){const e=new CustomEvent("keepMenu");this.dispatchEvent(e),this.remove()}renderModal(){return n`
|
|
2
2
|
<div class="mealz-planner-current-menu-modal__content">
|
|
3
3
|
<div class="mealz-planner-current-menu-modal__description mealz-ds-text size-m">
|
|
4
4
|
<span>Vous avez déjà un menu en cours de planification.</span>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{N as t,k as a}from"../../assets/no-shadow-element-CXVMZH9n.js";import{
|
|
1
|
+
import{N as t,k as a}from"../../assets/no-shadow-element-CXVMZH9n.js";import{c as o}from"../../modal/modal.min.js";import"../../assets/mealz-sdk-CnvUgy3V.js";import"../../assets/property-BXpY_hgs.js";import"../../assets/unsafe-html-LLTnDXid.js";import"../../onboarding/events.min.js";class n extends t{constructor(){super(),this.styleURL=new URL("./planner/planner-open-catalog-modal/planner-open-catalog-modal.css",this.getBaseURL())}displayMealzPlannerOpenCatalogModal(){const e=o();document.body.appendChild(this),e.titleSlot=a`<span>Rien à votre goût ?</span>`,e.contentSlot=this.renderModal(),this.appendChild(e),e.addEventListener("modalClosed",()=>{this.remove()})}openCatalog(){const e=new CustomEvent("openCatalog");this.dispatchEvent(e),this.remove()}closeModal(){const e=new CustomEvent("refuse");this.dispatchEvent(e),this.remove()}renderModal(){return a`
|
|
2
2
|
<div class="mealz-planner-open-catalog-modal__content">
|
|
3
3
|
<div class="mealz-planner-open-catalog-modal__description">
|
|
4
4
|
<span class="mealz-ds-text size-m">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{N as m,k as i}from"../../assets/no-shadow-element-CXVMZH9n.js";import{
|
|
1
|
+
import{N as m,k as i}from"../../assets/no-shadow-element-CXVMZH9n.js";import{c as d}from"../../modal/modal.min.js";import{n as p}from"../../assets/property-BXpY_hgs.js";import{M as u}from"../../onboarding/events.min.js";import{b as c,j as h,k as v}from"../../onboarding/analytics/onboarding-analytics.min.js";import{a as r,d as b,m as g}from"../helpers/planner-onboarding-storage.min.js";import"../../assets/mealz-sdk-CnvUgy3V.js";import"../../assets/unsafe-html-LLTnDXid.js";var f=Object.defineProperty,M=(t,e,n,z)=>{for(var s=void 0,o=t.length-1,a;o>=0;o--)(a=t[o])&&(s=a(e,n,s)||s);return s&&f(e,n,s),s};class l extends m{constructor(){super(),this.isCustomMenu=!1,this.analyticsPath="/meals-planner/onboarding",this.styleURL=new URL("./planner/planner-welcome-modal/planner-welcome-modal.css",this.getBaseURL())}displayPlannerWelcomeModal(){if(r())return;const e=d();document.body.appendChild(this);const n=this.isCustomMenu?"Bienvenue dans votre premier menu personnalisé":"Bienvenue dans votre première sélection du moment";e.disableMobileBottomSheet=!0,e.titleSlot=i`<span>${n}</span>`,e.contentSlot=this.renderModal(),this.appendChild(e),c(this.isCustomMenu?"personal":"suggestion","welcome"),e.addEventListener(u,()=>{this.skipOnboarding(!1)})}skipOnboarding(e=!1){h(this.isCustomMenu?"personal":"suggestion"),e&&(b(),g());const n=new CustomEvent("onboarding-skipped");this.dispatchEvent(n),this.remove()}startOnboardingTour(){if(r()){this.remove();return}v(this.isCustomMenu?"personal":"suggestion");const e=new CustomEvent("openOnboarding",{detail:{isCustomMenu:this.isCustomMenu}});this.dispatchEvent(e),this.remove()}renderModal(){const e=this.isCustomMenu?"Découvrez comment composer facilement votre menu selon vos envies.":"Découvrez le menu de la semaine que nous avons composé pour vous.";return i`
|
|
2
2
|
<div class="mealz-planner-welcome-modal__content">
|
|
3
3
|
<div class="mealz-planner-welcome-modal__description mealz-ds-text size-m">
|
|
4
4
|
<span>${e}</span>
|
|
@@ -14,4 +14,4 @@ import{N as m,k as i}from"../../assets/no-shadow-element-CXVMZH9n.js";import{M a
|
|
|
14
14
|
</button>
|
|
15
15
|
</div>
|
|
16
16
|
</div>
|
|
17
|
-
`}}
|
|
17
|
+
`}}M([p({type:Boolean})],l.prototype,"isCustomMenu");customElements.get("mealz-planner-welcome-modal")||customElements.define("mealz-planner-welcome-modal",l);export{l as M};
|