UNPKG

@scania/tegel

Version:
1 lines 26 kB
import{t,p as o,H as s,c as e,h as i,a as r}from"./index.js";import{c as l,a as d}from"./p-CBZ6wC3m.js";import{g as n}from"./p-Cn4f8w1e.js";import{d as a}from"./p-CIt4YhvL.js";const h=o(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tdsChange=e(this,"tdsChange",6),this.tdsFocus=e(this,"tdsFocus",6),this.tdsBlur=e(this,"tdsBlur",6),this.tdsInput=e(this,"tdsInput",6),this.tdsClear=e(this,"tdsClear",6),this.disabled=!1,this.modeVariant=null,this.openDirection="auto",this.size="lg",this.animation="slide",this.error=!1,this.multiselect=!1,this.filter=!1,this.normalizeText=!0,this.noResultText="No result",this.value=null,this.open=!1,this.internalValue="",this.filterResult=null,this.filterFocus=!1,this.internalDefaultValue="",this.selectedOptions=[],this.filterQuery="",this.hasFocus=!1,this.uuid=n(),this.setDefaultOption=()=>{if(this.internalDefaultValue){const t=this.multiselect?this.internalDefaultValue.split(","):[this.internalDefaultValue];this.updateDropdownStateInternal(t)}},this.getChildren=()=>{const t=Array.from(this.host.children).filter((t=>"TDS-DROPDOWN-OPTION"===t.tagName));return 0===t.length&&console.warn("TDS DROPDOWN: No options found. Disregard if loading data asynchronously."),t},this.getSelectedChildren=()=>0===this.selectedOptions.length?[]:this.selectedOptions.map((t=>{var o;return null===(o=this.getChildren())||void 0===o?void 0:o.find((o=>l(o.value)===l(t)))})).filter(Boolean),this.getSelectedChildrenLabels=()=>{var t;return null===(t=this.getSelectedChildren())||void 0===t?void 0:t.map((t=>{var o;return null===(o=t.textContent)||void 0===o?void 0:o.trim()}))},this.getValue=()=>{const t=this.getSelectedChildrenLabels();return t?null==t?void 0:t.join(", "):""},this.setValueAttribute=()=>{0===this.selectedOptions.length?this.host.removeAttribute("value"):this.host.setAttribute("value",this.selectedOptions.join(","))},this.getOpenDirection=()=>{var t,o,s,e,i;if("auto"===this.openDirection||!this.openDirection){const r=null!==(o=null===(t=this.dropdownList)||void 0===t?void 0:t.offsetHeight)&&void 0!==o?o:0;return(null!==(i=null===(e=(s=this.host).getBoundingClientRect)||void 0===e?void 0:e.call(s).top)&&void 0!==i?i:0)+r+57>window.innerHeight?"up":"down"}return this.openDirection},this.handleToggleOpen=()=>{var t;if(!this.disabled&&(this.open=!this.open,this.open))if(this.filter)this.focusInputElement();else{const o=null===(t=this.host.shadowRoot)||void 0===t?void 0:t.querySelector("button");o&&o.focus()}},this.focusInputElement=()=>{this.inputElement&&this.inputElement.focus()},this.handleFilter=t=>{const o=t.currentTarget;if(this.multiselect&&0===this.filterQuery.length&&this.selectedOptions.length>0&&this.inputElement){const t=this.getValue(),s=o.value,e=function(t,o){return t.length<=o.length+1?t:t.startsWith(o)?t.slice(o.length):t.endsWith(o)?t.slice(0,t.length-o.length):t}(s,t);e!==s&&(this.inputElement.value=e)}this.tdsInput.emit(t);const s=this.inputElement?this.inputElement.value.toLowerCase():o.value.toLowerCase();this.filterQuery=s;const e=this.getChildren();""===s?(e.forEach((t=>(t.removeAttribute("hidden"),t))),this.filterResult=null):this.filterResult=e.filter((t=>{var o;return this.normalizeString(null!==(o=null==t?void 0:t.textContent)&&void 0!==o?o:"").toLowerCase().includes(this.normalizeString(s).toLowerCase())?t.removeAttribute("hidden"):t.setAttribute("hidden",""),!t.hasAttribute("hidden")})).length},this.handleFilterReset=()=>{if(this.multiselect){if(this.filterQuery.length>0){const t=this.filterQuery;this.filterQuery="",this.resetFilterVisibility(),this.inputElement&&(this.inputElement.value=this.getValue(),this.inputElement.focus()),this.tdsClear.emit({clearedValue:t})}else if(this.selectedOptions.length>0){const t=this.selectedOptions.join(",");this.updateDropdownStateFromUser([]),this.inputElement&&(this.inputElement.value="",this.inputElement.focus()),this.tdsClear.emit({clearedValue:t})}}else{const t=[];this.filterQuery.length>0&&(t.push(this.filterQuery),this.filterQuery="",this.resetFilterVisibility()),this.selectedOptions.length>0&&(t.push(this.selectedOptions.join(",")),this.updateDropdownStateFromUser([])),this.inputElement&&(this.inputElement.value="",this.inputElement.focus()),t.length>0&&this.tdsClear.emit({clearedValue:t.join(",")})}},this.resetFilterVisibility=()=>{this.filterQuery="",this.getChildren().forEach((t=>{t.removeAttribute("hidden")})),this.filterResult=null},this.handleMultiselectClear=()=>{const t=this.selectedOptions.join(",");this.updateDropdownStateFromUser([]),this.tdsClear.emit({clearedValue:t})},this.handleFocus=()=>{this.open=!0,this.filterFocus=!0,this.multiselect&&this.filter?this.inputElement&&(this.inputElement.value=this.getValue()):this.inputElement&&(this.inputElement.value=""),this.filter&&this.resetFilterVisibility()},this.handleBlur=()=>{this.filterFocus=!1,this.filterQuery="",this.inputElement&&(this.inputElement.value=this.getValue()),this.filter&&this.resetFilterVisibility()},this.handleInputClick=()=>{this.multiselect&&this.filter&&(this.filterQuery="",this.inputElement&&(this.inputElement.value=""),this.resetFilterVisibility())},this.resetInput=()=>{this.host.querySelector("input")&&this.reset()}}handleValueChange(t){const o=this.normalizeValue(t);(function(t,o){return t.length!==o.length||t.some((t=>!o.includes(t)))})(o,this.selectedOptions)&&this.updateDropdownStateFromUser(o)}normalizeValue(t){return null==t||""===t?[]:this.multiselect?Array.isArray(t)?d(t):t.toString().split(",").filter((t=>""!==t)):Array.isArray(t)?[l(t[0])]:[l(t)]}updateDropdownStateInternal(t){this.updateDropdownState(t,!1)}updateDropdownStateFromUser(t){this.updateDropdownState(t,!0)}updateDropdownState(t,o=!0){const s=this.validateValues(t);this.selectedOptions=[...s],this.value=this.multiselect?this.selectedOptions:this.selectedOptions[0]||null,this.internalValue=this.getValue(),this.updateOptionElements(),this.updateDisplayValue(),o&&this.emitChange(),this.setValueAttribute()}validateValues(t){const o=this.getChildren();return o&&0!==o.length?t.filter((t=>{const s=o.some((o=>l(o.value)===l(t)));return s||console.warn(`Option with value "${t}" does not exist`),s})):(console.warn("No dropdown options found"),t)}updateOptionElements(){var t;null===(t=this.getChildren())||void 0===t||t.forEach((t=>{t.setSelected(this.selectedOptions.includes(l(t.value)))}))}updateDisplayValue(){this.internalValue=this.getSelectedChildrenLabels().join(", "),this.filter&&this.inputElement&&(this.inputElement.value=this.internalValue)}emitChange(){const t=this.multiselect?this.selectedOptions.join(","):this.selectedOptions[0]||null;this.tdsChange.emit({name:this.name,value:null!=t?t:null})}async setValue(t,o){let s;return s=Array.isArray(t)?d(t):[l(t)],this.updateDropdownStateFromUser(s),this.getSelectedChildren().map((t=>{var o;return{value:t.value,label:null===(o=t.textContent)||void 0===o?void 0:o.trim()}}))}async reset(){this.updateDropdownStateFromUser([])}async removeValue(t){const o=this.selectedOptions.filter((o=>o!==t));this.updateDropdownStateFromUser(o)}async focusElement(){var t;if(this.filter)this.focusInputElement();else{const o=null===(t=this.host.shadowRoot)||void 0===t?void 0:t.querySelector("button");o&&o.focus()}this.handleFocus()}async close(){this.open=!1}async updateDisplay(){this.updateDisplayValue()}onAnyClick(t){this.open&&!t.composedPath().includes(this.host)&&(this.filter&&this.filterQuery&&this.tdsClear.emit({clearedValue:this.filterQuery}),this.open=!1)}onFocusIn(t){this.host.contains(t.target)&&(this.hasFocus||(this.hasFocus=!0,this.tdsFocus.emit(t)))}onFocusOut(t){const o=t.relatedTarget;!this.hasFocus||o&&this.host.contains(o)||(this.hasFocus=!1,this.handleBlur(),this.tdsBlur.emit(t))}async onKeyDown(t){var o,s;const{activeElement:e}=document;if(!e)return;const i=this.getChildren();if("ArrowDown"===t.key){const t=e.nextElementSibling?i.findIndex((t=>t===e.nextElementSibling)):0;if(i.length>0){const o=((t,o)=>{if(void 0===t[o])return 0;for(let s=o;s<t.length;s++)if(!t[s].disabled)return s})(i,t),s="number"==typeof o?i[o]:i[0];null==s||s.focus()}}else if("ArrowUp"===t.key){const t=e.nextElementSibling?this.getChildren().findIndex((t=>t===e.previousElementSibling)):0;if(i.length>0){const o=((t,o)=>{if(void 0===t[o])return t.length-1;for(let s=o;s>=0;s--)if(!t[s].disabled)return s})(i,t),s="number"==typeof o?i[o]:i[i.length-1];null==s||s.focus()}}else if("Escape"===t.key)if(this.open=!1,this.filter)null===(o=this.inputElement)||void 0===o||o.focus();else{const t=null===(s=this.host.shadowRoot)||void 0===s?void 0:s.querySelector("button");null==t||t.focus()}}handleOpenState(){this.filter&&(this.open||(this.filterQuery="",this.resetFilterVisibility(),this.inputElement&&(this.inputElement.value=this.selectedOptions.length?this.getValue():""))),this.updateDropdownListInertState()}handleDefaultValueChange(t){null!=t&&(this.internalDefaultValue=l(t),this.setDefaultOption())}componentWillLoad(){if(null==this.value){if(null!=this.defaultValue){const t=l(this.defaultValue),o=this.multiselect?t.split(",").map(l):[t];this.updateDropdownStateInternal(o)}}else{const t=this.normalizeValue(this.value);this.updateDropdownStateInternal(t)}}handleSlotChange(){this.setDefaultOption()}normalizeString(t){return this.normalizeText?t.normalize("NFD").replace(/\p{Diacritic}/gu,""):t}async appendValue(t){this.filter&&this.filterQuery.length>0&&(this.filterQuery="",this.resetFilterVisibility()),this.updateDropdownStateFromUser(this.multiselect?[...this.selectedOptions,t]:[t]),this.filter&&this.multiselect&&this.inputElement&&(this.inputElement.value=this.getValue())}componentDidRender(){const t=this.host.closest("form");t&&t.addEventListener("reset",this.resetInput),this.updateDropdownListInertState()}disconnectedCallback(){const t=this.host.closest("form");t&&t.removeEventListener("reset",this.resetInput)}updateDropdownListInertState(){this.dropdownList&&(this.open?this.dropdownList.removeAttribute("inert"):this.dropdownList.setAttribute("inert",""))}render(){var t,o,s,e;((t,o,s,e)=>{let i=t.querySelector("input");t.querySelector("input")||(i=t.ownerDocument.createElement("input"),i.type="hidden",t.appendChild(i)),i&&(i.disabled=e,i.name=o||"",i.value=s||"")})(this.host,this.name,this.selectedOptions.join(","),this.disabled);const l=this.name||this.uuid,d=`dropdown-input-${l}`,n=this.label?`dropdown-label-${l}`:void 0,a=this.helper?`dropdown-helper-${l}`:void 0,h=this.selectedOptions.length>0,c=this.filterQuery.length>0,p=this.filterFocus||h||c,u=this.open||h,b="inside"!==this.labelPosition||u,v=null!==(t=this.tdsAriaLabel)&&void 0!==t?t:this.label?void 0:"Dropdown";let w=null!==(o=this.placeholder)&&void 0!==o?o:"";"inside"===this.labelPosition&&(w=!this.filterFocus||c||h||null===(s=this.placeholder)||void 0===s?"":s);let f="";return this.selectedOptions.length>0?f=this.getValue():b&&(f=null!==(e=this.placeholder)&&void 0!==e?e:""),i(r,{key:"e7c3ade8e5b56a41f78016c44fb75efcaaf666c1",class:{[`tds-mode-variant-${this.modeVariant}`]:Boolean(this.modeVariant)}},this.label&&"outside"===this.labelPosition&&i("div",{key:"26dd2d4137fea024b4b436fca739cfecaea13491",id:n,class:"label-outside "+(this.disabled?"disabled":"")},this.label),i("div",{key:"ce88e29fa87c4c9e54ea68bef9bde26b6300bae9",class:{"dropdown-select":!0,[this.size]:!0,disabled:this.disabled}},this.filter?i("div",{class:{filter:!0,focus:this.filterFocus,disabled:this.disabled,error:this.error}},i("div",{class:"value-wrapper"},this.label&&"inside"===this.labelPosition&&i("label",{id:n,htmlFor:d,class:{"label-inside":!0,[this.size]:!0,floated:p}},this.label),i("input",{"aria-label":v,"aria-labelledby":n,"aria-describedby":a,"aria-disabled":this.disabled,ref:t=>{this.inputElement=t,this.inputElement&&!this.filterFocus&&(this.inputElement.value=this.getValue())},class:{placeholder:"inside"===this.labelPosition},id:d,type:"text",placeholder:w,disabled:this.disabled,onInput:t=>this.handleFilter(t),onFocus:()=>this.handleFocus(),onClick:()=>this.handleInputClick(),onKeyDown:t=>{"Escape"===t.key&&(this.open=!1)}})),i("tds-icon",{tabIndex:0,role:"button","aria-label":this.filterQuery.length>0?"Clear filter":"Clear selection",svgTitle:this.filterQuery.length>0?"Clear filter":"Clear selection",onClick:this.handleFilterReset,onKeyDown:t=>{"Enter"===t.key&&this.handleFilterReset()},class:{"clear-icon":!0,hide:!(this.filterQuery.length>0||this.selectedOptions.length>0)},name:"cross",size:"16px"}),i("tds-icon",{tdsAriaHidden:!0,role:"button","aria-label":"Open/Close dropdown",svgTitle:"Open/Close dropdown",onClick:this.handleToggleOpen,onKeyDown:t=>{"Enter"===t.key&&this.handleToggleOpen()},class:"menu-icon "+(this.open?"open":"closed"),name:"chevron_down",size:"16px"})):i("button",{"aria-label":this.tdsAriaLabel,"aria-labelledby":n,"aria-describedby":a,"aria-disabled":this.disabled,onClick:()=>this.handleToggleOpen(),onKeyDown:t=>{"Escape"===t.key&&(this.open=!1)},class:`\n ${this.selectedOptions.length?"value":"placeholder"}\n ${this.open?"open":"closed"}\n ${this.error?"error":""}\n `,disabled:this.disabled},i("div",{class:`value-wrapper ${this.size}`},this.label&&"inside"===this.labelPosition&&i("div",{id:n,class:{"label-inside":!0,[this.size]:!0,floated:u}},this.label),i("div",{"aria-label":this.tdsAriaLabel?`Selected options for ${this.tdsAriaLabel}`:void 0,class:`placeholder ${this.size}`},f)),i("tds-icon",{tabIndex:0,role:"button","aria-label":"Clear selection",svgTitle:"Clear selection",onClick:t=>{t.stopPropagation(),this.handleMultiselectClear()},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.stopPropagation(),t.preventDefault(),this.handleMultiselectClear())},class:{"clear-icon":!0,hide:!(this.multiselect&&this.selectedOptions.length>0)},name:"cross",size:"16px"}),i("tds-icon",{"aria-label":"Open/Close dropdown",svgTitle:"Open/Close dropdown",class:"menu-icon "+(this.open?"open":"closed"),name:"chevron_down",size:"16px"}))),i("div",{key:"0d76e422a2f0887595f60d57e03ec3980d4b9774",role:"listbox","aria-label":this.tdsAriaLabel,inert:!this.open,"aria-orientation":"vertical","aria-multiselectable":this.multiselect,ref:t=>{t&&(this.dropdownList=t)},class:{"dropdown-list":!0,[this.size]:!0,[this.getOpenDirection()]:!0,"label-outside":!(!this.label||"outside"!==this.labelPosition),open:this.open,closed:!this.open,[`animation-enter-${this.animation}`]:"none"!==this.animation&&this.open,[`animation-exit-${this.animation}`]:"none"!==this.animation&&!this.open}},i("slot",{key:"f971e4e9e24fe8d9092066d72bb05b76547f05a7",onSlotchange:()=>this.handleSlotChange()}),0===this.filterResult&&""!==this.noResultText&&i("div",{key:"0d8f90a543bf7b8dc3b3185d27f05d0517b4e0e6",class:`no-result ${this.size}`},this.noResultText)),this.helper&&i("div",{key:"4f17cfead0616b262e91e0e5b82cf59ce1309d73",id:a,class:{helper:!0,error:this.error,disabled:this.disabled}},this.error&&i("tds-icon",{key:"032599d86280e2a204c22fb97409f097841259b5",name:"error",size:"16px"}),this.helper))}get host(){return this}static get watchers(){return{value:[{handleValueChange:0}],open:[{handleOpenState:0}],defaultValue:[{handleDefaultValueChange:0}]}}static get style(){return'@charset "UTF-8";:host button{all:unset;display:flex;align-items:center;height:100%;width:100%;box-sizing:border-box;background-color:var(--tds-dropdown-bg);border-bottom:1px solid var(--tds-dropdown-border-bottom);border-radius:var(--tds-dropdown-border-radius);padding:0 16px}:host button:hover{border-bottom:1px solid var(--tds-dropdown-border-bottom-hover)}:host button .value-wrapper{flex:1;min-width:0;display:flex;align-items:center;padding:0}:host button .menu-icon{margin-right:16px}:host button.placeholder{color:var(--tds-dropdown-placeholder-color);line-height:1.3}:host button.value{color:var(--tds-dropdown-value-color);font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls);line-height:1.3}:host button:focus{border-bottom:0}:host button.error{border-bottom:1px solid var(--tds-dropdown-error)}:host button.error:focus{border-bottom-color:transparent}:host button.error:focus::before{content:"";position:absolute;bottom:0;left:0;width:100%;height:1px;background:var(--tds-dropdown-error)}:host button:disabled{color:var(--tds-dropdown-disabled-color);border-bottom:1px solid transparent}:host button .menu-icon{margin-right:0}:host .dropdown-select:focus-within{outline:2px solid var(--tds-focus-outline-color);box-shadow:0 0 0 1px var(--tds-white);outline-offset:1px;z-index:1}:host .filter{display:flex;align-items:center;justify-content:space-between;height:100%;background-color:var(--tds-dropdown-bg);border-bottom:1px solid var(--tds-dropdown-border-bottom);padding-left:16px;border-radius:4px 4px 0 0}:host .filter:hover{border-bottom:1px solid var(--tds-dropdown-border-bottom-hover)}:host .filter.disabled{color:var(--tds-dropdown-disabled-color);border-bottom:1px solid transparent}:host .filter.disabled .value-wrapper input{color:var(--tds-dropdown-disabled-color)}:host .filter .value-wrapper{display:flex;align-items:center;width:100%;height:100%}:host .filter .value-wrapper input{color:var(--tds-dropdown-filter-input-color)}:host .filter .label-inside-as-placeholder{position:absolute;font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls);line-height:1.3;color:var(--tds-dropdown-placeholder-color)}:host .filter .label-inside-as-placeholder.lg{top:20px}:host .filter .label-inside-as-placeholder.md{top:16px}:host .filter .label-inside-as-placeholder.sm{display:none}:host .filter .label-inside-as-placeholder.selected{font:var(--tds-detail-07);letter-spacing:var(--tds-detail-07-ls);transition:all 0.2s ease-in-out}:host .filter .label-inside-as-placeholder.selected.lg{top:12px}:host .filter .label-inside-as-placeholder.selected.md{top:8px}:host .filter .label-inside-as-placeholder.selected.sm{display:none}:host .filter .label-inside-as-placeholder.selected+.placeholder:not(.sm){margin-top:8px}:host .filter.focus{border-bottom:0}:host .filter.focus:hover{border-bottom:0}:host .filter.error{border-bottom:1px solid var(--tds-dropdown-error)}:host .filter.error.focus{border-bottom-color:transparent}:host .filter.error.focus::before{content:"";position:absolute;bottom:0;left:0;width:100%;height:1px;background:var(--tds-dropdown-error)}:host .filter input{flex:1;all:unset;width:100%}:host .filter input::placeholder{color:var(--tds-dropdown-placeholder-color)}:host .filter input:disabled::placeholder{color:var(--tds-dropdown-disabled-color)}:host .filter tds-icon{cursor:pointer}:host .filter .menu-icon{margin-right:16px}:host,:root{--tds-scrollbar-width-standard:thin;--tds-scrollbar-width:10px;--tds-scrollbar-height:10px;--tds-scrollbar-thumb-border-width:3px;--tds-scrollbar-thumb-border-hover-width:2px}body{scrollbar-width:thin}:host{display:block;position:relative;font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls)}:host .label-outside{font:var(--tds-detail-05);letter-spacing:var(--tds-detail-05-ls);color:var(--tds-dropdown-label-color);margin-bottom:8px}:host .label-outside.disabled{color:var(--tds-dropdown-disabled-color)}:host .dropdown-select{position:relative}:host .dropdown-select button:focus{outline:2px solid var(--tds-focus-outline-color);box-shadow:0 0 0 1px var(--tds-white);outline-offset:1px;z-index:1;border-radius:0}:host .dropdown-select button{transition:border-bottom-color var(--tds-motion-duration-fast-02) var(--tds-motion-easing-scania)}:host .dropdown-select button:hover{border-bottom-color:var(--tds-dropdown-border-bottom-hover)}:host .dropdown-select button{border-bottom-color:var(--tds-dropdown-border-bottom)}:host .dropdown-select button.error{border-bottom-color:var(--tds-dropdown-error)}:host .dropdown-select button.error:focus{border-bottom-color:transparent}:host .dropdown-select.disabled .label-inside,:host .dropdown-select.disabled .placeholder,:host .dropdown-select.disabled .label-inside-as-placeholder,:host .dropdown-select.disabled .value-wrapper,:host .dropdown-select.disabled .menu-icon{color:var(--tds-dropdown-disabled-color)}:host .dropdown-select.disabled button{border:none}:host .dropdown-select .label-inside{position:absolute;font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls);color:var(--tds-dropdown-label-inside-color);left:16px;transition:all 0.2s ease-in-out}:host .dropdown-select .label-inside.lg{top:20px;left:16px}:host .dropdown-select .label-inside.md{top:16px;left:16px}:host .dropdown-select .label-inside.sm{display:none}:host .dropdown-select .label-inside.xs{display:none}:host .dropdown-select .label-inside+.placeholder:not(.sm){margin-top:8px}:host .dropdown-select .label-inside.floated{font:var(--tds-detail-07);letter-spacing:var(--tds-detail-07-ls)}:host .dropdown-select .label-inside.floated.lg{top:12px}:host .dropdown-select .label-inside.floated.md{top:8px}:host .dropdown-select .placeholder{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-right:var(--tds-placeholder-margin);}:host .dropdown-select .placeholder.xs{line-height:1}:host .dropdown-select .label-inside-as-placeholder{color:var(--tds-dropdown-placeholder-color)}:host .dropdown-select .label-inside-as-placeholder.selected{position:absolute;font:var(--tds-detail-07);letter-spacing:var(--tds-detail-07-ls);transition:all 0.2s ease-in-out}:host .dropdown-select .label-inside-as-placeholder.selected.lg{top:12px}:host .dropdown-select .label-inside-as-placeholder.selected.md{top:8px}:host .dropdown-select .label-inside-as-placeholder.selected.sm{display:none}:host .dropdown-select .label-inside-as-placeholder.selected+.placeholder:not(.sm){margin-top:8px}:host .dropdown-select.lg{height:55px}:host .dropdown-select.md{height:47px}:host .dropdown-select.sm{height:39px}:host .dropdown-select.xs{height:29px}:host .helper{margin-top:4px;color:var(--tds-dropdown-helper-color);font:var(--tds-detail-05);letter-spacing:var(--tds-detail-05-ls);display:flex;align-items:center;gap:8px}:host .helper.error{color:var(--tds-dropdown-error)}:host .helper.disabled{color:var(--tds-dropdown-disabled-color)}:host .dropdown-list{z-index:100;position:absolute;width:100%;transform-origin:top;box-shadow:0 2px 3px 0 rgba(0, 0, 0, 0.1);border-radius:var(--tds-dropdown-list-border-radius-down);overflow-y:auto;transform:scaleY(0);pointer-events:none;background-color:var(--tds-dropdown-bg)}:host .dropdown-list:hover::-webkit-scrollbar-thumb{border:var(--tds-scrollbar-thumb-border-hover-width) solid transparent;background-clip:padding-box}:host .dropdown-list::-webkit-scrollbar{width:var(--tds-scrollbar-width)}:host .dropdown-list::-webkit-scrollbar-track{background:var(--tds-scrollbar-track-color)}:host .dropdown-list::-webkit-scrollbar-thumb{border-radius:40px;background:var(--tds-scrollbar-thumb-color);border:var(--tds-scrollbar-thumb-border-width) solid transparent;background-clip:padding-box}:host .dropdown-list::-webkit-scrollbar-button{height:0;width:0}@supports not selector(::-webkit-scrollbar){:host .dropdown-list{scrollbar-color:var(--tds-scrollbar-thumb-color) var(--tds-scrollbar-track-color);scrollbar-width:var(--tds-scrollbar-width-standard)}}:host .dropdown-list.lg{max-height:312px}:host .dropdown-list.md{max-height:312px}:host .dropdown-list.sm{max-height:260px}:host .dropdown-list.xs{max-height:260px}:host .dropdown-list.up{bottom:100%;margin-top:0;margin-bottom:1px;transform-origin:bottom;display:flex;flex-direction:column-reverse;border-radius:var(--tds-dropdown-list-border-radius-up)}:host .dropdown-list.up.label-outside{bottom:calc(100% - 24px)}:host .dropdown-list.closed{transform:scaleY(0);pointer-events:none}:host .dropdown-list.open{transform:scaleY(1);visibility:visible;opacity:1;pointer-events:auto}:host .dropdown-list.animation-enter-slide{transition:transform var(--tds-motion-duration-moderate-01) var(--tds-motion-easing-enter)}:host .dropdown-list.animation-exit-slide{transition:transform var(--tds-motion-duration-moderate-01) var(--tds-motion-easing-exit)}:host .dropdown-list .no-result{font:var(--tds-detail-02);letter-spacing:var(--tds-detail-02-ls);display:flex;align-items:center;padding:0 16px;background-color:var(--tds-dropdown-bg)}:host .dropdown-list .no-result.lg{height:56px}:host .dropdown-list .no-result.md{height:48px}:host .dropdown-list .no-result.sm{height:40px}:host .dropdown-list .no-result.xs{height:40px}:host .menu-icon{color:var(--tds-dropdown-menu-icon-color)}:host .clear-icon{cursor:pointer;flex-shrink:0;margin:0;margin-right:8px;color:var(--tds-dropdown-clear-icon-color);padding-right:8px;border-right:1px solid var(--tds-dropdown-clear-icon-color)}:host .clear-icon:hover{color:var(--tds-dropdown-clear-icon-hover-color)}:host .clear-icon.hide{display:none;visibility:hidden}:host tds-icon{transition:transform var(--tds-motion-duration-fast-02) var(--tds-motion-easing-scania)}:host tds-icon.open{transform:rotateZ(180deg)}'}},[257,"tds-dropdown",{name:[1],disabled:[4],helper:[1],label:[1],labelPosition:[1,"label-position"],modeVariant:[1,"mode-variant"],openDirection:[1,"open-direction"],placeholder:[1],size:[1],animation:[1],error:[4],multiselect:[4],filter:[4],normalizeText:[4,"normalize-text"],noResultText:[1,"no-result-text"],defaultValue:[8,"default-value"],value:[1032],tdsAriaLabel:[1,"tds-aria-label"],open:[32],internalValue:[32],filterResult:[32],filterFocus:[32],internalDefaultValue:[32],selectedOptions:[32],filterQuery:[32],setValue:[64],reset:[64],removeValue:[64],focusElement:[64],close:[64],updateDisplay:[64],appendValue:[64]},[[9,"mousedown","onAnyClick"],[0,"focusin","onFocusIn"],[0,"focusout","onFocusOut"],[0,"keydown","onKeyDown"]],{value:[{handleValueChange:0}],open:[{handleOpenState:0}],defaultValue:[{handleDefaultValueChange:0}]}]);function c(){"undefined"!=typeof customElements&&["tds-dropdown","tds-icon"].forEach((o=>{switch(o){case"tds-dropdown":customElements.get(t(o))||customElements.define(t(o),h);break;case"tds-icon":customElements.get(t(o))||a()}}))}c();export{h as T,c as d}