aw-wizard-forms 4.10.0 → 4.12.0
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/wizard-form.esm.js +667 -204
- package/dist/wizard-form.esm.js.map +1 -1
- package/dist/wizard-form.min.js +239 -23
- package/dist/wizard-form.min.js.map +1 -1
- package/package.json +1 -1
package/dist/wizard-form.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).WizardForm={})}(this,function(t){"use strict";function e(){if("undefined"==typeof document)return;const t=document.cookie.match(/hubspotutk=([^;]+)/);return t?t[1]:void 0}function s(t){const{portalId:s,formId:r,fieldMapping:i={},mock:o=!1}=t;return{name:"hubspot",mapFields(t){const e={};for(const[s,r]of Object.entries(t))e[i[s]||s]=r;return e},async submit(t,i){if(o)return await new Promise(t=>setTimeout(t,500)),{success:!0,data:{mock:!0,formData:t}};const a=`https://api.hsforms.com/submissions/v3/integration/submit/${s}/${r}`,n=this.mapFields(t),l={fields:Object.entries(n).map(([t,e])=>({name:t,value:Array.isArray(e)?e.join(";"):(e??"")+""})),context:{pageUri:i.pageUrl,pageName:i.pageTitle,hutk:e()}};try{const t=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});return t.ok?{success:!0,data:await t.json()}:{success:!1,error:(await t.json().catch(()=>({}))).message||"HubSpot submission failed: "+t.status}}catch(h){return{success:!1,error:h instanceof Error?h.message:"Network error"}}}}}function r(t){const{url:e,method:s="POST",headers:r={},fieldMapping:i={},mock:o=!1}=t;return{name:"webhook",mapFields(t){const e={};for(const[s,r]of Object.entries(t))e[i[s]||s]=r;return e},async submit(t,i){if(o)return await new Promise(t=>setTimeout(t,500)),{success:!0,data:{mock:!0,formData:t}};if(!e)return{success:!1,error:"Webhook URL is required"};const a={formData:this.mapFields(t),context:{pageUrl:i.pageUrl,pageTitle:i.pageTitle,referrer:i.referrer,submittedAt:i.timestamp}};try{const t=await fetch(e,{method:s,headers:{"Content-Type":"application/json",...r},body:JSON.stringify(a)});if(!t.ok){const e=await t.text().catch(()=>"");return{success:!1,error:`Webhook failed: ${t.status} ${e}`.trim()}}let i;try{i=await t.json()}catch{i={status:t.status}}return{success:!0,data:i}}catch(n){return{success:!1,error:n instanceof Error?n.message:"Network error"}}}}}function i(){return"undefined"!=typeof window&&void 0!==window.RevenueHero}function o(t){const{routerId:e,fieldMapping:s={},mock:r=!1}=t;return{name:"revenuehero",mapFields(t){const e={};for(const[r,i]of Object.entries(t))e[s[r]||r]=i;return e},async submit(t,s){if(r)return await new Promise(t=>setTimeout(t,500)),{success:!0,data:{mock:!0,scheduled:!0}};if(!e)return{success:!1,error:"RevenueHero router ID is required"};if(!i())return{success:!1,error:"RevenueHero SDK not loaded. Please load the SDK in your page."};const o=this.mapFields(t),a=(o.email||o.workEmail||"")+"";if(!a)return{success:!1,error:"Email is required for RevenueHero scheduling"};try{return window.RevenueHero.schedule({routerId:e,email:a,...o}),{success:!0,data:{scheduled:!0,email:a}}}catch(n){return{success:!1,error:n instanceof Error?n.message:"RevenueHero error"}}}}}const a=globalThis,n=a.ShadowRoot&&(void 0===a.ShadyCSS||a.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,l=Symbol(),h=new WeakMap;let d=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==l)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(n&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=h.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&h.set(e,t))}return t}toString(){return this.cssText}};const c=(t,...e)=>{const s=1===t.length?t[0]:e.reduce((e,s,r)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[r+1],t[0]);return new d(s,t,l)},p=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new d("string"==typeof t?t:t+"",void 0,l))(e)})(t):t,{is:u,defineProperty:f,getOwnPropertyDescriptor:g,getOwnPropertyNames:m,getOwnPropertySymbols:w,getPrototypeOf:b}=Object,v=globalThis,_=v.trustedTypes,y=_?_.emptyScript:"",S=v.reactiveElementPolyfillSupport,x=(t,e)=>t,$={toAttribute(t,e){switch(e){case Boolean:t=t?y:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(r){s=null}}return s}},E=(t,e)=>!u(t,e),k={attribute:!0,type:String,converter:$,reflect:!1,useDefault:!1,hasChanged:E};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),v.litPropertyMetadata??(v.litPropertyMetadata=new WeakMap);let A=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=k){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(t,s,e);void 0!==r&&f(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){const{get:r,set:i}=g(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:r,set(e){const o=r?.call(this);i?.call(this,e),this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??k}static _$Ei(){if(this.hasOwnProperty(x("elementProperties")))return;const t=b(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(x("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(x("properties"))){const t=this.properties,e=[...m(t),...w(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const t=this._$Eu(e,s);void 0!==t&&this._$Eh.set(t,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(p(t))}else void 0!==t&&e.push(p(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(n)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const s of e){const e=document.createElement("style"),r=a.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=s.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(void 0!==r&&!0===s.reflect){const i=(void 0!==s.converter?.toAttribute?s.converter:$).toAttribute(e,s.type);this._$Em=t,null==i?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(t,e){const s=this.constructor,r=s._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=s.getPropertyOptions(r),i="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:$;this._$Em=r;const o=i.fromAttribute(e,t.type);this[r]=o??this._$Ej?.get(r)??o,this._$Em=null}}requestUpdate(t,e,s,r=!1,i){if(void 0!==t){const o=this.constructor;if(!1===r&&(i=this[t]),s??(s=o.getPropertyOptions(t)),!((s.hasChanged??E)(i,e)||s.useDefault&&s.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:r,wrapped:i},o){s&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,o??e??this[t]),!0!==i||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===r&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,r=this[e];!0!==t||this._$AL.has(e)||void 0===r||this.C(e,void 0,s,r)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[x("elementProperties")]=new Map,A[x("finalized")]=new Map,S?.({ReactiveElement:A}),(v.reactiveElementVersions??(v.reactiveElementVersions=[])).push("2.1.2");const C=globalThis,O=t=>t,W=C.trustedTypes,z=W?W.createPolicy("lit-html",{createHTML:t=>t}):void 0,P="$lit$",N=`lit$${Math.random().toFixed(9).slice(2)}$`,L="?"+N,T=`<${L}>`,D=document,F=()=>D.createComment(""),M=t=>null===t||"object"!=typeof t&&"function"!=typeof t,B=Array.isArray,I="[ \t\n\f\r]",j=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,q=/-->/g,H=/>/g,V=RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),U=/'/g,R=/"/g,Y=/^(?:script|style|textarea|title)$/i,K=(t,...e)=>({_$litType$:1,strings:t,values:e}),X=Symbol.for("lit-noChange"),J=Symbol.for("lit-nothing"),G=new WeakMap,Z=D.createTreeWalker(D,129);function Q(t,e){if(!B(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==z?z.createHTML(e):e}class tt{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let i=0,o=0;const a=t.length-1,n=this.parts,[l,h]=((t,e)=>{const s=t.length-1,r=[];let i,o=2===e?"<svg>":3===e?"<math>":"",a=j;for(let n=0;n<s;n++){const e=t[n];let s,l,h=-1,d=0;for(;d<e.length&&(a.lastIndex=d,l=a.exec(e),null!==l);)d=a.lastIndex,a===j?"!--"===l[1]?a=q:void 0!==l[1]?a=H:void 0!==l[2]?(Y.test(l[2])&&(i=RegExp("</"+l[2],"g")),a=V):void 0!==l[3]&&(a=V):a===V?">"===l[0]?(a=i??j,h=-1):void 0===l[1]?h=-2:(h=a.lastIndex-l[2].length,s=l[1],a=void 0===l[3]?V:'"'===l[3]?R:U):a===R||a===U?a=V:a===q||a===H?a=j:(a=V,i=void 0);const c=a===V&&t[n+1].startsWith("/>")?" ":"";o+=a===j?e+T:h>=0?(r.push(s),e.slice(0,h)+P+e.slice(h)+N+c):e+N+(-2===h?n:c)}return[Q(t,o+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),r]})(t,e);if(this.el=tt.createElement(l,s),Z.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=Z.nextNode())&&n.length<a;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(P)){const e=h[o++],s=r.getAttribute(t).split(N),a=/([.?@])?(.*)/.exec(e);n.push({type:1,index:i,name:a[2],strings:s,ctor:"."===a[1]?ot:"?"===a[1]?at:"@"===a[1]?nt:it}),r.removeAttribute(t)}else t.startsWith(N)&&(n.push({type:6,index:i}),r.removeAttribute(t));if(Y.test(r.tagName)){const t=r.textContent.split(N),e=t.length-1;if(e>0){r.textContent=W?W.emptyScript:"";for(let s=0;s<e;s++)r.append(t[s],F()),Z.nextNode(),n.push({type:2,index:++i});r.append(t[e],F())}}}else if(8===r.nodeType)if(r.data===L)n.push({type:2,index:i});else{let t=-1;for(;-1!==(t=r.data.indexOf(N,t+1));)n.push({type:7,index:i}),t+=N.length-1}i++}}static createElement(t,e){const s=D.createElement("template");return s.innerHTML=t,s}}function et(t,e,s=t,r){if(e===X)return e;let i=void 0!==r?s._$Co?.[r]:s._$Cl;const o=M(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),void 0===o?i=void 0:(i=new o(t),i._$AT(t,s,r)),void 0!==r?(s._$Co??(s._$Co=[]))[r]=i:s._$Cl=i),void 0!==i&&(e=et(t,i._$AS(t,e.values),i,r)),e}class st{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,r=(t?.creationScope??D).importNode(e,!0);Z.currentNode=r;let i=Z.nextNode(),o=0,a=0,n=s[0];for(;void 0!==n;){if(o===n.index){let e;2===n.type?e=new rt(i,i.nextSibling,this,t):1===n.type?e=new n.ctor(i,n.name,n.strings,this,t):6===n.type&&(e=new lt(i,this,t)),this._$AV.push(e),n=s[++a]}o!==n?.index&&(i=Z.nextNode(),o++)}return Z.currentNode=D,r}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class rt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,r){this.type=2,this._$AH=J,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=et(this,t,e),M(t)?t===J||null==t||""===t?(this._$AH!==J&&this._$AR(),this._$AH=J):t!==this._$AH&&t!==X&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>B(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==J&&M(this._$AH)?this._$AA.nextSibling.data=t:this.T(D.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,r="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=tt.createElement(Q(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(e);else{const t=new st(r,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=G.get(t.strings);return void 0===e&&G.set(t.strings,e=new tt(t)),e}k(t){B(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,r=0;for(const i of t)r===e.length?e.push(s=new rt(this.O(F()),this.O(F()),this,this.options)):s=e[r],s._$AI(i),r++;r<e.length&&(this._$AR(s&&s._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=O(t).nextSibling;O(t).remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class it{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,r,i){this.type=1,this._$AH=J,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=i,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=J}_$AI(t,e=this,s,r){const i=this.strings;let o=!1;if(void 0===i)t=et(this,t,e,0),o=!M(t)||t!==this._$AH&&t!==X,o&&(this._$AH=t);else{const r=t;let a,n;for(t=i[0],a=0;a<i.length-1;a++)n=et(this,r[s+a],e,a),n===X&&(n=this._$AH[a]),o||(o=!M(n)||n!==this._$AH[a]),n===J?t=J:t!==J&&(t+=(n??"")+i[a+1]),this._$AH[a]=n}o&&!r&&this.j(t)}j(t){t===J?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class ot extends it{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===J?void 0:t}}class at extends it{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==J)}}class nt extends it{constructor(t,e,s,r,i){super(t,e,s,r,i),this.type=5}_$AI(t,e=this){if((t=et(this,t,e,0)??J)===X)return;const s=this._$AH,r=t===J&&s!==J||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,i=t!==J&&(s===J||r);r&&this.element.removeEventListener(this.name,this,s),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class lt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){et(this,t)}}const ht=C.litHtmlPolyfillSupport;ht?.(tt,rt),(C.litHtmlVersions??(C.litHtmlVersions=[])).push("3.3.2");const dt=globalThis;class ct extends A{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,s)=>{const r=s?.renderBefore??e;let i=r._$litPart$;if(void 0===i){const t=s?.renderBefore??null;r._$litPart$=i=new rt(e.insertBefore(F(),t),t,void 0,s??{})}return i._$AI(t),i})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return X}}ct._$litElement$=!0,ct.finalized=!0,dt.litElementHydrateSupport?.({LitElement:ct});const pt=dt.litElementPolyfillSupport;pt?.({LitElement:ct}),(dt.litElementVersions??(dt.litElementVersions=[])).push("4.2.2");const ut=t=>(e,s)=>{void 0!==s?s.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},ft={attribute:!0,type:String,converter:$,reflect:!1,hasChanged:E},gt=(t=ft,e,s)=>{const{kind:r,metadata:i}=s;let o=globalThis.litPropertyMetadata.get(i);if(void 0===o&&globalThis.litPropertyMetadata.set(i,o=new Map),"setter"===r&&((t=Object.create(t)).wrapped=!0),o.set(s.name,t),"accessor"===r){const{name:r}=s;return{set(s){const i=e.get.call(this);e.set.call(this,s),this.requestUpdate(r,i,t,!0,s)},init(e){return void 0!==e&&this.C(r,void 0,t,e),e}}}if("setter"===r){const{name:r}=s;return function(s){const i=this[r];e.call(this,s),this.requestUpdate(r,i,t,!0,s)}}throw Error("Unsupported decorator location: "+r)};function mt(t){return(e,s)=>"object"==typeof s?gt(t,e,s):((t,e,s)=>{const r=e.hasOwnProperty(s);return e.constructor.createProperty(s,t),r?Object.getOwnPropertyDescriptor(e,s):void 0})(t,e,s)}function wt(t){return mt({...t,state:!0,attribute:!1})}function bt(t,e){return(e,s,r)=>((t,e,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,s),s))(e,s,{get(){return e=this,e.renderRoot?.querySelector(t)??null;var e}})}const vt=c`
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).WizardForm={})}(this,function(t){"use strict";function e(){if("undefined"==typeof document)return;const t=document.cookie.match(/hubspotutk=([^;]+)/);return t?t[1]:void 0}function s(t){const{portalId:s,formId:r,fieldMapping:i={},mock:o=!1}=t;return{name:"hubspot",mapFields(t){const e={};for(const[s,r]of Object.entries(t))e[i[s]||s]=r;return e},async submit(t,i){if(o)return await new Promise(t=>setTimeout(t,500)),{success:!0,data:{mock:!0,formData:t}};const a=`https://api.hsforms.com/submissions/v3/integration/submit/${s}/${r}`,n=this.mapFields(t),l={fields:Object.entries(n).map(([t,e])=>({name:t,value:Array.isArray(e)?e.join(";"):(e??"")+""})),context:{pageUri:i.pageUrl,pageName:i.pageTitle,hutk:e()}};try{const t=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});return t.ok?{success:!0,data:await t.json()}:{success:!1,error:(await t.json().catch(()=>({}))).message||"HubSpot submission failed: "+t.status}}catch(d){return{success:!1,error:d instanceof Error?d.message:"Network error"}}}}}function r(t){const{url:e,method:s="POST",headers:r={},fieldMapping:i={},mock:o=!1}=t;return{name:"webhook",mapFields(t){const e={};for(const[s,r]of Object.entries(t))e[i[s]||s]=r;return e},async submit(t,i){if(o)return await new Promise(t=>setTimeout(t,500)),{success:!0,data:{mock:!0,formData:t}};if(!e)return{success:!1,error:"Webhook URL is required"};const a={formData:this.mapFields(t),context:{pageUrl:i.pageUrl,pageTitle:i.pageTitle,referrer:i.referrer,submittedAt:i.timestamp}};try{const t=await fetch(e,{method:s,headers:{"Content-Type":"application/json",...r},body:JSON.stringify(a)});if(!t.ok){const e=await t.text().catch(()=>"");return{success:!1,error:`Webhook failed: ${t.status} ${e}`.trim()}}let i;try{i=await t.json()}catch{i={status:t.status}}return{success:!0,data:i}}catch(n){return{success:!1,error:n instanceof Error?n.message:"Network error"}}}}}function i(){return"undefined"!=typeof window&&void 0!==window.RevenueHero}function o(t){const{routerId:e,fieldMapping:s={},mock:r=!1}=t;return{name:"revenuehero",mapFields(t){const e={};for(const[r,i]of Object.entries(t))e[s[r]||r]=i;return e},async submit(t,s){if(r)return await new Promise(t=>setTimeout(t,500)),{success:!0,data:{mock:!0,scheduled:!0}};if(!e)return{success:!1,error:"RevenueHero router ID is required"};if(!i())return{success:!1,error:"RevenueHero SDK not loaded. Please load the SDK in your page."};const o=this.mapFields(t),a=(o.email||o.workEmail||"")+"";if(!a)return{success:!1,error:"Email is required for RevenueHero scheduling"};try{return window.RevenueHero.schedule({routerId:e,email:a,...o}),{success:!0,data:{scheduled:!0,email:a}}}catch(n){return{success:!1,error:n instanceof Error?n.message:"RevenueHero error"}}}}}const a=globalThis,n=a.ShadowRoot&&(void 0===a.ShadyCSS||a.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,l=Symbol(),d=new WeakMap;let h=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==l)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(n&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=d.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&d.set(e,t))}return t}toString(){return this.cssText}};const c=(t,...e)=>{const s=1===t.length?t[0]:e.reduce((e,s,r)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[r+1],t[0]);return new h(s,t,l)},p=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new h("string"==typeof t?t:t+"",void 0,l))(e)})(t):t,{is:f,defineProperty:u,getOwnPropertyDescriptor:g,getOwnPropertyNames:w,getOwnPropertySymbols:m,getPrototypeOf:b}=Object,v=globalThis,_=v.trustedTypes,y=_?_.emptyScript:"",S=v.reactiveElementPolyfillSupport,x=(t,e)=>t,$={toAttribute(t,e){switch(e){case Boolean:t=t?y:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(r){s=null}}return s}},k=(t,e)=>!f(t,e),E={attribute:!0,type:String,converter:$,reflect:!1,useDefault:!1,hasChanged:k};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),v.litPropertyMetadata??(v.litPropertyMetadata=new WeakMap);let C=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=E){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(t,s,e);void 0!==r&&u(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){const{get:r,set:i}=g(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:r,set(e){const o=r?.call(this);i?.call(this,e),this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??E}static _$Ei(){if(this.hasOwnProperty(x("elementProperties")))return;const t=b(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(x("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(x("properties"))){const t=this.properties,e=[...w(t),...m(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const t=this._$Eu(e,s);void 0!==t&&this._$Eh.set(t,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(p(t))}else void 0!==t&&e.push(p(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(n)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const s of e){const e=document.createElement("style"),r=a.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=s.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(void 0!==r&&!0===s.reflect){const i=(void 0!==s.converter?.toAttribute?s.converter:$).toAttribute(e,s.type);this._$Em=t,null==i?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(t,e){const s=this.constructor,r=s._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=s.getPropertyOptions(r),i="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:$;this._$Em=r;const o=i.fromAttribute(e,t.type);this[r]=o??this._$Ej?.get(r)??o,this._$Em=null}}requestUpdate(t,e,s,r=!1,i){if(void 0!==t){const o=this.constructor;if(!1===r&&(i=this[t]),s??(s=o.getPropertyOptions(t)),!((s.hasChanged??k)(i,e)||s.useDefault&&s.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:r,wrapped:i},o){s&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,o??e??this[t]),!0!==i||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===r&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,r=this[e];!0!==t||this._$AL.has(e)||void 0===r||this.C(e,void 0,s,r)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};C.elementStyles=[],C.shadowRootOptions={mode:"open"},C[x("elementProperties")]=new Map,C[x("finalized")]=new Map,S?.({ReactiveElement:C}),(v.reactiveElementVersions??(v.reactiveElementVersions=[])).push("2.1.2");const A=globalThis,O=t=>t,W=A.trustedTypes,z=W?W.createPolicy("lit-html",{createHTML:t=>t}):void 0,P="$lit$",L=`lit$${Math.random().toFixed(9).slice(2)}$`,N="?"+L,T=`<${N}>`,D=document,F=()=>D.createComment(""),M=t=>null===t||"object"!=typeof t&&"function"!=typeof t,B=Array.isArray,I="[ \t\n\f\r]",j=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,q=/-->/g,H=/>/g,V=RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),U=/'/g,R=/"/g,Y=/^(?:script|style|textarea|title)$/i,K=(t,...e)=>({_$litType$:1,strings:t,values:e}),X=Symbol.for("lit-noChange"),J=Symbol.for("lit-nothing"),G=new WeakMap,Z=D.createTreeWalker(D,129);function Q(t,e){if(!B(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==z?z.createHTML(e):e}class tt{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let i=0,o=0;const a=t.length-1,n=this.parts,[l,d]=((t,e)=>{const s=t.length-1,r=[];let i,o=2===e?"<svg>":3===e?"<math>":"",a=j;for(let n=0;n<s;n++){const e=t[n];let s,l,d=-1,h=0;for(;h<e.length&&(a.lastIndex=h,l=a.exec(e),null!==l);)h=a.lastIndex,a===j?"!--"===l[1]?a=q:void 0!==l[1]?a=H:void 0!==l[2]?(Y.test(l[2])&&(i=RegExp("</"+l[2],"g")),a=V):void 0!==l[3]&&(a=V):a===V?">"===l[0]?(a=i??j,d=-1):void 0===l[1]?d=-2:(d=a.lastIndex-l[2].length,s=l[1],a=void 0===l[3]?V:'"'===l[3]?R:U):a===R||a===U?a=V:a===q||a===H?a=j:(a=V,i=void 0);const c=a===V&&t[n+1].startsWith("/>")?" ":"";o+=a===j?e+T:d>=0?(r.push(s),e.slice(0,d)+P+e.slice(d)+L+c):e+L+(-2===d?n:c)}return[Q(t,o+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),r]})(t,e);if(this.el=tt.createElement(l,s),Z.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=Z.nextNode())&&n.length<a;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(P)){const e=d[o++],s=r.getAttribute(t).split(L),a=/([.?@])?(.*)/.exec(e);n.push({type:1,index:i,name:a[2],strings:s,ctor:"."===a[1]?ot:"?"===a[1]?at:"@"===a[1]?nt:it}),r.removeAttribute(t)}else t.startsWith(L)&&(n.push({type:6,index:i}),r.removeAttribute(t));if(Y.test(r.tagName)){const t=r.textContent.split(L),e=t.length-1;if(e>0){r.textContent=W?W.emptyScript:"";for(let s=0;s<e;s++)r.append(t[s],F()),Z.nextNode(),n.push({type:2,index:++i});r.append(t[e],F())}}}else if(8===r.nodeType)if(r.data===N)n.push({type:2,index:i});else{let t=-1;for(;-1!==(t=r.data.indexOf(L,t+1));)n.push({type:7,index:i}),t+=L.length-1}i++}}static createElement(t,e){const s=D.createElement("template");return s.innerHTML=t,s}}function et(t,e,s=t,r){if(e===X)return e;let i=void 0!==r?s._$Co?.[r]:s._$Cl;const o=M(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),void 0===o?i=void 0:(i=new o(t),i._$AT(t,s,r)),void 0!==r?(s._$Co??(s._$Co=[]))[r]=i:s._$Cl=i),void 0!==i&&(e=et(t,i._$AS(t,e.values),i,r)),e}class st{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,r=(t?.creationScope??D).importNode(e,!0);Z.currentNode=r;let i=Z.nextNode(),o=0,a=0,n=s[0];for(;void 0!==n;){if(o===n.index){let e;2===n.type?e=new rt(i,i.nextSibling,this,t):1===n.type?e=new n.ctor(i,n.name,n.strings,this,t):6===n.type&&(e=new lt(i,this,t)),this._$AV.push(e),n=s[++a]}o!==n?.index&&(i=Z.nextNode(),o++)}return Z.currentNode=D,r}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class rt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,r){this.type=2,this._$AH=J,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=et(this,t,e),M(t)?t===J||null==t||""===t?(this._$AH!==J&&this._$AR(),this._$AH=J):t!==this._$AH&&t!==X&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>B(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==J&&M(this._$AH)?this._$AA.nextSibling.data=t:this.T(D.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,r="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=tt.createElement(Q(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(e);else{const t=new st(r,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=G.get(t.strings);return void 0===e&&G.set(t.strings,e=new tt(t)),e}k(t){B(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,r=0;for(const i of t)r===e.length?e.push(s=new rt(this.O(F()),this.O(F()),this,this.options)):s=e[r],s._$AI(i),r++;r<e.length&&(this._$AR(s&&s._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=O(t).nextSibling;O(t).remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class it{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,r,i){this.type=1,this._$AH=J,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=i,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=J}_$AI(t,e=this,s,r){const i=this.strings;let o=!1;if(void 0===i)t=et(this,t,e,0),o=!M(t)||t!==this._$AH&&t!==X,o&&(this._$AH=t);else{const r=t;let a,n;for(t=i[0],a=0;a<i.length-1;a++)n=et(this,r[s+a],e,a),n===X&&(n=this._$AH[a]),o||(o=!M(n)||n!==this._$AH[a]),n===J?t=J:t!==J&&(t+=(n??"")+i[a+1]),this._$AH[a]=n}o&&!r&&this.j(t)}j(t){t===J?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class ot extends it{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===J?void 0:t}}class at extends it{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==J)}}class nt extends it{constructor(t,e,s,r,i){super(t,e,s,r,i),this.type=5}_$AI(t,e=this){if((t=et(this,t,e,0)??J)===X)return;const s=this._$AH,r=t===J&&s!==J||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,i=t!==J&&(s===J||r);r&&this.element.removeEventListener(this.name,this,s),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class lt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){et(this,t)}}const dt=A.litHtmlPolyfillSupport;dt?.(tt,rt),(A.litHtmlVersions??(A.litHtmlVersions=[])).push("3.3.2");const ht=globalThis;class ct extends C{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,s)=>{const r=s?.renderBefore??e;let i=r._$litPart$;if(void 0===i){const t=s?.renderBefore??null;r._$litPart$=i=new rt(e.insertBefore(F(),t),t,void 0,s??{})}return i._$AI(t),i})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return X}}ct._$litElement$=!0,ct.finalized=!0,ht.litElementHydrateSupport?.({LitElement:ct});const pt=ht.litElementPolyfillSupport;pt?.({LitElement:ct}),(ht.litElementVersions??(ht.litElementVersions=[])).push("4.2.2");const ft=t=>(e,s)=>{void 0!==s?s.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},ut={attribute:!0,type:String,converter:$,reflect:!1,hasChanged:k},gt=(t=ut,e,s)=>{const{kind:r,metadata:i}=s;let o=globalThis.litPropertyMetadata.get(i);if(void 0===o&&globalThis.litPropertyMetadata.set(i,o=new Map),"setter"===r&&((t=Object.create(t)).wrapped=!0),o.set(s.name,t),"accessor"===r){const{name:r}=s;return{set(s){const i=e.get.call(this);e.set.call(this,s),this.requestUpdate(r,i,t,!0,s)},init(e){return void 0!==e&&this.C(r,void 0,t,e),e}}}if("setter"===r){const{name:r}=s;return function(s){const i=this[r];e.call(this,s),this.requestUpdate(r,i,t,!0,s)}}throw Error("Unsupported decorator location: "+r)};function wt(t){return(e,s)=>"object"==typeof s?gt(t,e,s):((t,e,s)=>{const r=e.hasOwnProperty(s);return e.constructor.createProperty(s,t),r?Object.getOwnPropertyDescriptor(e,s):void 0})(t,e,s)}function mt(t){return wt({...t,state:!0,attribute:!1})}function bt(t,e){return(e,s,r)=>((t,e,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,s),s))(e,s,{get(){return e=this,e.renderRoot?.querySelector(t)??null;var e}})}const vt=c`
|
|
2
2
|
:host {
|
|
3
3
|
${c`
|
|
4
4
|
/* Colors */
|
|
@@ -285,7 +285,7 @@
|
|
|
285
285
|
:host([submitted]) ::slotted(wf-step) {
|
|
286
286
|
display: none !important;
|
|
287
287
|
}
|
|
288
|
-
`];class xt{constructor(t){this._formData={},this._validation={},this._currentStep=1,this._totalSteps=0,this._submitting=!1,this._submitted=!1,this._stepConfigs=new Map,this._subscribers=new Set,this.host=t,t.addController(this)}hostConnected(){}hostDisconnected(){this._subscribers.clear()}get formData(){return{...this._formData}}get validation(){return{...this._validation}}get currentStep(){return this._currentStep}get totalSteps(){return this._totalSteps}get submitting(){return this._submitting}get submitted(){return this._submitted}get error(){return this._error}get state(){return{formData:this.formData,validation:this.validation,currentStep:this._currentStep,totalSteps:this._totalSteps,submitting:this._submitting,submitted:this._submitted,error:this._error}}setValue(t,e){this._formData[t]=e,this._validation[t]?this._validation[t]={...this._validation[t],value:e,dirty:!0}:this._validation[t]={name:t,value:e,result:{valid:!0},touched:!1,dirty:!0},this._notifyChange()}getValue(t){return this._formData[t]}setValidation(t,e){const s=this._validation[t];this._validation[t]={name:t,value:s?.value??this._formData[t],result:e,touched:s?.touched??!1,dirty:s?.dirty??!1},this._notifyChange()}markTouched(t){this._validation[t]?this._validation[t]={...this._validation[t],touched:!0}:this._validation[t]={name:t,value:this._formData[t],result:{valid:!0},touched:!0,dirty:!1},this._notifyChange()}setTotalSteps(t){this._totalSteps=t,this._notifyChange()}setStepConfig(t,e){this._stepConfigs.set(t,e)}getStepConfig(t){return this._stepConfigs.get(t)}getStepFields(t){return this._stepConfigs.get(t)?.fields??[]}goToStep(t){if(t<1||t>this._totalSteps)return!1;const e=this._stepConfigs.get(t);return e?.skipIf?.(this._formData)?t>this._currentStep?this.goToStep(t+1):this.goToStep(t-1):(this._currentStep=t,this._notifyChange(),!0)}nextStep(){return this.goToStep(this._currentStep+1)}previousStep(){return this.goToStep(this._currentStep-1)}isFirstStep(){return 1===this._currentStep}isLastStep(){return this._currentStep===this._totalSteps}isStepValid(t){return this.getStepFields(t).every(t=>{const e=this._validation[t];return!e||e.result.valid})}isCurrentStepValid(){return this.isStepValid(this._currentStep)}getFieldError(t){const e=this._validation[t];if(e?.touched&&!e.result.valid)return e.result.error}hasFieldError(t){return void 0!==this.getFieldError(t)}setSubmitting(t){this._submitting=t,this._notifyChange()}setSubmitted(t){this._submitted=t,this._notifyChange()}setError(t){this._error=t,this._notifyChange()}reset(){this._formData={},this._validation={},this._currentStep=1,this._submitting=!1,this._submitted=!1,this._error=void 0,this._notifyChange()}subscribe(t){return this._subscribers.add(t),()=>{this._subscribers.delete(t)}}_notifyChange(){this.host.requestUpdate();const t=this.state;this._subscribers.forEach(e=>{try{e(t)}catch(s){}})}}class $t{constructor(t,e={}){this._enabled=!0,this.host=t,this._config={blockEnterOnTextarea:!0,...e},this._boundHandler=this._handleKeydown.bind(this),t.addController(this)}hostConnected(){this.host.addEventListener("keydown",this._boundHandler),document.addEventListener("keydown",this._boundHandler)}hostDisconnected(){this.host.removeEventListener("keydown",this._boundHandler),document.removeEventListener("keydown",this._boundHandler)}_handleKeydown(t){if(!this._enabled)return;const e=this._getActiveElement(),s="TEXTAREA"===e?.tagName,r="INPUT"===e?.tagName,i="true"===e?.getAttribute("contenteditable"),o=s||r||i;switch(t.key){case"Enter":if(s&&this._config.blockEnterOnTextarea)return;this._config.onEnter&&(t.preventDefault(),this._config.onEnter());break;case"Escape":this._config.onEscape&&(t.preventDefault(),this._config.onEscape());break;case"ArrowUp":!o&&this._config.onArrowUp&&(t.preventDefault(),this._config.onArrowUp());break;case"ArrowDown":!o&&this._config.onArrowDown&&(t.preventDefault(),this._config.onArrowDown());break;case"ArrowLeft":!o&&this._config.onArrowLeft&&(t.preventDefault(),this._config.onArrowLeft());break;case"ArrowRight":!o&&this._config.onArrowRight&&(t.preventDefault(),this._config.onArrowRight())}}_getActiveElement(){let t=document.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}updateConfig(t){this._config={...this._config,...t}}enable(){this._enabled=!0}disable(){this._enabled=!1}get enabled(){return this._enabled}}const
|
|
288
|
+
`];class xt{constructor(t){this._formData={},this._validation={},this._currentStep=1,this._totalSteps=0,this._submitting=!1,this._submitted=!1,this._stepConfigs=new Map,this._subscribers=new Set,this.host=t,t.addController(this)}hostConnected(){}hostDisconnected(){this._subscribers.clear()}get formData(){return{...this._formData}}get validation(){return{...this._validation}}get currentStep(){return this._currentStep}get totalSteps(){return this._totalSteps}get submitting(){return this._submitting}get submitted(){return this._submitted}get error(){return this._error}get state(){return{formData:this.formData,validation:this.validation,currentStep:this._currentStep,totalSteps:this._totalSteps,submitting:this._submitting,submitted:this._submitted,error:this._error}}setValue(t,e){this._formData[t]=e,this._validation[t]?this._validation[t]={...this._validation[t],value:e,dirty:!0}:this._validation[t]={name:t,value:e,result:{valid:!0},touched:!1,dirty:!0},this._notifyChange()}getValue(t){return this._formData[t]}setValidation(t,e){const s=this._validation[t];this._validation[t]={name:t,value:s?.value??this._formData[t],result:e,touched:s?.touched??!1,dirty:s?.dirty??!1},this._notifyChange()}markTouched(t){this._validation[t]?this._validation[t]={...this._validation[t],touched:!0}:this._validation[t]={name:t,value:this._formData[t],result:{valid:!0},touched:!0,dirty:!1},this._notifyChange()}setTotalSteps(t){this._totalSteps=t,this._notifyChange()}setStepConfig(t,e){this._stepConfigs.set(t,e)}getStepConfig(t){return this._stepConfigs.get(t)}getStepFields(t){return this._stepConfigs.get(t)?.fields??[]}goToStep(t){if(t<1||t>this._totalSteps)return!1;const e=this._stepConfigs.get(t);return e?.skipIf?.(this._formData)?t>this._currentStep?this.goToStep(t+1):this.goToStep(t-1):(this._currentStep=t,this._notifyChange(),!0)}nextStep(){return this.goToStep(this._currentStep+1)}previousStep(){return this.goToStep(this._currentStep-1)}isFirstStep(){return 1===this._currentStep}isLastStep(){return this._currentStep===this._totalSteps}isStepValid(t){return this.getStepFields(t).every(t=>{const e=this._validation[t];return!e||e.result.valid})}isCurrentStepValid(){return this.isStepValid(this._currentStep)}getFieldError(t){const e=this._validation[t];if(e?.touched&&!e.result.valid)return e.result.error}hasFieldError(t){return void 0!==this.getFieldError(t)}setSubmitting(t){this._submitting=t,this._notifyChange()}setSubmitted(t){this._submitted=t,this._notifyChange()}setError(t){this._error=t,this._notifyChange()}reset(){this._formData={},this._validation={},this._currentStep=1,this._submitting=!1,this._submitted=!1,this._error=void 0,this._notifyChange()}subscribe(t){return this._subscribers.add(t),()=>{this._subscribers.delete(t)}}_notifyChange(){this.host.requestUpdate();const t=this.state;this._subscribers.forEach(e=>{try{e(t)}catch(s){}})}}class $t{constructor(t,e={}){this._enabled=!0,this.host=t,this._config={blockEnterOnTextarea:!0,...e},this._boundHandler=this._handleKeydown.bind(this),t.addController(this)}hostConnected(){this.host.addEventListener("keydown",this._boundHandler),document.addEventListener("keydown",this._boundHandler)}hostDisconnected(){this.host.removeEventListener("keydown",this._boundHandler),document.removeEventListener("keydown",this._boundHandler)}_handleKeydown(t){if(!this._enabled)return;const e=this._getActiveElement(),s="TEXTAREA"===e?.tagName,r="INPUT"===e?.tagName,i="true"===e?.getAttribute("contenteditable"),o=s||r||i;switch(t.key){case"Enter":if(s&&this._config.blockEnterOnTextarea)return;if("BUTTON"===e?.tagName)return;this._config.onEnter&&(t.preventDefault(),this._config.onEnter());break;case"Escape":this._config.onEscape&&(t.preventDefault(),this._config.onEscape());break;case"ArrowUp":!o&&this._config.onArrowUp&&(t.preventDefault(),this._config.onArrowUp());break;case"ArrowDown":!o&&this._config.onArrowDown&&(t.preventDefault(),this._config.onArrowDown());break;case"ArrowLeft":!o&&this._config.onArrowLeft&&(t.preventDefault(),this._config.onArrowLeft());break;case"ArrowRight":!o&&this._config.onArrowRight&&(t.preventDefault(),this._config.onArrowRight())}}_getActiveElement(){let t=document.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}updateConfig(t){this._config={...this._config,...t}}enable(){this._enabled=!0}disable(){this._enabled=!1}get enabled(){return this._enabled}}const kt=c`
|
|
289
289
|
:host {
|
|
290
290
|
display: inline-flex;
|
|
291
291
|
}
|
|
@@ -337,7 +337,7 @@
|
|
|
337
337
|
border-radius: var(--wf-radius-sm);
|
|
338
338
|
color: var(--wf-color-text-muted);
|
|
339
339
|
}
|
|
340
|
-
`;var
|
|
340
|
+
`;var Et=Object.defineProperty,Ct=Object.getOwnPropertyDescriptor,At=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?Ct(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&Et(e,s,o),o};t.WfBadge=class extends ct{constructor(){super(...arguments),this.shortcut="",this.variant="default"}render(){return K`
|
|
341
341
|
<span
|
|
342
342
|
class="wf-badge wf-badge--${this.variant}"
|
|
343
343
|
aria-hidden="true"
|
|
@@ -345,7 +345,7 @@
|
|
|
345
345
|
>
|
|
346
346
|
${this.shortcut}
|
|
347
347
|
</span>
|
|
348
|
-
`}},t.WfBadge.styles=
|
|
348
|
+
`}},t.WfBadge.styles=kt,At([wt({type:String})],t.WfBadge.prototype,"shortcut",2),At([wt({type:String})],t.WfBadge.prototype,"variant",2),t.WfBadge=At([ft("wf-badge")],t.WfBadge);var Ot=Object.defineProperty,Wt=Object.getOwnPropertyDescriptor,zt=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?Wt(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&Ot(e,s,o),o};t.WizardForm=class extends ct{constructor(){super(),this.hubspotPortal="",this.hubspotForm="",this.theme="light",this.mock=!1,this.showProgress=!1,this.autoAdvance=!0,this.hideBack=!0,this.submitOnStep=!1,this._steps=[],this._currentStep=1,this._totalSteps=0,this._formData={},this._submitting=!1,this.submitted=!1,this._error="",this._otherInputActive=!1,this._partialSubmitting=!1,this._stateController=new xt(this),this._handleFieldChange=t=>{const{name:e,value:s,extraFields:r}=t.detail;if(this._formData[e]=s,this._stateController.setValue(e,s),r){Object.entries(r).forEach(([t,e])=>{this._formData[t]=e,this._stateController.setValue(t,e)});const t=Object.values(r).some(t=>t&&(t+"").trim());this._otherInputActive=t}else this._otherInputActive=!1;this._error="",this.dispatchEvent(new CustomEvent("wf:field-change",{detail:{name:e,value:s,formData:{...this._formData}},bubbles:!0,composed:!0}))},this._handleOptionSelect=t=>{if(!this._stepHasComposableNav()&&this.autoAdvance){const e=t.target.closest("wf-options");e&&!e.hasAttribute("multi")&&setTimeout(()=>{this._goNext()},300)}},this._handleNavNext=async t=>{t.stopPropagation(),await this._goNext()},this._handleNavBack=t=>{t.stopPropagation(),this._goBack()},this._handleNavSkip=t=>{t.stopPropagation(),this._submitting||(this._currentStep>=this._totalSteps?this._submit():this._navigateToStep(this._currentStep+1,"forward"))},this._handleNavStateRequest=()=>{this._broadcastNavState()},new $t(this,{onEnter:()=>this._handleEnter(),onEscape:()=>this._handleEscape()})}connectedCallback(){super.connectedCallback(),this.addEventListener("wf-change",this._handleFieldChange),this.addEventListener("wf-option-select",this._handleOptionSelect),this.addEventListener("wf:nav-next",this._handleNavNext),this.addEventListener("wf:nav-back",this._handleNavBack),this.addEventListener("wf:nav-skip",this._handleNavSkip),this.addEventListener("wf:nav-state-request",this._handleNavStateRequest)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("wf-change",this._handleFieldChange),this.removeEventListener("wf-option-select",this._handleOptionSelect),this.removeEventListener("wf:nav-next",this._handleNavNext),this.removeEventListener("wf:nav-back",this._handleNavBack),this.removeEventListener("wf:nav-skip",this._handleNavSkip),this.removeEventListener("wf:nav-state-request",this._handleNavStateRequest)}firstUpdated(){this._discoverSteps(),this._showCurrentStep(),this._broadcastNavState()}render(){return this.submitted?(this._steps.forEach(t=>{t.active=!1}),K`
|
|
349
349
|
<div class="wf-container" data-testid="wf-container">
|
|
350
350
|
<slot name="success">
|
|
351
351
|
<div class="wf-success-screen">
|
|
@@ -364,7 +364,7 @@
|
|
|
364
364
|
<div
|
|
365
365
|
class="wf-progress-segment ${s?"completed":""} ${r?"active":""}"
|
|
366
366
|
></div>
|
|
367
|
-
`)}return K`<div class="wf-progress">${t}</div>`}_renderNavigation(){return J}_discoverSteps(){const t=this.shadowRoot?.querySelector("slot:not([name])");if(t){const e=t.assignedElements({flatten:!0});this._steps=e.filter(t=>"wf-step"===t.tagName.toLowerCase())}else this._steps=Array.from(this.querySelectorAll(":scope > wf-step"));this._steps.forEach((t,e)=>{t.step=e+1}),this._totalSteps=this._steps.length,this._stateController.setTotalSteps(this._totalSteps),document.dispatchEvent(new CustomEvent("wf:steps-discovered",{detail:{wizard:this,wizardId:this.id,totalSteps:this._totalSteps,currentStep:this._currentStep}}))}_showCurrentStep(){this._steps.forEach((t,e)=>{e+1===this._currentStep?t.show("forward"):t.active=!1})}_getStepByNumber(t){const e=t-1;return this._steps[e]}_stepRequiresManualNav(){if(!this.autoAdvance)return!0;const t=this._getStepByNumber(this._currentStep);if(!t)return!0;const e=["wf-input","wf-email","wf-textarea","wf-number"];for(const s of e)if(t.querySelector(s))return!0;return!!t.querySelector("wf-options[multi]")||!(!t.querySelector("wf-options[allow-other]")||!this._otherInputActive)}_stepHasComposableNav(){const t=this._getStepByNumber(this._currentStep);if(!t)return!1;const e=t.querySelectorAll("wf-next-btn, wf-back-btn");for(const s of e)if(!s.closest("wf-other"))return!0;return!1}_broadcastNavState(){this.dispatchEvent(new CustomEvent("wf:nav-state",{detail:{currentStep:this._currentStep,totalSteps:this._totalSteps,isFirstStep:1===this._currentStep,isLastStep:this._currentStep===this._totalSteps,isSubmitting:this._submitting},bubbles:!1}))}async _goNext(){if(this._submitting)return;const t=this._getStepByNumber(this._currentStep);t&&!(await t.validate())||(this._currentStep>=this._totalSteps?await this._submit():this._navigateToStep(this._currentStep+1,"forward"))}_goBack(){this._submitting||this._currentStep<=1||this._navigateToStep(this._currentStep-1,"backward")}async _navigateToStep(t,e){if(t<1||t>this._totalSteps)return;const s=this._getStepByNumber(t);if(!s)return;if(s.shouldSkip(this._formData)){const s="forward"===e?t+1:t-1;return s>=1&&s<=this._totalSteps?this._navigateToStep(s,e):void 0}const r=this._currentStep;this.submitOnStep&&this.hubspotPortal&&this.hubspotForm&&"forward"===e&&this._submitPartialToHubSpot().catch(t=>{this.dispatchEvent(new CustomEvent("wf:error",{detail:{error:t instanceof Error?t.message:"Partial submission failed",formData:this._getFieldsUpToStep(this._currentStep)},bubbles:!0,composed:!0}))});const i=this._getStepByNumber(this._currentStep);i&&await i.hide(),this._currentStep=t,this._stateController.goToStep(t),this._otherInputActive=!1,this._broadcastNavState(),s.show(e),this.dispatchEvent(new CustomEvent("wf:step-change",{detail:{from:r,to:t,direction:e,submitted:!1,adapter:void 0},bubbles:!0,composed:!0}))}async _handleEnter(){await this._goNext()}_handleEscape(){this._goBack()}async _submit(){if(this._submitting)return;const t={...this._formData},e=new CustomEvent("wf:submit",{detail:{formData:t},bubbles:!0,composed:!0,cancelable:!0});if(this.dispatchEvent(e),e.defaultPrevented)return;this._submitting=!0,this._error="",this._broadcastNavState();let s=t;this.serialize&&(s=this.serialize(t));try{let t;this.mock?(await new Promise(t=>setTimeout(t,1e3)),t={success:!0}):t=this.hubspotPortal&&this.hubspotForm?await this._submitToHubSpot(s):{success:!0},this.submitted=!0,this.dispatchEvent(new CustomEvent("wf:success",{detail:{formData:s,response:t},bubbles:!0,composed:!0}))}catch(r){const t=r instanceof Error?r.message:"Submission failed";this._error=t,this.dispatchEvent(new CustomEvent("wf:error",{detail:{error:t,formData:s},bubbles:!0,composed:!0}))}finally{this._submitting=!1,this._broadcastNavState()}}async _submitToHubSpot(t){const e=`https://api.hsforms.com/submissions/v3/integration/submit/${this.hubspotPortal}/${this.hubspotForm}`,s={fields:Object.entries(t).map(([t,e])=>({name:t,value:Array.isArray(e)?e.join(";"):(e??"")+""})),context:{pageUri:window.location.href,pageName:document.title}},r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!r.ok){const t=await r.json().catch(()=>({}));throw Error(t.message||"HubSpot submission failed: "+r.status)}return r.json()}_getFieldsUpToStep(t){const e={};for(let s=0;s<t&&s<this._steps.length;s++)this._steps[s].querySelectorAll("[name]").forEach(t=>{t.name&&void 0!==this._formData[t.name]&&(e[t.name]=this._formData[t.name])});return e}async _submitPartialToHubSpot(){let t={...this._getFieldsUpToStep(this._currentStep)};this.serialize&&(t=this.serialize(t));const e=Object.fromEntries(Object.entries(t).filter(([,t])=>null!=t&&""!==t&&(!Array.isArray(t)||0!==t.length)));await this._submitToHubSpot(e)}get formData(){return{...this._formData}}get currentStep(){return this._currentStep}get totalSteps(){return this._totalSteps}get isSubmitting(){return this._submitting}get isSubmitted(){return this.submitted}goToStep(t){const e=t>this._currentStep?"forward":"backward";this._navigateToStep(t,e)}next(){return this._goNext()}back(){this._goBack()}submit(){return this._submit()}reset(){this._formData={},this._currentStep=1,this._submitting=!1,this.submitted=!1,this._error="",this._stateController.reset(),this._showCurrentStep(),this._steps.forEach(t=>{t.querySelectorAll("wf-options, wf-field, wf-email").forEach(t=>{"reset"in t&&"function"==typeof t.reset&&t.reset()})})}setFormData(t){this._formData={...this._formData,...t},Object.entries(t).forEach(([t,e])=>{this._stateController.setValue(t,e)})}},t.WizardForm.styles=St,zt([
|
|
367
|
+
`)}return K`<div class="wf-progress">${t}</div>`}_renderNavigation(){return J}_discoverSteps(){const t=this.shadowRoot?.querySelector("slot:not([name])");if(t){const e=t.assignedElements({flatten:!0});this._steps=e.filter(t=>"wf-step"===t.tagName.toLowerCase())}else this._steps=Array.from(this.querySelectorAll(":scope > wf-step"));this._steps.forEach((t,e)=>{t.step=e+1}),this._totalSteps=this._steps.length,this._stateController.setTotalSteps(this._totalSteps),document.dispatchEvent(new CustomEvent("wf:steps-discovered",{detail:{wizard:this,wizardId:this.id,totalSteps:this._totalSteps,currentStep:this._currentStep}}))}_showCurrentStep(){this._steps.forEach((t,e)=>{e+1===this._currentStep?t.show("forward"):t.active=!1})}_getStepByNumber(t){const e=t-1;return this._steps[e]}_stepRequiresManualNav(){if(!this.autoAdvance)return!0;const t=this._getStepByNumber(this._currentStep);if(!t)return!0;const e=["wf-input","wf-email","wf-textarea","wf-number"];for(const s of e)if(t.querySelector(s))return!0;return!!t.querySelector("wf-options[multi]")||!(!t.querySelector("wf-options[allow-other]")||!this._otherInputActive)}_stepHasComposableNav(){const t=this._getStepByNumber(this._currentStep);if(!t)return!1;const e=t.querySelectorAll("wf-next-btn, wf-back-btn");for(const s of e)if(!s.closest("wf-other"))return!0;return!1}_broadcastNavState(){this.dispatchEvent(new CustomEvent("wf:nav-state",{detail:{currentStep:this._currentStep,totalSteps:this._totalSteps,isFirstStep:1===this._currentStep,isLastStep:this._currentStep===this._totalSteps,isSubmitting:this._submitting},bubbles:!1}))}async _goNext(){if(this._submitting)return;const t=this._getStepByNumber(this._currentStep);t&&!(await t.validate())||(this._currentStep>=this._totalSteps?await this._submit():this._navigateToStep(this._currentStep+1,"forward"))}_goBack(){this._submitting||this._currentStep<=1||this._navigateToStep(this._currentStep-1,"backward")}async _navigateToStep(t,e){if(t<1||t>this._totalSteps)return;const s=this._getStepByNumber(t);if(!s)return;if(s.shouldSkip(this._formData)){const s="forward"===e?t+1:t-1;return s>=1&&s<=this._totalSteps?this._navigateToStep(s,e):void 0}const r=this._currentStep;this.submitOnStep&&this.hubspotPortal&&this.hubspotForm&&"forward"===e&&this._submitPartialToHubSpot().catch(t=>{this.dispatchEvent(new CustomEvent("wf:error",{detail:{error:t instanceof Error?t.message:"Partial submission failed",formData:this._getFieldsUpToStep(this._currentStep)},bubbles:!0,composed:!0}))});const i=this._getStepByNumber(this._currentStep);i&&await i.hide(),this._currentStep=t,this._stateController.goToStep(t),this._otherInputActive=!1,this._broadcastNavState(),s.show(e),this.dispatchEvent(new CustomEvent("wf:step-change",{detail:{from:r,to:t,direction:e,submitted:!1,adapter:void 0},bubbles:!0,composed:!0}))}async _handleEnter(){await this._goNext()}_handleEscape(){this._goBack()}async _submit(){if(this._submitting)return;const t={...this._formData},e=new CustomEvent("wf:submit",{detail:{formData:t},bubbles:!0,composed:!0,cancelable:!0});if(this.dispatchEvent(e),e.defaultPrevented)return;this._submitting=!0,this._error="",this._broadcastNavState();let s=t;this.serialize&&(s=this.serialize(t));try{let t;this.mock?(await new Promise(t=>setTimeout(t,1e3)),t={success:!0}):t=this.hubspotPortal&&this.hubspotForm?await this._submitToHubSpot(s):{success:!0},this.submitted=!0,this.dispatchEvent(new CustomEvent("wf:success",{detail:{formData:s,response:t},bubbles:!0,composed:!0}))}catch(r){const t=r instanceof Error?r.message:"Submission failed";this._error=t,this.dispatchEvent(new CustomEvent("wf:error",{detail:{error:t,formData:s},bubbles:!0,composed:!0}))}finally{this._submitting=!1,this._broadcastNavState()}}async _submitToHubSpot(t){const e=`https://api.hsforms.com/submissions/v3/integration/submit/${this.hubspotPortal}/${this.hubspotForm}`,s={fields:Object.entries(t).map(([t,e])=>({name:t,value:Array.isArray(e)?e.join(";"):(e??"")+""})),context:{pageUri:window.location.href,pageName:document.title}},r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!r.ok){const t=await r.json().catch(()=>({}));throw Error(t.message||"HubSpot submission failed: "+r.status)}return r.json()}_getFieldsUpToStep(t){const e={};for(let s=0;s<t&&s<this._steps.length;s++)this._steps[s].querySelectorAll("[name]").forEach(t=>{t.name&&void 0!==this._formData[t.name]&&(e[t.name]=this._formData[t.name])});return e}async _submitPartialToHubSpot(){let t={...this._getFieldsUpToStep(this._currentStep)};this.serialize&&(t=this.serialize(t));const e=Object.fromEntries(Object.entries(t).filter(([,t])=>null!=t&&""!==t&&(!Array.isArray(t)||0!==t.length)));await this._submitToHubSpot(e)}get formData(){return{...this._formData}}get currentStep(){return this._currentStep}get totalSteps(){return this._totalSteps}get isSubmitting(){return this._submitting}get isSubmitted(){return this.submitted}goToStep(t){const e=t>this._currentStep?"forward":"backward";this._navigateToStep(t,e)}next(){return this._goNext()}back(){this._goBack()}submit(){return this._submit()}reset(){this._formData={},this._currentStep=1,this._submitting=!1,this.submitted=!1,this._error="",this._stateController.reset(),this._showCurrentStep(),this._steps.forEach(t=>{t.querySelectorAll("wf-options, wf-field, wf-email").forEach(t=>{"reset"in t&&"function"==typeof t.reset&&t.reset()})})}setFormData(t){this._formData={...this._formData,...t},Object.entries(t).forEach(([t,e])=>{this._stateController.setValue(t,e)})}},t.WizardForm.styles=St,zt([wt({type:String,attribute:"hubspot-portal"})],t.WizardForm.prototype,"hubspotPortal",2),zt([wt({type:String,attribute:"hubspot-form"})],t.WizardForm.prototype,"hubspotForm",2),zt([wt({type:String,reflect:!0})],t.WizardForm.prototype,"theme",2),zt([wt({type:Boolean})],t.WizardForm.prototype,"mock",2),zt([wt({type:Boolean,attribute:"show-progress"})],t.WizardForm.prototype,"showProgress",2),zt([wt({type:Boolean,attribute:"auto-advance"})],t.WizardForm.prototype,"autoAdvance",2),zt([wt({type:Boolean,attribute:"hide-back"})],t.WizardForm.prototype,"hideBack",2),zt([wt({attribute:!1})],t.WizardForm.prototype,"serialize",2),zt([wt({type:Boolean,attribute:"submit-on-step"})],t.WizardForm.prototype,"submitOnStep",2),zt([mt()],t.WizardForm.prototype,"_steps",2),zt([mt()],t.WizardForm.prototype,"_currentStep",2),zt([mt()],t.WizardForm.prototype,"_totalSteps",2),zt([mt()],t.WizardForm.prototype,"_formData",2),zt([mt()],t.WizardForm.prototype,"_submitting",2),zt([wt({type:Boolean,reflect:!0})],t.WizardForm.prototype,"submitted",2),zt([mt()],t.WizardForm.prototype,"_error",2),zt([mt()],t.WizardForm.prototype,"_otherInputActive",2),t.WizardForm=zt([ft("wizard-form")],t.WizardForm),t.WfSuccess=class extends ct{render(){return K`<slot></slot>`}},t.WfSuccess.styles=c`
|
|
368
368
|
:host {
|
|
369
369
|
display: block;
|
|
370
370
|
}
|
|
@@ -372,7 +372,7 @@
|
|
|
372
372
|
:host([hidden]) {
|
|
373
373
|
display: none;
|
|
374
374
|
}
|
|
375
|
-
`,t.WfSuccess=zt([
|
|
375
|
+
`,t.WfSuccess=zt([ft("wf-success")],t.WfSuccess);const Pt=[_t,c`
|
|
376
376
|
:host {
|
|
377
377
|
display: none;
|
|
378
378
|
width: 100%;
|
|
@@ -424,11 +424,11 @@
|
|
|
424
424
|
color: var(--wf-color-text-muted);
|
|
425
425
|
font-size: var(--wf-font-size-xl);
|
|
426
426
|
}
|
|
427
|
-
`];var
|
|
427
|
+
`];var Lt=Object.defineProperty,Nt=Object.getOwnPropertyDescriptor,Tt=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?Nt(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&Lt(e,s,o),o};t.WfStep=class extends ct{constructor(){super(...arguments),this.step=0,this.active=!1,this.direction="forward",this.leaving=!1,this.skipIf="",this._fields=[]}render(){return K`
|
|
428
428
|
<div class="wf-step-content" data-testid="wf-step-content">
|
|
429
429
|
<slot></slot>
|
|
430
430
|
</div>
|
|
431
|
-
`}firstUpdated(){this._discoverFields()}updated(t){t.has("active")&&this.active&&(this.leaving=!1,this._focusFirstField())}_discoverFields(){const t=["wf-options","wf-field","wf-email","wf-input","wf-textarea","wf-number"],e=[],s=r=>{if(t.includes(r.tagName.toLowerCase())){const t=r.getAttribute("name");t&&e.push(t)}Array.from(r.children).forEach(s)};Array.from(this.children).forEach(s),this._fields=e}_focusFirstField(){requestAnimationFrame(()=>{for(const t of this.children){const e=this._findFocusable(t);if(e)return void e.focus()}})}_findFocusable(t){if(t instanceof HTMLElement&&"function"==typeof t.focus&&["wf-field","wf-email","wf-input","wf-textarea"].includes(t.tagName.toLowerCase()))return t;for(const e of t.children){const t=this._findFocusable(e);if(t)return t}return null}get fields(){return[...this._fields]}shouldSkip(t){if(!this.skipIf)return!1;try{const e=this.skipIf.trim();if(e.startsWith("!"))return!t[e.slice(1)];if(e.includes("===")){const[s,r]=e.split("===").map(t=>t.trim());return t[s]===r.replace(/['"]/g,"")}if(e.includes("!==")){const[s,r]=e.split("!==").map(t=>t.trim());return t[s]!==r.replace(/['"]/g,"")}return!!t[e]}catch(e){return!1}}show(t="forward"){this.direction=t,this.leaving=!1,this.active=!0}hide(){return new Promise(t=>{this.leaving=!0;const e=()=>{this.active=!1,this.leaving=!1,this.removeEventListener("animationend",e),t()};this.addEventListener("animationend",e),setTimeout(()=>{this.active=!1,this.leaving=!1,this.removeEventListener("animationend",e),t()},300)})}async validate(){const t=[];let e=!0;const s=async r=>{"validate"in r&&"function"==typeof r.validate&&(await r.validate()||(t.push(r),e=!1));for(const t of r.children)await s(t)};for(const r of this.children)await s(r);if(t.length>0){const e=t[0];e.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>{"focus"in e&&"function"==typeof e.focus&&e.focus()},100)}return e}},t.WfStep.styles=Pt,Tt([
|
|
431
|
+
`}firstUpdated(){this._discoverFields()}updated(t){t.has("active")&&this.active&&(this.leaving=!1,this._focusFirstField())}_discoverFields(){const t=["wf-options","wf-field","wf-email","wf-input","wf-textarea","wf-number","wf-select"],e=[],s=r=>{if(t.includes(r.tagName.toLowerCase())){const t=r.getAttribute("name");t&&e.push(t)}Array.from(r.children).forEach(s)};Array.from(this.children).forEach(s),this._fields=e}_focusFirstField(){requestAnimationFrame(()=>{for(const t of this.children){const e=this._findFocusable(t);if(e)return void e.focus()}})}_findFocusable(t){if(t instanceof HTMLElement&&"function"==typeof t.focus&&["wf-field","wf-email","wf-input","wf-textarea","wf-select"].includes(t.tagName.toLowerCase()))return t;for(const e of t.children){const t=this._findFocusable(e);if(t)return t}return null}get fields(){return[...this._fields]}shouldSkip(t){if(!this.skipIf)return!1;try{const e=this.skipIf.trim();if(e.startsWith("!"))return!t[e.slice(1)];if(e.includes("===")){const[s,r]=e.split("===").map(t=>t.trim());return t[s]===r.replace(/['"]/g,"")}if(e.includes("!==")){const[s,r]=e.split("!==").map(t=>t.trim());return t[s]!==r.replace(/['"]/g,"")}return!!t[e]}catch(e){return!1}}show(t="forward"){this.direction=t,this.leaving=!1,this.active=!0}hide(){return new Promise(t=>{this.leaving=!0;const e=()=>{this.active=!1,this.leaving=!1,this.removeEventListener("animationend",e),t()};this.addEventListener("animationend",e),setTimeout(()=>{this.active=!1,this.leaving=!1,this.removeEventListener("animationend",e),t()},300)})}async validate(){const t=[];let e=!0;const s=async r=>{"validate"in r&&"function"==typeof r.validate&&(await r.validate()||(t.push(r),e=!1));for(const t of r.children)await s(t)};for(const r of this.children)await s(r);if(t.length>0){const e=t[0];e.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>{"focus"in e&&"function"==typeof e.focus&&e.focus()},100)}return e}},t.WfStep.styles=Pt,Tt([wt({type:Number,attribute:"data-step"})],t.WfStep.prototype,"step",2),Tt([wt({type:Boolean,reflect:!0})],t.WfStep.prototype,"active",2),Tt([wt({type:String,reflect:!0})],t.WfStep.prototype,"direction",2),Tt([wt({type:Boolean,reflect:!0})],t.WfStep.prototype,"leaving",2),Tt([wt({type:String,attribute:"data-skip-if"})],t.WfStep.prototype,"skipIf",2),Tt([mt()],t.WfStep.prototype,"_fields",2),t.WfStep=Tt([ft("wf-step")],t.WfStep);const Dt=c`
|
|
432
432
|
:host {
|
|
433
433
|
display: block;
|
|
434
434
|
box-sizing: border-box;
|
|
@@ -450,7 +450,7 @@
|
|
|
450
450
|
:host(.wf-layout--width-fit) {
|
|
451
451
|
width: fit-content;
|
|
452
452
|
}
|
|
453
|
-
`;var Ft=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,Bt=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?Mt(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&Ft(e,s,o),o};const It={none:0,xs:4,sm:8,md:16,lg:24,xl:32};t.WfLayout=class extends ct{constructor(){super(...arguments),this.mode="flex",this.direction="column",this.gap="none",this.gapX="",this.gapY="",this.align="stretch",this.justify="start",this.padding="none",this.paddingX="",this.paddingY="",this.wrap=!1,this.width="full",this.columns="auto",this.minItemWidth="200px"}_resolveSpacing(t){if(!t||"none"===t)return"0";if(t in It)return It[t]+"px";const e=parseFloat(t);return isNaN(e)?t:e+"px"}_getGapX(){return this._resolveSpacing(this.gapX||this.gap)}_getGapY(){return this._resolveSpacing(this.gapY||this.gap)}_getPadding(){const t=this._resolveSpacing(this.padding),e=this.paddingX?this._resolveSpacing(this.paddingX):t;return`${this.paddingY?this._resolveSpacing(this.paddingY):t} ${e}`}_buildStyles(){const t=[];if("grid"===this.mode){t.push("display: grid");const e=parseInt(this.columns,10);!isNaN(e)&&e>0?t.push(`grid-template-columns: repeat(${e}, 1fr)`):t.push(`grid-template-columns: repeat(auto-fit, minmax(${this.minItemWidth}, 1fr))`),"stretch"!==this.align&&t.push("align-items: "+this.align),"start"!==this.justify&&t.push("justify-content: "+this.justify)}else t.push("display: flex"),t.push("flex-direction: "+this.direction),this.wrap&&t.push("flex-wrap: wrap"),"stretch"!==this.align&&t.push("align-items: "+this.align),"start"!==this.justify&&t.push("justify-content: "+this.justify);const e=this._getGapX(),s=this._getGapY();"0"===e&&"0"===s||(t.push("column-gap: "+e),t.push("row-gap: "+s));const r=this._getPadding();return"0 0"!==r&&t.push("padding: "+r),t.join("; ")}_applyChildStyles(){if(!this._slot)return;const t=this._slot.assignedElements({flatten:!0});for(const e of t){const t=e,s=[],r=t.getAttribute("data-span");r&&s.push("grid-column: span "+r);const i=t.getAttribute("data-row-span");i&&s.push("grid-row: span "+i),t.hasAttribute("data-grow")&&s.push("flex-grow: 1"),t.hasAttribute("data-shrink")&&s.push("flex-shrink: 0");const o=t.getAttribute("data-align");o&&s.push("align-self: "+o);const a=t.getAttribute("data-order");if(a&&s.push("order: "+a),s.length>0){const e=t.style.cssText,r=s.join("; ");t.style.cssText=e?`${e}; ${r}`:r}}}_handleLayoutSlotChange(){this._applyChildStyles()}updated(t){super.updated(t),this.style.cssText=this._buildStyles(),this.classList.remove("wf-layout--width-full","wf-layout--width-auto","wf-layout--width-fit"),this.classList.add("wf-layout--width-"+this.width),this._applyChildStyles()}render(){return K`<slot @slotchange="${this._handleLayoutSlotChange}"></slot>`}},t.WfLayout.styles=Dt,Bt([
|
|
453
|
+
`;var Ft=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,Bt=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?Mt(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&Ft(e,s,o),o};const It={none:0,xs:4,sm:8,md:16,lg:24,xl:32};t.WfLayout=class extends ct{constructor(){super(...arguments),this.mode="flex",this.direction="column",this.gap="none",this.gapX="",this.gapY="",this.align="stretch",this.justify="start",this.padding="none",this.paddingX="",this.paddingY="",this.wrap=!1,this.width="full",this.columns="auto",this.minItemWidth="200px"}_resolveSpacing(t){if(!t||"none"===t)return"0";if(t in It)return It[t]+"px";const e=parseFloat(t);return isNaN(e)?t:e+"px"}_getGapX(){return this._resolveSpacing(this.gapX||this.gap)}_getGapY(){return this._resolveSpacing(this.gapY||this.gap)}_getPadding(){const t=this._resolveSpacing(this.padding),e=this.paddingX?this._resolveSpacing(this.paddingX):t;return`${this.paddingY?this._resolveSpacing(this.paddingY):t} ${e}`}_buildStyles(){const t=[];if("grid"===this.mode){t.push("display: grid");const e=parseInt(this.columns,10);!isNaN(e)&&e>0?t.push(`grid-template-columns: repeat(${e}, 1fr)`):t.push(`grid-template-columns: repeat(auto-fit, minmax(${this.minItemWidth}, 1fr))`),"stretch"!==this.align&&t.push("align-items: "+this.align),"start"!==this.justify&&t.push("justify-content: "+this.justify)}else t.push("display: flex"),t.push("flex-direction: "+this.direction),this.wrap&&t.push("flex-wrap: wrap"),"stretch"!==this.align&&t.push("align-items: "+this.align),"start"!==this.justify&&t.push("justify-content: "+this.justify);const e=this._getGapX(),s=this._getGapY();"0"===e&&"0"===s||(t.push("column-gap: "+e),t.push("row-gap: "+s));const r=this._getPadding();return"0 0"!==r&&t.push("padding: "+r),t.join("; ")}_applyChildStyles(){if(!this._slot)return;const t=this._slot.assignedElements({flatten:!0});for(const e of t){const t=e,s=[],r=t.getAttribute("data-span");r&&s.push("grid-column: span "+r);const i=t.getAttribute("data-row-span");i&&s.push("grid-row: span "+i),t.hasAttribute("data-grow")&&s.push("flex-grow: 1"),t.hasAttribute("data-shrink")&&s.push("flex-shrink: 0");const o=t.getAttribute("data-align");o&&s.push("align-self: "+o);const a=t.getAttribute("data-order");if(a&&s.push("order: "+a),s.length>0){const e=t.style.cssText,r=s.join("; ");t.style.cssText=e?`${e}; ${r}`:r}}}_handleLayoutSlotChange(){this._applyChildStyles()}updated(t){super.updated(t),this.style.cssText=this._buildStyles(),this.classList.remove("wf-layout--width-full","wf-layout--width-auto","wf-layout--width-fit"),this.classList.add("wf-layout--width-"+this.width),this._applyChildStyles()}render(){return K`<slot @slotchange="${this._handleLayoutSlotChange}"></slot>`}},t.WfLayout.styles=Dt,Bt([wt({type:String})],t.WfLayout.prototype,"mode",2),Bt([wt({type:String})],t.WfLayout.prototype,"direction",2),Bt([wt({type:String})],t.WfLayout.prototype,"gap",2),Bt([wt({type:String,attribute:"gap-x"})],t.WfLayout.prototype,"gapX",2),Bt([wt({type:String,attribute:"gap-y"})],t.WfLayout.prototype,"gapY",2),Bt([wt({type:String})],t.WfLayout.prototype,"align",2),Bt([wt({type:String})],t.WfLayout.prototype,"justify",2),Bt([wt({type:String})],t.WfLayout.prototype,"padding",2),Bt([wt({type:String,attribute:"padding-x"})],t.WfLayout.prototype,"paddingX",2),Bt([wt({type:String,attribute:"padding-y"})],t.WfLayout.prototype,"paddingY",2),Bt([wt({type:Boolean})],t.WfLayout.prototype,"wrap",2),Bt([wt({type:String})],t.WfLayout.prototype,"width",2),Bt([wt({type:String})],t.WfLayout.prototype,"columns",2),Bt([wt({type:String,attribute:"min-item-width"})],t.WfLayout.prototype,"minItemWidth",2),Bt([bt("slot")],t.WfLayout.prototype,"_slot",2),t.WfLayout=Bt([ft("wf-layout")],t.WfLayout);const jt=c`
|
|
454
454
|
:host {
|
|
455
455
|
display: grid;
|
|
456
456
|
box-sizing: border-box;
|
|
@@ -617,14 +617,14 @@
|
|
|
617
617
|
</div>
|
|
618
618
|
</div>
|
|
619
619
|
</div>
|
|
620
|
-
`}},t.WfOther.styles=qt,Ut([
|
|
620
|
+
`}},t.WfOther.styles=qt,Ut([wt({type:String})],t.WfOther.prototype,"label",2),Ut([wt({type:String,attribute:"label-hint"})],t.WfOther.prototype,"labelHint",2),Ut([wt({type:String})],t.WfOther.prototype,"placeholder",2),Ut([wt({type:String})],t.WfOther.prototype,"name",2),Ut([wt({type:String,attribute:"parent-value"})],t.WfOther.prototype,"parentValue",2),Ut([wt({type:Boolean})],t.WfOther.prototype,"required",2),Ut([wt({type:Boolean})],t.WfOther.prototype,"disabled",2),Ut([wt({type:String})],t.WfOther.prototype,"shortcut",2),Ut([mt()],t.WfOther.prototype,"_value",2),t.WfOther=Ut([ft("wf-other")],t.WfOther);var Rt=Object.defineProperty,Yt=Object.getOwnPropertyDescriptor,Kt=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?Yt(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&Rt(e,s,o),o};t.WfOptions=class extends t.WfLayout{constructor(){super(...arguments),this.mode="grid",this.gap="md",this.name="",this.multi=!1,this.required=!1,this.min=0,this.max=0,this.columns="2",this._selected=new Set,this._otherValue="",this._errorMessage="",this._validationActivated=!1,this._options=[],this._shortcutMap=new Map,this._composableOther=null,this._handleComposableOtherChange=t=>{t.stopPropagation(),this._otherValue=t.detail.value,this._otherValue.trim()&&this._selected.size>0&&(this._selected.clear(),this._updateOptionStates()),this._dispatchChange()},this._handleOptionSelect=t=>{if(t.detail.forwarded)return;t.stopPropagation();const{value:e}=t.detail;this._selectValue(e),this.multi||this.dispatchEvent(new CustomEvent("wf-option-select",{detail:{...t.detail,forwarded:!0},bubbles:!0,composed:!0}))},this._handleKeydown=t=>{const e=this.closest("wf-step");if(!e||!e.hasAttribute("active"))return;const s=t.composedPath()[0];if("INPUT"===s?.tagName||"TEXTAREA"===s?.tagName)return;const r=t.key.toUpperCase();if(1===r.length&&r>="A"&&r<="Z"){if(this._composableOther&&r===this._composableOther.shortcut)return t.preventDefault(),void this._composableOther.focusInput();const e=this._shortcutMap.get(r);e&&!e.disabled&&(t.preventDefault(),e.triggerSelect())}}}connectedCallback(){super.connectedCallback(),this._errorMessage="",this._validationActivated=!1,this.addEventListener("wf-option-select",this._handleOptionSelect),this.addEventListener("wf-other-change",this._handleComposableOtherChange),document.addEventListener("keydown",this._handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("wf-option-select",this._handleOptionSelect),this.removeEventListener("wf-other-change",this._handleComposableOtherChange),document.removeEventListener("keydown",this._handleKeydown)}firstUpdated(t){super.firstUpdated(t);const e=(this._defaultSlot?.assignedElements({flatten:!0})||[]).find(t=>"wf-other"===t.tagName.toLowerCase());this._composableOther=e||null,this._discoverOptions(),this.requestUpdate()}_hasComposableOther(){return null!==this._composableOther}updated(t){super.updated(t),(t.has("multi")||t.has("max"))&&this._updateOptionStates()}render(){return super.updated(new Map),this.setAttribute("role","listbox"),this.setAttribute("aria-multiselectable",this.multi+""),this.setAttribute("aria-required",this.required+""),K`
|
|
621
621
|
<slot @slotchange="${this._handleSlotChange}"></slot>
|
|
622
622
|
<div class="wf-error-wrapper ${this._errorMessage?"wf-has-error":""}">
|
|
623
623
|
<span class="wf-error-message" role="alert" aria-live="polite" data-testid="wf-error">
|
|
624
624
|
${this._errorMessage||""}
|
|
625
625
|
</span>
|
|
626
626
|
</div>
|
|
627
|
-
`}_handleSlotChange(){const t=(this._defaultSlot?.assignedElements({flatten:!0})||[]).find(t=>"wf-other"===t.tagName.toLowerCase());this._composableOther=t||null,this._discoverOptions()}_discoverOptions(){const t=this._defaultSlot?.assignedElements({flatten:!0})||[];if(this._options=t.filter(t=>"wf-option"===t.tagName.toLowerCase()),this._shortcutMap.clear(),this._options.forEach((t,e)=>{if(e<26){const s=String.fromCharCode(65+e);t.shortcut=s,this._shortcutMap.set(s,t)}t.setSelected(this._selected.has(t.value))}),this._composableOther&&this._options.length<26){const t=String.fromCharCode(65+this._options.length);this._composableOther.shortcut=t}}_selectValue(t){this.multi?this._handleMultiSelect(t):this._handleSingleSelect(t),this._otherValue&&(this._otherValue="",this._composableOther&&this._composableOther.clear()),this._updateOptionStates(),this._validateSelection(),this._dispatchChange()}_handleSingleSelect(t){this._selected.clear(),this._selected.add(t)}_handleMultiSelect(t){if(this._selected.has(t))this._selected.delete(t);else{if(this.max>0&&this._selected.size>=this.max)return;this._selected.add(t)}}_updateOptionStates(){this._options.forEach(t=>{t.setSelected(this._selected.has(t.value))})}_checkValidation(){const t=this._hasComposableOther()&&this._otherValue.trim(),e=this._selected.size>0||t;if(this.required&&!e)return!1;if(this.multi){if(this.min>0&&this._selected.size<this.min&&!t)return!1;if(this.max>0&&this._selected.size>this.max)return!1}return!0}_validateSelection(){if(!this._validationActivated)return this._errorMessage="",this._checkValidation();this._errorMessage="";const t=this._hasComposableOther()&&this._otherValue.trim(),e=this._selected.size>0||t;if(this.required&&!e)return this._errorMessage=this._hasComposableOther()?"Please select an option or specify in the text field":"Please select an option",!1;if(this.multi){if(this.min>0&&this._selected.size<this.min&&!t)return this._errorMessage=`Please select at least ${this.min} option${this.min>1?"s":""}`,!1;if(this.max>0&&this._selected.size>this.max)return this._errorMessage=`Please select at most ${this.max} option${this.max>1?"s":""}`,!1}return!0}_dispatchChange(){const t=Array.from(this._selected),e={name:this.name,value:this.value,selected:t};if(this._hasComposableOther()&&this._otherValue.trim()&&0===this._selected.size){const t=this._composableOther?.name||this.name+"_other";e.extraFields={[t]:this._otherValue},e.value=this._composableOther?.parentValue||"Others"}this.dispatchEvent(new CustomEvent("wf-change",{detail:e,bubbles:!0,composed:!0}))}get value(){if(this._hasComposableOther()&&this._otherValue.trim()&&0===this._selected.size)return this.multi?[this._otherValue]:this._otherValue;const t=Array.from(this._selected);return this.multi?t:t[0]??""}set value(t){this._selected.clear(),Array.isArray(t)?t.forEach(t=>this._selected.add(t)):t&&this._selected.add(t),this._updateOptionStates(),this._validateSelection()}getSelected(){return Array.from(this._selected)}isSelected(t){return this._selected.has(t)}select(t){this._selectValue(t)}deselect(t){this._selected.has(t)&&(this._selected.delete(t),this._updateOptionStates(),this._validateSelection(),this._dispatchChange())}clear(){this._selected.clear(),this._updateOptionStates(),this._validateSelection(),this._dispatchChange()}validate(){return this._validationActivated=!0,this._validateSelection()}get isValid(){return this._checkValidation()}showError(t){this._errorMessage=t}clearError(){this._errorMessage=""}focus(){this._options[0]?.focus()}reset(){this._selected.clear(),this._otherValue="",this._errorMessage="",this._validationActivated=!1,this._composableOther&&this._composableOther.clear(),this._options.forEach(t=>{t.hasAttribute("selected")&&this._selected.add(t.value),t.setSelected(this._selected.has(t.value))}),this._dispatchChange()}},t.WfOptions.styles=[t.WfLayout.styles,jt],Kt([bt("slot:not([name])")],t.WfOptions.prototype,"_defaultSlot",2),Kt([
|
|
627
|
+
`}_handleSlotChange(){const t=(this._defaultSlot?.assignedElements({flatten:!0})||[]).find(t=>"wf-other"===t.tagName.toLowerCase());this._composableOther=t||null,this._discoverOptions()}_discoverOptions(){const t=this._defaultSlot?.assignedElements({flatten:!0})||[];if(this._options=t.filter(t=>"wf-option"===t.tagName.toLowerCase()),this._shortcutMap.clear(),this._options.forEach((t,e)=>{if(e<26){const s=String.fromCharCode(65+e);t.shortcut=s,this._shortcutMap.set(s,t)}t.setSelected(this._selected.has(t.value))}),this._composableOther&&this._options.length<26){const t=String.fromCharCode(65+this._options.length);this._composableOther.shortcut=t}}_selectValue(t){this.multi?this._handleMultiSelect(t):this._handleSingleSelect(t),this._otherValue&&(this._otherValue="",this._composableOther&&this._composableOther.clear()),this._updateOptionStates(),this._validateSelection(),this._dispatchChange()}_handleSingleSelect(t){this._selected.clear(),this._selected.add(t)}_handleMultiSelect(t){if(this._selected.has(t))this._selected.delete(t);else{if(this.max>0&&this._selected.size>=this.max)return;this._selected.add(t)}}_updateOptionStates(){this._options.forEach(t=>{t.setSelected(this._selected.has(t.value))})}_checkValidation(){const t=this._hasComposableOther()&&this._otherValue.trim(),e=this._selected.size>0||t;if(this.required&&!e)return!1;if(this.multi){if(this.min>0&&this._selected.size<this.min&&!t)return!1;if(this.max>0&&this._selected.size>this.max)return!1}return!0}_validateSelection(){if(!this._validationActivated)return this._errorMessage="",this._checkValidation();this._errorMessage="";const t=this._hasComposableOther()&&this._otherValue.trim(),e=this._selected.size>0||t;if(this.required&&!e)return this._errorMessage=this._hasComposableOther()?"Please select an option or specify in the text field":"Please select an option",!1;if(this.multi){if(this.min>0&&this._selected.size<this.min&&!t)return this._errorMessage=`Please select at least ${this.min} option${this.min>1?"s":""}`,!1;if(this.max>0&&this._selected.size>this.max)return this._errorMessage=`Please select at most ${this.max} option${this.max>1?"s":""}`,!1}return!0}_dispatchChange(){const t=Array.from(this._selected),e={name:this.name,value:this.value,selected:t};if(this._hasComposableOther()&&this._otherValue.trim()&&0===this._selected.size){const t=this._composableOther?.name||this.name+"_other";e.extraFields={[t]:this._otherValue},e.value=this._composableOther?.parentValue||"Others"}this.dispatchEvent(new CustomEvent("wf-change",{detail:e,bubbles:!0,composed:!0}))}get value(){if(this._hasComposableOther()&&this._otherValue.trim()&&0===this._selected.size)return this.multi?[this._otherValue]:this._otherValue;const t=Array.from(this._selected);return this.multi?t:t[0]??""}set value(t){this._selected.clear(),Array.isArray(t)?t.forEach(t=>this._selected.add(t)):t&&this._selected.add(t),this._updateOptionStates(),this._validateSelection()}getSelected(){return Array.from(this._selected)}isSelected(t){return this._selected.has(t)}select(t){this._selectValue(t)}deselect(t){this._selected.has(t)&&(this._selected.delete(t),this._updateOptionStates(),this._validateSelection(),this._dispatchChange())}clear(){this._selected.clear(),this._updateOptionStates(),this._validateSelection(),this._dispatchChange()}validate(){return this._validationActivated=!0,this._validateSelection()}get isValid(){return this._checkValidation()}showError(t){this._errorMessage=t}clearError(){this._errorMessage=""}focus(){this._options[0]?.focus()}reset(){this._selected.clear(),this._otherValue="",this._errorMessage="",this._validationActivated=!1,this._composableOther&&this._composableOther.clear(),this._options.forEach(t=>{t.hasAttribute("selected")&&this._selected.add(t.value),t.setSelected(this._selected.has(t.value))}),this._dispatchChange()}},t.WfOptions.styles=[t.WfLayout.styles,jt],Kt([bt("slot:not([name])")],t.WfOptions.prototype,"_defaultSlot",2),Kt([wt({type:String})],t.WfOptions.prototype,"mode",2),Kt([wt({type:String})],t.WfOptions.prototype,"gap",2),Kt([wt({type:String})],t.WfOptions.prototype,"name",2),Kt([wt({type:Boolean})],t.WfOptions.prototype,"multi",2),Kt([wt({type:Boolean})],t.WfOptions.prototype,"required",2),Kt([wt({type:Number})],t.WfOptions.prototype,"min",2),Kt([wt({type:Number})],t.WfOptions.prototype,"max",2),Kt([wt({type:String,reflect:!0})],t.WfOptions.prototype,"columns",2),Kt([mt()],t.WfOptions.prototype,"_selected",2),Kt([mt()],t.WfOptions.prototype,"_otherValue",2),Kt([mt()],t.WfOptions.prototype,"_errorMessage",2),t.WfOptions=Kt([ft("wf-options")],t.WfOptions);const Xt=c`
|
|
628
628
|
:host {
|
|
629
629
|
display: block;
|
|
630
630
|
}
|
|
@@ -732,7 +732,7 @@
|
|
|
732
732
|
<slot></slot>
|
|
733
733
|
</div>
|
|
734
734
|
</button>
|
|
735
|
-
`}_handleClick(t){this.disabled?t.preventDefault():this._triggerSelect()}triggerSelect(){this.disabled||this._triggerSelect()}_triggerSelect(){this._selecting=!0;const t={value:this.value,selected:!this.selected};this.dispatchEvent(new CustomEvent("wf-option-select",{detail:t,bubbles:!0,composed:!0})),setTimeout(()=>{this._selecting=!1},300)}focus(){const t=this.shadowRoot?.querySelector("button");t?.focus()}setSelected(t){this.selected=t}},t.WfOption.styles=Xt,Zt([
|
|
735
|
+
`}_handleClick(t){this.disabled?t.preventDefault():this._triggerSelect()}triggerSelect(){this.disabled||this._triggerSelect()}_triggerSelect(){this._selecting=!0;const t={value:this.value,selected:!this.selected};this.dispatchEvent(new CustomEvent("wf-option-select",{detail:t,bubbles:!0,composed:!0})),setTimeout(()=>{this._selecting=!1},300)}focus(){const t=this.shadowRoot?.querySelector("button");t?.focus()}setSelected(t){this.selected=t}},t.WfOption.styles=Xt,Zt([wt({type:String})],t.WfOption.prototype,"value",2),Zt([wt({type:Boolean,reflect:!0})],t.WfOption.prototype,"selected",2),Zt([wt({type:Boolean,reflect:!0})],t.WfOption.prototype,"disabled",2),Zt([wt({type:String})],t.WfOption.prototype,"shortcut",2),Zt([mt()],t.WfOption.prototype,"_selecting",2),t.WfOption=Zt([ft("wf-option")],t.WfOption);const Qt=c`
|
|
736
736
|
:host {
|
|
737
737
|
display: block;
|
|
738
738
|
}
|
|
@@ -908,7 +908,7 @@
|
|
|
908
908
|
<span class="wf-error-message" role="alert" aria-live="polite" data-testid="wf-error">
|
|
909
909
|
${this._errorMessage||""}
|
|
910
910
|
</span>
|
|
911
|
-
</div>`}get value(){return this._value}set value(t){this._value=t}addValidator(t){this._validators.push(t)}async validate(){this._validationActivated=!0;const t=this.value;for(const s of this._validators)try{const e=await s.validate(t);if(!e.valid)return this._errorMessage=e.error??s.message??"Validation failed",!1}catch(e){return this._errorMessage="Validation error occurred",!1}return this._errorMessage="",!0}get isValid(){const t=this.value;for(const e of this._validators){const s=e.validate(t);if(!(s instanceof Promise||s.valid))return!1}return!0}showError(t){this._errorMessage=t}clearError(){this._errorMessage=""}focus(){const t=this.shadowRoot?.querySelector(this._getFocusableSelector());t?.focus()}reset(){this._value="",this._errorMessage="",this._validationActivated=!1,this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null)}};se.styles=Qt;let re=se;ee([
|
|
911
|
+
</div>`}get value(){return this._value}set value(t){this._value=t}addValidator(t){this._validators.push(t)}async validate(){this._validationActivated=!0;const t=this.value;for(const s of this._validators)try{const e=await s.validate(t);if(!e.valid)return this._errorMessage=e.error??s.message??"Validation failed",!1}catch(e){return this._errorMessage="Validation error occurred",!1}return this._errorMessage="",!0}get isValid(){const t=this.value;for(const e of this._validators){const s=e.validate(t);if(!(s instanceof Promise||s.valid))return!1}return!0}showError(t){this._errorMessage=t}clearError(){this._errorMessage=""}focus(){const t=this.shadowRoot?.querySelector(this._getFocusableSelector());t?.focus()}reset(){this._value="",this._errorMessage="",this._validationActivated=!1,this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null)}};se.styles=Qt;let re=se;ee([wt({type:String})],re.prototype,"name"),ee([wt({type:String})],re.prototype,"label"),ee([wt({type:Boolean})],re.prototype,"required"),ee([wt({type:String})],re.prototype,"hint"),ee([mt()],re.prototype,"_errorMessage"),ee([mt()],re.prototype,"_value");const ie=["gmail.com","yahoo.com","hotmail.com","outlook.com","aol.com","icloud.com","mail.com","protonmail.com","zoho.com","yandex.com","live.com","msn.com","me.com","inbox.com","gmx.com"];class oe{constructor(t){this._validators=new Map,this.host=t,t.addController(this)}hostConnected(){}hostDisconnected(){this._validators.clear()}addValidator(t,e){const s=this._validators.get(t)??[];this._validators.set(t,[...s,e])}addValidators(t,e){e.forEach(e=>this.addValidator(t,e))}removeValidator(t,e){const s=this._validators.get(t)??[];this._validators.set(t,s.filter(t=>t.name!==e))}clearValidators(t){this._validators.delete(t)}getValidators(t){return this._validators.get(t)??[]}async validate(t,e){const s=this.getValidators(t);for(const i of s)try{const t=await i.validate(e);if(!t.valid)return{valid:!1,error:t.error??i.message??"Validation failed"}}catch(r){return{valid:!1,error:"Validation error occurred"}}return{valid:!0}}validateSync(t,e){const s=this.getValidators(t);for(const r of s){const t=r.validate(e);if(!(t instanceof Promise||t.valid))return{valid:!1,error:t.error??r.message??"Validation failed"}}return{valid:!0}}static required(t="This field is required"){return{name:"required",message:t,validate:e=>null==e||"string"==typeof e&&""===e.trim()||Array.isArray(e)&&0===e.length?{valid:!1,error:t}:{valid:!0}}}static email(t="Please enter a valid email address"){const e=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return{name:"email",message:t,validate:s=>"string"!=typeof s||""===s.trim()||e.test(s)?{valid:!0}:{valid:!1,error:t}}}static workEmail(t=ie,e="Please use your work email address"){return{name:"workEmail",message:e,validate:s=>{if("string"!=typeof s||""===s.trim())return{valid:!0};const r=s.split("@")[1]?.toLowerCase();return r&&t.includes(r)?{valid:!1,error:e}:{valid:!0}}}}static pattern(t,e="Invalid format"){return{name:"pattern",message:e,validate:s=>"string"!=typeof s||""===s.trim()||t.test(s)?{valid:!0}:{valid:!1,error:e}}}static minLength(t,e){const s=e??`Minimum ${t} characters required`;return{name:"minLength",message:s,validate:e=>"string"!=typeof e?{valid:!0}:e.length<t?{valid:!1,error:s}:{valid:!0}}}static maxLength(t,e){const s=e??`Maximum ${t} characters allowed`;return{name:"maxLength",message:s,validate:e=>"string"!=typeof e?{valid:!0}:e.length>t?{valid:!1,error:s}:{valid:!0}}}static minSelections(t,e){const s=e??`Select at least ${t} option${t>1?"s":""}`;return{name:"minSelections",message:s,validate:e=>Array.isArray(e)&&e.length<t?{valid:!1,error:s}:{valid:!0}}}static maxSelections(t,e){const s=e??`Select at most ${t} option${t>1?"s":""}`;return{name:"maxSelections",message:s,validate:e=>Array.isArray(e)&&e.length>t?{valid:!1,error:s}:{valid:!0}}}static custom(t,e,s){return{name:t,message:s,validate:e}}}var ae=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,le=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?ne(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&ae(e,s,o),o};t.WfEmail=class extends re{constructor(){super(...arguments),this.placeholder="you@company.com",this.workEmail=!1,this.blockedDomains="",this.workEmailMessage="Please use your work email address",this.disabled=!1}_getValidationTriggerProperties(){return["required","workEmail","blockedDomains"]}_getDebounceMs(){return 300}_setupValidators(){if(this._validators=[],this.required&&this._validators.push(oe.required()),this._validators.push(oe.email()),this.workEmail){let t=ie;this.blockedDomains&&(t=this.blockedDomains.split(",").map(t=>t.trim().toLowerCase())),this._validators.push(oe.workEmail(t,this.workEmailMessage))}}render(){return K`
|
|
912
912
|
<div class="wf-field-container">
|
|
913
913
|
${this._renderLabel()}
|
|
914
914
|
<input
|
|
@@ -928,7 +928,7 @@
|
|
|
928
928
|
${this._renderHint()}
|
|
929
929
|
${this._renderError()}
|
|
930
930
|
</div>
|
|
931
|
-
`}},le([
|
|
931
|
+
`}},le([wt({type:String})],t.WfEmail.prototype,"placeholder",2),le([wt({type:Boolean,attribute:"work-email"})],t.WfEmail.prototype,"workEmail",2),le([wt({type:String,attribute:"blocked-domains"})],t.WfEmail.prototype,"blockedDomains",2),le([wt({type:String,attribute:"work-email-message"})],t.WfEmail.prototype,"workEmailMessage",2),le([wt({type:Boolean})],t.WfEmail.prototype,"disabled",2),t.WfEmail=le([ft("wf-email")],t.WfEmail);var de=Object.defineProperty,he=Object.getOwnPropertyDescriptor,ce=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?he(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&de(e,s,o),o};t.WfInput=class extends re{constructor(){super(...arguments),this.placeholder="",this.type="text",this.patternMessage="Invalid format",this.disabled=!1,this.autocomplete=""}_getValidationTriggerProperties(){return["required","minlength","maxlength","pattern"]}_setupValidators(){this._validators=[],this.required&&this._validators.push(oe.required()),void 0!==this.minlength&&this._validators.push(oe.minLength(this.minlength)),void 0!==this.maxlength&&this._validators.push(oe.maxLength(this.maxlength)),this.pattern&&this._validators.push(oe.pattern(RegExp(this.pattern),this.patternMessage))}render(){return K`
|
|
932
932
|
<div class="wf-field-container">
|
|
933
933
|
${this._renderLabel()}
|
|
934
934
|
<input
|
|
@@ -949,7 +949,7 @@
|
|
|
949
949
|
${this._renderHint()}
|
|
950
950
|
${this._renderError()}
|
|
951
951
|
</div>
|
|
952
|
-
`}},ce([
|
|
952
|
+
`}},ce([wt({type:String})],t.WfInput.prototype,"placeholder",2),ce([wt({type:String})],t.WfInput.prototype,"type",2),ce([wt({type:Number})],t.WfInput.prototype,"minlength",2),ce([wt({type:Number})],t.WfInput.prototype,"maxlength",2),ce([wt({type:String})],t.WfInput.prototype,"pattern",2),ce([wt({type:String,attribute:"pattern-message"})],t.WfInput.prototype,"patternMessage",2),ce([wt({type:Boolean})],t.WfInput.prototype,"disabled",2),ce([wt({type:String})],t.WfInput.prototype,"autocomplete",2),t.WfInput=ce([ft("wf-input")],t.WfInput);var pe=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,ue=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?fe(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&pe(e,s,o),o};t.WfNumber=class extends t.WfInput{constructor(){super(...arguments),this.step=1}_setupValidators(){this._validators=[],this.required&&this._validators.push(oe.required()),void 0===this.min&&void 0===this.max||this._validators.push(oe.custom("range",t=>{if(""===t||null==t)return{valid:!0};const e=Number(t);return isNaN(e)?{valid:!1,error:"Please enter a valid number"}:void 0!==this.min&&e<this.min?{valid:!1,error:"Value must be at least "+this.min}:void 0!==this.max&&e>this.max?{valid:!1,error:"Value must be at most "+this.max}:{valid:!0}},"Value out of range"))}render(){return K`
|
|
953
953
|
<div class="wf-field-container">
|
|
954
954
|
${this._renderLabel()}
|
|
955
955
|
<input
|
|
@@ -973,7 +973,7 @@
|
|
|
973
973
|
${this._renderHint()}
|
|
974
974
|
${this._renderError()}
|
|
975
975
|
</div>
|
|
976
|
-
`}get valueAsNumber(){return Number(this._value)||0}set valueAsNumber(t){this._value=t+""}},
|
|
976
|
+
`}get valueAsNumber(){return Number(this._value)||0}set valueAsNumber(t){this._value=t+""}},ue([wt({type:Number})],t.WfNumber.prototype,"min",2),ue([wt({type:Number})],t.WfNumber.prototype,"max",2),ue([wt({type:Number})],t.WfNumber.prototype,"step",2),t.WfNumber=ue([ft("wf-number")],t.WfNumber);var ge=Object.defineProperty,we=Object.getOwnPropertyDescriptor,me=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?we(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&ge(e,s,o),o};function be(t){const e="string"==typeof t.container?document.querySelector(t.container):t.container;if(!e)throw Error("[WizardForm] Container not found: "+t.container);let i=e.querySelector("wizard-form");if(!i&&(i=e,"wizard-form"!==i.tagName.toLowerCase()))throw Error("[WizardForm] Container must be a <wizard-form> element or contain one");t.theme&&i.setAttribute("theme",t.theme),void 0!==t.showProgress&&(i.showProgress=t.showProgress),void 0!==t.autoAdvance&&(i.autoAdvance=t.autoAdvance),t.mock&&(i.mock=t.mock);let a=null;if("object"==typeof t.adapter)a=t.adapter;else switch(t.adapter||"json"){case"hubspot":if(!t.hubspot?.portalId||!t.hubspot?.formId)throw Error("[WizardForm] HubSpot config requires portalId and formId");a=s({portalId:t.hubspot.portalId,formId:t.hubspot.formId,fieldMapping:t.hubspot.fieldMapping,mock:t.mock}),i.setAttribute("hubspot-portal",t.hubspot.portalId),i.setAttribute("hubspot-form",t.hubspot.formId);break;case"webhook":if(!t.webhook?.url)throw Error("[WizardForm] Webhook config requires url");a=r({url:t.webhook.url,method:t.webhook.method,headers:t.webhook.headers,fieldMapping:t.webhook.fieldMapping,mock:t.mock});break;case"revenuehero":if(!t.revenuehero?.routerId)throw Error("[WizardForm] RevenueHero config requires routerId");a=o({routerId:t.revenuehero.routerId,fieldMapping:t.revenuehero.fieldMapping,mock:t.mock});break;case"json":a=null}const n=e=>{const s=e.detail.formData;let r={...s};if(t.serialize&&(r=t.serialize(r)),t.mock&&(window.__wizardFormData=r,window.__wizardFormRawData=s,window.__wizardFormInstance=p),t.onSubmit&&!1===t.onSubmit(r))e.preventDefault();else if(a){e.preventDefault();const o={pageUrl:window.location.href,pageTitle:document.title,referrer:document.referrer,timestamp:(new Date).toISOString()};a.submit(r,o).then(e=>{t.mock&&(window.__wizardFormResponse=e),e.success?(i._submitted=!0,i.requestUpdate(),i.dispatchEvent(new CustomEvent("wf:success",{detail:{formData:s,response:e.data},bubbles:!0,composed:!0}))):(t.mock&&(window.__wizardFormError=e.error),t.onError&&t.onError(e.error||"Submission failed",s))})}},l=e=>{t.mock&&(window.__wizardFormResponse={success:!0,data:e.detail.response}),t.onSuccess&&t.onSuccess(e.detail.formData,e.detail.response)},d=e=>{t.mock&&(window.__wizardFormError=e.detail.error),t.onError&&t.onError(e.detail.error,e.detail.formData)},h=e=>{t.onStepChange&&t.onStepChange(e.detail.from,e.detail.to,e.detail.direction)},c=e=>{t.onFieldChange&&t.onFieldChange(e.detail.name,e.detail.value,e.detail.formData)};i.addEventListener("wf:submit",n),i.addEventListener("wf:success",l),i.addEventListener("wf:error",d),i.addEventListener("wf:step-change",h),i.addEventListener("wf:field-change",c);const p={element:i,get formData(){return i.formData},get currentStep(){return i.currentStep},get totalSteps(){return i.totalSteps},next:()=>i.next(),back(){i.back()},goToStep(t){i.goToStep(t)},submit:()=>i.submit(),reset(){i.reset()},setFormData(t){i.setFormData(t)},destroy(){i.removeEventListener("wf:submit",n),i.removeEventListener("wf:success",l),i.removeEventListener("wf:error",d),i.removeEventListener("wf:step-change",h),i.removeEventListener("wf:field-change",c)},serialize:t.serialize};return p}t.WfTextarea=class extends re{constructor(){super(...arguments),this.placeholder="",this.rows=4,this.disabled=!1,this.showCount=!1,this._handleKeydown=t=>{"Enter"===t.key&&t.stopPropagation()}}_getValidationTriggerProperties(){return["required","minlength","maxlength"]}_getFocusableSelector(){return"textarea"}_setupValidators(){this._validators=[],this.required&&this._validators.push(oe.required()),void 0!==this.minlength&&this._validators.push(oe.minLength(this.minlength)),void 0!==this.maxlength&&this._validators.push(oe.maxLength(this.maxlength))}render(){const t=this._value.length,e=void 0!==this.maxlength&&t>=this.maxlength;return K`
|
|
977
977
|
<div class="wf-field-container">
|
|
978
978
|
${this._renderLabel()}
|
|
979
979
|
<textarea
|
|
@@ -998,7 +998,7 @@
|
|
|
998
998
|
${this._renderHint()}
|
|
999
999
|
${this._renderError()}
|
|
1000
1000
|
</div>
|
|
1001
|
-
`}},
|
|
1001
|
+
`}},me([wt({type:String})],t.WfTextarea.prototype,"placeholder",2),me([wt({type:Number})],t.WfTextarea.prototype,"rows",2),me([wt({type:Number})],t.WfTextarea.prototype,"minlength",2),me([wt({type:Number})],t.WfTextarea.prototype,"maxlength",2),me([wt({type:Boolean})],t.WfTextarea.prototype,"disabled",2),me([wt({type:Boolean,attribute:"show-count"})],t.WfTextarea.prototype,"showCount",2),t.WfTextarea=me([ft("wf-textarea")],t.WfTextarea);const ve={init:be},_e=[vt,c`
|
|
1002
1002
|
:host {
|
|
1003
1003
|
display: block;
|
|
1004
1004
|
}
|
|
@@ -1039,7 +1039,7 @@
|
|
|
1039
1039
|
aria-valuemin="1"
|
|
1040
1040
|
aria-valuemax="${this._totalSteps}"
|
|
1041
1041
|
></div>
|
|
1042
|
-
`)}return K`<div class="wf-progress" data-testid="wf-progress-bar" role="group" aria-label="Form progress">${t}</div>`}},t.WfProgress.styles=_e,xe([
|
|
1042
|
+
`)}return K`<div class="wf-progress" data-testid="wf-progress-bar" role="group" aria-label="Form progress">${t}</div>`}},t.WfProgress.styles=_e,xe([wt({type:String})],t.WfProgress.prototype,"for",2),xe([mt()],t.WfProgress.prototype,"_currentStep",2),xe([mt()],t.WfProgress.prototype,"_totalSteps",2),xe([mt()],t.WfProgress.prototype,"_isComplete",2),t.WfProgress=xe([ft("wf-progress")],t.WfProgress);var $e=Object.defineProperty,ke=(t,e,s,r)=>{for(var i,o=void 0,a=t.length-1;a>=0;a--)(i=t[a])&&(o=i(e,s,o)||o);return o&&$e(e,s,o),o};class Ee extends ct{constructor(){super(...arguments),this._isFirstStep=!0,this._isLastStep=!1,this._isSubmitting=!1,this._handleNavState=t=>{this._isFirstStep=t.detail.isFirstStep,this._isLastStep=t.detail.isLastStep,this._isSubmitting=t.detail.isSubmitting}}connectedCallback(){super.connectedCallback(),this._findWizardForm()?.addEventListener("wf:nav-state",this._handleNavState),this._requestNavState()}disconnectedCallback(){super.disconnectedCallback(),this._findWizardForm()?.removeEventListener("wf:nav-state",this._handleNavState)}_findWizardForm(){return this.closest("wizard-form")}_requestNavState(){this.dispatchEvent(new CustomEvent("wf:nav-state-request",{bubbles:!0,composed:!0}))}_dispatchNavEvent(){this.dispatchEvent(new CustomEvent(this._getEventName(),{bubbles:!0,composed:!0}))}}ke([mt()],Ee.prototype,"_isFirstStep"),ke([mt()],Ee.prototype,"_isLastStep"),ke([mt()],Ee.prototype,"_isSubmitting");const Ce=[_t,yt,c`
|
|
1043
1043
|
:host {
|
|
1044
1044
|
display: block;
|
|
1045
1045
|
width: 100%;
|
|
@@ -1052,7 +1052,7 @@
|
|
|
1052
1052
|
.wf-btn-next {
|
|
1053
1053
|
width: 100%;
|
|
1054
1054
|
flex: 1;
|
|
1055
|
-
background
|
|
1055
|
+
background: var(--wf-btn-background, var(--wf-color-primary));
|
|
1056
1056
|
border: 1px solid var(--wf-color-primary-border);
|
|
1057
1057
|
color: white;
|
|
1058
1058
|
position: relative;
|
|
@@ -1092,7 +1092,7 @@
|
|
|
1092
1092
|
padding-left: 12px;
|
|
1093
1093
|
padding-right: 8px;
|
|
1094
1094
|
}
|
|
1095
|
-
`];var
|
|
1095
|
+
`];var Ae=Object.defineProperty,Oe=Object.getOwnPropertyDescriptor,We=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?Oe(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&Ae(e,s,o),o};t.WfNextBtn=class extends Ee{constructor(){super(...arguments),this.showShortcut=!0,this.inline=!1,this.disabled=!1,this._handleClick=()=>{this.disabled||this._isSubmitting||this._dispatchNavEvent()}}_getEventName(){return"wf:nav-next"}_getButtonLabel(){return this.label?this.label:!this.inline&&("submit"===this.action||"next"!==this.action&&this._isLastStep)?"Submit":"Continue"}_isSubmitAction(){return!this.inline&&("submit"===this.action||"next"!==this.action&&this._isLastStep)}render(){const t=this._getButtonLabel(),e=this.disabled||this._isSubmitting;return K`
|
|
1096
1096
|
<button
|
|
1097
1097
|
type="button"
|
|
1098
1098
|
class="wf-btn wf-btn-next"
|
|
@@ -1109,7 +1109,7 @@
|
|
|
1109
1109
|
`:J}
|
|
1110
1110
|
`}
|
|
1111
1111
|
</button>
|
|
1112
|
-
`}},t.WfNextBtn.styles=
|
|
1112
|
+
`}},t.WfNextBtn.styles=Ce,We([wt({type:String})],t.WfNextBtn.prototype,"label",2),We([wt({type:String})],t.WfNextBtn.prototype,"action",2),We([wt({type:Boolean,attribute:"show-shortcut"})],t.WfNextBtn.prototype,"showShortcut",2),We([wt({type:Boolean})],t.WfNextBtn.prototype,"inline",2),We([wt({type:Boolean})],t.WfNextBtn.prototype,"disabled",2),t.WfNextBtn=We([ft("wf-next-btn")],t.WfNextBtn);const ze=[yt,c`
|
|
1113
1113
|
:host {
|
|
1114
1114
|
display: inline-block;
|
|
1115
1115
|
}
|
|
@@ -1136,7 +1136,7 @@
|
|
|
1136
1136
|
align-items: center;
|
|
1137
1137
|
gap: var(--wf-spacing-05);
|
|
1138
1138
|
}
|
|
1139
|
-
`];var Pe=Object.defineProperty,
|
|
1139
|
+
`];var Pe=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,Ne=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?Le(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&Pe(e,s,o),o};t.WfBackBtn=class extends Ee{constructor(){super(...arguments),this.label="Back",this.showShortcut=!0,this.disabled=!1,this.hideOnFirst=!0,this._handleClick=()=>{this.disabled||this._dispatchNavEvent()}}_getEventName(){return"wf:nav-back"}render(){return this.hideOnFirst&&this._isFirstStep?J:K`
|
|
1140
1140
|
<button
|
|
1141
1141
|
type="button"
|
|
1142
1142
|
class="wf-btn wf-btn-back"
|
|
@@ -1151,5 +1151,221 @@
|
|
|
1151
1151
|
`:J}
|
|
1152
1152
|
${this.label}
|
|
1153
1153
|
</button>
|
|
1154
|
-
`}},t.WfBackBtn.styles=ze,
|
|
1154
|
+
`}},t.WfBackBtn.styles=ze,Ne([wt({type:String})],t.WfBackBtn.prototype,"label",2),Ne([wt({type:Boolean,attribute:"show-shortcut"})],t.WfBackBtn.prototype,"showShortcut",2),Ne([wt({type:Boolean})],t.WfBackBtn.prototype,"disabled",2),Ne([wt({type:Boolean,attribute:"hide-on-first"})],t.WfBackBtn.prototype,"hideOnFirst",2),t.WfBackBtn=Ne([ft("wf-back-btn")],t.WfBackBtn);const Te=[Qt,c`
|
|
1155
|
+
:host {
|
|
1156
|
+
position: relative;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
.wf-select-trigger {
|
|
1160
|
+
display: flex;
|
|
1161
|
+
align-items: center;
|
|
1162
|
+
justify-content: space-between;
|
|
1163
|
+
width: 100%;
|
|
1164
|
+
min-height: var(--wf-input-min-height);
|
|
1165
|
+
padding: var(--wf-spacing-4);
|
|
1166
|
+
font-size: var(--wf-font-size-base);
|
|
1167
|
+
font-weight: var(--wf-font-weight-input);
|
|
1168
|
+
font-family: inherit;
|
|
1169
|
+
background: var(--wf-glass-bg);
|
|
1170
|
+
backdrop-filter: blur(var(--wf-glass-blur));
|
|
1171
|
+
-webkit-backdrop-filter: blur(var(--wf-glass-blur));
|
|
1172
|
+
border: 1px solid var(--wf-glass-border);
|
|
1173
|
+
border-radius: var(--wf-radius-md);
|
|
1174
|
+
box-shadow: var(--wf-glass-shadow);
|
|
1175
|
+
color: var(--wf-color-text);
|
|
1176
|
+
transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
|
|
1177
|
+
outline: none;
|
|
1178
|
+
box-sizing: border-box;
|
|
1179
|
+
cursor: pointer;
|
|
1180
|
+
text-align: left;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
.wf-select-trigger:focus {
|
|
1184
|
+
border-color: var(--wf-color-primary);
|
|
1185
|
+
box-shadow: 0 0 0 var(--wf-focus-ring-width) var(--wf-focus-ring-primary);
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
.wf-select-trigger:disabled {
|
|
1189
|
+
opacity: 0.5;
|
|
1190
|
+
cursor: not-allowed;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
.wf-select-trigger.wf-select-error {
|
|
1194
|
+
border-color: var(--wf-color-error);
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
.wf-select-trigger.wf-select-error:focus {
|
|
1198
|
+
box-shadow: 0 0 0 var(--wf-focus-ring-width) var(--wf-focus-ring-error);
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
.wf-select-placeholder {
|
|
1202
|
+
color: var(--wf-color-text-muted);
|
|
1203
|
+
font-weight: var(--wf-font-weight-input);
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
.wf-select-chevron {
|
|
1207
|
+
flex-shrink: 0;
|
|
1208
|
+
width: 16px;
|
|
1209
|
+
height: 16px;
|
|
1210
|
+
margin-left: var(--wf-spacing-2);
|
|
1211
|
+
color: var(--wf-color-text-muted);
|
|
1212
|
+
transition: transform 150ms ease;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
.wf-select-chevron.wf-open {
|
|
1216
|
+
transform: rotate(180deg);
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
/* Dropdown panel */
|
|
1220
|
+
.wf-select-panel {
|
|
1221
|
+
position: absolute;
|
|
1222
|
+
top: 100%;
|
|
1223
|
+
left: 0;
|
|
1224
|
+
right: 0;
|
|
1225
|
+
z-index: 100;
|
|
1226
|
+
margin-top: var(--wf-spacing-1);
|
|
1227
|
+
padding: var(--wf-spacing-1) 0;
|
|
1228
|
+
background: var(--wf-color-text);
|
|
1229
|
+
border-radius: var(--wf-radius-md);
|
|
1230
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
|
|
1231
|
+
max-height: 240px;
|
|
1232
|
+
overflow-x: hidden;
|
|
1233
|
+
overflow-y: auto;
|
|
1234
|
+
opacity: 0;
|
|
1235
|
+
transform: translateY(-4px);
|
|
1236
|
+
transition: opacity 150ms ease, transform 150ms ease;
|
|
1237
|
+
pointer-events: none;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
.wf-select-panel.wf-open {
|
|
1241
|
+
opacity: 1;
|
|
1242
|
+
transform: translateY(0);
|
|
1243
|
+
pointer-events: auto;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
.wf-select-option {
|
|
1247
|
+
display: block;
|
|
1248
|
+
width: 100%;
|
|
1249
|
+
padding: var(--wf-spacing-3) var(--wf-spacing-4);
|
|
1250
|
+
font-size: var(--wf-font-size-base);
|
|
1251
|
+
font-family: inherit;
|
|
1252
|
+
color: white;
|
|
1253
|
+
background: transparent;
|
|
1254
|
+
border: none;
|
|
1255
|
+
cursor: pointer;
|
|
1256
|
+
text-align: left;
|
|
1257
|
+
outline: none;
|
|
1258
|
+
transition: background 100ms ease;
|
|
1259
|
+
word-wrap: break-word;
|
|
1260
|
+
overflow-wrap: break-word;
|
|
1261
|
+
box-sizing: border-box;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
.wf-select-option:hover,
|
|
1265
|
+
.wf-select-option.wf-active {
|
|
1266
|
+
background: rgba(255, 255, 255, 0.1);
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
.wf-select-option.wf-selected {
|
|
1270
|
+
background: rgba(255, 255, 255, 0.15);
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
/* Hidden slot for slotted <option> elements */
|
|
1274
|
+
.wf-options-slot {
|
|
1275
|
+
display: none;
|
|
1276
|
+
}
|
|
1277
|
+
`];var De=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,Me=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?Fe(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&De(e,s,o),o};t.WfSelect=class extends re{constructor(){super(...arguments),this.placeholder="",this.disabled=!1,this._open=!1,this._options=[],this._activeIndex=-1,this._selectedLabel="",this._boundClickOutside=this._handleClickOutside.bind(this)}connectedCallback(){super.connectedCallback(),this._collectOptions()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._boundClickOutside)}firstUpdated(){this._collectOptions()}_getValidationTriggerProperties(){return["required"]}_setupValidators(){this._validators=[],this.required&&this._validators.push(oe.required())}_getFocusableSelector(){return".wf-select-trigger"}reset(){super.reset(),this._selectedLabel="",this._open=!1,this._activeIndex=-1}_collectOptions(){const t=this.querySelectorAll("option");this._options=Array.from(t).map(t=>({value:t.value,label:t.textContent?.trim()||t.value}))}_toggle(){this.disabled||(this._open?this._close():this._openPanel())}_openPanel(){this._open=!0;const t=this._options.findIndex(t=>t.value===this._value);this._activeIndex=t>=0?t:0,document.addEventListener("click",this._boundClickOutside)}_close(){this._open=!1,this._activeIndex=-1,document.removeEventListener("click",this._boundClickOutside)}_handleClickOutside(t){this.contains(t.target)||this.shadowRoot?.contains(t.target)||this._close()}_selectOption(t){this._value=t.value,this._selectedLabel=t.label,this._close(),this._validationActivated&&this.validate(),this.dispatchEvent(new CustomEvent("wf-change",{detail:{name:this.name,value:this._value},bubbles:!0,composed:!0}))}_handleKeyDown(t){switch(t.key){case"ArrowDown":t.preventDefault(),this._open?this._activeIndex=Math.min(this._activeIndex+1,this._options.length-1):this._openPanel();break;case"ArrowUp":t.preventDefault(),this._open&&(this._activeIndex=Math.max(this._activeIndex-1,0));break;case"Enter":case" ":t.preventDefault(),this._open&&this._activeIndex>=0?this._selectOption(this._options[this._activeIndex]):this._open||this._openPanel();break;case"Escape":this._open&&(t.preventDefault(),t.stopPropagation(),this._close(),this.shadowRoot?.querySelector(".wf-select-trigger")?.focus());break;case"Tab":this._open&&this._close()}}render(){const t=this._activeIndex>=0?"wf-select-opt-"+this._activeIndex:"";return K`
|
|
1278
|
+
<div class="wf-field-container">
|
|
1279
|
+
${this._renderLabel()}
|
|
1280
|
+
|
|
1281
|
+
<button
|
|
1282
|
+
type="button"
|
|
1283
|
+
class="wf-select-trigger ${this._errorMessage?"wf-select-error":""}"
|
|
1284
|
+
role="combobox"
|
|
1285
|
+
aria-expanded="${this._open}"
|
|
1286
|
+
aria-haspopup="listbox"
|
|
1287
|
+
aria-activedescendant="${t||J}"
|
|
1288
|
+
aria-controls="wf-select-listbox"
|
|
1289
|
+
?disabled="${this.disabled}"
|
|
1290
|
+
data-testid="wf-select-trigger"
|
|
1291
|
+
@click="${this._toggle}"
|
|
1292
|
+
@keydown="${this._handleKeyDown}"
|
|
1293
|
+
>
|
|
1294
|
+
${this._selectedLabel?K`<span>${this._selectedLabel}</span>`:K`<span class="wf-select-placeholder">${this.placeholder}</span>`}
|
|
1295
|
+
<svg class="wf-select-chevron ${this._open?"wf-open":""}" viewBox="0 0 16 16" fill="none">
|
|
1296
|
+
<path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1297
|
+
</svg>
|
|
1298
|
+
</button>
|
|
1299
|
+
|
|
1300
|
+
<div
|
|
1301
|
+
class="wf-select-panel ${this._open?"wf-open":""}"
|
|
1302
|
+
role="listbox"
|
|
1303
|
+
id="wf-select-listbox"
|
|
1304
|
+
data-testid="wf-select-panel"
|
|
1305
|
+
>
|
|
1306
|
+
${this._options.map((t,e)=>K`
|
|
1307
|
+
<div
|
|
1308
|
+
class="wf-select-option ${e===this._activeIndex?"wf-active":""} ${t.value===this._value?"wf-selected":""}"
|
|
1309
|
+
role="option"
|
|
1310
|
+
id="wf-select-opt-${e}"
|
|
1311
|
+
aria-selected="${t.value===this._value}"
|
|
1312
|
+
data-testid="wf-select-option"
|
|
1313
|
+
@click="${()=>this._selectOption(t)}"
|
|
1314
|
+
@mouseenter="${()=>{this._activeIndex=e}}"
|
|
1315
|
+
>
|
|
1316
|
+
${t.label}
|
|
1317
|
+
</div>
|
|
1318
|
+
`)}
|
|
1319
|
+
</div>
|
|
1320
|
+
|
|
1321
|
+
<div class="wf-options-slot">
|
|
1322
|
+
<slot @slotchange="${this._collectOptions}"></slot>
|
|
1323
|
+
</div>
|
|
1324
|
+
|
|
1325
|
+
${this._renderHint()}
|
|
1326
|
+
${this._renderError()}
|
|
1327
|
+
</div>
|
|
1328
|
+
`}},t.WfSelect.styles=Te,Me([wt({type:String})],t.WfSelect.prototype,"placeholder",2),Me([wt({type:Boolean})],t.WfSelect.prototype,"disabled",2),Me([mt()],t.WfSelect.prototype,"_open",2),Me([mt()],t.WfSelect.prototype,"_options",2),Me([mt()],t.WfSelect.prototype,"_activeIndex",2),Me([mt()],t.WfSelect.prototype,"_selectedLabel",2),t.WfSelect=Me([ft("wf-select")],t.WfSelect);const Be=c`
|
|
1329
|
+
:host {
|
|
1330
|
+
display: block;
|
|
1331
|
+
text-align: center;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
:host([hidden]) {
|
|
1335
|
+
display: none;
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
.wf-skip-link {
|
|
1339
|
+
display: inline-block;
|
|
1340
|
+
padding: var(--wf-spacing-3, 12px) var(--wf-spacing-4, 16px);
|
|
1341
|
+
font-size: var(--wf-font-size-sm, 0.875rem);
|
|
1342
|
+
font-family: inherit;
|
|
1343
|
+
color: var(--wf-color-text-muted, #646464);
|
|
1344
|
+
background: none;
|
|
1345
|
+
border: none;
|
|
1346
|
+
cursor: pointer;
|
|
1347
|
+
text-decoration: underline;
|
|
1348
|
+
text-underline-offset: 2px;
|
|
1349
|
+
transition: color 150ms ease;
|
|
1350
|
+
outline: none;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
.wf-skip-link:hover {
|
|
1354
|
+
color: var(--wf-color-text, #0a0a0a);
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
.wf-skip-link:focus-visible {
|
|
1358
|
+
border-radius: var(--wf-radius-sm, 4px);
|
|
1359
|
+
box-shadow: 0 0 0 var(--wf-focus-ring-width, 3px) var(--wf-focus-ring-primary, rgba(128, 64, 240, 0.2));
|
|
1360
|
+
}
|
|
1361
|
+
`;var Ie=Object.defineProperty,je=Object.getOwnPropertyDescriptor,qe=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?je(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&Ie(e,s,o),o};t.WfSkipBtn=class extends ct{constructor(){super(...arguments),this.label="Skip this step",this._handleClick=()=>{this.dispatchEvent(new CustomEvent("wf:nav-skip",{bubbles:!0,composed:!0}))}}render(){return K`
|
|
1362
|
+
<button
|
|
1363
|
+
type="button"
|
|
1364
|
+
class="wf-skip-link"
|
|
1365
|
+
data-testid="wf-skip-btn"
|
|
1366
|
+
@click="${this._handleClick}"
|
|
1367
|
+
>
|
|
1368
|
+
${this.label}
|
|
1369
|
+
</button>
|
|
1370
|
+
`}},t.WfSkipBtn.styles=Be,qe([wt({type:String})],t.WfSkipBtn.prototype,"label",2),t.WfSkipBtn=qe([ft("wf-skip-btn")],t.WfSkipBtn),t.DEFAULT_BLOCKED_DOMAINS=ie,t.FormStateController=xt,t.KeyboardController=$t,t.ValidationController=oe,t.createHubSpotAdapter=s,t.createRevenueHeroAdapter=o,t.createWebhookAdapter=r,t.default=ve,t.getHubSpotCookie=e,t.init=be,t.isRevenueHeroLoaded=i,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1155
1371
|
//# sourceMappingURL=wizard-form.min.js.map
|