@randstad-uca/design-system 1.0.15 → 1.0.17

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.
@@ -17,9 +17,12 @@ export declare class RandstadForm extends LitElement {
17
17
  linkText?: string;
18
18
  linkRoute?: string;
19
19
  isPasswordVisible: boolean;
20
+ cleanButton: boolean;
21
+ maxLength?: number;
20
22
  static styles: import("lit").CSSResult;
21
23
  private togglePassword;
22
24
  private handleInput;
25
+ private handleClear;
23
26
  private handleLinkClick;
24
27
  render(): import("lit-html").TemplateResult<1>;
25
28
  }
@@ -11,6 +11,7 @@ export declare class FilterableSelect extends LitElement {
11
11
  filteredOptions: never[];
12
12
  filterValue: string;
13
13
  isOpen: boolean;
14
+ maxLength?: number;
14
15
  private debounceTimeout;
15
16
  static styles: import("lit").CSSResult;
16
17
  constructor();
package/dist/index.js CHANGED
@@ -303,7 +303,7 @@ function N(t,e){return(e,o,i)=>((t,e,o)=>(o.configurable=!0,o.enumerable=!0,Refl
303
303
  text-decoration: none;
304
304
  cursor: pointer;
305
305
  }
306
- `}toggleCheck(t){this.checked=t.target.checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked},bubbles:!0,composed:!0}))}renderClause(t,e){return e?o`<a class="terms-link" href="${e}" target="_blank" rel="noopener" @click=${this.stopPropagation}>${t}</a>`:o`${t}`}stopPropagation(t){t.stopPropagation()}render(){return o`
306
+ `}toggleCheck(t){this.checked=t.target.checked,this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))}renderClause(t,e){return e?o`<a class="terms-link" href="${e}" target="_blank" rel="noopener" @click=${this.stopPropagation}>${t}</a>`:o`${t}`}stopPropagation(t){t.stopPropagation()}render(){return o`
307
307
  <label>
308
308
  <input
309
309
  type="checkbox"
@@ -3960,7 +3960,7 @@ console.warn('WARNING: Since Vaadin 23.2, "@vaadin/vaadin-date-picker" is deprec
3960
3960
  }
3961
3961
  `}render(){return o`
3962
3962
  <vaadin-date-picker label="Select a date"></vaadin-date-picker>
3963
- `}}customElements.define("my-date-picker",ws);let xs=class extends t{constructor(){super(...arguments),this.value="",this.size="md",this.icon=null,this.helper=null,this.error=!1,this.errorMessage="",this.success=!1,this.disabled=!1,this.typing=!1,this.type="text",this.isPasswordVisible=!1}static{this.styles=e`
3963
+ `}}customElements.define("my-date-picker",ws);let xs=class extends t{constructor(){super(...arguments),this.value="",this.size="md",this.icon=null,this.helper=null,this.error=!1,this.errorMessage="",this.success=!1,this.disabled=!1,this.typing=!1,this.type="text",this.isPasswordVisible=!1,this.cleanButton=!1}static{this.styles=e`
3964
3964
  :host {
3965
3965
  display: block;
3966
3966
  font-family: 'Graphik', sans-serif;
@@ -4060,10 +4060,16 @@ console.warn('WARNING: Since Vaadin 23.2, "@vaadin/vaadin-date-picker" is deprec
4060
4060
  background-color: #d4edda;
4061
4061
  }
4062
4062
 
4063
- .form-input:hover {
4063
+ /* Hover normal (sin error ni foco) */
4064
+ .form:not(.error):not(:focus-within) .form-input:hover {
4064
4065
  box-shadow: 0px 0px 0px 4px #D1D3DB;
4065
4066
  }
4066
4067
 
4068
+ /* Hover con error (sin foco) */
4069
+ .form.error:not(:focus-within) .form-input:hover {
4070
+ box-shadow: 0px 0px 0px 4px #E00F0F1A;
4071
+ }
4072
+
4067
4073
  .form-input:focus {
4068
4074
  border: 2px solid #2175D9
4069
4075
  }
@@ -4182,21 +4188,38 @@ console.warn('WARNING: Since Vaadin 23.2, "@vaadin/vaadin-date-picker" is deprec
4182
4188
  .toggle-password randstad-icon svg {
4183
4189
  fill: #2175D9 !important;
4184
4190
  }
4185
- `}togglePassword(t){this.isPasswordVisible=!this.isPasswordVisible;const e=t.currentTarget.parentElement?.querySelector("input");e&&(e.type=this.isPasswordVisible?"text":"password"),this.requestUpdate()}handleInput(t){const e=t.target;this.value=e.value,this.dispatchEvent(new CustomEvent("valueChanged",{detail:this.value})),this.dispatchEvent(new Event("input",{bubbles:!0}))}handleLinkClick(t){t.preventDefault(),this.linkRoute&&this.dispatchEvent(new CustomEvent("linkClicked",{detail:this.linkRoute,bubbles:!0,composed:!0}))}render(){return o`
4191
+
4192
+ .clean-button {
4193
+ position: absolute;
4194
+ right: 10px;
4195
+ top: 50%;
4196
+ transform: translateY(-50%);
4197
+ background: transparent;
4198
+ border: none;
4199
+ cursor: pointer;
4200
+ display: flex;
4201
+ align-items: center;
4202
+ justify-content: center;
4203
+ width: 40px;
4204
+ height: 40px;
4205
+ }
4206
+ .clean-button randstad-icon {
4207
+ width: 24px;
4208
+ height: 24px;
4209
+ }
4210
+ `}togglePassword(t){this.isPasswordVisible=!this.isPasswordVisible;const e=t.currentTarget.parentElement?.querySelector("input");e&&(e.type=this.isPasswordVisible?"text":"password"),this.requestUpdate()}handleInput(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}))}render(){const t=this.cleanButton&&this.value&&"password"!==this.type&&"textarea"!==this.type;return o`
4186
4211
  <div
4187
4212
  class="form ${this.error?"error":""} ${this.success?"success":""} ${this.disabled?"disabled":""}"
4188
4213
  style=${this.labelColor?`--label-color: ${this.labelColor}`:r}
4189
4214
  >
4190
4215
  ${this.label?o`
4191
- <div class="label-container">
4192
- <label class="form-label">${this.label}</label>
4193
- ${this.tooltipMessage&&""!==this.tooltipMessage.trim()?o`
4194
- <div class="tooltip-wrapper">
4195
- <randstad-icon class="help-icon" name="ayuda" size="20px" color="#2175D9"></randstad-icon>
4196
- </div>
4197
- `:r}
4198
- </div>
4199
- `:r}
4216
+ <div class="label-container">
4217
+ <label class="form-label">${this.label}</label>
4218
+ ${this.tooltipMessage?.trim()?o`<div class="tooltip-wrapper">
4219
+ <randstad-icon class="help-icon" name="ayuda" size="20px" color="#2175D9"></randstad-icon>
4220
+ </div>`:r}
4221
+ </div>
4222
+ `:r}
4200
4223
 
4201
4224
  <div class="form-container">
4202
4225
  ${"left"===this.icon?o`<span class="icon left"></span>`:r}
@@ -4209,8 +4232,7 @@ console.warn('WARNING: Since Vaadin 23.2, "@vaadin/vaadin-date-picker" is deprec
4209
4232
  .value=${this.value}
4210
4233
  ?disabled=${this.disabled}
4211
4234
  @input=${this.handleInput}
4212
- ></textarea>
4213
- `:o`
4235
+ ></textarea>`:o`
4214
4236
  <input
4215
4237
  class="form-input"
4216
4238
  type=${"password"!==this.type||this.isPasswordVisible?"text":"password"}
@@ -4218,29 +4240,32 @@ console.warn('WARNING: Since Vaadin 23.2, "@vaadin/vaadin-date-picker" is deprec
4218
4240
  .value=${this.value}
4219
4241
  ?disabled=${this.disabled}
4220
4242
  @input=${this.handleInput}
4243
+ maxlength=${this.maxLength??r}
4221
4244
  />
4222
- ${"password"===this.type?o`
4223
- <button type="button" class="toggle-password" @click=${this.togglePassword}>
4224
- ${this.isPasswordVisible?o`<randstad-icon name='eye_crossed' size="24px" color="#2175D9"></randstad-icon>`:o`<randstad-icon name='eye' size="24px" color="#2175D9"></randstad-icon>`}
4225
-
4226
- </button>
4227
- `:r}
4228
- `}
4245
+
4246
+ ${"password"===this.type?o`<button type="button" class="toggle-password" @click=${this.togglePassword}>
4247
+ ${this.isPasswordVisible?o`<randstad-icon name='eye_crossed' size="24px" color="#2175D9"></randstad-icon>`:o`<randstad-icon name='eye' size="24px" color="#2175D9"></randstad-icon>`}
4248
+ </button>`:r}
4249
+
4250
+ ${t?o`<button type="button" class="clean-button" @click=${this.handleClear}>
4251
+ <randstad-icon name="close" size="24px" color="#2175D9"></randstad-icon>
4252
+ </button>`:r}
4253
+ `}
4229
4254
  </div>
4230
4255
 
4231
4256
  ${"right"===this.icon?o`<span class="icon right"></span>`:r}
4232
4257
  </div>
4233
4258
 
4234
4259
  ${this.error?o`
4235
- <p class="error-message">
4236
- ${this.errorMessage?this.errorMessage:o`<slot name="error-extended"></slot>`}
4237
- </p>
4238
- `:r}
4260
+ <p class="error-message">
4261
+ ${this.errorMessage?this.errorMessage:o`<slot name="error-extended"></slot>`}
4262
+ </p>`:r}
4263
+
4239
4264
  ${this.linkText&&this.linkRoute?o`<a class="link-text" href="#" @click=${this.handleLinkClick}>${this.linkText}</a>`:r}
4240
4265
 
4241
4266
  ${this.helper?o`<p class="helper-description">${this.helper}</p>`:r}
4242
4267
  </div>
4243
- `}};n([I({type:String}),a("design:type",String)],xs.prototype,"placeholder",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"label",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"labelColor",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"value",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"size",void 0),n([I({type:String}),a("design:type",Object)],xs.prototype,"icon",void 0),n([I({type:String}),a("design:type",Object)],xs.prototype,"helper",void 0),n([I({type:Boolean}),a("design:type",Boolean)],xs.prototype,"error",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"errorMessage",void 0),n([I({type:Boolean}),a("design:type",Boolean)],xs.prototype,"success",void 0),n([I({type:Boolean}),a("design:type",Boolean)],xs.prototype,"disabled",void 0),n([I({type:Boolean}),a("design:type",Boolean)],xs.prototype,"typing",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"type",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"tooltipMessage",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"linkText",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"linkRoute",void 0),n([I({type:Boolean,reflect:!0}),a("design:type",Object)],xs.prototype,"isPasswordVisible",void 0),xs=n([l("randstad-form")],xs);class Cs extends t{static{this.styles=e`
4268
+ `}};n([I({type:String}),a("design:type",String)],xs.prototype,"placeholder",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"label",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"labelColor",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"value",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"size",void 0),n([I({type:String}),a("design:type",Object)],xs.prototype,"icon",void 0),n([I({type:String}),a("design:type",Object)],xs.prototype,"helper",void 0),n([I({type:Boolean}),a("design:type",Boolean)],xs.prototype,"error",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"errorMessage",void 0),n([I({type:Boolean}),a("design:type",Boolean)],xs.prototype,"success",void 0),n([I({type:Boolean}),a("design:type",Boolean)],xs.prototype,"disabled",void 0),n([I({type:Boolean}),a("design:type",Boolean)],xs.prototype,"typing",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"type",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"tooltipMessage",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"linkText",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"linkRoute",void 0),n([I({type:Boolean,reflect:!0}),a("design:type",Object)],xs.prototype,"isPasswordVisible",void 0),n([I({type:Boolean}),a("design:type",Boolean)],xs.prototype,"cleanButton",void 0),n([I({type:Number}),a("design:type",Number)],xs.prototype,"maxLength",void 0),xs=n([l("randstad-form")],xs);class Cs extends t{static{this.styles=e`
4244
4269
  :host {
4245
4270
  display: inline-flex;
4246
4271
  width: var(--icon-size, 24px);
@@ -4965,7 +4990,7 @@ const ha=e`@layer{:host{display:inline-flex;height:var(--md-radio-icon-size, 20p
4965
4990
  opacity: 0.5;
4966
4991
  cursor: default;
4967
4992
  }
4968
- `}constructor(){if(super(),this.options=[],this.placeholder="Filtrar opciones...",this.defaultValue="",this.disabled=!1,this.label="",this.value="",this.labelColor="",this.filterable=!0,this.filteredOptions=[],this.filterValue="",this.isOpen=!1,this.debounceTimeout=null,this.defaultValue){const t=this.options.find((t=>"string"==typeof t?t===this.defaultValue:t.value===this.defaultValue));t&&(this.filterValue="string"==typeof t?t:t.label)}}willUpdate(t){if(t.has("options")&&(this.filteredOptions=[...this.options]),t.has("defaultValue")||t.has("options")){const t=this.options.find((t=>"string"==typeof t?t===this.defaultValue:t.value===this.defaultValue));t&&(this.filterValue="string"==typeof t?t:t.label)}if(t.has("value")){const t=this.options.find((t=>"string"==typeof t?t===this.value:t.value===this.value));t&&(this.filterValue="string"==typeof t?t:t.label)}}connectedCallback(){super.connectedCallback(),this.filteredOptions=[...this.options],document.addEventListener("click",this.handleClickOutside.bind(this))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleClickOutside.bind(this))}handleInputClick(t){this.disabled||t.target!==this.shadowRoot.querySelector(".filter-input")||(this.isOpen=!this.isOpen,this.requestUpdate())}handleInput(t){const e=t.target.value.toLowerCase();this.filterValue=e,this.filteredOptions=this.options.filter((t=>("string"==typeof t?t:t.label).toLowerCase().includes(this.filterValue.toLowerCase()))),this.isOpen=!0,this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=window.setTimeout((()=>{this.filterValue.length>2&&this.dispatchEvent(new CustomEvent("filter-location",{detail:{value:this.filterValue},bubbles:!0,composed:!0}))}),300),this.requestUpdate()}handleSelect(t){this.value="string"==typeof t?t:t.value;const e="string"==typeof t?t:t.value;this.dispatchEvent(new CustomEvent("option-selected",{detail:{value:e},bubbles:!0,composed:!0})),this.filterValue="string"==typeof t?t:t.label,this.isOpen=!1,this.requestUpdate()}handleIconClick(){this.disabled||(this.filterable&&this.filterValue?(this.filterValue="",this.filteredOptions=[...this.options],this.dispatchEvent(new CustomEvent("option-selected",{detail:{value:""},bubbles:!0,composed:!0})),this.isOpen=!1):this.isOpen=!this.isOpen,this.requestUpdate())}handleClickOutside(t){this.contains(t.target)||(this.isOpen=!1,this.requestUpdate())}render(){return o`
4993
+ `}constructor(){if(super(),this.options=[],this.placeholder="Filtrar opciones...",this.defaultValue="",this.disabled=!1,this.label="",this.value="",this.labelColor="",this.filterable=!0,this.filteredOptions=[],this.filterValue="",this.isOpen=!1,this.debounceTimeout=null,this.defaultValue){const t=this.options.find((t=>"string"==typeof t?t===this.defaultValue:t.value===this.defaultValue));t&&(this.filterValue="string"==typeof t?t:t.label)}}willUpdate(t){if(t.has("options")&&(this.filteredOptions=[...this.options]),t.has("defaultValue")||t.has("options")){const t=this.options.find((t=>"string"==typeof t?t===this.defaultValue:t.value===this.defaultValue));t&&(this.filterValue="string"==typeof t?t:t.label)}if(t.has("value")){const t=this.options.find((t=>"string"==typeof t?t===this.value:t.value===this.value));t&&(this.filterValue="string"==typeof t?t:t.label)}}connectedCallback(){super.connectedCallback(),this.filteredOptions=[...this.options],document.addEventListener("click",this.handleClickOutside.bind(this))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleClickOutside.bind(this))}handleInputClick(t){this.disabled||t.target!==this.shadowRoot.querySelector(".filter-input")||(this.isOpen=!this.isOpen,this.requestUpdate())}handleInput(t){const e=t.target.value,o=this.maxLength?e.slice(0,this.maxLength).toLowerCase():e.toLowerCase();this.filterValue=o,this.filteredOptions=this.options.filter((t=>("string"==typeof t?t:t.label).toLowerCase().includes(this.filterValue.toLowerCase()))),this.isOpen=!0,this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=window.setTimeout((()=>{this.filterValue.length>2&&this.dispatchEvent(new CustomEvent("filter-location",{detail:{value:this.filterValue},bubbles:!0,composed:!0}))}),300),this.requestUpdate()}handleSelect(t){this.value="string"==typeof t?t:t.value;const e="string"==typeof t?t:t.value;this.dispatchEvent(new CustomEvent("option-selected",{detail:{value:e},bubbles:!0,composed:!0})),this.filterValue="string"==typeof t?t:t.label,this.isOpen=!1,this.requestUpdate()}handleIconClick(){this.disabled||(this.filterable&&this.filterValue?(this.filterValue="",this.filteredOptions=[...this.options],this.dispatchEvent(new CustomEvent("option-selected",{detail:{value:""},bubbles:!0,composed:!0})),this.isOpen=!1):this.isOpen=!this.isOpen,this.requestUpdate())}handleClickOutside(t){this.contains(t.target)||(this.isOpen=!1,this.requestUpdate())}render(){return o`
4969
4994
  <div class="select-container" style="${this.labelColor?` --label-color: ${this.labelColor}`:""}">
4970
4995
  ${this.label?o`
4971
4996
  <div class="label-container">
@@ -4982,6 +5007,7 @@ const ha=e`@layer{:host{display:inline-flex;height:var(--md-radio-icon-size, 20p
4982
5007
  placeholder="${this.filterValue?"":this.placeholder}"
4983
5008
  ?disabled="${this.disabled}"
4984
5009
  ?readonly="${!this.filterable}"
5010
+ maxlength="${this.maxLength??""}"
4985
5011
  />
4986
5012
  <button
4987
5013
  class="icon-button"
@@ -5004,7 +5030,7 @@ const ha=e`@layer{:host{display:inline-flex;height:var(--md-radio-icon-size, 20p
5004
5030
  </ul>
5005
5031
  </div>
5006
5032
  </div>
5007
- `}};n([I({type:Array}),a("design:type",Array)],ma.prototype,"options",void 0),n([I({type:String}),a("design:type",Object)],ma.prototype,"placeholder",void 0),n([I({type:String,attribute:"default-value"}),a("design:type",Object)],ma.prototype,"defaultValue",void 0),n([I({type:Boolean}),a("design:type",Object)],ma.prototype,"disabled",void 0),n([I({type:String}),a("design:type",Object)],ma.prototype,"label",void 0),n([I({type:String}),a("design:type",String)],ma.prototype,"value",void 0),n([I({type:String}),a("design:type",Object)],ma.prototype,"labelColor",void 0),n([I({type:Boolean}),a("design:type",Object)],ma.prototype,"filterable",void 0),n([$(),a("design:type",Object)],ma.prototype,"filteredOptions",void 0),n([$(),a("design:type",Object)],ma.prototype,"filterValue",void 0),n([$(),a("design:type",Object)],ma.prototype,"isOpen",void 0),ma=n([l("filterable-select"),a("design:paramtypes",[])],ma);let fa=class extends t{constructor(){super(...arguments),this.totalSteps=4,this.currentStep=0}static{this.styles=e`
5033
+ `}};n([I({type:Array}),a("design:type",Array)],ma.prototype,"options",void 0),n([I({type:String}),a("design:type",Object)],ma.prototype,"placeholder",void 0),n([I({type:String,attribute:"default-value"}),a("design:type",Object)],ma.prototype,"defaultValue",void 0),n([I({type:Boolean}),a("design:type",Object)],ma.prototype,"disabled",void 0),n([I({type:String}),a("design:type",Object)],ma.prototype,"label",void 0),n([I({type:String}),a("design:type",String)],ma.prototype,"value",void 0),n([I({type:String}),a("design:type",Object)],ma.prototype,"labelColor",void 0),n([I({type:Boolean}),a("design:type",Object)],ma.prototype,"filterable",void 0),n([$(),a("design:type",Object)],ma.prototype,"filteredOptions",void 0),n([$(),a("design:type",Object)],ma.prototype,"filterValue",void 0),n([$(),a("design:type",Object)],ma.prototype,"isOpen",void 0),n([I({type:Number}),a("design:type",Number)],ma.prototype,"maxLength",void 0),ma=n([l("filterable-select"),a("design:paramtypes",[])],ma);let fa=class extends t{constructor(){super(...arguments),this.totalSteps=4,this.currentStep=0}static{this.styles=e`
5008
5034
  .stepper {
5009
5035
  display: flex;
5010
5036
  gap: 20px;