@rtstic.dev/pulse 0.0.33 → 0.0.35
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/form/styles.css +1 -1
- package/dist/marquee/index.js +2 -2
- package/package.json +1 -1
package/dist/form/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.w-form-formradioinput--inputType-custom.w--redirected-focus{box-shadow:none}.radio-checked{display:none}.w-form-formradioinput.w--redirected-checked~.radio-checked{display:flex}.w-checkbox-input--inputType-custom.w--redirected-focus{box-shadow:none}.w-input:focus,.w-select:focus{border-color:transparent;outline:0}.radio-inner-label{color:var(--text-colors--subtext)}input[type=radio]:checked+.radio-inner-label{color:var(--text-colors--title)}.checkbox-label{color:var(--text-colors--subtext)}.w-checkbox-input--inputType-custom.w--redirected-checked{background-color:#f66025;border-color:#f66025}input[type=checkbox]:checked+.checkbox-label{color:var(--text-colors--title)}.checkbox-field:has(input[type=checkbox]:checked){border-color:#f66025}.radio-inner-label,.checkbox-label{transition:color .3s ease}.checkbox-field{transition:border-color .3s ease}.w-checkbox-input--inputType-custom{transition:background-color .3s ease,border-color .3s ease}span.pulse-form-error{color:#e55757;font-size:var(--_text-size---body--s);line-height:var(--_line-height---line-height-body--s);font-weight:var(--_font-weight---font-weight-body--s);letter-spacing:var(--_letter-spacing---letter-spacing-body--s)}[data-error-code=ERR_LEGAL_REQUIRED]{padding-left:18px}[form-flow-active=false]{display:none}[form-flow-active=true]{display:flex}[fullwidth]{width:100%}[hs-calender-active=true]{display:block;width:100%}[hs-calender-active=false]{display:none}
|
|
1
|
+
.w-form-formradioinput--inputType-custom.w--redirected-focus{box-shadow:none}.radio-checked{display:none}.w-form-formradioinput.w--redirected-checked~.radio-checked{display:flex}.w-checkbox-input--inputType-custom.w--redirected-focus{box-shadow:none}.w-input:focus,.w-select:focus{border-color:transparent;outline:0}.radio-inner-label{color:var(--text-colors--subtext)}input[type=radio]:checked+.radio-inner-label{color:var(--text-colors--title)}.checkbox-label{color:var(--text-colors--subtext)}.w-checkbox-input--inputType-custom.w--redirected-checked{background-color:#f66025;border-color:#f66025}input[type=checkbox]:checked+.checkbox-label{color:var(--text-colors--title)}.checkbox-field:has(input[type=checkbox]:checked){border-color:#f66025}.radio-inner-label,.checkbox-label{transition:color .3s ease}.checkbox-field{transition:border-color .3s ease}.w-checkbox-input--inputType-custom{transition:background-color .3s ease,border-color .3s ease}span.pulse-form-error{color:#e55757;font-size:var(--_text-size---body--s);line-height:var(--_line-height---line-height-body--s);font-weight:var(--_font-weight---font-weight-body--s);letter-spacing:var(--_letter-spacing---letter-spacing-body--s)}[data-error-code=ERR_LEGAL_REQUIRED]{padding-left:18px}[form-flow-active=false]{display:none}[form-flow-active=true]{display:flex}[fullwidth]{width:100%}[hs-calender-active=true]{display:block;width:100%}[hs-calender-active=false]{display:none}div#iti-0__dropdown-content{background-color:#121212;border-color:#242424}#iti-0__search-input{background:#242424}.iti__search-input-wrapper{border-color:#242424}
|
package/dist/marquee/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
2
|
-
e.g. <script src="https://cdn.jsdelivr.net/npm/intl-tel-input@25/build/js/intlTelInput.min.js"><\/script>`);return}document.querySelectorAll('[pulse-form-block="phone"] input[type="tel"]').forEach(n=>{try{let r=e(n,{initialCountry:"us",separateDialCode:!0,strictMode:!1,loadUtils:()=>import("https://cdn.jsdelivr.net/npm/intl-tel-input@25/build/js/utils.js")});
|
|
1
|
+
"use strict";(()=>{var v=Object.create;var T=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var F=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var k=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of S(t))!P.call(e,o)&&o!==n&&T(e,o,{get:()=>t[o],enumerable:!(r=H(t,o))||r.enumerable});return e};var D=(e,t,n)=>(n=e!=null?v(M(e)):{},k(t||!e||!e.__esModule?T(n,"default",{value:e,enumerable:!0}):n,e));console.log("Book a demo form script loaded");var O=["text","email","phone","checkbox","radio","select","legal"],q=["true","atleast-one","only-one"],l={REQUIRED_INPUT:"ERR_REQUIRED",REQUIRED_LEGAL:"ERR_LEGAL_REQUIRED",REQUIRED_SELECT:"ERR_SELECT_REQUIRED",ATLEAST_ONE:"ERR_ATLEAST_ONE",ONLY_ONE_NONE:"ERR_ONLY_ONE_NONE",ONLY_ONE_EXCEEDED:"ERR_ONLY_ONE_EXCEEDED",INVALID_EMAIL:"ERR_INVALID_EMAIL",INVALID_PHONE:"ERR_INVALID_PHONE",PHONE_TOO_SHORT:"ERR_PHONE_TOO_SHORT",PHONE_TOO_LONG:"ERR_PHONE_TOO_LONG",PHONE_INVALID_COUNTRY:"ERR_PHONE_INVALID_COUNTRY"},u={[l.REQUIRED_INPUT]:"This field is required.",[l.REQUIRED_LEGAL]:"You must accept this to continue.",[l.REQUIRED_SELECT]:"Please select an option.",[l.ATLEAST_ONE]:"Please select at least one option.",[l.ONLY_ONE_NONE]:"Please select one option.",[l.ONLY_ONE_EXCEEDED]:"Only one option can be selected.",[l.INVALID_EMAIL]:"Please enter a valid email address.",[l.INVALID_PHONE]:"Please enter a valid phone number.",[l.PHONE_TOO_SHORT]:"Phone number is too short.",[l.PHONE_TOO_LONG]:"Phone number is too long.",[l.PHONE_INVALID_COUNTRY]:"Invalid country code."},f="pulse-form-error",N=new Map;function g(e){try{let t=e.getSelectedCountryData?.();if(!t?.dialCode)return;document.querySelectorAll('input[pulse-form-field="country-code"]').forEach(r=>{r.value=`+${t.dialCode}`})}catch(t){console.warn("[PulseForm] Error filling country code:",t)}}function x(){let e=window.intlTelInput;if(!e){console.warn(`[PulseForm] intlTelInput not found on window. Make sure you include the intl-tel-input script before this script.
|
|
2
|
+
e.g. <script src="https://cdn.jsdelivr.net/npm/intl-tel-input@25/build/js/intlTelInput.min.js"><\/script>`);return}document.querySelectorAll('[pulse-form-block="phone"] input[type="tel"]').forEach(n=>{try{let r=e(n,{initialCountry:"us",separateDialCode:!0,strictMode:!1,loadUtils:()=>import("https://cdn.jsdelivr.net/npm/intl-tel-input@25/build/js/utils.js")});N.set(n,r),g(r),n.addEventListener("countrychange",()=>{g(r)}),console.log(`[PulseForm] intl-tel-input initialized for "${n.closest("[pulse-form-block]")?.getAttribute("pulse-field-name")||"unknown"}"`)}catch(r){console.warn("[PulseForm] Failed to init intl-tel-input:",r)}})}var C={0:l.INVALID_PHONE,1:l.PHONE_INVALID_COUNTRY,2:l.PHONE_TOO_SHORT,3:l.PHONE_TOO_LONG,4:l.INVALID_PHONE};function V(e){return e?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?null:{code:l.INVALID_EMAIL,message:u[l.INVALID_EMAIL]}:null}function w(e){let t=e.value.trim();if(!t)return null;let n=N.get(e);if(n)try{if(n.isValidNumber())return null;let o=n.getValidationError?.()??0,s=C[o]||l.INVALID_PHONE;return{code:s,message:u[s]}}catch{return{code:l.INVALID_PHONE,message:u[l.INVALID_PHONE]}}let r=t.replace(/\D/g,"");return r.length<7?{code:l.PHONE_TOO_SHORT,message:u[l.PHONE_TOO_SHORT]}:r.length>15?{code:l.PHONE_TOO_LONG,message:u[l.PHONE_TOO_LONG]}:null}function U(e){let t=e.querySelector("input, textarea");return t?t.value.trim():null}function Y(e){let t=e.querySelector('input[type="email"]');return t?t.value.trim():null}function Q(e){let t=e.querySelector('input[type="tel"]');return t?t.value.trim():null}function $(e){let t=e.querySelectorAll('input[type="checkbox"]'),n=[];return t.forEach(r=>{if(r.checked){let o=r.getAttribute("data-name")?.trim();n.push(o||r.value||"on")}}),n}function G(e){let t=e.querySelectorAll('input[type="radio"]');for(let n of t)if(n.checked)return n.closest("label")?.textContent?.trim()||n.value||"on";return null}function B(e){let t=e.querySelector("select");if(!t)return null;let n=t.value.trim();return!n||t.selectedIndex===0?null:n}function j(e){let t=e.querySelector('input[type="checkbox"]');return t?t.checked:!1}function _(e,t){switch(e){case"text":return U(t);case"email":return Y(t);case"phone":return Q(t);case"checkbox":return $(t);case"radio":return G(t);case"select":return B(t);case"legal":return j(t);default:return null}}function y(e){let t=e.getAttribute("required-selection")?.trim().toLowerCase();return!t||!q.includes(t)?null:t}function X(e){return e.getAttribute("mirror-value")?.trim().toLowerCase()==="true"}function b(e,t,n,r){if(t)switch(t){case"true":{if(e==="legal"&&n!==!0)return{code:l.REQUIRED_LEGAL,message:u[l.REQUIRED_LEGAL]};if(e==="select"&&!n)return{code:l.REQUIRED_SELECT,message:u[l.REQUIRED_SELECT]};if((e==="text"||e==="email"||e==="phone")&&(!n||typeof n=="string"&&n===""))return{code:l.REQUIRED_INPUT,message:u[l.REQUIRED_INPUT]};break}case"atleast-one":{if(Array.isArray(n)?n.length===0:!n)return{code:l.ATLEAST_ONE,message:u[l.ATLEAST_ONE]};break}case"only-one":{if(Array.isArray(n)){if(n.length===0)return{code:l.ONLY_ONE_NONE,message:u[l.ONLY_ONE_NONE]};if(n.length>1)return{code:l.ONLY_ONE_EXCEEDED,message:u[l.ONLY_ONE_EXCEEDED]}}else if(!n)return{code:l.ONLY_ONE_NONE,message:u[l.ONLY_ONE_NONE]};break}}if(e==="email"&&typeof n=="string"&&n){let o=V(n);if(o)return o}if(e==="phone"&&typeof n=="string"&&n){let o=r.querySelector('input[type="tel"]');if(o){let s=w(o);if(s)return s}}return null}function p(e){let t=document.querySelectorAll("[pulse-form-block]"),n=[];return t.forEach(r=>{let o=r.getAttribute("pulse-form-block")?.trim().toLowerCase();if(!o||!O.includes(o))return;let s=o,d=r.getAttribute("pulse-field-name")?.trim();if(!d)return;let c=y(r),a=X(r),h=_(s,r),R=e?b(s,c,h,r):null;n.push({"form-block":s,"field-name":d,value:h,required:c,"mirror-value":a,error:R})}),n}function I(){document.querySelectorAll(`.${f}`).forEach(e=>e.remove()),document.querySelectorAll("[pulse-form-block]").forEach(e=>e.classList.remove("has-error"))}function W(e){let t=e.querySelector(`.${f}`);t&&t.remove(),e.classList.remove("has-error")}function A(e,t){let n=e.querySelector(`.${f}`);n&&n.remove();let r=document.createElement("span");r.className=f,r.textContent=t.message,r.setAttribute("data-error-code",t.code),r.setAttribute("data-field-name",e.getAttribute("pulse-field-name")?.trim()||""),e.classList.add("has-error"),e.appendChild(r)}function z(e){I(),document.querySelectorAll("[pulse-form-block]").forEach(n=>{let r=n.getAttribute("pulse-field-name")?.trim();if(!r)return;let o=e.find(s=>s["field-name"]===r);!o||!o.error||A(n,o.error)})}function J(){let e=document.querySelector("[pulse-form-block].has-error");if(!e)return;e.scrollIntoView({behavior:"smooth",block:"center"});let t=e.querySelector("input, textarea, select");t&&setTimeout(()=>t.focus(),400)}function m(){let e=i.filter(n=>n["mirror-value"]===!0);if(e.length===0)return;let t=document.querySelectorAll("[pulse-form-block-mirror]");e.forEach(n=>{let r=n["field-name"],o=!1;t.forEach(s=>{if(s.getAttribute("pulse-form-block-mirror")?.trim()!==r)return;o=!0;let c=s.querySelector("input, textarea, select");if(!c){console.warn(`[PulseForm] Mirror target for "${r}" found, but no input element inside it.`);return}let a=n.value;typeof a=="string"?c.value=a:typeof a=="boolean"?c instanceof HTMLInputElement&&c.type==="checkbox"?c.checked=a:c.value=String(a):Array.isArray(a)?c.value=a.join(", "):c.value=""}),o||console.warn(`[PulseForm] No mirror target found for field "${r}". Add an element with attribute pulse-form-block-mirror="${r}" to mirror this value.`)})}var K={"Financial Services":"david",Sports:"steven",Beauty:"albany",Music:"steven","Customer Packaged Goods":"david",Other:"david"};function Z(){let e=i.find(r=>r["field-name"]==="industry");if(!e||typeof e.value!="string"||!e.value)return;let t=K[e.value];document.querySelectorAll("[hs-calender]").forEach(r=>{let o=r.getAttribute("hs-calender")?.trim();t&&o===t?r.setAttribute("hs-calender-active","true"):r.setAttribute("hs-calender-active","false")})}function E(){let e=i.find(r=>r["field-name"]==="flow-type");if(!e)return;let t=e.value;document.querySelectorAll("[form-flow]").forEach(r=>{r.getAttribute("form-flow")?.trim()===t?r.setAttribute("form-flow-active","true"):r.setAttribute("form-flow-active","false")}),t==="White Glove services"&&Z()}var i=[];function L(e,t,n){let r=i.findIndex(o=>o["field-name"]===e);r!==-1&&(i[r]={...i[r],value:t,error:n},window.PulseFormData=i,m(),E())}function ee(e){let t=e.getAttribute("pulse-form-block")?.trim().toLowerCase(),n=e.getAttribute("pulse-field-name")?.trim();if(!n)return;let r=y(e),o=_(t,e);if(e.classList.contains("has-error")){let d=b(t,r,o,e);d?(A(e,d),L(n,o,d)):(W(e),L(n,o,null))}else L(n,o,null)}function te(){document.querySelectorAll("[pulse-form-block]").forEach(t=>{let n=t.getAttribute("pulse-form-block")?.trim().toLowerCase();if(!n||!O.includes(n))return;let r=()=>ee(t);switch(n){case"text":case"email":{let o=t.querySelector("input, textarea");o&&(o.addEventListener("input",r),o.addEventListener("change",r));break}case"phone":{let o=t.querySelector('input[type="tel"]');o&&(o.addEventListener("input",r),o.addEventListener("change",r),o.addEventListener("keyup",r),o.addEventListener("countrychange",r));break}case"checkbox":case"legal":{t.querySelectorAll('input[type="checkbox"]').forEach(o=>o.addEventListener("change",r));break}case"radio":{t.querySelectorAll('input[type="radio"]').forEach(o=>o.addEventListener("change",r));break}case"select":{let o=t.querySelector("select");o&&o.addEventListener("change",r);break}}})}var ne={get fields(){return i},refresh(){return i=p(!1),window.PulseFormData=i,m(),E(),i},validate(){let e=p(!0),t=e.every(n=>n.error===null);return i=e,window.PulseFormData=i,m(),E(),z(e),t||J(),{fields:e,isValid:t}},clearErrors(){I(),i=i.map(e=>({...e,error:null})),window.PulseFormData=i,m(),E()},ERROR_CODES:l,ERROR_MESSAGES:u};document.addEventListener("DOMContentLoaded",()=>{let e=document.querySelectorAll("[pulse-form-block]").length;console.log(`[PulseForm] Initialized \u2014 found ${e} form blocks.`),x(),i=p(!1),window.PulseFormData=i,m(),E(),te(),window.PulseForm=ne});})();
|