@randstad-uca/design-system 1.0.72 → 1.0.74

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.
@@ -3,6 +3,7 @@ import "./CalendarOverlay.ts";
3
3
  export declare class DatePickerComponent extends BaseControl {
4
4
  width?: string;
5
5
  isRenderClearButton: boolean;
6
+ readonly: boolean;
6
7
  minDate?: string;
7
8
  maxDate?: string;
8
9
  eighteenOrOlder: boolean;
package/dist/index.js CHANGED
@@ -128,18 +128,18 @@ function P(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
128
128
  :host {
129
129
  display: flex;
130
130
  flex-direction: column;
131
- font-family: 'Graphik', sans-serif;
132
- position: relative;
131
+ font-family: 'Graphik', sans-serif;
133
132
  }
134
133
 
135
134
  .header {
135
+ position: relative;
136
136
  display: flex;
137
137
  justify-content: space-between;
138
138
  gap: 16px;
139
139
  flex-direction: row;
140
- align-items: center;
140
+ align-items: flex-start;
141
141
  cursor: pointer;
142
- padding-bottom: 16px;
142
+ min-height: 57px;
143
143
  }
144
144
 
145
145
  .title {
@@ -148,6 +148,9 @@ function P(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
148
148
  }
149
149
 
150
150
  .icon-wrapper {
151
+ position: absolute;
152
+ top: 0;
153
+ right: 0;
151
154
  width: 40px;
152
155
  height: 40px;
153
156
  border-radius: 50%;
@@ -188,13 +191,22 @@ function P(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
188
191
  }
189
192
 
190
193
  @media (min-width: 941px) {
191
- .header {
192
- align-items: flex-start;
194
+ .header:hover .icon-wrapper {
195
+ background-color: var( --primary-color-5 );
193
196
  }
194
-
197
+ }
198
+
199
+ @media (max-width: 500px) {
195
200
  .header:hover .icon-wrapper {
196
201
  background-color: var( --primary-color-5 );
197
202
  }
203
+ .header {
204
+ min-height: 42px;
205
+ max-height: 67px;
206
+ }
207
+ .title {
208
+ margin-bottom: 16px;
209
+ }
198
210
  }
199
211
  `}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.handleResize)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.handleResize)}toggle(){this.isOpen=!this.isOpen}render(){const t=e`
200
212
  <randstad-icon
@@ -1095,7 +1107,7 @@ function P(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
1095
1107
  height: 24px;
1096
1108
  color: var( --primary-color );
1097
1109
  }
1098
- `]}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}handleInputKeyDown(t){this.handleKeyDown(t),this.handleInputArrowKey(t)}get _isCleanButtonVisible(){return this.cleanButton&&!!this.value&&"password"!==this.type&&"textarea"!==this.type}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)}handleInputArrowKey(t){if("ArrowRight"!==t.key)return;const e=t.target;if(("password"===this.type||this._isCleanButtonVisible)&&e.selectionStart===e.value.length){t.preventDefault();const e=this.shadowRoot?.querySelector(".toggle-password, .clean-button");e?.focus()}}handleButtonArrowKey(t){if("ArrowLeft"!==t.key)return;t.preventDefault();const e=this.shadowRoot?.querySelector(".form-input");e&&(e.focus(),e.selectionStart=e.selectionEnd=e.value.length)}render(){const t="textarea"===this.type?` height: ${this.heightTextArea??"30px"}; max-height: ${this.maxHeightTextArea??"30px"}; overflow-y: auto; `:"",o=this.labelColor?`--label-color: ${this.labelColor};`:"",r=e`
1110
+ `]}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,o=i.replace(/[^a-zA-Z\sáéíóúüñÁÉÍÓÚÑÜ]/g,"").trimStart();i!==o&&(t.preventDefault(),e.value=o)}handleInputKeyDown(t){this.handleKeyDown(t),this.handleInputArrowKey(t)}get _isCleanButtonVisible(){return this.cleanButton&&!!this.value&&"password"!==this.type&&"textarea"!==this.type}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)}handleInputArrowKey(t){if("ArrowRight"!==t.key)return;const e=t.target;if(("password"===this.type||this._isCleanButtonVisible)&&e.selectionStart===e.value.length){t.preventDefault();const e=this.shadowRoot?.querySelector(".toggle-password, .clean-button");e?.focus()}}handleButtonArrowKey(t){if("ArrowLeft"!==t.key)return;t.preventDefault();const e=this.shadowRoot?.querySelector(".form-input");e&&(e.focus(),e.selectionStart=e.selectionEnd=e.value.length)}render(){const t="textarea"===this.type?` height: ${this.heightTextArea??"30px"}; max-height: ${this.maxHeightTextArea??"30px"}; overflow-y: auto; `:"",o=this.labelColor?`--label-color: ${this.labelColor};`:"",r=e`
1099
1111
  <randstad-icon
1100
1112
  name="${this.isPasswordVisible?"eye_crossed":"eye"}"
1101
1113
  size="24px"
@@ -3503,7 +3515,7 @@ function P(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
3503
3515
  <div class="calendar-container" style="width: ${this.calendarWidth}px;">
3504
3516
  ${i}
3505
3517
  </div>
3506
- `}};s([L({type:Object}),n("design:type",Object)],$e.prototype,"selectedDate",void 0),s([L({type:Object}),n("design:type",Date)],$e.prototype,"viewDate",void 0),s([L({type:Boolean}),n("design:type",Object)],$e.prototype,"isMobile",void 0),s([L({type:Number}),n("design:type",Number)],$e.prototype,"calendarWidth",void 0),s([L({type:Object}),n("design:type",Object)],$e.prototype,"minDate",void 0),s([L({type:Object}),n("design:type",Object)],$e.prototype,"maxDate",void 0),s([T(),n("design:type",String)],$e.prototype,"currentView",void 0),s([P(".day.selected, .day.today:not(.selected)"),n("design:type",HTMLButtonElement)],$e.prototype,"initialFocusElement",void 0),$e=s([a("calendar-overlay")],$e);let Se=class extends j{constructor(){super(...arguments),this.isRenderClearButton=!0,this.eighteenOrOlder=!1,this._maxLength=10,this.isOpen=!1,this.selectedDate=null,this.viewDate=new Date,this.isMobile=!1,this.calendarWidth=0,this.inputValue=null,this.updateResponsiveModeBound=this.updateResponsiveMode.bind(this),this.handleClickOutside=t=>{t.composedPath().includes(this)||(this.isOpen=!1)}}get maxLength(){return this._maxLength}set maxLength(t){const e=this._maxLength;this._maxLength=t<10?10:t,this.requestUpdate("maxLength",e)}static{this.styles=o`
3518
+ `}};s([L({type:Object}),n("design:type",Object)],$e.prototype,"selectedDate",void 0),s([L({type:Object}),n("design:type",Date)],$e.prototype,"viewDate",void 0),s([L({type:Boolean}),n("design:type",Object)],$e.prototype,"isMobile",void 0),s([L({type:Number}),n("design:type",Number)],$e.prototype,"calendarWidth",void 0),s([L({type:Object}),n("design:type",Object)],$e.prototype,"minDate",void 0),s([L({type:Object}),n("design:type",Object)],$e.prototype,"maxDate",void 0),s([T(),n("design:type",String)],$e.prototype,"currentView",void 0),s([P(".day.selected, .day.today:not(.selected)"),n("design:type",HTMLButtonElement)],$e.prototype,"initialFocusElement",void 0),$e=s([a("calendar-overlay")],$e);let Se=class extends j{constructor(){super(...arguments),this.isRenderClearButton=!0,this.readonly=!1,this.eighteenOrOlder=!1,this._maxLength=10,this.isOpen=!1,this.selectedDate=null,this.viewDate=new Date,this.isMobile=!1,this.calendarWidth=0,this.inputValue=null,this.updateResponsiveModeBound=this.updateResponsiveMode.bind(this),this.handleClickOutside=t=>{t.composedPath().includes(this)||(this.isOpen=!1)}}get maxLength(){return this._maxLength}set maxLength(t){const e=this._maxLength;this._maxLength=t<10?10:t,this.requestUpdate("maxLength",e)}static{this.styles=o`
3507
3519
  ${X}
3508
3520
  ${Q}
3509
3521
  ${G}
@@ -3543,6 +3555,16 @@ function P(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
3543
3555
  cursor: default;
3544
3556
  }
3545
3557
 
3558
+ /* Estilos para el estado readonly */
3559
+ .input-wrapper.readonly .date-input {
3560
+ cursor: pointer;
3561
+ }
3562
+
3563
+ .input-wrapper.readonly .calendar-button {
3564
+ cursor: pointer;
3565
+ color: #2175d9;
3566
+ }
3567
+
3546
3568
  /* Estilos del campo de entrada y sus estados */
3547
3569
  .input-wrapper {
3548
3570
  display: flex;
@@ -3610,7 +3632,7 @@ function P(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
3610
3632
  .calendar-button randstad-icon {
3611
3633
  font-size: 18px;
3612
3634
  }
3613
- `}setMessageErrorFormatInvalid(){return"formato de fecha inválido, se esperaba 'dd-MM-yyyy'"}handleFocusInput(){this.shadowRoot?.querySelector(".date-input")?.focus()}connectedCallback(){super.connectedCallback(),this.updateResponsiveMode(),window.addEventListener("resize",this.updateResponsiveModeBound),document.addEventListener("click",this.handleClickOutside),this.addEventListener("focus-input",this.handleFocusInput)}disconnectedCallback(){window.removeEventListener("resize",this.updateResponsiveModeBound),document.removeEventListener("click",this.handleClickOutside),this.removeEventListener("focus-input",this.handleFocusInput),super.disconnectedCallback()}firstUpdated(){this.setInitialWidth()}updated(t){t.has("width")&&this.style.setProperty("width",this.width||"100%"),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){this.onlyNumericAndDash(t);const e=t.target,i=e.value.substring(0,this.maxLength);e.value!==i&&(e.value=i),this.inputValue=e.value,this._parseAndValidateDate(e.value,!0)}handleCalendarButtonClick(t){if(!this.disabled)if(t.stopPropagation(),this.isOpen){this.isOpen=!1;const t=this.shadowRoot?.querySelector(".date-input");t?.focus()}else this.isOpen=!0,this.selectedDate?this.viewDate=this.selectedDate:this.viewDate=new Date,this.requestUpdate(),this.updateComplete.then((()=>{const t=this.shadowRoot?.querySelector(".date-input");t?.focus()}))}handleClearDate(){this.inputValue=null,this.selectedDate=null,this.error=!1,this.errorMessage=null,this.closeOverlay(null)}handleDateSelect(t){const e=t.detail.date;if(!e)return;if(this._validateDate(e)){this.selectedDate=e,this.viewDate=e;const t=ge(e,"dd-MM-yyyy");this.inputValue=t,this.closeOverlay(t)}else{const t=ge(e,"dd-MM-yyyy");this.inputValue=t,this.selectedDate=null,this.closeOverlay(null)}}handleViewDateChange(t){this.viewDate=t.detail.date}closeOverlay(t){this.value=t,this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:t}})),this.isOpen=!1;const e=this.shadowRoot?.querySelector(".date-input");e?.focus()}_syncValue(t){if(""===t||null===t)return void(this.error||(this.selectedDate=null,this.inputValue=null,this.errorMessage=null));const e=this._parseDate(t);e&&this._validateDate(e)?(this.selectedDate=e,this.viewDate=e,this.error=!1,this.errorMessage=null,this.value=ge(e,"dd-MM-yyyy"),this.inputValue=this.value):this.selectedDate=e}_validateDate(t){if(!t)return!1;if(this.error=!1,this.errorMessage=null,this.eighteenOrOlder){const e=function(t,e,i){return Ot(t,-18,i)}(new Date);if(ve(t,e))return this.error=!0,this.errorMessage="tenés que ser mayor de 18 años",!1}if(!this._isWithinBounds(t)){const t=this._getValidDateRange();return this.error=!0,this.errorMessage=`la fecha debe estar entre ${t?.minDate?ge(t.minDate,"dd-MM-yyyy"):""} y ${t?.maxDate?ge(t.maxDate,"dd-MM-yyyy"):""}.`,!1}return!0}_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){this._validateDate(i)?(this.selectedDate=i,this.viewDate=i,this.error=!1,this.errorMessage=null,e&&this.closeOverlay(ge(i,"dd-MM-yyyy"))):(this.error=!0,this.selectedDate=null,e&&this.closeOverlay(null))}else this.error=!0,this.errorMessage=this.setMessageErrorFormatInvalid(),this.selectedDate=null,e&&this.closeOverlay(null)}_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(Bt(e)&&ge(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(Bt(i)&&ge(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&&ve(t,e)?null:{minDate:t,maxDate:e}:{minDate:null,maxDate:null}}_isWithinBounds(t){const e=this._getValidDateRange();return!e||(!e.minDate||!fe(t,e.minDate))&&(!e.maxDate||!ve(t,e.maxDate))}handleKeyDown(t){if(this.disabled)return;const{key:e}=t,i=this.shadowRoot?.querySelector(".date-input");if("Enter"===e||" "===e)t.preventDefault(),this.isOpen?this.closeOverlay(this.value):(this.isOpen=!0,this.selectedDate?this.viewDate=this.selectedDate:this.viewDate=new Date,this.requestUpdate());else if("Escape"===e){if(!this.isOpen)return;t.preventDefault(),this.closeOverlay(this.value)}else"ArrowDown"===e&&(t.preventDefault(),this.isOpen||(this.isOpen=!0,this.selectedDate?this.viewDate=this.selectedDate:this.viewDate=new Date,this.requestUpdate()),this.updateComplete.then((()=>{const t=this.shadowRoot?.querySelector("calendar-overlay");t&&"function"==typeof t.focusCalendar&&t.focusCalendar()})));const o=this.shadowRoot?.querySelector(".clear-button"),r=this.shadowRoot?.querySelector(".calendar-button");"ArrowRight"===e&&(t.preventDefault(),this.shadowRoot?.activeElement===i&&(o?o.focus():r?.focus()))}handleClearButtonKeydown(t){if(this.disabled)return;const{key:e}=t,i=this.shadowRoot?.querySelector(".date-input"),o=this.shadowRoot?.querySelector(".calendar-button");"ArrowLeft"===e?(t.preventDefault(),i?.focus()):"ArrowRight"===e&&(t.preventDefault(),o?.focus())}handleCalendarButtonKeydown(t){if(this.disabled)return;const{key:e}=t,i=this.shadowRoot?.querySelector(".date-input"),o=this.shadowRoot?.querySelector(".clear-button");"ArrowLeft"===e?(t.preventDefault(),o?o.focus():i?.focus()):("Enter"!==e&&" "!==e||t.preventDefault(),this.handleCalendarButtonClick(t))}onlyNumericAndDash(t){const e=t.target,i=e.value.replace(/[^0-9-]/g,"");e.value=i}render(){const t=r({"input-wrapper":!0,active:this.isOpen,error:this.error,disabled:this.disabled}),o=this._getValidDateRange();return e`
3635
+ `}setMessageErrorFormatInvalid(){return"formato de fecha inválido, se esperaba 'dd-MM-yyyy'"}handleFocusInput(){this.shadowRoot?.querySelector(".date-input")?.focus()}connectedCallback(){super.connectedCallback(),this.updateResponsiveMode(),window.addEventListener("resize",this.updateResponsiveModeBound),document.addEventListener("click",this.handleClickOutside),this.addEventListener("focus-input",this.handleFocusInput)}disconnectedCallback(){window.removeEventListener("resize",this.updateResponsiveModeBound),document.removeEventListener("click",this.handleClickOutside),this.removeEventListener("focus-input",this.handleFocusInput),super.disconnectedCallback()}firstUpdated(){this.setInitialWidth()}updated(t){t.has("width")&&this.style.setProperty("width",this.width||"100%"),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){this.onlyNumericAndDash(t);const e=t.target,i=e.value.substring(0,this.maxLength);e.value!==i&&(e.value=i),this.inputValue=e.value,this._parseAndValidateDate(e.value,!0)}handleCalendarButtonClick(t){if(!this.disabled)if(t.stopPropagation(),this.isOpen){this.isOpen=!1;const t=this.shadowRoot?.querySelector(".date-input");t?.focus()}else this.isOpen=!0,this.selectedDate?this.viewDate=this.selectedDate:this.viewDate=new Date,this.requestUpdate(),this.updateComplete.then((()=>{const t=this.shadowRoot?.querySelector(".date-input");t?.focus()}))}handleClearDate(){this.inputValue=null,this.selectedDate=null,this.error=!1,this.errorMessage=null,this.closeOverlay(null)}handleDateSelect(t){const e=t.detail.date;if(!e)return;if(this._validateDate(e)){this.selectedDate=e,this.viewDate=e;const t=ge(e,"dd-MM-yyyy");this.inputValue=t,this.closeOverlay(t)}else{const t=ge(e,"dd-MM-yyyy");this.inputValue=t,this.selectedDate=null,this.closeOverlay(null)}}handleViewDateChange(t){this.viewDate=t.detail.date}closeOverlay(t){this.value=t,this.dispatchEvent(new CustomEvent("date-selected",{detail:{value:t}})),this.isOpen=!1;const e=this.shadowRoot?.querySelector(".date-input");e?.focus()}_syncValue(t){if(""===t||null===t)return void(this.error||(this.selectedDate=null,this.inputValue=null,this.errorMessage=null));const e=this._parseDate(t);e&&this._validateDate(e)?(this.selectedDate=e,this.viewDate=e,this.error=!1,this.errorMessage=null,this.value=ge(e,"dd-MM-yyyy"),this.inputValue=this.value):this.selectedDate=e}_validateDate(t){if(!t)return!1;if(this.error=!1,this.errorMessage=null,this.eighteenOrOlder){const e=function(t,e,i){return Ot(t,-18,i)}(new Date);if(ve(t,e))return this.error=!0,this.errorMessage="tenés que ser mayor de 18 años",!1}if(!this._isWithinBounds(t)){const t=this._getValidDateRange();return this.error=!0,this.errorMessage=`la fecha debe estar entre ${t?.minDate?ge(t.minDate,"dd-MM-yyyy"):""} y ${t?.maxDate?ge(t.maxDate,"dd-MM-yyyy"):""}.`,!1}return!0}_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){this._validateDate(i)?(this.selectedDate=i,this.viewDate=i,this.error=!1,this.errorMessage=null,e&&this.closeOverlay(ge(i,"dd-MM-yyyy"))):(this.error=!0,this.selectedDate=null,e&&this.closeOverlay(null))}else this.error=!0,this.errorMessage=this.setMessageErrorFormatInvalid(),this.selectedDate=null,e&&this.closeOverlay(null)}_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(Bt(e)&&ge(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(Bt(i)&&ge(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&&ve(t,e)?null:{minDate:t,maxDate:e}:{minDate:null,maxDate:null}}_isWithinBounds(t){const e=this._getValidDateRange();return!e||(!e.minDate||!fe(t,e.minDate))&&(!e.maxDate||!ve(t,e.maxDate))}handleKeyDown(t){if(this.disabled)return;const{key:e}=t,i=this.shadowRoot?.querySelector(".date-input");if("Enter"===e||" "===e)t.preventDefault(),this.isOpen?this.closeOverlay(this.value):(this.isOpen=!0,this.selectedDate?this.viewDate=this.selectedDate:this.viewDate=new Date,this.requestUpdate());else if("Escape"===e){if(!this.isOpen)return;t.preventDefault(),this.closeOverlay(this.value)}else"ArrowDown"===e&&(t.preventDefault(),this.isOpen||(this.isOpen=!0,this.selectedDate?this.viewDate=this.selectedDate:this.viewDate=new Date,this.requestUpdate()),this.updateComplete.then((()=>{const t=this.shadowRoot?.querySelector("calendar-overlay");t&&"function"==typeof t.focusCalendar&&t.focusCalendar()})));const o=this.shadowRoot?.querySelector(".clear-button"),r=this.shadowRoot?.querySelector(".calendar-button");"ArrowRight"===e&&(t.preventDefault(),this.shadowRoot?.activeElement===i&&(o?o.focus():r?.focus()))}handleClearButtonKeydown(t){if(this.disabled)return;const{key:e}=t,i=this.shadowRoot?.querySelector(".date-input"),o=this.shadowRoot?.querySelector(".calendar-button");"ArrowLeft"===e?(t.preventDefault(),i?.focus()):"ArrowRight"===e&&(t.preventDefault(),o?.focus())}handleCalendarButtonKeydown(t){if(this.disabled)return;const{key:e}=t,i=this.shadowRoot?.querySelector(".date-input"),o=this.shadowRoot?.querySelector(".clear-button");"ArrowLeft"===e?(t.preventDefault(),o?o.focus():i?.focus()):("Enter"!==e&&" "!==e||t.preventDefault(),this.handleCalendarButtonClick(t))}onlyNumericAndDash(t){const e=t.target,i=e.value.replace(/[^0-9-]/g,"");e.value=i}render(){const t=r({"input-wrapper":!0,active:this.isOpen,error:this.error,disabled:this.disabled,readonly:this.readonly}),o=this._getValidDateRange();return e`
3614
3636
  <div class="datepicker-container" style="${this.labelColor?` --label-color: ${this.labelColor}`:""}">
3615
3637
  ${this.renderLabelContainer()}
3616
3638
 
@@ -3622,9 +3644,11 @@ function P(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
3622
3644
  .value="${this.inputValue??""}"
3623
3645
  placeholder="${this.placeholder}"
3624
3646
  ?disabled=${this.disabled}
3647
+ ?readonly=${this.readonly}
3625
3648
  maxlength="${this.maxLength}"
3626
- @input=${this.handleInput}
3627
- @keydown=${this.handleKeyDown}
3649
+ @input=${this.readonly?null:this.handleInput}
3650
+ @keydown=${this.readonly?null:this.handleKeyDown}
3651
+ @click=${this.readonly?this.handleCalendarButtonClick:null}
3628
3652
  />
3629
3653
 
3630
3654
  ${this.isRenderClearButton&&this.selectedDate&&!this.disabled?e`
@@ -3666,7 +3690,7 @@ function P(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
3666
3690
 
3667
3691
  ${this.renderHelper()}
3668
3692
  </div>
3669
- `}};s([L({type:String}),n("design:type",String)],Se.prototype,"width",void 0),s([L({type:Boolean}),n("design:type",Object)],Se.prototype,"isRenderClearButton",void 0),s([L({type:String}),n("design:type",String)],Se.prototype,"minDate",void 0),s([L({type:String}),n("design:type",String)],Se.prototype,"maxDate",void 0),s([L({type:Boolean}),n("design:type",Object)],Se.prototype,"eighteenOrOlder",void 0),s([L({type:Number}),n("design:type",Number),n("design:paramtypes",[Number])],Se.prototype,"maxLength",null),s([T(),n("design:type",Object)],Se.prototype,"isOpen",void 0),s([T(),n("design:type",Object)],Se.prototype,"selectedDate",void 0),s([T(),n("design:type",Date)],Se.prototype,"viewDate",void 0),s([T(),n("design:type",Object)],Se.prototype,"isMobile",void 0),s([T(),n("design:type",Number)],Se.prototype,"calendarWidth",void 0),s([T(),n("design:type",Object)],Se.prototype,"inputValue",void 0),s([P(".input-container"),n("design:type",HTMLDivElement)],Se.prototype,"inputContainer",void 0),Se=s([a("datepicker-component")],Se);let De=class extends pt{constructor(){super(...arguments),this.maxFiles=1,this.acceptedFileTypes=[],this.maxFileSize=0,this.buttonText="Agregar archivo",this.showDeleteConfirmation=!1,this.isRemovePopupOpen=!1,this.fileIndexToRemove=-1,this.fileNameToRemove=""}static{this.styles=o`
3693
+ `}};s([L({type:String}),n("design:type",String)],Se.prototype,"width",void 0),s([L({type:Boolean}),n("design:type",Object)],Se.prototype,"isRenderClearButton",void 0),s([L({type:Boolean}),n("design:type",Object)],Se.prototype,"readonly",void 0),s([L({type:String}),n("design:type",String)],Se.prototype,"minDate",void 0),s([L({type:String}),n("design:type",String)],Se.prototype,"maxDate",void 0),s([L({type:Boolean}),n("design:type",Object)],Se.prototype,"eighteenOrOlder",void 0),s([L({type:Number}),n("design:type",Number),n("design:paramtypes",[Number])],Se.prototype,"maxLength",null),s([T(),n("design:type",Object)],Se.prototype,"isOpen",void 0),s([T(),n("design:type",Object)],Se.prototype,"selectedDate",void 0),s([T(),n("design:type",Date)],Se.prototype,"viewDate",void 0),s([T(),n("design:type",Object)],Se.prototype,"isMobile",void 0),s([T(),n("design:type",Number)],Se.prototype,"calendarWidth",void 0),s([T(),n("design:type",Object)],Se.prototype,"inputValue",void 0),s([P(".input-container"),n("design:type",HTMLDivElement)],Se.prototype,"inputContainer",void 0),Se=s([a("datepicker-component")],Se);let De=class extends pt{constructor(){super(...arguments),this.maxFiles=1,this.acceptedFileTypes=[],this.maxFileSize=0,this.buttonText="Agregar archivo",this.showDeleteConfirmation=!1,this.isRemovePopupOpen=!1,this.fileIndexToRemove=-1,this.fileNameToRemove=""}static{this.styles=o`
3670
3694
  ${X}
3671
3695
  ${Q}
3672
3696
  ${G}