1var k=Object.defineProperty;var I=(n,e)=>{for(var t in e)k(n,t,{get:e[t],enumerable:!0})};var g={};I(g,{OptionPure:()=>p,SelectPure:()=>o});function v(n){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?v=function(t){return typeof t}:v=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(n)}function a(n,e,t){var i=t.value;if(typeof i!="function")throw new TypeError("@boundMethod decorator can only be applied to methods not: ".concat(v(i)));var r=!1;return{configurable:!0,get:function(){if(r||this===n.prototype||this.hasOwnProperty(e)||typeof i!="function")return i;var d=i.bind(this);return r=!0,Object.defineProperty(this,e,{configurable:!0,get:function(){return d},set:function(C){i=C,delete this[e]}}),r=!1,d},set:function(d){i=d}}}import{LitElement as _,html as $}from"lit";import{ifDefined as P}from"lit-html/directives/if-defined.js";import{customElement as D}from"lit/decorators/custom-element.js";import{property as f}from"lit/decorators/property.js";var b={ENTER:"Enter",TAB:"Tab"};var y=()=>{};var O={label:"",value:"",select:y,unselect:y,disabled:!1,hidden:!1,selected:!1};import{css as E}from"lit";var x=E` 2 .select-wrapper { 3 position: relative; 4 } 5 .select { 6 bottom: 0; 7 display: flex; 8 flex-wrap: wrap; 9 left: 0; 10 position: absolute; 11 right: 0; 12 top: 0; 13 width: var(--select-width, 100%); 14 } 15 .label:focus { 16 outline: var(--select-outline, 2px solid #e3e3e3); 17 } 18 .label:after { 19 border-bottom: 1px solid var(--color, #000); 20 border-right: 1px solid var(--color, #000); 21 box-sizing: border-box; 22 content: ""; 23 display: block; 24 height: 10px; 25 margin-top: -2px; 26 transform: rotate(45deg); 27 transition: 0.2s ease-in-out; 28 width: 10px; 29 } 30 .label.visible:after { 31 margin-bottom: -4px; 32 margin-top: 0; 33 transform: rotate(225deg); 34 } 35 select { 36 -webkit-appearance: none; 37 -moz-appearance: none; 38 appearance: none; 39 position: relative; 40 opacity: 0; 41 } 42 select[multiple] { 43 z-index: 0; 44 } 45 select, 46 .label { 47 align-items: center; 48 background-color: var(--background-color, #fff); 49 border-radius: var(--border-radius, 4px); 50 border: var(--border-width, 1px) solid var(--border-color, #000); 51 box-sizing: border-box; 52 color: var(--color, #000); 53 cursor: pointer; 54 display: flex; 55 font-family: var(--font-family, inherit); 56 font-size: var(--font-size, 14px); 57 font-weight: var(--font-weight, 400); 58 min-height: var(--select-height, 44px); 59 justify-content: space-between; 60 padding: var(--padding, 0 10px); 61 width: 100%; 62 z-index: 1; 63 } 64 @media only screen and (hover: none) and (pointer: coarse){ 65 select { 66 z-index: 2; 67 } 68 } 69 .dropdown { 70 background-color: var(--border-color, #000); 71 border-radius: var(--border-radius, 4px); 72 border: var(--border-width, 1px) solid var(--border-color, #000); 73 display: none; 74 flex-direction: column; 75 gap: var(--border-width, 1px); 76 justify-content: space-between; 77 max-height: calc(var(--select-height, 44px) * var(--dropdown-items, 4) + var(--border-width, 1px) * calc(var(--dropdown-items, 4) - 1)); 78 overflow-y: scroll; 79 position: absolute; 80 top: calc(var(--select-height, 44px) + var(--dropdown-gap, 0px)); 81 width: calc(100% - var(--border-width, 1px) * 2); 82 z-index: var(--dropdown-z-index, 2); 83 } 84 .dropdown.visible { 85 display: flex; 86 z-index: 100; 87 } 88 .disabled { 89 background-color: var(--disabled-background-color, #bdc3c7); 90 color: var(--disabled-color, #ecf0f1); 91 cursor: default; 92 } 93 .multi-selected { 94 background-color: var(--selected-background-color, #e3e3e3); 95 border-radius: var(--border-radius, 4px); 96 color: var(--selected-color, #000); 97 display: flex; 98 gap: 8px; 99 justify-content: space-between; 100 padding: 2px 4px; 101 } 102 .multi-selected-wrapper { 103 display: flex; 104 flex-wrap: wrap; 105 gap: 4px; 106 width: calc(100% - 30px); 107 } 108 .cross:after { 109 content: '\\00d7'; 110 display: inline-block; 111 height: 100%; 112 text-align: center; 113 width: 12px; 114 } 115`;import{css as L}from"lit";var S=L` 116 .option {
117 align-items: center; 118 background-color: var(--background-color, #fff); 119 box-sizing: border-box; 120 color: var(--color, #000); 121 cursor: pointer; 122 display: flex; 123 font-family: var(--font-family, inherit); 124 font-size: var(--font-size, 14px); 125 font-weight: var(--font-weight, 400); 126 min-height: var(--select-height, 44px); 127 justify-content: flex-start; 128 padding: var(--padding, 0 10px); 129 width: 100%; 130 } 131 .option:not(.disabled):focus, .option:not(.disabled):not(.selected):hover { 132 background-color: var(--hover-background-color, #e3e3e3); 133 color: var(--hover-color, #000); 134 } 135 .selected { 136 background-color: var(--selected-background-color, #e3e3e3); 137 color: var(--selected-color, #000); 138 } 139 .disabled { 140 background-color: var(--disabled-background-color, #e3e3e3); 141 color: var(--disabled-color, #000); 142 cursor: default; 143 } 144`;var u=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var h=n.length-1;h>=0;h--)(d=n[h])&&(s=(r<3?d(s):r>3?d(e,t,s):d(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},p=class extends _{constructor(){super(...arguments),this.isSelected=!1,this.isDisabled=!1,this.isHidden=!1,this.optionValue="",this.displayedLabel="",this.optionIndex=-1}static get styles(){return S}connectedCallback(){super.connectedCallback(),this.isSelected=this.getAttribute("selected")!==null,this.isDisabled=this.getAttribute("disabled")!==null,this.isHidden=this.getAttribute("hidden")!==null,this.optionValue=this.getAttribute("value")||"",this.assignDisplayedLabel(),this.fireOnReadyCallback()}getOption(){return{label:this.displayedLabel,value:this.optionValue,select:this.select,unselect:this.unselect,selected:this.isSelected,disabled:this.isDisabled,hidden:this.isHidden}}select(){this.isSelected=!0,this.setAttribute("selected","")}unselect(){this.isSelected=!1,this.removeAttribute("selected")}setOnReadyCallback(e,t){this.onReady=e,this.optionIndex=t}setOnSelectCallback(e){this.onSelect=e}render(){let e=["option"];return this.isSelected&&e.push("selected"),this.isDisabled&&e.push("disabled"),$` 145 <div 146 class="${e.join(" ")}" 147 @click=${this.fireOnSelectCallback} 148 @keydown="${this.fireOnSelectIfEnterPressed}" 149 tabindex="${P(this.isDisabled?void 0:"0")}" 150 > 151 <slot hidden @slotchange=${this.assignDisplayedLabel}></slot> 152 ${this.displayedLabel} 153 </div> 154 `}assignDisplayedLabel(){if(this.textContent){this.displayedLabel=this.textContent;return}this.getAttribute("label")&&(this.displayedLabel=this.getAttribute("label")||"")}fireOnReadyCallback(){this.onReady&&this.onReady(this.getOption(),this.optionIndex)}fireOnSelectCallback(e){e.stopPropagation(),!(!this.onSelect||this.isDisabled)&&this.onSelect(this.optionValue)}fireOnSelectIfEnterPressed(e){e.key===b.ENTER&&this.fireOnSelectCallback(e)}};u([f()],p.prototype,"isSelected",void 0);u([f()],p.prototype,"isDisabled",void 0);u([f()],p.prototype,"isHidden",void 0);u([f()],p.prototype,"optionValue",void 0);u([f()],p.prototype,"displayedLabel",void 0);u([f()],p.prototype,"optionIndex",void 0);u([a],p.prototype,"getOption",null);u([a],p.prototype,"select",null);u([a],p.prototype,"unselect",null);u([a],p.prototype,"fireOnReadyCallback",null);
154p=u([D("option-pure")],p);import{LitElement as A,html as m}from"lit";import{ifDefined as w}from"lit-html/directives/if-defined.js";import{customElement as R}from"lit/decorators/custom-element.js";import{property as c}from"lit/decorators/property.js";import{query as z}from"lit/decorators/query.js";var l=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var h=n.length-1;h>=0;h--)(d=n[h])&&(s=(r<3?d(s):r>3?d(e,t,s):d(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},o=class extends A{constructor(){super(...arguments),this.options=[],this.visible=!1,this.selectedOption=O,this._selectedOptions=[],this.disabled=!1,this.isMultipleSelect=!1,this.name="",this._id="",this.formName="",this.value="",this.values=[],this.defaultLabel="",this.totalRenderedChildOptions=-1,this.form=null,this.hiddenInput=null}static get styles(){return x}connectedCallback(){super.connectedCallback(),this.disabled=this.getAttribute("disabled")!==null,this.isMultipleSelect=this.getAttribute("multiple")!==null,this.name=this.getAttribute("name")||"",this._id=this.getAttribute("id")||"",this.formName=this.name||this.id,this.defaultLabel=this.getAttribute("default-label")||""}open(){this.disabled||(this.visible=!0,this.removeEventListeners(),document.body.addEventListener("click",this.close,!0))}close(e){e&&this.contains(e.target)||(this.visible=!1,this.removeEventListeners())}enable(){this.disabled=!1}disable(){this.disabled=!0}get selectedIndex(){var e;return(e=this.nativeSelect)===null||e===void 0?void 0:e.selectedIndex}set selectedIndex(e){!e&&e!==0||this.selectOptionByValue(this.options[e].value)}get selectedOptions(){var e;return(e=this.nativeSelect)===null||e===void 0?void 0:e.selectedOptions}render(){let e=["label"];return this.disabled&&e.push("disabled"),this.visible&&e.push("visible"),m` 155 <div class="select-wrapper"> 156 <select 157 @change=${this.handleNativeSelectChange} 158 ?disabled=${this.disabled} 159 ?multiple=${this.isMultipleSelect} 160 name="${w(this.name||void 0)}" 161 id=${w(this.id||void 0)} 162 size="1" 163 > 164 ${this.getNativeOptionsHtml()} 165 </select> 166 <div class="select"> 167 <div 168 class="${e.join(" ")}" 169 @click="${this.visible?this.close:this.open}" 170 @keydown="${this.openDropdownIfProperKeyIsPressed}" 171 tabindex="0" 172 > 173 ${this.getDisplayedLabel()} 174 </div> 175 <div class="dropdown${this.visible?" visible":""}"> 176 <slot @slotchange=${this.initializeSelect}></slot> 177 </div> 178 </div> 179 </div> 180 `}handleNativeSelectChange(){var e;this.selectedIndex=(e=this.nativeSelect)===null||e===void 0?void 0:e.selectedIndex}getNativeOptionsHtml(){return this.options.map(this.getSingleNativeOptionHtml)}getSingleNativeOptionHtml({value:e,label:t,hidden:i,disabled:r}){return m` 181 <option 182 value=${e} 183 ?selected=${this.isOptionSelected(e)} 184 ?hidden=${i} 185 ?disabled=${r} 186 > 187 ${t} 188 </option> 189 `}isOptionSelected(e){let t=this.selectedOption.value===e;return this.isMultipleSelect&&(t=!!this._selectedOptions.find(i=>i.value===e)),t}openDropdownIfProperKeyIsPressed(e){(e.key===b.ENTER||e.key===b.TAB)&&this.open()}getDisplayedLabel(){return this.isMultipleSelect&&this._selectedOptions.length?this.getMultiSelectLabelHtml():this.selectedOption.label||this.defaultLabel}getMultiSelectLabelHtml(){return m` 190 <div class="multi-selected-wrapper"> 191 ${this._selectedOptions.map(this.getMultiSelectSelectedOptionHtml)} 192 </div> 193 `}getMultiSelectSelectedOptionHtml({label:e,value:t}){return m` 194 <span class="multi-selected"> 195 ${e} 196 <span 197 class="cross" 198 @click=${i=>this.fireOnSelectCallback(i,t)} 199 > 200 </span> 201 </span> 202 `}fireOnSelectCallback(e,t){e.stopPropagation(),this.selectOptionByValue(t)}initializeSelect(){this.processChildOptions(),this.selectDefaultOptionIfNoneSelected(),this.appendHiddenInputToClosestForm()}
202processChildOptions(){let e=this.querySelectorAll("option-pure");this.totalRenderedChildOptions=e.length;for(let t=0;t<e.length;t++)this.initializeSingleOption(e[t],t)}selectDefaultOptionIfNoneSelected(){!this.selectedOption.value&&!this.isMultipleSelect&&this.options.length&&this.selectOptionByValue(this.options[0].value)}initializeSingleOption(e,t){e.setOnSelectCallback(this.selectOptionByValue),this.options[t]=e.getOption(),this.options[t].selected&&this.selectOptionByValue(this.options[t].value)}removeEventListeners(){document.body.removeEventListener("click",this.close)}appendHiddenInputToClosestForm(){this.form=this.closest("form"),!(!this.form||this.hiddenInput)&&(this.hiddenInput=document.createElement("input"),this.hiddenInput.setAttribute("type","hidden"),this.hiddenInput.setAttribute("name",this.formName),this.form.appendChild(this.hiddenInput))}unselectAllOptions(){for(let e=0;e<this.options.length;e++)this.options[e].unselect()}selectOptionByValue(e){let t=this.options.find(({value:i})=>i===e);t&&this.setSelectValue(t)}setSelectValue(e){this.isMultipleSelect?this.setMultiSelectValue(e):this.setSingleSelectValue(e),this.updateHiddenInputInForm(),this.dispatchChangeEvent()}dispatchChangeEvent(){this.dispatchEvent(new Event("change"))}setMultiSelectValue(e){let t=this._selectedOptions.indexOf(e);t!==-1?(this.values.splice(t,1),this._selectedOptions.splice(t,1),e.unselect()):(this.values.push(e.value),this._selectedOptions.push(e),e.select()),this.requestUpdate()}setSingleSelectValue(e){this.unselectAllOptions(),this.close(),this.selectedOption=e,this.value=e.value,e.select()}updateHiddenInputInForm(){if(!this.form||!this.hiddenInput)return;this.hiddenInput.value=this.isMultipleSelect?this.values.join(","):this.value;let e=new Event("change",{bubbles:!0});this.hiddenInput.dispatchEvent(e)}};l([c()],o.prototype,"options",void 0);l([c()],o.prototype,"visible",void 0);l([c()],o.prototype,"selectedOption",void 0);l([c()],o.prototype,"_selectedOptions",void 0);l([c()],o.prototype,"disabled",void 0);l([c()],o.prototype,"isMultipleSelect",void 0);l([c()],o.prototype,"name",void 0);l([c()],o.prototype,"_id",void 0);l([c()],o.prototype,"formName",void 0);l([c()],o.prototype,"value",void 0);l([c()],o.prototype,"values",void 0);l([c()],o.prototype,"defaultLabel",void 0);l([c()],o.prototype,"totalRenderedChildOptions",void 0);l([z("select")],o.prototype,"nativeSelect",void 0);l([a],o.prototype,"close",null);l([a],o.prototype,"getSingleNativeOptionHtml",null);l([a],o.prototype,"getMultiSelectLabelHtml",null);l([a],o.prototype,"getMultiSelectSelectedOptionHtml",null);l([a],o.prototype,"initializeSelect",null);l([a],o.prototype,"initializeSingleOption",null);l([a],o.prototype,"removeEventListeners",null);l([a],o.prototype,"appendHiddenInputToClosestForm",null);l([a],o.prototype,"selectOptionByValue",null);o=l([R("select-pure")],o);var xe=g;export{xe as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.