@pairbo/ui-kit 0.3.11 → 0.3.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.
- package/dist/ui-kit.js +2 -2
- package/package.json +1 -1
package/dist/ui-kit.js
CHANGED
|
@@ -1474,7 +1474,7 @@
|
|
|
1474
1474
|
.skip::part(label) {
|
|
1475
1475
|
font-size: 14px;
|
|
1476
1476
|
}
|
|
1477
|
-
`,gi=()=>/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent),ws=o=>o!=null,Kl=o=>Object.entries(o).reduce((t,[e,i])=>(i==null||(t[e]=i),t),{});function Nu(o,t){let e;return function(...i){clearTimeout(e),e=setTimeout(()=>o.apply(this,i),t)}}var Vu=Object.defineProperty,Uu=Object.getOwnPropertyDescriptor,At=(o,t,e,i)=>{for(var s=i>1?void 0:i?Uu(t,e):t,r=o.length-1,n;r>=0;r--)(n=o[r])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&Vu(t,e,s),s};let K=class extends gt{constructor(){super(...arguments),this.resizeTimeout=null,this.cardInnerImageUrl="../../../public/Greeting Card from Pairbo.png",this.card=null,this.submitTypeForm=async t=>{console.error("submitTypingForm function not implemented",t)},this.loading=!1,this.disabled=!1,this.onClose=()=>{},this.windowHeight=window.innerHeight,this.charsNum=0,this.ctaButtonState=K.CTA_STATES.primary,this.wrappedSubmitTypeForm=async t=>{console.warn("submitTypingForm function not implemented",t)},this.handleResize=()=>{this.resizeTimeout&&window.clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.windowHeight=window.innerHeight},50)}}updateWrappedSubmitTypeForm(){this.wrappedSubmitTypeForm=async t=>{this.loading=!0,this.disabled=!0;try{this.submitTypeForm(t),this.onClose(),this.emit("pbo-type-form-submitted")}catch(e){console.error("Error submitting type form:",e)}finally{this.loading=!1,this.disabled=!1}}}firstUpdated(){console.log("Is type-form disabled: ",this.disabled,this.loading),this.textArea.addEventListener("invalid",()=>{alert("Please add a message to continue")})}get formData(){var e,i,s,r,n,a,l,c;const t={pboCardId:((e=this.card)==null?void 0:e.pboId)||"Unknown",productId:(i=this.card)==null?void 0:i.productId,sku:(s=this.card)==null?void 0:s.sku,variantId:(r=this.card)==null?void 0:r.variantId,font:((n=this.fontSelector)==null?void 0:n.value)||"",text:((a=this.greetingText)==null?void 0:a.value)||"",color:((l=this.textColor)==null?void 0:l.value)||"",alignment:((c=this.textAlignment)==null?void 0:c.value)||""};return Kl(t)}handleFormChange(t){var e;this.ctaButtonState=K.CTA_STATES.primary,this.charsNum=((e=this.greetingText)==null?void 0:e.value.length)||0,this.emit("pbo-
|
|
1477
|
+
`,gi=()=>/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent),ws=o=>o!=null,Kl=o=>Object.entries(o).reduce((t,[e,i])=>(i==null||(t[e]=i),t),{});function Nu(o,t){let e;return function(...i){clearTimeout(e),e=setTimeout(()=>o.apply(this,i),t)}}var Vu=Object.defineProperty,Uu=Object.getOwnPropertyDescriptor,At=(o,t,e,i)=>{for(var s=i>1?void 0:i?Uu(t,e):t,r=o.length-1,n;r>=0;r--)(n=o[r])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&Vu(t,e,s),s};let K=class extends gt{constructor(){super(...arguments),this.resizeTimeout=null,this.cardInnerImageUrl="../../../public/Greeting Card from Pairbo.png",this.card=null,this.submitTypeForm=async t=>{console.error("submitTypingForm function not implemented",t)},this.loading=!1,this.disabled=!1,this.onClose=()=>{},this.windowHeight=window.innerHeight,this.charsNum=0,this.ctaButtonState=K.CTA_STATES.primary,this.wrappedSubmitTypeForm=async t=>{console.warn("submitTypingForm function not implemented",t)},this.handleResize=()=>{this.resizeTimeout&&window.clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.windowHeight=window.innerHeight},50)}}updateWrappedSubmitTypeForm(){this.wrappedSubmitTypeForm=async t=>{this.loading=!0,this.disabled=!0;try{this.submitTypeForm(t),this.onClose(),this.emit("pbo-type-form-submitted")}catch(e){console.error("Error submitting type form:",e)}finally{this.loading=!1,this.disabled=!1}}}firstUpdated(){console.log("Is type-form disabled: ",this.disabled,this.loading),this.textArea.addEventListener("invalid",()=>{alert("Please add a message to continue")})}get formData(){var e,i,s,r,n,a,l,c;const t={pboCardId:((e=this.card)==null?void 0:e.pboId)||"Unknown",productId:(i=this.card)==null?void 0:i.productId,sku:(s=this.card)==null?void 0:s.sku,variantId:(r=this.card)==null?void 0:r.variantId,font:((n=this.fontSelector)==null?void 0:n.value)||"",text:((a=this.greetingText)==null?void 0:a.value)||"",color:((l=this.textColor)==null?void 0:l.value)||"",alignment:((c=this.textAlignment)==null?void 0:c.value)||""};return Kl(t)}handleFormChange(t){var e;this.ctaButtonState=K.CTA_STATES.primary,this.charsNum=((e=this.greetingText)==null?void 0:e.value.length)||0,this.emit("pbo-change",{detail:this.formData})}hostConnected(){this.addEventListener("pbo-change",this.handleFormChange)}hostDisconnected(){this.removeEventListener("pbo-change",this.handleFormChange)}submitFormHandler(t){var i;t.preventDefault();const e=(i=t.submitter)==null?void 0:i.name;if(this.ctaButtonState.type==="danger"){e==="skip"&&this.wrappedSubmitTypeForm(this.formData);return}if(this.greetingText.value===""||this.greetingText.value===null||this.greetingText.value===void 0){this.ctaButtonState=K.CTA_STATES.danger,this.greetingText.focus();return}this.wrappedSubmitTypeForm(this.formData)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.handleResize)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.handleResize),this.resizeTimeout&&window.clearTimeout(this.resizeTimeout)}render(){const t=223-this.charsNum;return L`
|
|
1478
1478
|
<form class="typing-form" @submit=${this.submitFormHandler}>
|
|
1479
1479
|
<pbo-textarea
|
|
1480
1480
|
exportparts="textarea:editor-textarea"
|
|
@@ -2138,7 +2138,6 @@
|
|
|
2138
2138
|
grid-template-columns: repeat(2, 1fr);
|
|
2139
2139
|
gap: 0.6rem;
|
|
2140
2140
|
align-items: center;
|
|
2141
|
-
color: black;
|
|
2142
2141
|
}
|
|
2143
2142
|
|
|
2144
2143
|
.embla__button {
|
|
@@ -2159,6 +2158,7 @@
|
|
|
2159
2158
|
display: flex;
|
|
2160
2159
|
align-items: center;
|
|
2161
2160
|
justify-content: center;
|
|
2161
|
+
color: black;
|
|
2162
2162
|
}
|
|
2163
2163
|
|
|
2164
2164
|
.embla__button:disabled {
|