@randstad-uca/design-system 1.0.13 → 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 +14 -5
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4959,6 +4959,12 @@ const ha=e`@layer{:host{display:inline-flex;height:var(--md-radio-icon-size, 20p
|
|
|
4959
4959
|
.hidden {
|
|
4960
4960
|
display: none;
|
|
4961
4961
|
}
|
|
4962
|
+
|
|
4963
|
+
.options-list li.disabled {
|
|
4964
|
+
pointer-events: none;
|
|
4965
|
+
opacity: 0.5;
|
|
4966
|
+
cursor: default;
|
|
4967
|
+
}
|
|
4962
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`
|
|
4963
4969
|
<div class="select-container" style="${this.labelColor?` --label-color: ${this.labelColor}`:""}">
|
|
4964
4970
|
${this.label?o`
|
|
@@ -4987,11 +4993,14 @@ const ha=e`@layer{:host{display:inline-flex;height:var(--md-radio-icon-size, 20p
|
|
|
4987
4993
|
</button>
|
|
4988
4994
|
</div>
|
|
4989
4995
|
<ul class="options-list ${this.isOpen&&this.filteredOptions.length>0?"":"hidden"}">
|
|
4990
|
-
${this.filteredOptions.map((t=>o`
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
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
|
+
`}))}
|
|
4995
5004
|
</ul>
|
|
4996
5005
|
</div>
|
|
4997
5006
|
</div>
|