@saasbase-io/core-elements 1.19.0 → 1.21.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/index.js CHANGED
@@ -4342,7 +4342,7 @@ body {
4342
4342
  .onfocus=${this.onFocus}
4343
4343
  .onblur=${this.onBlur}
4344
4344
  ></rtg-textarea>
4345
- `}};l([a({type:String}),c("design:type",Object)],at.prototype,"autocomplete",void 0),l([a({type:Number}),c("design:type",Number)],at.prototype,"cols",void 0),l([a({type:Boolean}),c("design:type",Boolean)],at.prototype,"disabled",void 0),l([a({type:String}),c("design:type",String)],at.prototype,"form",void 0),l([a({type:String}),c("design:type",Object)],at.prototype,"id",void 0),l([a({type:Boolean}),c("design:type",Boolean)],at.prototype,"invalid",void 0),l([a({type:Number}),c("design:type",Number)],at.prototype,"maxlength",void 0),l([a({type:Number}),c("design:type",Number)],at.prototype,"minlength",void 0),l([a({type:String}),c("design:type",String)],at.prototype,"name",void 0),l([a({type:String}),c("design:type",String)],at.prototype,"placeholder",void 0),l([a({type:Boolean}),c("design:type",Boolean)],at.prototype,"readonly",void 0),l([a({type:Boolean}),c("design:type",Boolean)],at.prototype,"required",void 0),l([a({type:Number}),c("design:type",Number)],at.prototype,"rows",void 0),l([a({type:String}),c("design:type",Object)],at.prototype,"wrap",void 0),l([a({type:String}),c("design:type",String)],at.prototype,"value",void 0),l([a({attribute:!1}),c("design:type",Function)],at.prototype,"onInput",void 0),l([a({attribute:!1}),c("design:type",Function)],at.prototype,"onChange",void 0),l([a({attribute:!1}),c("design:type",Function)],at.prototype,"onFocus",void 0),l([a({attribute:!1}),c("design:type",Function)],at.prototype,"onBlur",void 0),at=l([p("rtg-input-group-textarea")],at);var et=class extends v{constructor(){super(),this.autocomplete="one-time-code",this.id="",this.inputmode="numeric",this._activeSlot=null,this._hasFocus=!1,this._value="",this._children=[],this._handleBlur=e=>{var t;this._hasFocus=!1,this._activeSlot=null,this._sync(),this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0,relatedTarget:e.relatedTarget})),(t=this.onBlur)==null||t.call(this,e)},this._handleFocus=e=>{var t;this._hasFocus=!0,this._activeSlot===null&&(this._activeSlot=this._computeInitialActiveSlot()),this._sync(),this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0,relatedTarget:e.relatedTarget})),(t=this.onFocus)==null||t.call(this,e)},this._handleKeyDown=e=>{if(this.disabled||!this._hasFocus)return;this._activeSlot===null&&(this._activeSlot=this._computeInitialActiveSlot());let t=e.key;if(t==="Backspace"){e.preventDefault(),this._deleteChar();return}if(t.length!==1)return;let r=this._regex();r&&!r.test(t)||(e.preventDefault(),this._insertChar(t))},this._handlePaste=e=>{var s,o;if(this.disabled)return;e.preventDefault();let t=((s=e.clipboardData)==null?void 0:s.getData("text"))??"";this.pasteTransformer&&(t=this.pasteTransformer(t));let r=this._regex(),i=Array.from(t).filter(n=>r?r.test(n):!0).slice(0,this.maxlength).join("");this._updateValue(i),this._activeSlot=Math.min(i.length,this.maxlength-1),this._checkComplete(),(o=this.onPaste)==null||o.call(this,e)},this._children=Array.from(this.childNodes)}createRenderRoot(){return this}get _containerSlot(){return this.querySelector('[data-slot="input-otp-container"]')}get _wrapperSlot(){return this.querySelector('[data-slot="input-otp-wrapper"]')}get _slots(){return Array.from(this.querySelectorAll("rtg-input-otp-slot"))}get _isControlled(){return this.value!==void 0}get _currentValue(){return this._isControlled?this.value:this._value}_inputEl(){return this.querySelector('[data-slot="input-otp"]')}_regex(){return this.pattern?new RegExp(this.pattern):null}_clampIndex(e){return Math.max(0,Math.min(e,this.maxlength-1))}_computeInitialActiveSlot(){let e=(this._currentValue??"").length;return e>=this.maxlength?this.maxlength-1:e}_createCaret(){let e=document.createElement("div");e.dataset.slot="input-otp-slot-caret-wrapper";let t=document.createElement("div");return t.dataset.slot="input-otp-slot-caret",e.appendChild(t),e}_sync(){let e=this._currentValue??"";this._slots.forEach(t=>{let r=t._slotSlot;if(!r)return;let i=e[t.index]??"",s=this._hasFocus&&!this.disabled&&t.index===this._activeSlot;r.dataset.state=s?"active":"inactive",i?r.textContent=i:r.textContent="";let o=s&&!i,n=r.querySelector('[data-slot="input-otp-caret-wrapper"]');o&&!n&&r.appendChild(this._createCaret()),!o&&n&&n.remove()})}_updateValue(e){var t;this._isControlled||(this._value=e),(t=this.onChange)==null||t.call(this,e)}_checkComplete(){var e,t;((e=this._currentValue)==null?void 0:e.length)===this.maxlength&&((t=this.onComplete)==null||t.call(this,this._currentValue))}_insertChar(e){if(this._activeSlot===null)return;let t=this._activeSlot,r=(this._currentValue??"").split("");r[t]=e;let i=r.join("").slice(0,this.maxlength);this._updateValue(i),this._activeSlot=this._clampIndex(this._activeSlot+1),this._checkComplete()}_deleteChar(){if(this._activeSlot===null)return;let e=this._activeSlot,t=(this._currentValue??"").split("");e>0&&!t[e]&&e--,t[e]="",this._activeSlot=e,this._updateValue(t.join(""))}updated(e){e.has("id")&&(this.id&&(this._inputId=this.id),this.removeAttribute("id")),e.has("value")&&this._isControlled&&(this._value=this.value??""),this._sync()}firstUpdated(){this._inputId=this.id,this.removeAttribute("id"),this._value=this.value??this.defaultValue??"";let e=this._containerSlot,t=this._wrapperSlot;!e||!t||(this._children.forEach(r=>{e.insertBefore(r,t)}),this.addEventListener("rtg-input-otp-slot:focus",r=>{var s;if(this.disabled)return;let{index:i}=r.detail;this._activeSlot=i,this._hasFocus=!0,(s=this._inputEl())==null||s.focus(),this._sync()}))}render(){return d`
4345
+ `}};l([a({type:String}),c("design:type",Object)],at.prototype,"autocomplete",void 0),l([a({type:Number}),c("design:type",Number)],at.prototype,"cols",void 0),l([a({type:Boolean}),c("design:type",Boolean)],at.prototype,"disabled",void 0),l([a({type:String}),c("design:type",String)],at.prototype,"form",void 0),l([a({type:String}),c("design:type",Object)],at.prototype,"id",void 0),l([a({type:Boolean}),c("design:type",Boolean)],at.prototype,"invalid",void 0),l([a({type:Number}),c("design:type",Number)],at.prototype,"maxlength",void 0),l([a({type:Number}),c("design:type",Number)],at.prototype,"minlength",void 0),l([a({type:String}),c("design:type",String)],at.prototype,"name",void 0),l([a({type:String}),c("design:type",String)],at.prototype,"placeholder",void 0),l([a({type:Boolean}),c("design:type",Boolean)],at.prototype,"readonly",void 0),l([a({type:Boolean}),c("design:type",Boolean)],at.prototype,"required",void 0),l([a({type:Number}),c("design:type",Number)],at.prototype,"rows",void 0),l([a({type:String}),c("design:type",Object)],at.prototype,"wrap",void 0),l([a({type:String}),c("design:type",String)],at.prototype,"value",void 0),l([a({attribute:!1}),c("design:type",Function)],at.prototype,"onInput",void 0),l([a({attribute:!1}),c("design:type",Function)],at.prototype,"onChange",void 0),l([a({attribute:!1}),c("design:type",Function)],at.prototype,"onFocus",void 0),l([a({attribute:!1}),c("design:type",Function)],at.prototype,"onBlur",void 0),at=l([p("rtg-input-group-textarea")],at);var rt=class extends v{constructor(){super(),this.autocomplete="one-time-code",this.id="",this.inputmode="numeric",this._activeSlot=null,this._hasFocus=!1,this._value="",this._children=[],this._handleBlur=e=>{var t;this._hasFocus=!1,this._activeSlot=null,this._sync(),this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0,relatedTarget:e.relatedTarget})),(t=this.onBlur)==null||t.call(this,e)},this._handleFocus=e=>{var t;this._hasFocus=!0,this._activeSlot===null&&(this._activeSlot=this._computeInitialActiveSlot()),this._sync(),this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0,relatedTarget:e.relatedTarget})),(t=this.onFocus)==null||t.call(this,e)},this._handleKeyDown=e=>{if(this.disabled||!this._hasFocus)return;this._activeSlot===null&&(this._activeSlot=this._computeInitialActiveSlot());let t=e.key;if(t==="Backspace"){e.preventDefault(),this._deleteChar();return}if(t.length!==1)return;let r=this._regex();r&&!r.test(t)||(e.preventDefault(),this._insertChar(t))},this._handlePaste=e=>{var s,o;if(this.disabled)return;e.preventDefault();let t=((s=e.clipboardData)==null?void 0:s.getData("text"))??"";this.pasteTransformer&&(t=this.pasteTransformer(t));let r=this._regex(),i=Array.from(t).filter(n=>r?r.test(n):!0).slice(0,this.maxlength).join("");this._updateValue(i),this._activeSlot=Math.min(i.length,this.maxlength-1),this._checkComplete(),(o=this.onPaste)==null||o.call(this,e)},this._children=Array.from(this.childNodes)}createRenderRoot(){return this}get _containerSlot(){return this.querySelector('[data-slot="input-otp-container"]')}get _wrapperSlot(){return this.querySelector('[data-slot="input-otp-wrapper"]')}get _slots(){return Array.from(this.querySelectorAll("rtg-input-otp-slot"))}get _isControlled(){return this.value!==void 0}get _currentValue(){return this._isControlled?this.value:this._value}_inputEl(){return this.querySelector('[data-slot="input-otp"]')}_regex(){return this.pattern?new RegExp(this.pattern):null}_clampIndex(e){return Math.max(0,Math.min(e,this.maxlength-1))}_computeInitialActiveSlot(){let e=(this._currentValue??"").length;return e>=this.maxlength?this.maxlength-1:e}_createCaret(){let e=document.createElement("div");e.dataset.slot="input-otp-slot-caret-wrapper";let t=document.createElement("div");return t.dataset.slot="input-otp-slot-caret",e.appendChild(t),e}_sync(){let e=this._currentValue??"";this._slots.forEach(t=>{let r=t._slotSlot;if(!r)return;let i=e[t.index]??"",s=this._hasFocus&&!this.disabled&&t.index===this._activeSlot;r.dataset.state=s?"active":"inactive",i?r.textContent=i:r.textContent="";let o=s&&!i,n=r.querySelector('[data-slot="input-otp-caret-wrapper"]');o&&!n&&r.appendChild(this._createCaret()),!o&&n&&n.remove()})}_updateValue(e){var t;this._isControlled||(this._value=e),(t=this.onChange)==null||t.call(this,e)}_checkComplete(){var e,t;((e=this._currentValue)==null?void 0:e.length)===this.maxlength&&((t=this.onComplete)==null||t.call(this,this._currentValue))}_insertChar(e){if(this._activeSlot===null)return;let t=this._activeSlot,r=(this._currentValue??"").split("");r[t]=e;let i=r.join("").slice(0,this.maxlength);this._updateValue(i),this._activeSlot=this._clampIndex(this._activeSlot+1),this._checkComplete()}_deleteChar(){if(this._activeSlot===null)return;let e=this._activeSlot,t=(this._currentValue??"").split("");e>0&&!t[e]&&e--,t[e]="",this._activeSlot=e,this._updateValue(t.join(""))}updated(e){e.has("id")&&(this.id&&(this._inputId=this.id),this.removeAttribute("id")),e.has("value")&&this._isControlled&&(this._value=this.value??""),this._sync()}firstUpdated(){this._inputId=this.id,this.removeAttribute("id"),this._value=this.value??this.defaultValue??"";let e=this._containerSlot,t=this._wrapperSlot;!e||!t||(this._children.forEach(r=>{e.insertBefore(r,t)}),this.addEventListener("rtg-input-otp-slot:focus",r=>{var s;if(this.disabled)return;let{index:i}=r.detail;this._activeSlot=i,this._hasFocus=!0,(s=this._inputEl())==null||s.focus(),this._sync()}))}render(){return d`
4346
4346
  <div data-slot="input-otp-container">
4347
4347
  <div data-slot="input-otp-wrapper">
4348
4348
  <input
@@ -4365,7 +4365,7 @@ body {
4365
4365
  />
4366
4366
  </div>
4367
4367
  </div>
4368
- `}};l([a({type:String}),c("design:type",Object)],et.prototype,"autocomplete",void 0),l([a({attribute:"default-value",type:String}),c("design:type",String)],et.prototype,"defaultValue",void 0),l([a({type:Boolean}),c("design:type",Boolean)],et.prototype,"disabled",void 0),l([a({type:String}),c("design:type",String)],et.prototype,"form",void 0),l([a({type:String}),c("design:type",Object)],et.prototype,"id",void 0),l([a({type:String}),c("design:type",Object)],et.prototype,"inputmode",void 0),l([a({type:Number}),c("design:type",Number)],et.prototype,"maxlength",void 0),l([a({type:String}),c("design:type",String)],et.prototype,"name",void 0),l([a({type:String}),c("design:type",String)],et.prototype,"pattern",void 0),l([a({type:Boolean}),c("design:type",Boolean)],et.prototype,"required",void 0),l([a({type:String}),c("design:type",String)],et.prototype,"value",void 0),l([a({attribute:!1}),c("design:type",Function)],et.prototype,"onChange",void 0),l([a({attribute:!1}),c("design:type",Function)],et.prototype,"onComplete",void 0),l([a({attribute:!1}),c("design:type",Function)],et.prototype,"onBlur",void 0),l([a({attribute:!1}),c("design:type",Function)],et.prototype,"onFocus",void 0),l([a({attribute:!1}),c("design:type",Function)],et.prototype,"onPaste",void 0),l([a({attribute:!1}),c("design:type",Function)],et.prototype,"pasteTransformer",void 0),l([x(),c("design:type",Object)],et.prototype,"_activeSlot",void 0),l([x(),c("design:type",Object)],et.prototype,"_hasFocus",void 0),l([x(),c("design:type",Object)],et.prototype,"_value",void 0),et=l([p("rtg-input-otp"),c("design:paramtypes",[])],et);var al=class extends v{createRenderRoot(){return this}get _groupSlot(){return this.querySelector('[data-slot="input-otp-group"]')}firstUpdated(){let e=this._groupSlot;e&&Array.from(this.childNodes).filter(t=>t!==e).forEach(t=>e.appendChild(t))}render(){return d`<div data-slot="input-otp-group"></div>`}};al=l([p("rtg-input-otp-group")],al);var Hi=class extends v{constructor(...e){super(...e),this._handleClick=()=>{this.dispatchEvent(new CustomEvent("rtg-input-otp-slot:focus",{detail:{index:this.index},bubbles:!0}))}}createRenderRoot(){return this}get _slotSlot(){return this.querySelector('[data-slot="input-otp-slot"]')}render(){return d`
4368
+ `}};l([a({type:String}),c("design:type",Object)],rt.prototype,"autocomplete",void 0),l([a({attribute:"default-value",type:String}),c("design:type",String)],rt.prototype,"defaultValue",void 0),l([a({type:Boolean}),c("design:type",Boolean)],rt.prototype,"disabled",void 0),l([a({type:String}),c("design:type",String)],rt.prototype,"form",void 0),l([a({type:String}),c("design:type",Object)],rt.prototype,"id",void 0),l([a({type:String}),c("design:type",Object)],rt.prototype,"inputmode",void 0),l([a({type:Number}),c("design:type",Number)],rt.prototype,"maxlength",void 0),l([a({type:String}),c("design:type",String)],rt.prototype,"name",void 0),l([a({type:String}),c("design:type",String)],rt.prototype,"pattern",void 0),l([a({type:Boolean}),c("design:type",Boolean)],rt.prototype,"required",void 0),l([a({type:String}),c("design:type",String)],rt.prototype,"value",void 0),l([a({attribute:!1}),c("design:type",Function)],rt.prototype,"onChange",void 0),l([a({attribute:!1}),c("design:type",Function)],rt.prototype,"onComplete",void 0),l([a({attribute:!1}),c("design:type",Function)],rt.prototype,"onBlur",void 0),l([a({attribute:!1}),c("design:type",Function)],rt.prototype,"onFocus",void 0),l([a({attribute:!1}),c("design:type",Function)],rt.prototype,"onPaste",void 0),l([a({attribute:!1}),c("design:type",Function)],rt.prototype,"pasteTransformer",void 0),l([x(),c("design:type",Object)],rt.prototype,"_activeSlot",void 0),l([x(),c("design:type",Object)],rt.prototype,"_hasFocus",void 0),l([x(),c("design:type",Object)],rt.prototype,"_value",void 0),rt=l([p("rtg-input-otp"),c("design:paramtypes",[])],rt);var al=class extends v{createRenderRoot(){return this}get _groupSlot(){return this.querySelector('[data-slot="input-otp-group"]')}firstUpdated(){let e=this._groupSlot;e&&Array.from(this.childNodes).filter(t=>t!==e).forEach(t=>e.appendChild(t))}render(){return d`<div data-slot="input-otp-group"></div>`}};al=l([p("rtg-input-otp-group")],al);var Hi=class extends v{constructor(...e){super(...e),this._handleClick=()=>{this.dispatchEvent(new CustomEvent("rtg-input-otp-slot:focus",{detail:{index:this.index},bubbles:!0}))}}createRenderRoot(){return this}get _slotSlot(){return this.querySelector('[data-slot="input-otp-slot"]')}render(){return d`
4369
4369
  <div
4370
4370
  data-slot="input-otp-slot"
4371
4371
  aria-invalid=${this.invalid||this.ariaInvalid==="true"?"true":m}
@@ -6236,7 +6236,7 @@ body {
6236
6236
  ${this._renderError()}
6237
6237
  ${this.content==="split"&&!this._invalid?this._renderDescription():m}
6238
6238
  </rtg-field>
6239
- `}};exports.SbIdentifierField._ROOT="identifier-field";exports.SbIdentifierField._CONTENT="content";exports.SbIdentifierField._LABEL="label";exports.SbIdentifierField._MARK="mark";exports.SbIdentifierField._DESCRIPTION="description";exports.SbIdentifierField._INPUT="input";exports.SbIdentifierField._ERROR="error";exports.SbIdentifierField.TAG=`sb-${exports.SbIdentifierField._ROOT}`;ut([a({type:String})],exports.SbIdentifierField.prototype,"seed",2);ut([a({attribute:"child-id",type:String})],exports.SbIdentifierField.prototype,"childId",2);ut([a({attribute:"field-id",type:String})],exports.SbIdentifierField.prototype,"fieldId",2);ut([a({type:String})],exports.SbIdentifierField.prototype,"name",2);ut([a({type:Array})],exports.SbIdentifierField.prototype,"identifiers",2);ut([a({type:String})],exports.SbIdentifierField.prototype,"content",2);ut([a({type:String})],exports.SbIdentifierField.prototype,"label",2);ut([a({type:String})],exports.SbIdentifierField.prototype,"placeholder",2);ut([a({type:String})],exports.SbIdentifierField.prototype,"description",2);ut([a({type:String})],exports.SbIdentifierField.prototype,"mark",2);ut([a({type:Boolean})],exports.SbIdentifierField.prototype,"caret",2);ut([a({type:Boolean})],exports.SbIdentifierField.prototype,"disabled",2);ut([a({type:String})],exports.SbIdentifierField.prototype,"autocomplete",2);ut([a({type:Boolean})],exports.SbIdentifierField.prototype,"required",2);ut([a({attribute:"required-error",type:String})],exports.SbIdentifierField.prototype,"requiredError",2);ut([x()],exports.SbIdentifierField.prototype,"_invalid",2);ut([x()],exports.SbIdentifierField.prototype,"_error",2);ut([x()],exports.SbIdentifierField.prototype,"_value",2);exports.SbIdentifierField=ut([p("sb-identifier-field")],exports.SbIdentifierField);var $g=Object.defineProperty,Cg=Object.getOwnPropertyDescriptor,rt=(e,t,r,i)=>{for(var s=i>1?void 0:i?Cg(t,r):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(s=(i?n(t,r,s):n(s))||s);return i&&s&&$g(t,r,s),s};exports.SbNameField=class extends v{constructor(){super(...arguments),this.firstLabel="First name",this.lastLabel="Last name",this.seed=_t(),this.name="name",this.firstName="first_name",this.lastName="last_name",this.firstPlaceholder="First name",this.lastPlaceholder="Last name",this.requiredError="This field is required.",this.formatError="Enter a valid name.",this._first="",this._firstInvalid=!1,this._firstError="",this._last="",this._lastInvalid=!1,this._lastError="",this._handleInput=t=>{const r=t.target;r.name===this.firstName&&(this._first=r.value),r.name===this.lastName&&(this._last=r.value)}}static get parts(){const t=this._ROOT;return{root:t,firstField:`${t}-first-field`,lastField:`${t}-last-field`,input:`${t}-input`,label:`${t}-label`,error:`${t}-error`,mark:`${t}-mark`,description:`${t}-description`}}static get validateEventName(){return`sb-${this._ROOT}:validate`}createRenderRoot(){return this}get rootId(){return this.childId??`sb-${exports.SbNameField.parts.root}-${this.seed}`}_renderMark(){return!this.mark&&(!this.caret||!this.required)?m:d`
6239
+ `}};exports.SbIdentifierField._ROOT="identifier-field";exports.SbIdentifierField._CONTENT="content";exports.SbIdentifierField._LABEL="label";exports.SbIdentifierField._MARK="mark";exports.SbIdentifierField._DESCRIPTION="description";exports.SbIdentifierField._INPUT="input";exports.SbIdentifierField._ERROR="error";exports.SbIdentifierField.TAG=`sb-${exports.SbIdentifierField._ROOT}`;ut([a({type:String})],exports.SbIdentifierField.prototype,"seed",2);ut([a({attribute:"child-id",type:String})],exports.SbIdentifierField.prototype,"childId",2);ut([a({attribute:"field-id",type:String})],exports.SbIdentifierField.prototype,"fieldId",2);ut([a({type:String})],exports.SbIdentifierField.prototype,"name",2);ut([a({type:Array})],exports.SbIdentifierField.prototype,"identifiers",2);ut([a({type:String})],exports.SbIdentifierField.prototype,"content",2);ut([a({type:String})],exports.SbIdentifierField.prototype,"label",2);ut([a({type:String})],exports.SbIdentifierField.prototype,"placeholder",2);ut([a({type:String})],exports.SbIdentifierField.prototype,"description",2);ut([a({type:String})],exports.SbIdentifierField.prototype,"mark",2);ut([a({type:Boolean})],exports.SbIdentifierField.prototype,"caret",2);ut([a({type:Boolean})],exports.SbIdentifierField.prototype,"disabled",2);ut([a({type:String})],exports.SbIdentifierField.prototype,"autocomplete",2);ut([a({type:Boolean})],exports.SbIdentifierField.prototype,"required",2);ut([a({attribute:"required-error",type:String})],exports.SbIdentifierField.prototype,"requiredError",2);ut([x()],exports.SbIdentifierField.prototype,"_invalid",2);ut([x()],exports.SbIdentifierField.prototype,"_error",2);ut([x()],exports.SbIdentifierField.prototype,"_value",2);exports.SbIdentifierField=ut([p("sb-identifier-field")],exports.SbIdentifierField);var $g=Object.defineProperty,Cg=Object.getOwnPropertyDescriptor,tt=(e,t,r,i)=>{for(var s=i>1?void 0:i?Cg(t,r):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(s=(i?n(t,r,s):n(s))||s);return i&&s&&$g(t,r,s),s};exports.SbNameField=class extends v{constructor(){super(...arguments),this.seed=_t(),this.name="name",this.content="split",this.label="Name",this.requiredError="Name is a required field.",this.formatError="Enter a valid name.",this._invalid=!1,this._error="",this._value="",this._form=null,this._handleInput=t=>{const r=t.target;r.matches(`[part="${exports.SbNameField.parts.input}"]>input`)&&(this._value=r.value)},this._handleFormSubmit=t=>{this._validate()||t.preventDefault()},this._handleFormReset=()=>{const t=this.querySelector(`rtg-input[part="${exports.SbNameField.parts.input}"]`);t&&(t.value=""),this._value="",this._invalid=!1,this._error=""}}static get parts(){const t=this._ROOT,r=`${t}-${this._CONTENT}`,i=`${t}-${this._LABEL}`,s=`${t}-${this._MARK}`,o=`${t}-${this._DESCRIPTION}`,n=`${t}-${this._INPUT}`,h=`${t}-${this._ERROR}`;return{root:t,content:r,label:i,mark:s,description:o,input:n,error:h}}static get validateEventName(){return`${this.TAG}:validate`}createRenderRoot(){return this}get rootId(){return this.childId??`sb-${exports.SbNameField.parts.root}-${this.seed}`}get contentId(){return`${this.rootId}-${exports.SbNameField._CONTENT}`}get labelId(){return`${this.rootId}-${exports.SbNameField._LABEL}`}get descriptionId(){return`${this.rootId}-${exports.SbNameField._DESCRIPTION}`}get markId(){return`${this.rootId}-${exports.SbNameField._MARK}`}get inputId(){return this.fieldId??`${this.rootId}-${exports.SbNameField._INPUT}`}get errorId(){return`${this.rootId}-${exports.SbNameField._ERROR}`}get _normalizedValue(){return this._value.trim().replace(/\s+/g," ")}get _lengths(){const t={minlength:this.minlength&&this.minlength>0?this.minlength:void 0,maxlength:this.maxlength&&this.maxlength>0?this.maxlength:void 0};return t.minlength&&t.maxlength&&t.maxlength<t.minlength&&(t.maxlength=void 0),t}get _pattern(){return this.pattern?new RegExp(this.pattern):exports.SbNameField._PATTERN}connectedCallback(){var t,r;super.connectedCallback(),this.addEventListener("input",this._handleInput),this._form=this.closest("form"),this._form&&(this._form.noValidate=!0),(t=this._form)==null||t.addEventListener("submit",this._handleFormSubmit),(r=this._form)==null||r.addEventListener("reset",this._handleFormReset)}disconnectedCallback(){var t,r;super.disconnectedCallback(),this.removeEventListener("input",this._handleInput),(t=this._form)==null||t.removeEventListener("submit",this._handleFormSubmit),(r=this._form)==null||r.removeEventListener("reset",this._handleFormReset),this._form=null}validate(){return this._validate()}_dispatchValidate(t,r,i,s){const o=this.inputId,n=this.rootId,h=this.name,u=new CustomEvent(exports.SbNameField.validateEventName,{detail:{id:o,parentId:n,name:h,value:i,valid:t,type:r,message:s},bubbles:!0,composed:!0});this.dispatchEvent(u)}_validateRequired(t){if(!this.required||t)return!0;const r=this.requiredError;return this._invalid=!0,this._error=r,this._dispatchValidate(!1,"required",t,r),!1}_validateMinlength(t){const{minlength:r}=this._lengths;if(!r||t.length>=r)return!0;const i=this.minlengthError??`Name must be at least ${r} characters.`;return this._invalid=!0,this._error=i,this._dispatchValidate(!1,"minlength",t,i),!1}_validateMaxlength(t){const{maxlength:r}=this._lengths;if(!r||t.length<=r)return!0;const i=this.maxlengthError??`Name must be at most ${r} characters.`;return this._invalid=!0,this._error=i,this._dispatchValidate(!1,"maxlength",t,i),!1}_validateFormat(t){if(this._pattern.test(t))return!0;const r=this.formatError;return this._invalid=!0,this._error=r,this._dispatchValidate(!1,"format",t,r),!1}_doValidateSuccess(t,r){this._invalid=!1,this._error="",this._dispatchValidate(!0,"success",t,r)}_validate(){const t=this._normalizedValue;let r=this._validateRequired(t);return r?t?(r=this._validateMinlength(t),!r||(r=this._validateMaxlength(t),!r)||(r=this._validateFormat(t),!r)?!1:(this._doValidateSuccess(t,"Valid name."),!0)):(this._doValidateSuccess(t,"Valid name (optional and empty)."),!0):!1}_renderMark(){return!this.mark&&(!this.caret||!this.required)?m:d`
6240
6240
  <span
6241
6241
  id="${this.markId}"
6242
6242
  part="${exports.SbNameField.parts.mark}"
@@ -6244,69 +6244,62 @@ body {
6244
6244
  >
6245
6245
  ${this.mark?this.mark:d`&ast;`}
6246
6246
  </span>
6247
- `}_dispatchValidate(t,r,i,s,o){this.dispatchEvent(new CustomEvent(exports.SbNameField.validateEventName,{detail:{id:this.rootId,parentId:this.rootId,name:t,value:s,valid:r,type:i,message:o},bubbles:!0,composed:!0}))}_validateName(t,r,i,s){const o=t.trim();return this.required&&!o?(i(!0),s(this.requiredError),this._dispatchValidate(r,!1,"required",o,this.requiredError),!1):/^[a-zA-Z\-'\s]+$/.test(o)?(i(!1),s(""),this._dispatchValidate(r,!0,"success",o,"Valid name"),!0):(i(!0),s(this.formatError),this._dispatchValidate(r,!1,"format",o,this.formatError),!1)}_validate(){const t=this._validateName(this._first,"first_name",i=>this._firstInvalid=i,i=>this._firstError=i),r=this._validateName(this._last,"last_name",i=>this._lastInvalid=i,i=>this._lastError=i);return t&&r}validate(){return this._validate()}connectedCallback(){super.connectedCallback(),this.addEventListener("input",this._handleInput)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("input",this._handleInput)}_renderFirstField(){const t=`${this.rootId}-first`;return d`
6248
- <rtg-field
6249
- id="${t}"
6250
- part="${exports.SbNameField.parts.firstField}"
6251
- data-content="split"
6252
- ?disabled="${this.disabled}"
6253
- ?invalid="${this._firstInvalid}"
6247
+ `}_renderLabel(){return d`
6248
+ <rtg-field-label
6249
+ id="${this.labelId}"
6250
+ part="${exports.SbNameField.parts.label}"
6251
+ for="${this.inputId}"
6254
6252
  >
6255
- <rtg-field-label part="${exports.SbNameField.parts.label}">
6256
- ${this.firstLabel} ${this._renderMark()}
6257
- </rtg-field-label>
6258
-
6259
- <rtg-input
6260
- id="${t}-input"
6261
- part="${exports.SbNameField.parts.input}"
6262
- name="${this.firstName}"
6263
- placeholder="${this.firstPlaceholder}"
6264
- .value=${this._first}
6265
- ?disabled=${this.disabled}
6266
- ?invalid=${this._firstInvalid}
6267
- ?required=${this.required}
6268
- ></rtg-input>
6269
-
6270
- ${this._firstInvalid?d`
6271
- <rtg-field-error part="${exports.SbNameField.parts.error}">
6272
- ${this._firstError}
6273
- </rtg-field-error>
6274
- `:m}
6275
- </rtg-field>
6276
- `}_renderLastField(){const t=`${this.rootId}-last`;return d`
6253
+ ${this.label} ${this._renderMark()}
6254
+ </rtg-field-label>
6255
+ `}_renderDescription(){return this.description?d`
6256
+ <rtg-field-description
6257
+ id="${this.descriptionId}"
6258
+ part="${exports.SbNameField.parts.description}"
6259
+ >
6260
+ ${this.description}
6261
+ </rtg-field-description>
6262
+ `:m}_renderError(){return this._invalid?d`
6263
+ <rtg-field-error
6264
+ id="${this.errorId}"
6265
+ part="${exports.SbNameField.parts.error}"
6266
+ .errors=${[{message:this._error}]}
6267
+ ></rtg-field-error>
6268
+ `:m}render(){const{minlength:t,maxlength:r}=this._lengths;return d`
6277
6269
  <rtg-field
6278
- id="${t}"
6279
- part="${exports.SbNameField.parts.lastField}"
6280
- data-content="split"
6270
+ id="${this.rootId}"
6271
+ part="${exports.SbNameField.parts.root}"
6272
+ data-content="${this.content}"
6281
6273
  ?disabled="${this.disabled}"
6282
- ?invalid="${this._lastInvalid}"
6274
+ ?invalid="${this._invalid}"
6283
6275
  >
6284
- <rtg-field-label part="${exports.SbNameField.parts.label}">
6285
- ${this.lastLabel} ${this._renderMark()}
6286
- </rtg-field-label>
6276
+ ${this.content==="group"?d`
6277
+ <rtg-field-content
6278
+ id="${this.contentId}"
6279
+ part="${exports.SbNameField.parts.content}"
6280
+ >
6281
+ ${this._renderLabel()} ${this._renderDescription()}
6282
+ </rtg-field-content>
6283
+ `:this._renderLabel()}
6287
6284
 
6288
6285
  <rtg-input
6289
- id="${t}-input"
6286
+ id="${this.inputId}"
6290
6287
  part="${exports.SbNameField.parts.input}"
6291
- name="${this.lastName}"
6292
- placeholder="${this.lastPlaceholder}"
6293
- .value=${this._last}
6294
- ?disabled=${this.disabled}
6295
- ?invalid=${this._lastInvalid}
6288
+ type="text"
6289
+ name="${this.name}"
6290
+ placeholder="${this.placeholder??m}"
6291
+ pattern="${this._pattern.source}"
6292
+ minlength="${t??m}"
6293
+ maxlength="${r??m}"
6294
+ ?disabled="${this.disabled}"
6295
+ ?invalid=${this._invalid}
6296
6296
  ?required=${this.required}
6297
6297
  ></rtg-input>
6298
6298
 
6299
- ${this._lastInvalid?d`
6300
- <rtg-field-error part="${exports.SbNameField.parts.error}">
6301
- ${this._lastError}
6302
- </rtg-field-error>
6303
- `:m}
6299
+ ${this._renderError()}
6300
+ ${this.content==="split"&&!this._invalid?this._renderDescription():m}
6304
6301
  </rtg-field>
6305
- `}render(){return d`
6306
- <div class="sb-flex">
6307
- ${this._renderFirstField()} ${this._renderLastField()}
6308
- </div>
6309
- `}};exports.SbNameField._ROOT="name-field";exports.SbNameField._FIRST="first";exports.SbNameField._LAST="last";rt([a({type:String})],exports.SbNameField.prototype,"firstLabel",2);rt([a({type:String})],exports.SbNameField.prototype,"lastLabel",2);rt([a({type:String})],exports.SbNameField.prototype,"seed",2);rt([a({attribute:"child-id"})],exports.SbNameField.prototype,"childId",2);rt([a({type:String})],exports.SbNameField.prototype,"name",2);rt([a({type:Boolean})],exports.SbNameField.prototype,"required",2);rt([a({type:Boolean})],exports.SbNameField.prototype,"disabled",2);rt([a({type:String})],exports.SbNameField.prototype,"firstName",2);rt([a({type:String})],exports.SbNameField.prototype,"lastName",2);rt([a({type:String})],exports.SbNameField.prototype,"firstPlaceholder",2);rt([a({type:String})],exports.SbNameField.prototype,"lastPlaceholder",2);rt([a({type:String})],exports.SbNameField.prototype,"requiredError",2);rt([a({type:String})],exports.SbNameField.prototype,"formatError",2);rt([a({type:String})],exports.SbNameField.prototype,"mark",2);rt([a({type:Boolean})],exports.SbNameField.prototype,"caret",2);rt([x()],exports.SbNameField.prototype,"_first",2);rt([x()],exports.SbNameField.prototype,"_firstInvalid",2);rt([x()],exports.SbNameField.prototype,"_firstError",2);rt([x()],exports.SbNameField.prototype,"_last",2);rt([x()],exports.SbNameField.prototype,"_lastInvalid",2);rt([x()],exports.SbNameField.prototype,"_lastError",2);exports.SbNameField=rt([p("sb-name-field")],exports.SbNameField);var Eg=Object.defineProperty,kg=Object.getOwnPropertyDescriptor,mt=(e,t,r,i)=>{for(var s=i>1?void 0:i?kg(t,r):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(s=(i?n(t,r,s):n(s))||s);return i&&s&&Eg(t,r,s),s};exports.SbPhoneField=class extends v{constructor(){super(...arguments),this.seed=_t(),this.name="phone",this.content="split",this.label="Phone",this.requiredError="Phone is a required field.",this.formatError="Enter a valid phone number.",this._invalid=!1,this._error="",this._value="",this._form=null,this._handleInput=t=>{const r=t.target;r.matches(`[part="${exports.SbPhoneField.parts.input}"]>input`)&&(this._value=r.value)},this._handleFormSubmit=t=>{this._validate()||t.preventDefault()},this._handleFormReset=()=>{const t=this.querySelector(`rtg-input[part="${exports.SbPhoneField.parts.input}"]`);t&&(t.value=""),this._value="",this._invalid=!1,this._error=""}}static get parts(){const t=this._ROOT,r=`${t}-${this._CONTENT}`,i=`${t}-${this._LABEL}`,s=`${t}-${this._MARK}`,o=`${t}-${this._DESCRIPTION}`,n=`${t}-${this._INPUT}`,h=`${t}-${this._ERROR}`;return{root:t,content:r,label:i,mark:s,description:o,input:n,error:h}}static get validateEventName(){return`${this.TAG}:validate`}createRenderRoot(){return this}get rootId(){return this.childId??`sb-${exports.SbPhoneField.parts.root}-${this.seed}`}get contentId(){return`${this.rootId}-${exports.SbPhoneField._CONTENT}`}get labelId(){return`${this.rootId}-${exports.SbPhoneField._LABEL}`}get descriptionId(){return`${this.rootId}-${exports.SbPhoneField._DESCRIPTION}`}get markId(){return`${this.rootId}-${exports.SbPhoneField._MARK}`}get inputId(){return this.fieldId??`${this.rootId}-${exports.SbPhoneField._INPUT}`}get errorId(){return`${this.rootId}-${exports.SbPhoneField._ERROR}`}get _normalizedValue(){return this._value.replace(/\s/g,"")}connectedCallback(){var t,r;super.connectedCallback(),this.addEventListener("input",this._handleInput),this._form=this.closest("form"),this._form&&(this._form.noValidate=!0),(t=this._form)==null||t.addEventListener("submit",this._handleFormSubmit),(r=this._form)==null||r.addEventListener("reset",this._handleFormReset)}disconnectedCallback(){var t,r;super.disconnectedCallback(),this.removeEventListener("input",this._handleInput),(t=this._form)==null||t.removeEventListener("submit",this._handleFormSubmit),(r=this._form)==null||r.removeEventListener("reset",this._handleFormReset),this._form=null}validate(){return this._validate()}_dispatchValidate(t,r,i,s){const o=this.inputId,n=this.rootId,h=this.name,u=new CustomEvent(exports.SbPhoneField.validateEventName,{detail:{id:o,parentId:n,name:h,value:i,valid:t,type:r,message:s},bubbles:!0,composed:!0});this.dispatchEvent(u)}_validateRequired(t){if(!this.required||t)return!0;const r=this.requiredError;return this._invalid=!0,this._error=r,this._dispatchValidate(!1,"required",t,r),!1}_validateFormat(t){if(!this.required&&t===""||exports.SbPhoneField._PATTERN.test(t))return!0;const r=this.formatError;return this._invalid=!0,this._error=r,this._dispatchValidate(!1,"format",t,r),!1}_validate(){const t=this._normalizedValue;let r=this._validateRequired(t);if(!r||(r=this._validateFormat(t),!r))return!1;const i=`Valid phone number${!t&&" (optional and empty)"}.`;return this._invalid=!1,this._error="",this._dispatchValidate(!0,"success",t,i),!0}_renderMark(){return!this.mark&&(!this.caret||!this.required)?m:d`
6302
+ `}};exports.SbNameField._ROOT="name-field";exports.SbNameField._CONTENT="content";exports.SbNameField._LABEL="label";exports.SbNameField._MARK="mark";exports.SbNameField._DESCRIPTION="description";exports.SbNameField._INPUT="input";exports.SbNameField._ERROR="error";exports.SbNameField.TAG=`sb-${exports.SbNameField._ROOT}`;exports.SbNameField._PATTERN=/^[\p{L} .'-]*$/u;tt([a({type:String})],exports.SbNameField.prototype,"seed",2);tt([a({attribute:"child-id",type:String})],exports.SbNameField.prototype,"childId",2);tt([a({attribute:"field-id",type:String})],exports.SbNameField.prototype,"fieldId",2);tt([a({type:String})],exports.SbNameField.prototype,"name",2);tt([a({type:String})],exports.SbNameField.prototype,"content",2);tt([a({type:String})],exports.SbNameField.prototype,"label",2);tt([a({type:String})],exports.SbNameField.prototype,"placeholder",2);tt([a({type:String})],exports.SbNameField.prototype,"description",2);tt([a({type:String})],exports.SbNameField.prototype,"mark",2);tt([a({type:Boolean})],exports.SbNameField.prototype,"caret",2);tt([a({type:Boolean})],exports.SbNameField.prototype,"disabled",2);tt([a({type:Boolean})],exports.SbNameField.prototype,"required",2);tt([a({type:Number})],exports.SbNameField.prototype,"minlength",2);tt([a({type:Number})],exports.SbNameField.prototype,"maxlength",2);tt([a({type:String})],exports.SbNameField.prototype,"pattern",2);tt([a({attribute:"required-error",type:String})],exports.SbNameField.prototype,"requiredError",2);tt([a({attribute:"minlength-error",type:String})],exports.SbNameField.prototype,"minlengthError",2);tt([a({attribute:"maxlength-error",type:String})],exports.SbNameField.prototype,"maxlengthError",2);tt([a({attribute:"format-error",type:String})],exports.SbNameField.prototype,"formatError",2);tt([x()],exports.SbNameField.prototype,"_invalid",2);tt([x()],exports.SbNameField.prototype,"_error",2);tt([x()],exports.SbNameField.prototype,"_value",2);exports.SbNameField=tt([p("sb-name-field")],exports.SbNameField);var Eg=Object.defineProperty,kg=Object.getOwnPropertyDescriptor,mt=(e,t,r,i)=>{for(var s=i>1?void 0:i?kg(t,r):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(s=(i?n(t,r,s):n(s))||s);return i&&s&&Eg(t,r,s),s};exports.SbPhoneField=class extends v{constructor(){super(...arguments),this.seed=_t(),this.name="phone",this.content="split",this.label="Phone",this.requiredError="Phone is a required field.",this.formatError="Enter a valid phone number.",this._invalid=!1,this._error="",this._value="",this._form=null,this._handleInput=t=>{const r=t.target;r.matches(`[part="${exports.SbPhoneField.parts.input}"]>input`)&&(this._value=r.value)},this._handleFormSubmit=t=>{this._validate()||t.preventDefault()},this._handleFormReset=()=>{const t=this.querySelector(`rtg-input[part="${exports.SbPhoneField.parts.input}"]`);t&&(t.value=""),this._value="",this._invalid=!1,this._error=""}}static get parts(){const t=this._ROOT,r=`${t}-${this._CONTENT}`,i=`${t}-${this._LABEL}`,s=`${t}-${this._MARK}`,o=`${t}-${this._DESCRIPTION}`,n=`${t}-${this._INPUT}`,h=`${t}-${this._ERROR}`;return{root:t,content:r,label:i,mark:s,description:o,input:n,error:h}}static get validateEventName(){return`${this.TAG}:validate`}createRenderRoot(){return this}get rootId(){return this.childId??`sb-${exports.SbPhoneField.parts.root}-${this.seed}`}get contentId(){return`${this.rootId}-${exports.SbPhoneField._CONTENT}`}get labelId(){return`${this.rootId}-${exports.SbPhoneField._LABEL}`}get descriptionId(){return`${this.rootId}-${exports.SbPhoneField._DESCRIPTION}`}get markId(){return`${this.rootId}-${exports.SbPhoneField._MARK}`}get inputId(){return this.fieldId??`${this.rootId}-${exports.SbPhoneField._INPUT}`}get errorId(){return`${this.rootId}-${exports.SbPhoneField._ERROR}`}get _normalizedValue(){return this._value.replace(/\s/g,"")}connectedCallback(){var t,r;super.connectedCallback(),this.addEventListener("input",this._handleInput),this._form=this.closest("form"),this._form&&(this._form.noValidate=!0),(t=this._form)==null||t.addEventListener("submit",this._handleFormSubmit),(r=this._form)==null||r.addEventListener("reset",this._handleFormReset)}disconnectedCallback(){var t,r;super.disconnectedCallback(),this.removeEventListener("input",this._handleInput),(t=this._form)==null||t.removeEventListener("submit",this._handleFormSubmit),(r=this._form)==null||r.removeEventListener("reset",this._handleFormReset),this._form=null}validate(){return this._validate()}_dispatchValidate(t,r,i,s){const o=this.inputId,n=this.rootId,h=this.name,u=new CustomEvent(exports.SbPhoneField.validateEventName,{detail:{id:o,parentId:n,name:h,value:i,valid:t,type:r,message:s},bubbles:!0,composed:!0});this.dispatchEvent(u)}_validateRequired(t){if(!this.required||t)return!0;const r=this.requiredError;return this._invalid=!0,this._error=r,this._dispatchValidate(!1,"required",t,r),!1}_validateFormat(t){if(!this.required&&t===""||exports.SbPhoneField._PATTERN.test(t))return!0;const r=this.formatError;return this._invalid=!0,this._error=r,this._dispatchValidate(!1,"format",t,r),!1}_validate(){const t=this._normalizedValue;let r=this._validateRequired(t);if(!r||(r=this._validateFormat(t),!r))return!1;const i=`Valid phone number${!t&&" (optional and empty)"}.`;return this._invalid=!1,this._error="",this._dispatchValidate(!0,"success",t,i),!0}_renderMark(){return!this.mark&&(!this.caret||!this.required)?m:d`
6310
6303
  <span
6311
6304
  id="${this.markId}"
6312
6305
  part="${exports.SbPhoneField.parts.mark}"
@@ -6366,7 +6359,7 @@ body {
6366
6359
  ${this._renderError()}
6367
6360
  ${this.content==="split"&&!this._invalid?this._renderDescription():m}
6368
6361
  </rtg-field>
6369
- `}};exports.SbPhoneField._ROOT="phone-field";exports.SbPhoneField._CONTENT="content";exports.SbPhoneField._LABEL="label";exports.SbPhoneField._MARK="mark";exports.SbPhoneField._DESCRIPTION="description";exports.SbPhoneField._INPUT="input";exports.SbPhoneField._ERROR="error";exports.SbPhoneField.TAG=`sb-${exports.SbPhoneField._ROOT}`;exports.SbPhoneField._PATTERN=/^\+?(\d[\d-.() ]+)?(\([\d-.() ]+\))?[\d-.() ]+\d$/;mt([a({type:String})],exports.SbPhoneField.prototype,"seed",2);mt([a({attribute:"child-id",type:String})],exports.SbPhoneField.prototype,"childId",2);mt([a({attribute:"field-id",type:String})],exports.SbPhoneField.prototype,"fieldId",2);mt([a({type:String})],exports.SbPhoneField.prototype,"name",2);mt([a({type:String})],exports.SbPhoneField.prototype,"content",2);mt([a({type:String})],exports.SbPhoneField.prototype,"label",2);mt([a({type:String})],exports.SbPhoneField.prototype,"placeholder",2);mt([a({type:String})],exports.SbPhoneField.prototype,"description",2);mt([a({type:String})],exports.SbPhoneField.prototype,"mark",2);mt([a({type:Boolean})],exports.SbPhoneField.prototype,"caret",2);mt([a({type:Boolean})],exports.SbPhoneField.prototype,"disabled",2);mt([a({type:Boolean})],exports.SbPhoneField.prototype,"required",2);mt([a({attribute:"required-error",type:String})],exports.SbPhoneField.prototype,"requiredError",2);mt([a({attribute:"format-error",type:String})],exports.SbPhoneField.prototype,"formatError",2);mt([x()],exports.SbPhoneField.prototype,"_invalid",2);mt([x()],exports.SbPhoneField.prototype,"_error",2);mt([x()],exports.SbPhoneField.prototype,"_value",2);exports.SbPhoneField=mt([p("sb-phone-field")],exports.SbPhoneField);var Rg=Object.defineProperty,Ig=Object.getOwnPropertyDescriptor,tt=(e,t,r,i)=>{for(var s=i>1?void 0:i?Ig(t,r):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(s=(i?n(t,r,s):n(s))||s);return i&&s&&Rg(t,r,s),s};exports.SbUsernameField=class extends v{constructor(){super(...arguments),this.seed=_t(),this.name="username",this.content="split",this.label="Username",this.requiredError="Username is a required field.",this.formatError="Enter a valid username.",this._invalid=!1,this._error="",this._value="",this._form=null,this._handleInput=t=>{const r=t.target;r.matches(`[part="${exports.SbUsernameField.parts.input}"]>input`)&&(this._value=r.value)},this._handleFormSubmit=t=>{this._validate()||t.preventDefault()},this._handleFormReset=()=>{const t=this.querySelector(`rtg-input[part="${exports.SbUsernameField.parts.input}"]`);t&&(t.value=""),this._value="",this._invalid=!1,this._error=""}}static get parts(){const t=this._ROOT,r=`${t}-${this._CONTENT}`,i=`${t}-${this._LABEL}`,s=`${t}-${this._MARK}`,o=`${t}-${this._DESCRIPTION}`,n=`${t}-${this._INPUT}`,h=`${t}-${this._ERROR}`;return{root:t,content:r,label:i,mark:s,description:o,input:n,error:h}}static get validateEventName(){return`${this.TAG}:validate`}createRenderRoot(){return this}get rootId(){return this.childId??`sb-${exports.SbUsernameField.parts.root}-${this.seed}`}get contentId(){return`${this.rootId}-${exports.SbUsernameField._CONTENT}`}get labelId(){return`${this.rootId}-${exports.SbUsernameField._LABEL}`}get descriptionId(){return`${this.rootId}-${exports.SbUsernameField._DESCRIPTION}`}get markId(){return`${this.rootId}-${exports.SbUsernameField._MARK}`}get inputId(){return this.fieldId??`${this.rootId}-${exports.SbUsernameField._INPUT}`}get errorId(){return`${this.rootId}-${exports.SbUsernameField._ERROR}`}get _normalizedValue(){return this._value.trim().toLowerCase()}get _lengths(){const t={minlength:this.minlength&&this.minlength>0?this.minlength:void 0,maxlength:this.maxlength&&this.maxlength>0?this.maxlength:void 0};return t.minlength&&t.maxlength&&t.maxlength<t.minlength&&(t.maxlength=void 0),t}get _pattern(){return this.pattern?new RegExp(this.pattern):exports.SbUsernameField._PATTERN}connectedCallback(){var t,r;super.connectedCallback(),this.addEventListener("input",this._handleInput),this._form=this.closest("form"),this._form&&(this._form.noValidate=!0),(t=this._form)==null||t.addEventListener("submit",this._handleFormSubmit),(r=this._form)==null||r.addEventListener("reset",this._handleFormReset)}disconnectedCallback(){var t,r;super.disconnectedCallback(),this.removeEventListener("input",this._handleInput),(t=this._form)==null||t.removeEventListener("submit",this._handleFormSubmit),(r=this._form)==null||r.removeEventListener("reset",this._handleFormReset),this._form=null}validate(){return this._validate()}_dispatchValidate(t,r,i,s){const o=this.inputId,n=this.rootId,h=this.name,u=new CustomEvent(exports.SbUsernameField.validateEventName,{detail:{id:o,parentId:n,name:h,value:i,valid:t,type:r,message:s},bubbles:!0,composed:!0});this.dispatchEvent(u)}_validateRequired(t){if(!this.required||t)return!0;const r=this.requiredError;return this._invalid=!0,this._error=r,this._dispatchValidate(!1,"required",t,r),!1}_validateMinlength(t){const{minlength:r}=this._lengths;if(!r||t.length>=r)return!0;const i=this.minlengthError??`Username must be at least ${r} characters.`;return this._invalid=!0,this._error=i,this._dispatchValidate(!1,"minlength",t,i),!1}_validateMaxlength(t){const{maxlength:r}=this._lengths;if(!r||t.length<=r)return!0;const i=this.maxlengthError??`Username must be at most ${r} characters.`;return this._invalid=!0,this._error=i,this._dispatchValidate(!1,"maxlength",t,i),!1}_validateFormat(t){if(this._pattern.test(t))return!0;const r=this.formatError;return this._invalid=!0,this._error=r,this._dispatchValidate(!1,"format",t,r),!1}_doValidateSuccess(t,r){this._invalid=!1,this._error="",this._dispatchValidate(!0,"success",t,r)}_validate(){const t=this._normalizedValue;let r=this._validateRequired(t);return r?t?(r=this._validateMinlength(t),!r||(r=this._validateMaxlength(t),!r)||(r=this._validateFormat(t),!r)?!1:(this._doValidateSuccess(t,"Valid username."),!0)):(this._doValidateSuccess(t,"Valid username (optional and empty)."),!0):!1}_renderMark(){return!this.mark&&(!this.caret||!this.required)?m:d`
6362
+ `}};exports.SbPhoneField._ROOT="phone-field";exports.SbPhoneField._CONTENT="content";exports.SbPhoneField._LABEL="label";exports.SbPhoneField._MARK="mark";exports.SbPhoneField._DESCRIPTION="description";exports.SbPhoneField._INPUT="input";exports.SbPhoneField._ERROR="error";exports.SbPhoneField.TAG=`sb-${exports.SbPhoneField._ROOT}`;exports.SbPhoneField._PATTERN=/^\+?(\d[\d-.() ]+)?(\([\d-.() ]+\))?[\d-.() ]+\d$/;mt([a({type:String})],exports.SbPhoneField.prototype,"seed",2);mt([a({attribute:"child-id",type:String})],exports.SbPhoneField.prototype,"childId",2);mt([a({attribute:"field-id",type:String})],exports.SbPhoneField.prototype,"fieldId",2);mt([a({type:String})],exports.SbPhoneField.prototype,"name",2);mt([a({type:String})],exports.SbPhoneField.prototype,"content",2);mt([a({type:String})],exports.SbPhoneField.prototype,"label",2);mt([a({type:String})],exports.SbPhoneField.prototype,"placeholder",2);mt([a({type:String})],exports.SbPhoneField.prototype,"description",2);mt([a({type:String})],exports.SbPhoneField.prototype,"mark",2);mt([a({type:Boolean})],exports.SbPhoneField.prototype,"caret",2);mt([a({type:Boolean})],exports.SbPhoneField.prototype,"disabled",2);mt([a({type:Boolean})],exports.SbPhoneField.prototype,"required",2);mt([a({attribute:"required-error",type:String})],exports.SbPhoneField.prototype,"requiredError",2);mt([a({attribute:"format-error",type:String})],exports.SbPhoneField.prototype,"formatError",2);mt([x()],exports.SbPhoneField.prototype,"_invalid",2);mt([x()],exports.SbPhoneField.prototype,"_error",2);mt([x()],exports.SbPhoneField.prototype,"_value",2);exports.SbPhoneField=mt([p("sb-phone-field")],exports.SbPhoneField);var Rg=Object.defineProperty,Ig=Object.getOwnPropertyDescriptor,et=(e,t,r,i)=>{for(var s=i>1?void 0:i?Ig(t,r):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(s=(i?n(t,r,s):n(s))||s);return i&&s&&Rg(t,r,s),s};exports.SbUsernameField=class extends v{constructor(){super(...arguments),this.seed=_t(),this.name="username",this.content="split",this.label="Username",this.requiredError="Username is a required field.",this.formatError="Enter a valid username.",this._invalid=!1,this._error="",this._value="",this._form=null,this._handleInput=t=>{const r=t.target;r.matches(`[part="${exports.SbUsernameField.parts.input}"]>input`)&&(this._value=r.value)},this._handleFormSubmit=t=>{this._validate()||t.preventDefault()},this._handleFormReset=()=>{const t=this.querySelector(`rtg-input[part="${exports.SbUsernameField.parts.input}"]`);t&&(t.value=""),this._value="",this._invalid=!1,this._error=""}}static get parts(){const t=this._ROOT,r=`${t}-${this._CONTENT}`,i=`${t}-${this._LABEL}`,s=`${t}-${this._MARK}`,o=`${t}-${this._DESCRIPTION}`,n=`${t}-${this._INPUT}`,h=`${t}-${this._ERROR}`;return{root:t,content:r,label:i,mark:s,description:o,input:n,error:h}}static get validateEventName(){return`${this.TAG}:validate`}createRenderRoot(){return this}get rootId(){return this.childId??`sb-${exports.SbUsernameField.parts.root}-${this.seed}`}get contentId(){return`${this.rootId}-${exports.SbUsernameField._CONTENT}`}get labelId(){return`${this.rootId}-${exports.SbUsernameField._LABEL}`}get descriptionId(){return`${this.rootId}-${exports.SbUsernameField._DESCRIPTION}`}get markId(){return`${this.rootId}-${exports.SbUsernameField._MARK}`}get inputId(){return this.fieldId??`${this.rootId}-${exports.SbUsernameField._INPUT}`}get errorId(){return`${this.rootId}-${exports.SbUsernameField._ERROR}`}get _normalizedValue(){return this._value.trim().toLowerCase()}get _lengths(){const t={minlength:this.minlength&&this.minlength>0?this.minlength:void 0,maxlength:this.maxlength&&this.maxlength>0?this.maxlength:void 0};return t.minlength&&t.maxlength&&t.maxlength<t.minlength&&(t.maxlength=void 0),t}get _pattern(){return this.pattern?new RegExp(this.pattern):exports.SbUsernameField._PATTERN}connectedCallback(){var t,r;super.connectedCallback(),this.addEventListener("input",this._handleInput),this._form=this.closest("form"),this._form&&(this._form.noValidate=!0),(t=this._form)==null||t.addEventListener("submit",this._handleFormSubmit),(r=this._form)==null||r.addEventListener("reset",this._handleFormReset)}disconnectedCallback(){var t,r;super.disconnectedCallback(),this.removeEventListener("input",this._handleInput),(t=this._form)==null||t.removeEventListener("submit",this._handleFormSubmit),(r=this._form)==null||r.removeEventListener("reset",this._handleFormReset),this._form=null}validate(){return this._validate()}_dispatchValidate(t,r,i,s){const o=this.inputId,n=this.rootId,h=this.name,u=new CustomEvent(exports.SbUsernameField.validateEventName,{detail:{id:o,parentId:n,name:h,value:i,valid:t,type:r,message:s},bubbles:!0,composed:!0});this.dispatchEvent(u)}_validateRequired(t){if(!this.required||t)return!0;const r=this.requiredError;return this._invalid=!0,this._error=r,this._dispatchValidate(!1,"required",t,r),!1}_validateMinlength(t){const{minlength:r}=this._lengths;if(!r||t.length>=r)return!0;const i=this.minlengthError??`Username must be at least ${r} characters.`;return this._invalid=!0,this._error=i,this._dispatchValidate(!1,"minlength",t,i),!1}_validateMaxlength(t){const{maxlength:r}=this._lengths;if(!r||t.length<=r)return!0;const i=this.maxlengthError??`Username must be at most ${r} characters.`;return this._invalid=!0,this._error=i,this._dispatchValidate(!1,"maxlength",t,i),!1}_validateFormat(t){if(this._pattern.test(t))return!0;const r=this.formatError;return this._invalid=!0,this._error=r,this._dispatchValidate(!1,"format",t,r),!1}_doValidateSuccess(t,r){this._invalid=!1,this._error="",this._dispatchValidate(!0,"success",t,r)}_validate(){const t=this._normalizedValue;let r=this._validateRequired(t);return r?t?(r=this._validateMinlength(t),!r||(r=this._validateMaxlength(t),!r)||(r=this._validateFormat(t),!r)?!1:(this._doValidateSuccess(t,"Valid username."),!0)):(this._doValidateSuccess(t,"Valid username (optional and empty)."),!0):!1}_renderMark(){return!this.mark&&(!this.caret||!this.required)?m:d`
6370
6363
  <span
6371
6364
  id="${this.markId}"
6372
6365
  part="${exports.SbUsernameField.parts.mark}"
@@ -6429,7 +6422,7 @@ body {
6429
6422
  ${this._renderError()}
6430
6423
  ${this.content==="split"&&!this._invalid?this._renderDescription():m}
6431
6424
  </rtg-field>
6432
- `}};exports.SbUsernameField._ROOT="username-field";exports.SbUsernameField._CONTENT="content";exports.SbUsernameField._LABEL="label";exports.SbUsernameField._MARK="mark";exports.SbUsernameField._DESCRIPTION="description";exports.SbUsernameField._INPUT="input";exports.SbUsernameField._ERROR="error";exports.SbUsernameField.TAG=`sb-${exports.SbUsernameField._ROOT}`;exports.SbUsernameField._PATTERN=/^[a-z0-9_]*$/;tt([a({type:String})],exports.SbUsernameField.prototype,"seed",2);tt([a({attribute:"child-id",type:String})],exports.SbUsernameField.prototype,"childId",2);tt([a({attribute:"field-id",type:String})],exports.SbUsernameField.prototype,"fieldId",2);tt([a({type:String})],exports.SbUsernameField.prototype,"name",2);tt([a({type:String})],exports.SbUsernameField.prototype,"content",2);tt([a({type:String})],exports.SbUsernameField.prototype,"label",2);tt([a({type:String})],exports.SbUsernameField.prototype,"placeholder",2);tt([a({type:String})],exports.SbUsernameField.prototype,"description",2);tt([a({type:String})],exports.SbUsernameField.prototype,"mark",2);tt([a({type:Boolean})],exports.SbUsernameField.prototype,"caret",2);tt([a({type:Boolean})],exports.SbUsernameField.prototype,"disabled",2);tt([a({type:Boolean})],exports.SbUsernameField.prototype,"required",2);tt([a({type:Number})],exports.SbUsernameField.prototype,"minlength",2);tt([a({type:Number})],exports.SbUsernameField.prototype,"maxlength",2);tt([a({type:String})],exports.SbUsernameField.prototype,"pattern",2);tt([a({attribute:"required-error",type:String})],exports.SbUsernameField.prototype,"requiredError",2);tt([a({attribute:"minlength-error",type:String})],exports.SbUsernameField.prototype,"minlengthError",2);tt([a({attribute:"maxlength-error",type:String})],exports.SbUsernameField.prototype,"maxlengthError",2);tt([a({attribute:"format-error",type:String})],exports.SbUsernameField.prototype,"formatError",2);tt([x()],exports.SbUsernameField.prototype,"_invalid",2);tt([x()],exports.SbUsernameField.prototype,"_error",2);tt([x()],exports.SbUsernameField.prototype,"_value",2);exports.SbUsernameField=tt([p("sb-username-field")],exports.SbUsernameField);var Og=Object.defineProperty,Ag=Object.getOwnPropertyDescriptor,ee=(e,t,r,i)=>{for(var s=i>1?void 0:i?Ag(t,r):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(s=(i?n(t,r,s):n(s))||s);return i&&s&&Og(t,r,s),s};exports.SbFormSubmit=class extends v{constructor(){super(...arguments),this.seed=_t(),this.variant="default",this.size="default",this.label="Submit",this.spinnerAlign="start",this._loading=!1,this._handleClick=()=>{this.disabled||this.isLoading||this.dispatchEvent(new CustomEvent(exports.SbFormSubmit.clickEventName,{detail:{id:this.rootId,event:this.event},bubbles:!0,composed:!0}))}}static get parts(){const t=this._ROOT,r=`${t}-${this._SPINNER}`;return{root:t,spinner:r}}static get clickEventName(){return`${this.TAG}:click`}createRenderRoot(){return this}get rootId(){return this.childId??`sb-${exports.SbFormSubmit.parts.root}-${this.seed}`}get spinnerId(){return`${this.rootId}-${exports.SbFormSubmit._SPINNER}`}get isLoading(){return this._loading||this.loading}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._handleClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleClick)}_renderSpinner(){return this.isLoading?d`
6425
+ `}};exports.SbUsernameField._ROOT="username-field";exports.SbUsernameField._CONTENT="content";exports.SbUsernameField._LABEL="label";exports.SbUsernameField._MARK="mark";exports.SbUsernameField._DESCRIPTION="description";exports.SbUsernameField._INPUT="input";exports.SbUsernameField._ERROR="error";exports.SbUsernameField.TAG=`sb-${exports.SbUsernameField._ROOT}`;exports.SbUsernameField._PATTERN=/^[a-z0-9_]*$/;et([a({type:String})],exports.SbUsernameField.prototype,"seed",2);et([a({attribute:"child-id",type:String})],exports.SbUsernameField.prototype,"childId",2);et([a({attribute:"field-id",type:String})],exports.SbUsernameField.prototype,"fieldId",2);et([a({type:String})],exports.SbUsernameField.prototype,"name",2);et([a({type:String})],exports.SbUsernameField.prototype,"content",2);et([a({type:String})],exports.SbUsernameField.prototype,"label",2);et([a({type:String})],exports.SbUsernameField.prototype,"placeholder",2);et([a({type:String})],exports.SbUsernameField.prototype,"description",2);et([a({type:String})],exports.SbUsernameField.prototype,"mark",2);et([a({type:Boolean})],exports.SbUsernameField.prototype,"caret",2);et([a({type:Boolean})],exports.SbUsernameField.prototype,"disabled",2);et([a({type:Boolean})],exports.SbUsernameField.prototype,"required",2);et([a({type:Number})],exports.SbUsernameField.prototype,"minlength",2);et([a({type:Number})],exports.SbUsernameField.prototype,"maxlength",2);et([a({type:String})],exports.SbUsernameField.prototype,"pattern",2);et([a({attribute:"required-error",type:String})],exports.SbUsernameField.prototype,"requiredError",2);et([a({attribute:"minlength-error",type:String})],exports.SbUsernameField.prototype,"minlengthError",2);et([a({attribute:"maxlength-error",type:String})],exports.SbUsernameField.prototype,"maxlengthError",2);et([a({attribute:"format-error",type:String})],exports.SbUsernameField.prototype,"formatError",2);et([x()],exports.SbUsernameField.prototype,"_invalid",2);et([x()],exports.SbUsernameField.prototype,"_error",2);et([x()],exports.SbUsernameField.prototype,"_value",2);exports.SbUsernameField=et([p("sb-username-field")],exports.SbUsernameField);var Og=Object.defineProperty,Ag=Object.getOwnPropertyDescriptor,ee=(e,t,r,i)=>{for(var s=i>1?void 0:i?Ag(t,r):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(s=(i?n(t,r,s):n(s))||s);return i&&s&&Og(t,r,s),s};exports.SbFormSubmit=class extends v{constructor(){super(...arguments),this.seed=_t(),this.variant="default",this.size="default",this.label="Submit",this.spinnerAlign="start",this._loading=!1,this._handleClick=()=>{this.disabled||this.isLoading||this.dispatchEvent(new CustomEvent(exports.SbFormSubmit.clickEventName,{detail:{id:this.rootId,event:this.event},bubbles:!0,composed:!0}))}}static get parts(){const t=this._ROOT,r=`${t}-${this._SPINNER}`;return{root:t,spinner:r}}static get clickEventName(){return`${this.TAG}:click`}createRenderRoot(){return this}get rootId(){return this.childId??`sb-${exports.SbFormSubmit.parts.root}-${this.seed}`}get spinnerId(){return`${this.rootId}-${exports.SbFormSubmit._SPINNER}`}get isLoading(){return this._loading||this.loading}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._handleClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleClick)}_renderSpinner(){return this.isLoading?d`
6433
6426
  <rtg-spinner
6434
6427
  id="${this.spinnerId}"
6435
6428
  part="${exports.SbFormSubmit.parts.spinner}"
@@ -6450,7 +6443,7 @@ body {
6450
6443
  ${this.label}
6451
6444
  ${this.spinnerAlign==="end"?this._renderSpinner():m}
6452
6445
  </rtg-button>
6453
- `}};exports.SbFormSubmit._ROOT="form-submit";exports.SbFormSubmit._SPINNER="spinner";exports.SbFormSubmit.TAG=`sb-${exports.SbFormSubmit._ROOT}`;ee([a({type:String})],exports.SbFormSubmit.prototype,"seed",2);ee([a({attribute:"child-id",type:String})],exports.SbFormSubmit.prototype,"childId",2);ee([a({type:String})],exports.SbFormSubmit.prototype,"variant",2);ee([a({type:String})],exports.SbFormSubmit.prototype,"size",2);ee([a({type:String})],exports.SbFormSubmit.prototype,"label",2);ee([a({attribute:"spinner-align",type:String})],exports.SbFormSubmit.prototype,"spinnerAlign",2);ee([a({type:Boolean})],exports.SbFormSubmit.prototype,"disabled",2);ee([a({type:Boolean})],exports.SbFormSubmit.prototype,"loading",2);ee([a({type:String})],exports.SbFormSubmit.prototype,"event",2);ee([x()],exports.SbFormSubmit.prototype,"_loading",2);exports.SbFormSubmit=ee([p("sb-form-submit")],exports.SbFormSubmit);const cc=[exports.SbEmailField,exports.SbPhoneField,exports.SbUsernameField,exports.SbIdentifierField,exports.SbPasswordField,exports.SbConfirmField],Pg=cc.map(e=>e.TAG).join(", "),ud=cc.map(e=>e.validateEventName);var Fg=Object.defineProperty,Tg=Object.getOwnPropertyDescriptor,ki=(e,t,r,i)=>{for(var s=i>1?void 0:i?Tg(t,r):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(s=(i?n(t,r,s):n(s))||s);return i&&s&&Fg(t,r,s),s};exports.SbForm=class extends v{constructor(){super(...arguments),this.seed=_t(),this._loading=!1,this._handleSubmitClick=t=>{var r;this._pendingEvent=(r=t.detail)==null?void 0:r.event},this._handleSubmit=async t=>{if(t.preventDefault(),this._loading)return;const r=this._fields,i={},s=g=>{const y=g.detail;(y==null?void 0:y.name)!==void 0&&y.value!==void 0&&(i[y.name]=y.value)};ud.forEach(g=>this.addEventListener(g,s));const o=r.map(g=>g.validate());if(ud.forEach(g=>this.removeEventListener(g,s)),!o.every(Boolean))return;const h=this._pendingEvent;if(this.onSubmit){this.onSubmit(i,h);return}if(!h)return;const u=r.map(g=>!!g.disabled);this._setLoading(!0,r,u);try{await ht.processLoginflowEvent({event:h,...Object.keys(i).length?{data:i}:{}}),this._dispatch(exports.SbForm.SUCCESS_EVENT,{id:this.rootId,data:i,event:h})}catch(g){const y=g instanceof Error?g.message:String(g);this._dispatch(exports.SbForm.ERROR_EVENT,{id:this.rootId,data:i,event:h,message:y})}finally{this._setLoading(!1,r,u),this._pendingEvent=void 0}},this._handleReset=t=>{this._pendingEvent=void 0,this.onReset&&this.onReset(t),this._dispatch(exports.SbForm.RESET_EVENT,{id:this.rootId})}}static get parts(){return{root:this._ROOT}}createRenderRoot(){return this}get rootId(){return this.childId??`sb-${exports.SbForm.parts.root}-${this.seed}`}get _form(){return this.querySelector(`form[part="${exports.SbForm.parts.root}"]`)}get _fields(){const t=this._form;return t?Array.from(t.querySelectorAll(Pg)):[]}get _submit(){const t=this._form;return t?t.querySelector(exports.SbFormSubmit.TAG):null}connectedCallback(){super.connectedCallback(),this.addEventListener(exports.SbFormSubmit.clickEventName,this._handleSubmitClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(exports.SbFormSubmit.clickEventName,this._handleSubmitClick)}firstUpdated(){const t=this._form;if(!t)return;Array.from(this.childNodes).filter(i=>i!==t).forEach(i=>t.appendChild(i))}_dispatch(t,r={}){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}_setLoading(t,r,i){r.forEach((o,n)=>{o.disabled=t?!0:i[n]});const s=this._submit;s&&(s.loading=t),this._loading=t}render(){return d`
6446
+ `}};exports.SbFormSubmit._ROOT="form-submit";exports.SbFormSubmit._SPINNER="spinner";exports.SbFormSubmit.TAG=`sb-${exports.SbFormSubmit._ROOT}`;ee([a({type:String})],exports.SbFormSubmit.prototype,"seed",2);ee([a({attribute:"child-id",type:String})],exports.SbFormSubmit.prototype,"childId",2);ee([a({type:String})],exports.SbFormSubmit.prototype,"variant",2);ee([a({type:String})],exports.SbFormSubmit.prototype,"size",2);ee([a({type:String})],exports.SbFormSubmit.prototype,"label",2);ee([a({attribute:"spinner-align",type:String})],exports.SbFormSubmit.prototype,"spinnerAlign",2);ee([a({type:Boolean})],exports.SbFormSubmit.prototype,"disabled",2);ee([a({type:Boolean})],exports.SbFormSubmit.prototype,"loading",2);ee([a({type:String})],exports.SbFormSubmit.prototype,"event",2);ee([x()],exports.SbFormSubmit.prototype,"_loading",2);exports.SbFormSubmit=ee([p("sb-form-submit")],exports.SbFormSubmit);const cc=[exports.SbEmailField,exports.SbPhoneField,exports.SbUsernameField,exports.SbIdentifierField,exports.SbNameField,exports.SbPasswordField,exports.SbConfirmField],Pg=cc.map(e=>e.TAG).join(", "),ud=cc.map(e=>e.validateEventName);var Fg=Object.defineProperty,Tg=Object.getOwnPropertyDescriptor,ki=(e,t,r,i)=>{for(var s=i>1?void 0:i?Tg(t,r):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(s=(i?n(t,r,s):n(s))||s);return i&&s&&Fg(t,r,s),s};exports.SbForm=class extends v{constructor(){super(...arguments),this.seed=_t(),this._loading=!1,this._handleSubmitClick=t=>{var r;this._pendingEvent=(r=t.detail)==null?void 0:r.event},this._handleSubmit=async t=>{if(t.preventDefault(),this._loading)return;const r=this._fields,i={},s=g=>{const y=g.detail;(y==null?void 0:y.name)!==void 0&&y.value!==void 0&&(i[y.name]=y.value)};ud.forEach(g=>this.addEventListener(g,s));const o=r.map(g=>g.validate());if(ud.forEach(g=>this.removeEventListener(g,s)),!o.every(Boolean))return;const h=this._pendingEvent;if(this.onSubmit){this.onSubmit(i,h);return}if(!h)return;const u=r.map(g=>!!g.disabled);this._setLoading(!0,r,u);try{await ht.processLoginflowEvent({event:h,...Object.keys(i).length?{data:i}:{}}),this._dispatch(exports.SbForm.SUCCESS_EVENT,{id:this.rootId,data:i,event:h})}catch(g){const y=g instanceof Error?g.message:String(g);this._dispatch(exports.SbForm.ERROR_EVENT,{id:this.rootId,data:i,event:h,message:y})}finally{this._setLoading(!1,r,u),this._pendingEvent=void 0}},this._handleReset=t=>{this._pendingEvent=void 0,this.onReset&&this.onReset(t),this._dispatch(exports.SbForm.RESET_EVENT,{id:this.rootId})}}static get parts(){return{root:this._ROOT}}createRenderRoot(){return this}get rootId(){return this.childId??`sb-${exports.SbForm.parts.root}-${this.seed}`}get _form(){return this.querySelector(`form[part="${exports.SbForm.parts.root}"]`)}get _fields(){const t=this._form;return t?Array.from(t.querySelectorAll(Pg)):[]}get _submit(){const t=this._form;return t?t.querySelector(exports.SbFormSubmit.TAG):null}connectedCallback(){super.connectedCallback(),this.addEventListener(exports.SbFormSubmit.clickEventName,this._handleSubmitClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(exports.SbFormSubmit.clickEventName,this._handleSubmitClick)}firstUpdated(){const t=this._form;if(!t)return;Array.from(this.childNodes).filter(i=>i!==t).forEach(i=>t.appendChild(i))}_dispatch(t,r={}){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}_setLoading(t,r,i){r.forEach((o,n)=>{o.disabled=t?!0:i[n]});const s=this._submit;s&&(s.loading=t),this._loading=t}render(){return d`
6454
6447
  <form
6455
6448
  id="${this.rootId}"
6456
6449
  part="${exports.SbForm.parts.root}"