import{proxyCustomElement as e,HTMLElement as t,createEvent as i,h as s,Host as l,transformTag as r}from"@stencil/core/internal/client";import{C as o}from"./color-palettes.js";const a={display:"block",order:3,width:"6rem",flexShrink:0,marginRight:"-0.5rem"},n=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.change=i(this,"change",7),this.options=[],this.optionsById=new Map,this.handleChange=e=>{var t;e.stopPropagation();const i=e.detail,s=Array.isArray(i)?i[0]:i;this.change.emit(null!==(t=null==s?void 0:s.value)&&void 0!==t?t:"")}}componentWillLoad(){this.options=[{text:"",value:""},...o.map((e=>({text:e.title,secondaryText:e.description,value:e.id,primaryComponent:{name:"limebb-color-palette-swatches",props:{colors:e.colors,style:a}}})))],this.optionsById=new Map(this.options.map((e=>[e.value,e])))}render(){return s(l,{key:"60917a56a3aede46b8fdcae4ea47ea61801edc3e"},s("limel-select",{key:"9903a9645f7c46d6f7d96f7683b592716e38320e",label:this.label,helperText:this.helperText,disabled:this.disabled,readonly:this.readonly,invalid:this.invalid,required:this.required,options:this.options,value:this.getSelectedOption(),onChange:this.handleChange}))}getSelectedOption(){if(!this.value)return;return this.optionsById.get(this.value)||(this.lastWarnedValue!==this.value&&(console.warn(`limebb-color-palette-picker: palette "${this.value}" was not found in the registry. Rendering as (none).`),this.lastWarnedValue=this.value),this.optionsById.get(""))}static get style(){return":host(limebb-color-palette-picker){box-sizing:border-box;display:block;--color-palette-swatches-transform:scale(0.9) translateX(0.5rem)}"}},[1,"limebb-color-palette-picker",{value:[513],required:[516],readonly:[516],invalid:[516],disabled:[516],label:[513],helperText:[1,"helper-text"]}]),c=n,h=function(){"undefined"!=typeof customElements&&["limebb-color-palette-picker"].forEach((e=>{"limebb-color-palette-picker"===e&&(customElements.get(r(e))||customElements.define(r(e),n))}))};export{c as LimebbColorPalettePicker,h as defineCustomElement}