@randstad-uca/design-system 1.0.56 → 1.0.58
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 +13 -6
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -925,11 +925,18 @@ function z(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
|
|
|
925
925
|
border: 2px solid var(--primary-color)
|
|
926
926
|
}
|
|
927
927
|
|
|
928
|
-
.form.disabled .form-input,
|
|
929
|
-
|
|
928
|
+
.form.disabled .form-input,
|
|
929
|
+
.form.disabled .toggle-password randstad-icon,
|
|
930
|
+
.form.disabled .clean-button randstad-icon {
|
|
931
|
+
background-color: var( --secondary-color-10 );
|
|
930
932
|
color: #9FA3B3;
|
|
931
933
|
cursor: default;
|
|
932
934
|
}
|
|
935
|
+
|
|
936
|
+
.form.disabled .toggle-password,
|
|
937
|
+
.form.disabled .clean-button {
|
|
938
|
+
cursor: default;
|
|
939
|
+
}
|
|
933
940
|
|
|
934
941
|
.input-with-button {
|
|
935
942
|
display: flex;
|
|
@@ -1019,6 +1026,7 @@ function z(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
|
|
|
1019
1026
|
.clean-button randstad-icon {
|
|
1020
1027
|
width: 24px;
|
|
1021
1028
|
height: 24px;
|
|
1029
|
+
color: var( --primary-color );
|
|
1022
1030
|
}
|
|
1023
1031
|
`}togglePassword(t){this.isPasswordVisible=!this.isPasswordVisible;const e=t.currentTarget.parentElement?.querySelector("input");e&&(e.type=this.isPasswordVisible?"text":"password"),this.requestUpdate()}handleInput(t){this.handleInputCustom(t);const e=t.target.value;void 0!==this.maxLength&&"textarea"!==this.type?this.value=e.slice(0,this.maxLength):this.value=e,this.dispatchEvent(new CustomEvent("valueChanged",{detail:this.value})),this.dispatchEvent(new Event("input",{bubbles:!0})),this.requestUpdate()}handleClear(){this.value="",this.dispatchEvent(new CustomEvent("valueChanged",{detail:this.value})),this.dispatchEvent(new Event("input",{bubbles:!0})),this.requestUpdate()}handleLinkClick(t){t.preventDefault(),this.linkRoute&&this.dispatchEvent(new CustomEvent("linkClicked",{detail:this.linkRoute,bubbles:!0,composed:!0}))}handleInputCustom(t){"number"===this.keydown?this.onlyNumeric(t):"text"===this.keydown&&this.onlyText(t)}onlyNumeric(t){const e=t.target,i=e.value.replace(/[^0-9]/g,"");e.value=i}onlyText(t){const e=t.target,i=e.value.replace(/[^a-zA-Z\sáéíóúñÁÉÍÓÚÑ]/g,"");e.value=i}handleKeyDown(t){if("Enter"!==t.key)return;const e=new Event("submit",{bubbles:!0,composed:!0,cancelable:!0}),i=this.closest("form");i&&i.dispatchEvent(e)}render(){const t=this.cleanButton&&this.value&&"password"!==this.type&&"textarea"!==this.type,o="textarea"===this.type?`height: ${this.heightTextArea??"30px"}; max-height: ${this.maxHeightTextArea??"30px"}; overflow-y: auto;`:"",r=e`
|
|
1024
1032
|
${this.labelColor?`--label-color: ${this.labelColor};`:""}
|
|
@@ -1087,8 +1095,7 @@ function z(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
|
|
|
1087
1095
|
>
|
|
1088
1096
|
<randstad-icon
|
|
1089
1097
|
name="close"
|
|
1090
|
-
size="24px"
|
|
1091
|
-
style="--icon-color: var(--primary-color);"
|
|
1098
|
+
size="24px"
|
|
1092
1099
|
>
|
|
1093
1100
|
</randstad-icon>
|
|
1094
1101
|
</button>`:i}
|
|
@@ -3293,7 +3300,7 @@ const Yt=o`@layer{:host{display:inline-flex;height:var(--md-radio-icon-size, 20p
|
|
|
3293
3300
|
<div class="calendar-container" style="width: ${this.calendarWidth}px;">
|
|
3294
3301
|
${i}
|
|
3295
3302
|
</div>
|
|
3296
|
-
`}};a([A({type:Object}),s("design:type",Object)],si.prototype,"selectedDate",void 0),a([A({type:Object}),s("design:type",Date)],si.prototype,"viewDate",void 0),a([A({type:Boolean}),s("design:type",Object)],si.prototype,"isMobile",void 0),a([A({type:Number}),s("design:type",Number)],si.prototype,"calendarWidth",void 0),a([A({type:Object}),s("design:type",Object)],si.prototype,"minDate",void 0),a([A({type:Object}),s("design:type",Object)],si.prototype,"maxDate",void 0),a([T(),s("design:type",String)],si.prototype,"currentView",void 0),si=a([d("calendar-overlay")],si);let di=class extends L{constructor(){super(...arguments),this.isRenderClearButton=!0,this.isOpen=!1,this.selectedDate=null,this.viewDate=new Date,this.isMobile=!1,this.calendarWidth=0,this.updateResponsiveModeBound=this.updateResponsiveMode.bind(this),this.handleClickOutside=t=>{t.composedPath().includes(this)||(this.isOpen=!1
|
|
3303
|
+
`}};a([A({type:Object}),s("design:type",Object)],si.prototype,"selectedDate",void 0),a([A({type:Object}),s("design:type",Date)],si.prototype,"viewDate",void 0),a([A({type:Boolean}),s("design:type",Object)],si.prototype,"isMobile",void 0),a([A({type:Number}),s("design:type",Number)],si.prototype,"calendarWidth",void 0),a([A({type:Object}),s("design:type",Object)],si.prototype,"minDate",void 0),a([A({type:Object}),s("design:type",Object)],si.prototype,"maxDate",void 0),a([T(),s("design:type",String)],si.prototype,"currentView",void 0),si=a([d("calendar-overlay")],si);let di=class extends L{constructor(){super(...arguments),this.isRenderClearButton=!0,this.isOpen=!1,this.selectedDate=null,this.viewDate=new Date,this.isMobile=!1,this.calendarWidth=0,this.updateResponsiveModeBound=this.updateResponsiveMode.bind(this),this.handleClickOutside=t=>{t.composedPath().includes(this)||(this.isOpen=!1)}}static{this.styles=o`
|
|
3297
3304
|
${X}
|
|
3298
3305
|
${Q}
|
|
3299
3306
|
${K}
|
|
@@ -3394,7 +3401,7 @@ const Yt=o`@layer{:host{display:inline-flex;height:var(--md-radio-icon-size, 20p
|
|
|
3394
3401
|
.calendar-button randstad-icon {
|
|
3395
3402
|
font-size: 18px;
|
|
3396
3403
|
}
|
|
3397
|
-
`}connectedCallback(){super.connectedCallback(),this.updateResponsiveMode(),window.addEventListener("resize",this.updateResponsiveModeBound),document.addEventListener("click",this.handleClickOutside)}disconnectedCallback(){window.removeEventListener("resize",this.updateResponsiveModeBound),document.removeEventListener("click",this.handleClickOutside),super.disconnectedCallback()}firstUpdated(){this.setInitialWidth()}updated(t){t.has("value")&&this._syncValue(this.value),(t.has("isOpen")||t.has("value"))&&this.setInitialWidth(),super.updated(t)}setInitialWidth(){this.inputContainer&&(this.calendarWidth=this.inputContainer.getBoundingClientRect().width)}updateResponsiveMode(){this.isMobile=window.innerWidth<=940,this.setInitialWidth()}handleInput(t){const e=t.target;this._parseAndValidateDate(e.value,!0)}handleCalendarButtonClick(t){this.disabled||(t.stopPropagation(),this.isOpen=!this.isOpen,this.selectedDate?this.viewDate=this.selectedDate:this.viewDate=new Date,this.requestUpdate())}handleClearDate(){this.selectedDate=null,this.error=!1,this.errorMessage=null,this.closeOverlay(
|
|
3404
|
+
`}connectedCallback(){super.connectedCallback(),this.updateResponsiveMode(),window.addEventListener("resize",this.updateResponsiveModeBound),document.addEventListener("click",this.handleClickOutside)}disconnectedCallback(){window.removeEventListener("resize",this.updateResponsiveModeBound),document.removeEventListener("click",this.handleClickOutside),super.disconnectedCallback()}firstUpdated(){this.setInitialWidth()}updated(t){t.has("value")&&this._syncValue(this.value),(t.has("isOpen")||t.has("value"))&&this.setInitialWidth(),super.updated(t)}setInitialWidth(){this.inputContainer&&(this.calendarWidth=this.inputContainer.getBoundingClientRect().width)}updateResponsiveMode(){this.isMobile=window.innerWidth<=940,this.setInitialWidth()}handleInput(t){const e=t.target;this._parseAndValidateDate(e.value,!0)}handleCalendarButtonClick(t){this.disabled||(t.stopPropagation(),this.isOpen=!this.isOpen,this.selectedDate?this.viewDate=this.selectedDate:this.viewDate=new Date,this.requestUpdate())}handleClearDate(){this.selectedDate=null,this.error=!1,this.errorMessage=null,this.closeOverlay(null)}handleDateSelect(t){const e=t.detail.date;e&&(this.selectedDate=e,this.viewDate=e,this.closeOverlay(Je(e,"dd-MM-yyyy")))}handleViewDateChange(t){this.viewDate=t.detail.date}closeOverlay(t){this.value=t,this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:t}})),this.isOpen=!1}_syncValue(t){if(""===t||null===t)return void(this.error||(this.selectedDate=null,this.errorMessage=null));const e=this._parseDate(t);e&&this._isWithinBounds(e)?(this.selectedDate=e,this.viewDate=e,this.error=!1,this.errorMessage=null,this.value=Je(e,"dd-MM-yyyy")):(this.selectedDate=null,this.error=!0,this.errorMessage="Formato de fecha no válido o fuera de rango. Se esperaba 'dd-MM-yyyy'.")}_parseAndValidateDate(t,e){if(this.disabled)return;if(""===t||null===t)return this.selectedDate=null,this.error=!1,this.errorMessage=null,void(e&&this.closeOverlay(null));const i=this._parseDate(t);if(i)if(this._isWithinBounds(i))this.selectedDate=i,this.viewDate=i,this.error=!1,this.errorMessage=null,e&&this.closeOverlay(Je(i,"dd-MM-yyyy"));else{this.error=!0;const t=this._getValidDateRange();this.errorMessage=`La fecha debe estar entre ${t?.minDate?Je(t.minDate,"dd-MM-yyyy"):"el inicio de los tiempos"} y ${t?.maxDate?Je(t.maxDate,"dd-MM-yyyy"):"el fin de los tiempos"}.`,e&&this.closeOverlay(null),console.error("La fecha está fuera del rango permitido.")}else this.error=!0,this.errorMessage="Formato de fecha no válido. Se esperaba 'dd-MM-yyyy' o 'yyyy-MM-dd'.",e&&this.closeOverlay(null),console.error("Formato de fecha no válido.")}_parseDate(t){const e=t.split("-").map(Number);if(3===e.length){const[i,o,r]=e;if(i&&o&&r&&o>=1&&o<=12&&r>1e3){const e=new Date(r,o-1,i,12);if(me(e)&&Je(e,"dd-MM-yyyy")===t)return e}}const i=t.split("-").map(Number);if(3===i.length){const[e,o,r]=i;if(e&&o&&r&&o>=1&&o<=12&&e>1e3){const i=new Date(e,o-1,r,12);if(me(i)&&Je(i,"yyyy-MM-dd")===t)return i}}return null}_parseDateString(t){if(!t)return null;const e=t.split("-").map(Number);if(3===e.length&&!isNaN(e[0])&&!isNaN(e[1])&&!isNaN(e[2])){return new Date(e[0],e[1]-1,e[2],12)}return null}_getValidDateRange(){const t=this._parseDateString(this.minDate),e=this._parseDateString(this.maxDate);return t||e?t&&e&&ii(t,e)?null:{minDate:t,maxDate:e}:{minDate:null,maxDate:null}}_isWithinBounds(t){const e=this._getValidDateRange();return!e||(!e.minDate||!oi(t,e.minDate))&&(!e.maxDate||!ii(t,e.maxDate))}render(){const t=n({"input-wrapper":!0,active:this.isOpen,error:this.error,disabled:this.disabled}),o=`width: ${this.width||"100%"};`,r=this._getValidDateRange();return e`
|
|
3398
3405
|
<div class="datepicker-container" style="${this.labelColor?` --label-color: ${this.labelColor}`:""} ${o}">
|
|
3399
3406
|
${this.renderLabelContainer()}
|
|
3400
3407
|
|