@randstad-uca/design-system 1.0.97 → 1.0.98

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
@@ -1461,7 +1461,7 @@ function _(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
1461
1461
  .linkedin-input-container.error .input-wrapper:focus-within {
1462
1462
  border-width: 1px;
1463
1463
  }
1464
- `]}get _fixedPrefix(){switch(this.platform){case"facebook":return"facebook.com/";case"google":return"@gmail.com";default:return"linkedin.com/in/"}}get _isSuffix(){return"google"===this.platform}get _isPrefix(){return"linkedin"===this.platform||"facebook"===this.platform}get _placeholder(){return this.placeholder||"tu-usuario"}get _sanitizeRegex(){if(this.customSanitizeRegex)try{return new RegExp(this.customSanitizeRegex,"g")}catch{return/[^a-zA-Z0-9-]/g}return/[^a-zA-Z0-9-]/g}get _urlValidationRegex(){if(this.customUrlValidationRegex)try{return new RegExp(this.customUrlValidationRegex,"i")}catch{return null}switch(this.platform){case"linkedin":return/^(https?:\/\/)?(www\.)?linkedin\.com\/in\/([a-zA-Z0-9-]+)\/?.*$/i;case"facebook":return/^(https?:\/\/)?(www\.)?facebook\.com\/([a-zA-Z0-9-]+)\/?.*$/i;case"google":return/^([a-zA-Z0-9-._]+)@gmail\.com$/i;default:return null}}_handleInput(t){const e=t.target;let i=e.value,o=i.replace(this._sanitizeRegex,"");const r=this.maxLength-this._fixedPrefix.length;o.length>r&&(o=o.slice(0,r)),i!==o&&(e.value=o),this._inputValue=o,this._showFormatError=!1;const s=o.length>=3?this._getFullValue(o):"";this.value=s,this._onChangeFn(s),this.dispatchEvent(new CustomEvent("valueChanged",{detail:s})),this.requestUpdate()}_handlePaste(t){if(t.preventDefault(),this.disabled)return;const e=(t.clipboardData||window.clipboardData).getData("text/plain").trim();if(!e)return;const i=this._urlValidationRegex,o=/^(https?:\/\/|www\.)/i.test(e),r=i?e.match(i):null;let s="",n=!1;if(r){s=("google"===this.platform?r[1]:r[3]).replace(this._sanitizeRegex,""),n=!1}else o?(s=e,n=!0):(s=e.replace(this._sanitizeRegex,""),n=this._sanitizeRegex.test(e));this._inputValue=s,this._showFormatError=n;const a=this.shadowRoot?.querySelector(".user-input");a&&(a.value=s);const l=!n&&s.length>=3?this._getFullValue(s):"";this.value=l,this._onChangeFn(l),this.dispatchEvent(new CustomEvent("valueChanged",{detail:l})),this.requestUpdate()}_updateInternalValue(t,e){let i=t;if(!e){i=t.replace(this._sanitizeRegex,"");const e=this.maxLength-this._fixedPrefix.length;i.length>e&&(i=i.slice(0,e))}this._inputValue=i,this._showFormatError=e;const o=e?"":this._getFullValue(i);this.value=o;const r=this.shadowRoot?.querySelector(".user-input");r&&(r.value=i),this.dispatchEvent(new CustomEvent("valueChanged",{detail:o})),this._onChangeFn(o),this.requestUpdate()}get _hasMinLengthError(){return this._inputValue.length>0&&this._inputValue.length<3}get _errorMessageToDisplay(){if(this._hasMinLengthError)return"debés ingresar como mínimo 3 caracteres";if(this._showFormatError)switch(this.platform){case"facebook":return"la URL de facebook no es válida";case"google":return"la URL de tu cuenta de Google no es válida";default:return"la URL de linkedIn no es válida"}return this.errorMessage}get _hasError(){return this.error||this._hasMinLengthError||this._showFormatError}_getFullValue(t){if(!t)return"";switch(this.platform){case"facebook":return`https://www.facebook.com/${t}`;case"google":return`${t}@gmail.com`;default:return`https://www.linkedin.com/in/${t}`}}_extractUsernameFromValue(t){if(!t)return"";const e=this._urlValidationRegex;if(e){const i=t.match(e);if(i&&i[3])return i[3]}return t}updated(t){if(super.updated?.(t),t.has("value")&&this.value){const t=this._extractUsernameFromValue(this.value);if(t!==this._inputValue){this._inputValue=t;const e=this._getFullValue(t);setTimeout((()=>{this.dispatchEvent(new CustomEvent("valueChanged",{detail:e}))}),0),this.requestUpdate()}}}render(){const t=this.labelColor?`--label-color: ${this.labelColor};`:"";return e`
1464
+ `]}get _fixedPrefix(){switch(this.platform){case"facebook":return"facebook.com/";case"google":return"@gmail.com";default:return"linkedin.com/in/"}}get _isSuffix(){return"google"===this.platform}get _isPrefix(){return"linkedin"===this.platform||"facebook"===this.platform}get _placeholder(){return this.placeholder||"tu-usuario"}get _sanitizeRegex(){if(this.customSanitizeRegex)try{return new RegExp(this.customSanitizeRegex,"g")}catch{return/[^a-zA-Z0-9-]/g}return/[^a-zA-Z0-9-]/g}get _urlValidationRegex(){if(this.customUrlValidationRegex)try{return new RegExp(this.customUrlValidationRegex,"i")}catch{return null}switch(this.platform){case"linkedin":return/^(https?:\/\/)?(www\.)?linkedin\.com\/in\/([a-zA-Z0-9-]+)\/?.*$/i;case"facebook":return/^(https?:\/\/)?(www\.)?facebook\.com\/([a-zA-Z0-9-]+)\/?.*$/i;case"google":return/^([a-zA-Z0-9-._]+)@gmail\.com$/i;default:return null}}_handleInput(t){const e=t.target;let i=e.value,o=i.replace(this._sanitizeRegex,"");const r=this.maxLength-this._fixedPrefix.length;o.length>r&&(o=o.slice(0,r)),i!==o&&(e.value=o),this._inputValue=o,this._showFormatError=!1;const s=o.length>=3?this._getFullValue(o):o;this.value=s,this._onChangeFn(s),this.dispatchEvent(new CustomEvent("valueChanged",{detail:s})),this.requestUpdate()}_handlePaste(t){if(t.preventDefault(),this.disabled)return;const e=(t.clipboardData||window.clipboardData).getData("text/plain").trim();if(!e)return;const i=this._urlValidationRegex,o=/^(https?:\/\/|www\.)/i.test(e),r=i?e.match(i):null;let s="",n=!1;if(r){s=("google"===this.platform?r[1]:r[3]).replace(this._sanitizeRegex,""),n=!1}else o?(s=e,n=!0):(s=e.replace(this._sanitizeRegex,""),n=this._sanitizeRegex.test(e));this._inputValue=s,this._showFormatError=n;const a=this.shadowRoot?.querySelector(".user-input");a&&(a.value=s);const l=!n&&s.length>=3?this._getFullValue(s):s;this.value=l,this._onChangeFn(l),this.dispatchEvent(new CustomEvent("valueChanged",{detail:l})),this.requestUpdate()}_updateInternalValue(t,e){let i=t;if(!e){i=t.replace(this._sanitizeRegex,"");const e=this.maxLength-this._fixedPrefix.length;i.length>e&&(i=i.slice(0,e))}this._inputValue=i,this._showFormatError=e;const o=e?t:i.length>=3?this._getFullValue(i):i;this.value=o;const r=this.shadowRoot?.querySelector(".user-input");r&&(r.value=i),this.dispatchEvent(new CustomEvent("valueChanged",{detail:o})),this._onChangeFn(o),this.requestUpdate()}get _hasMinLengthError(){return this._inputValue.length>0&&this._inputValue.length<3}get _errorMessageToDisplay(){if(this._hasMinLengthError)return"debés ingresar como mínimo 3 caracteres";if(this._showFormatError)switch(this.platform){case"facebook":return"la URL de facebook no es válida";case"google":return"la URL de tu cuenta de Google no es válida";default:return"la URL de linkedIn no es válida"}return this.errorMessage}get _hasError(){return this.error||this._hasMinLengthError||this._showFormatError}_getFullValue(t){if(!t)return"";switch(this.platform){case"facebook":return`https://www.facebook.com/${t}`;case"google":return`${t}@gmail.com`;default:return`https://www.linkedin.com/in/${t}`}}_extractUsernameFromValue(t){if(!t)return"";const e=this._urlValidationRegex;if(e){const i=t.match(e);if(i)return"google"===this.platform?i[1]:i[3]}return t}updated(t){if(super.updated?.(t),t.has("value")&&this.value){const t=this._extractUsernameFromValue(this.value);if(t!==this._inputValue){this._inputValue=t;const e=this._getFullValue(t);setTimeout((()=>{this.dispatchEvent(new CustomEvent("valueChanged",{detail:e}))}),0),this.requestUpdate()}}}render(){const t=this.labelColor?`--label-color: ${this.labelColor};`:"";return e`
1465
1465
  <div
1466
1466
  class="linkedin-input-container ${this._hasError?"error":""} ${this.disabled?"disabled":""}"
1467
1467
  style="${t}"