@randstad-uca/design-system 1.0.12 → 1.0.14

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
@@ -4222,6 +4222,7 @@ console.warn('WARNING: Since Vaadin 23.2, "@vaadin/vaadin-date-picker" is deprec
4222
4222
  ${"password"===this.type?o`
4223
4223
  <button type="button" class="toggle-password" @click=${this.togglePassword}>
4224
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
+
4225
4226
  </button>
4226
4227
  `:r}
4227
4228
  `}
@@ -4958,6 +4959,12 @@ const ha=e`@layer{:host{display:inline-flex;height:var(--md-radio-icon-size, 20p
4958
4959
  .hidden {
4959
4960
  display: none;
4960
4961
  }
4962
+
4963
+ .options-list li.disabled {
4964
+ pointer-events: none;
4965
+ opacity: 0.5;
4966
+ cursor: default;
4967
+ }
4961
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`
4962
4969
  <div class="select-container" style="${this.labelColor?` --label-color: ${this.labelColor}`:""}">
4963
4970
  ${this.label?o`
@@ -4986,11 +4993,14 @@ const ha=e`@layer{:host{display:inline-flex;height:var(--md-radio-icon-size, 20p
4986
4993
  </button>
4987
4994
  </div>
4988
4995
  <ul class="options-list ${this.isOpen&&this.filteredOptions.length>0?"":"hidden"}">
4989
- ${this.filteredOptions.map((t=>o`
4990
- <li @click="${()=>this.handleSelect(t)}">
4991
- ${"string"==typeof t?t:t.label}
4992
- </li>
4993
- `))}
4996
+ ${this.filteredOptions.map((t=>{const e="string"==typeof t?t:t.label,i="object"==typeof t&&t.disabled;return o`
4997
+ <li
4998
+ class="${i?"disabled":""}"
4999
+ @click="${()=>{i||this.handleSelect(t)}}"
5000
+ >
5001
+ ${e}
5002
+ </li>
5003
+ `}))}
4994
5004
  </ul>
4995
5005
  </div>
4996
5006
  </div>