@pairbo/ui-kit 0.3.2 → 0.3.3

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.
Files changed (2) hide show
  1. package/dist/ui-kit.js +7 -0
  2. package/package.json +1 -1
package/dist/ui-kit.js CHANGED
@@ -1466,6 +1466,10 @@
1466
1466
  .cta-buttons pbo-button::part(base) {
1467
1467
  font-size: var(--pbo-font-size-medium);
1468
1468
  }
1469
+
1470
+ .skip::part(button__label) {
1471
+ font-size: 11px;
1472
+ }
1469
1473
  `,vs=()=>/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent),Zs=n=>n!=null,_h=n=>Object.entries(n).reduce((t,[e,i])=>(i==null||(t[e]=i),t),{});function Pg(n,t){let e;return function(...i){clearTimeout(e),e=setTimeout(()=>n.apply(this,i),t)}}var Dg=Object.defineProperty,Mg=Object.getOwnPropertyDescriptor,Lt=(n,t,e,i)=>{for(var s=i>1?void 0:i?Mg(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(t,e,s):o(s))||s);return i&&s&&Dg(t,e,s),s};let rt=class extends Pt{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.windowHeight=window.innerHeight,this.charsNum=0,this.ctaButtonState=rt.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),await new Promise(e=>setTimeout(e,1e3))}catch(e){console.error("Error submitting type form:",e)}finally{this.loading=!1,this.disabled=!1}}}isLoadingChanged(){this.ctaButtons.forEach(t=>{t.loading=this.loading})}disabledChanged(){this.greetingText.disabled=this.disabled,this.fontSelector.disabled=this.disabled,this.textColor.childNodes.forEach(t=>{t.disabled=this.disabled}),this.textAlignment.childNodes.forEach(t=>{t.disabled=this.disabled}),this.ctaButtons.forEach(t=>{t.disabled=this.disabled})}firstUpdated(){this.disabledChanged(),this.isLoadingChanged(),this.textArea.addEventListener("invalid",()=>{alert("Please add a message to continue")})}get formData(){var e,i,s,r,o,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:((o=this.fontSelector)==null?void 0:o.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 _h(t)}handleFormChange(t){var e;this.ctaButtonState=rt.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=rt.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 V`
1470
1474
  <form class="typing-form" @submit=${this.submitFormHandler}>
1471
1475
  <pbo-textarea
@@ -3225,6 +3229,9 @@ void main() {
3225
3229
  .reupload-cta::part(base) {
3226
3230
  color: black;
3227
3231
  }
3232
+ .reupload-cta::part(button__label) {
3233
+ font-size: 11px;
3234
+ }
3228
3235
  `,m_=ct`
3229
3236
  :host {
3230
3237
  display: block;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pairbo/ui-kit",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "readme": "./README-NPM.md",