@nuralyui/select 0.1.4 → 0.1.6

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.
Files changed (2) hide show
  1. package/bundle.js +3 -778
  2. package/package.json +1 -1
package/bundle.js CHANGED
@@ -1,787 +1,12 @@
1
- /**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- const t=window,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new WeakMap;class o{constructor(t,e,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const i=this.t;if(e&&void 0===t){const e=void 0!==i&&1===i.length;e&&(t=s.get(i)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&s.set(i,t))}return t}toString(){return this.cssText}}const r=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new o("string"==typeof t?t:t+"",void 0,i))(e)})(t):t
7
- /**
8
- * @license
9
- * Copyright 2017 Google LLC
10
- * SPDX-License-Identifier: BSD-3-Clause
11
- */;var n;const l=window,a=l.trustedTypes,c=a?a.emptyScript:"",h=l.reactiveElementPolyfillSupport,d={toAttribute(t,e){switch(e){case Boolean:t=t?c:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},u=(t,e)=>e!==t&&(e==e||t==t),p={attribute:!0,type:String,converter:d,reflect:!1,hasChanged:u},v="finalized";class y extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const s=this._$Ep(i,e);void 0!==s&&(this._$Ev.set(s,i),t.push(s))})),t}static createProperty(t,e=p){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const o=this[t];this[e]=s,this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||p}static finalize(){if(this.hasOwnProperty(v))return!1;this[v]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(r(t))}else void 0!==t&&e.push(r(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var i;const s=null!==(i=this.shadowRoot)&&void 0!==i?i:this.attachShadow(this.constructor.shadowRootOptions);return((i,s)=>{e?i.adoptedStyleSheets=s.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):s.forEach((e=>{const s=document.createElement("style"),o=t.litNonce;void 0!==o&&s.setAttribute("nonce",o),s.textContent=e.cssText,i.appendChild(s)}))})(s,this.constructor.elementStyles),s}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=p){var s;const o=this.constructor._$Ep(t,i);if(void 0!==o&&!0===i.reflect){const r=(void 0!==(null===(s=i.converter)||void 0===s?void 0:s.toAttribute)?i.converter:d).toAttribute(e,i.type);this._$El=t,null==r?this.removeAttribute(o):this.setAttribute(o,r),this._$El=null}}_$AK(t,e){var i;const s=this.constructor,o=s._$Ev.get(t);if(void 0!==o&&this._$El!==o){const t=s.getPropertyOptions(o),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:d;this._$El=o,this[o]=r.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let s=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||u)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}
12
- /**
13
- * @license
14
- * Copyright 2017 Google LLC
15
- * SPDX-License-Identifier: BSD-3-Clause
16
- */
17
- var f;y[v]=!0,y.elementProperties=new Map,y.elementStyles=[],y.shadowRootOptions={mode:"open"},null==h||h({ReactiveElement:y}),(null!==(n=l.reactiveElementVersions)&&void 0!==n?n:l.reactiveElementVersions=[]).push("1.6.3");const g=window,m=g.trustedTypes,b=m?m.createPolicy("lit-html",{createHTML:t=>t}):void 0,w="$lit$",x=`lit$${(Math.random()+"").slice(9)}$`,$="?"+x,E=`<${$}>`,S=document,O=()=>S.createComment(""),A=t=>null===t||"object"!=typeof t&&"function"!=typeof t,k=Array.isArray,z="[ \t\n\f\r]",C=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,T=/>/g,N=RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),D=/'/g,I=/"/g,R=/^(?:script|style|textarea|title)$/i,U=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),L=new WeakMap,F=S.createTreeWalker(S,129,null,!1);function M(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==b?b.createHTML(e):e}class B{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let o=0,r=0;const n=t.length-1,l=this.parts,[a,c]=((t,e)=>{const i=t.length-1,s=[];let o,r=2===e?"<svg>":"",n=C;for(let e=0;e<i;e++){const i=t[e];let l,a,c=-1,h=0;for(;h<i.length&&(n.lastIndex=h,a=n.exec(i),null!==a);)h=n.lastIndex,n===C?"!--"===a[1]?n=_:void 0!==a[1]?n=T:void 0!==a[2]?(R.test(a[2])&&(o=RegExp("</"+a[2],"g")),n=N):void 0!==a[3]&&(n=N):n===N?">"===a[0]?(n=null!=o?o:C,c=-1):void 0===a[1]?c=-2:(c=n.lastIndex-a[2].length,l=a[1],n=void 0===a[3]?N:'"'===a[3]?I:D):n===I||n===D?n=N:n===_||n===T?n=C:(n=N,o=void 0);const d=n===N&&t[e+1].startsWith("/>")?" ":"";r+=n===C?i+E:c>=0?(s.push(l),i.slice(0,c)+w+i.slice(c)+x+d):i+x+(-2===c?(s.push(void 0),e):d)}return[M(t,r+(t[i]||"<?>")+(2===e?"</svg>":"")),s]})(t,e);if(this.el=B.createElement(a,i),F.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=F.nextNode())&&l.length<n;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const e of s.getAttributeNames())if(e.endsWith(w)||e.startsWith(x)){const i=c[r++];if(t.push(e),void 0!==i){const t=s.getAttribute(i.toLowerCase()+w).split(x),e=/([.?@])?(.*)/.exec(i);l.push({type:1,index:o,name:e[2],strings:t,ctor:"."===e[1]?G:"?"===e[1]?q:"@"===e[1]?Y:W})}else l.push({type:6,index:o})}for(const e of t)s.removeAttribute(e)}if(R.test(s.tagName)){const t=s.textContent.split(x),e=t.length-1;if(e>0){s.textContent=m?m.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],O()),F.nextNode(),l.push({type:2,index:++o});s.append(t[e],O())}}}else if(8===s.nodeType)if(s.data===$)l.push({type:2,index:o});else{let t=-1;for(;-1!==(t=s.data.indexOf(x,t+1));)l.push({type:7,index:o}),t+=x.length-1}o++}}static createElement(t,e){const i=S.createElement("template");return i.innerHTML=t,i}}function j(t,e,i=t,s){var o,r,n,l;if(e===U)return e;let a=void 0!==s?null===(o=i._$Co)||void 0===o?void 0:o[s]:i._$Cl;const c=A(e)?void 0:e._$litDirective$;return(null==a?void 0:a.constructor)!==c&&(null===(r=null==a?void 0:a._$AO)||void 0===r||r.call(a,!1),void 0===c?a=void 0:(a=new c(t),a._$AT(t,i,s)),void 0!==s?(null!==(n=(l=i)._$Co)&&void 0!==n?n:l._$Co=[])[s]=a:i._$Cl=a),void 0!==a&&(e=j(t,a._$AS(t,e.values),a,s)),e}class V{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:i},parts:s}=this._$AD,o=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:S).importNode(i,!0);F.currentNode=o;let r=F.nextNode(),n=0,l=0,a=s[0];for(;void 0!==a;){if(n===a.index){let e;2===a.type?e=new H(r,r.nextSibling,this,t):1===a.type?e=new a.ctor(r,a.name,a.strings,this,t):6===a.type&&(e=new Z(r,this,t)),this._$AV.push(e),a=s[++l]}n!==(null==a?void 0:a.index)&&(r=F.nextNode(),n++)}return F.currentNode=S,o}v(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class H{constructor(t,e,i,s){var o;this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cp=null===(o=null==s?void 0:s.isConnected)||void 0===o||o}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=j(this,t,e),A(t)?t===P||null==t||""===t?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==U&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>k(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==P&&A(this._$AH)?this._$AA.nextSibling.data=t:this.$(S.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:s}=t,o="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=B.createElement(M(s.h,s.h[0]),this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===o)this._$AH.v(i);else{const t=new V(o,this),e=t.u(this.options);t.v(i),this.$(e),this._$AH=t}}_$AC(t){let e=L.get(t.strings);return void 0===e&&L.set(t.strings,e=new B(t)),e}T(t){k(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const o of t)s===e.length?e.push(i=new H(this.k(O()),this.k(O()),this,this.options)):i=e[s],i._$AI(o),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class W{constructor(t,e,i,s,o){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=P}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const o=this.strings;let r=!1;if(void 0===o)t=j(this,t,e,0),r=!A(t)||t!==this._$AH&&t!==U,r&&(this._$AH=t);else{const s=t;let n,l;for(t=o[0],n=0;n<o.length-1;n++)l=j(this,s[i+n],e,n),l===U&&(l=this._$AH[n]),r||(r=!A(l)||l!==this._$AH[n]),l===P?t=P:t!==P&&(t+=(null!=l?l:"")+o[n+1]),this._$AH[n]=l}r&&!s&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class G extends W{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}}const K=m?m.emptyScript:"";class q extends W{constructor(){super(...arguments),this.type=4}j(t){t&&t!==P?this.element.setAttribute(this.name,K):this.element.removeAttribute(this.name)}}class Y extends W{constructor(t,e,i,s,o){super(t,e,i,s,o),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=j(this,t,e,0))&&void 0!==i?i:P)===U)return;const s=this._$AH,o=t===P&&s!==P||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==P&&(s===P||o);o&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class Z{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){j(this,t)}}const Q=g.litHtmlPolyfillSupport;
18
- /**
19
- * @license
20
- * Copyright 2017 Google LLC
21
- * SPDX-License-Identifier: BSD-3-Clause
22
- */
23
- var X;null==Q||Q(B,H),(null!==(f=g.litHtmlVersions)&&void 0!==f?f:g.litHtmlVersions=[]).push("2.8.0");const J=window,tt=J.trustedTypes,et=tt?tt.createPolicy("lit-html",{createHTML:t=>t}):void 0,it="$lit$",st=`lit$${(Math.random()+"").slice(9)}$`,ot="?"+st,rt=`<${ot}>`,nt=document,lt=()=>nt.createComment(""),at=t=>null===t||"object"!=typeof t&&"function"!=typeof t,ct=Array.isArray,ht="[ \t\n\f\r]",dt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ut=/-->/g,pt=/>/g,vt=RegExp(`>|${ht}(?:([^\\s"'>=/]+)(${ht}*=${ht}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),yt=/'/g,ft=/"/g,gt=/^(?:script|style|textarea|title)$/i,mt=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),bt=Symbol.for("lit-noChange"),wt=Symbol.for("lit-nothing"),xt=new WeakMap,$t=nt.createTreeWalker(nt,129,null,!1);function Et(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==et?et.createHTML(e):e}const St=(t,e)=>{const i=t.length-1,s=[];let o,r=2===e?"<svg>":"",n=dt;for(let e=0;e<i;e++){const i=t[e];let l,a,c=-1,h=0;for(;h<i.length&&(n.lastIndex=h,a=n.exec(i),null!==a);)h=n.lastIndex,n===dt?"!--"===a[1]?n=ut:void 0!==a[1]?n=pt:void 0!==a[2]?(gt.test(a[2])&&(o=RegExp("</"+a[2],"g")),n=vt):void 0!==a[3]&&(n=vt):n===vt?">"===a[0]?(n=null!=o?o:dt,c=-1):void 0===a[1]?c=-2:(c=n.lastIndex-a[2].length,l=a[1],n=void 0===a[3]?vt:'"'===a[3]?ft:yt):n===ft||n===yt?n=vt:n===ut||n===pt?n=dt:(n=vt,o=void 0);const d=n===vt&&t[e+1].startsWith("/>")?" ":"";r+=n===dt?i+rt:c>=0?(s.push(l),i.slice(0,c)+it+i.slice(c)+st+d):i+st+(-2===c?(s.push(void 0),e):d)}return[Et(t,r+(t[i]||"<?>")+(2===e?"</svg>":"")),s]};class Ot{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let o=0,r=0;const n=t.length-1,l=this.parts,[a,c]=St(t,e);if(this.el=Ot.createElement(a,i),$t.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=$t.nextNode())&&l.length<n;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const e of s.getAttributeNames())if(e.endsWith(it)||e.startsWith(st)){const i=c[r++];if(t.push(e),void 0!==i){const t=s.getAttribute(i.toLowerCase()+it).split(st),e=/([.?@])?(.*)/.exec(i);l.push({type:1,index:o,name:e[2],strings:t,ctor:"."===e[1]?_t:"?"===e[1]?Nt:"@"===e[1]?Dt:Ct})}else l.push({type:6,index:o})}for(const e of t)s.removeAttribute(e)}if(gt.test(s.tagName)){const t=s.textContent.split(st),e=t.length-1;if(e>0){s.textContent=tt?tt.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],lt()),$t.nextNode(),l.push({type:2,index:++o});s.append(t[e],lt())}}}else if(8===s.nodeType)if(s.data===ot)l.push({type:2,index:o});else{let t=-1;for(;-1!==(t=s.data.indexOf(st,t+1));)l.push({type:7,index:o}),t+=st.length-1}o++}}static createElement(t,e){const i=nt.createElement("template");return i.innerHTML=t,i}}function At(t,e,i=t,s){var o,r,n,l;if(e===bt)return e;let a=void 0!==s?null===(o=i._$Co)||void 0===o?void 0:o[s]:i._$Cl;const c=at(e)?void 0:e._$litDirective$;return(null==a?void 0:a.constructor)!==c&&(null===(r=null==a?void 0:a._$AO)||void 0===r||r.call(a,!1),void 0===c?a=void 0:(a=new c(t),a._$AT(t,i,s)),void 0!==s?(null!==(n=(l=i)._$Co)&&void 0!==n?n:l._$Co=[])[s]=a:i._$Cl=a),void 0!==a&&(e=At(t,a._$AS(t,e.values),a,s)),e}class kt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:i},parts:s}=this._$AD,o=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:nt).importNode(i,!0);$t.currentNode=o;let r=$t.nextNode(),n=0,l=0,a=s[0];for(;void 0!==a;){if(n===a.index){let e;2===a.type?e=new zt(r,r.nextSibling,this,t):1===a.type?e=new a.ctor(r,a.name,a.strings,this,t):6===a.type&&(e=new It(r,this,t)),this._$AV.push(e),a=s[++l]}n!==(null==a?void 0:a.index)&&(r=$t.nextNode(),n++)}return $t.currentNode=nt,o}v(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class zt{constructor(t,e,i,s){var o;this.type=2,this._$AH=wt,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cp=null===(o=null==s?void 0:s.isConnected)||void 0===o||o}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=At(this,t,e),at(t)?t===wt||null==t||""===t?(this._$AH!==wt&&this._$AR(),this._$AH=wt):t!==this._$AH&&t!==bt&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>ct(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==wt&&at(this._$AH)?this._$AA.nextSibling.data=t:this.$(nt.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:s}=t,o="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=Ot.createElement(Et(s.h,s.h[0]),this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===o)this._$AH.v(i);else{const t=new kt(o,this),e=t.u(this.options);t.v(i),this.$(e),this._$AH=t}}_$AC(t){let e=xt.get(t.strings);return void 0===e&&xt.set(t.strings,e=new Ot(t)),e}T(t){ct(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const o of t)s===e.length?e.push(i=new zt(this.k(lt()),this.k(lt()),this,this.options)):i=e[s],i._$AI(o),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class Ct{constructor(t,e,i,s,o){this.type=1,this._$AH=wt,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=wt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const o=this.strings;let r=!1;if(void 0===o)t=At(this,t,e,0),r=!at(t)||t!==this._$AH&&t!==bt,r&&(this._$AH=t);else{const s=t;let n,l;for(t=o[0],n=0;n<o.length-1;n++)l=At(this,s[i+n],e,n),l===bt&&(l=this._$AH[n]),r||(r=!at(l)||l!==this._$AH[n]),l===wt?t=wt:t!==wt&&(t+=(null!=l?l:"")+o[n+1]),this._$AH[n]=l}r&&!s&&this.j(t)}j(t){t===wt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class _t extends Ct{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===wt?void 0:t}}const Tt=tt?tt.emptyScript:"";class Nt extends Ct{constructor(){super(...arguments),this.type=4}j(t){t&&t!==wt?this.element.setAttribute(this.name,Tt):this.element.removeAttribute(this.name)}}class Dt extends Ct{constructor(t,e,i,s,o){super(t,e,i,s,o),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=At(this,t,e,0))&&void 0!==i?i:wt)===bt)return;const s=this._$AH,o=t===wt&&s!==wt||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==wt&&(s===wt||o);o&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class It{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){At(this,t)}}const Rt=J.litHtmlPolyfillSupport;null==Rt||Rt(Ot,zt),(null!==(X=J.litHtmlVersions)&&void 0!==X?X:J.litHtmlVersions=[]).push("2.8.0");
24
- /**
25
- * @license
26
- * Copyright 2017 Google LLC
27
- * SPDX-License-Identifier: BSD-3-Clause
28
- */
29
- var Ut,Pt;class Lt extends y{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{var s,o;const r=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:e;let n=r._$litPart$;if(void 0===n){const t=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:null;r._$litPart$=n=new zt(e.insertBefore(lt(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return bt}}Lt.finalized=!0,Lt._$litElement$=!0,null===(Ut=globalThis.litElementHydrateSupport)||void 0===Ut||Ut.call(globalThis,{LitElement:Lt});const Ft=globalThis.litElementPolyfillSupport;null==Ft||Ft({LitElement:Lt}),(null!==(Pt=globalThis.litElementVersions)&&void 0!==Pt?Pt:globalThis.litElementVersions=[]).push("3.3.3");
30
- /**
31
- * @license
32
- * Copyright 2017 Google LLC
33
- * SPDX-License-Identifier: BSD-3-Clause
34
- */
35
- const Mt=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};
36
- /**
37
- * @license
38
- * Copyright 2017 Google LLC
39
- * SPDX-License-Identifier: BSD-3-Clause
40
- */function Bt(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):Mt(t,e)
41
- /**
42
- * @license
43
- * Copyright 2017 Google LLC
44
- * SPDX-License-Identifier: BSD-3-Clause
45
- */}
46
- /**
47
- * @license
48
- * Copyright 2017 Google LLC
49
- * SPDX-License-Identifier: BSD-3-Clause
50
- */
51
- function jt(t,e){return(({finisher:t,descriptor:e})=>(i,s)=>{var o;if(void 0===s){const s=null!==(o=i.originalKey)&&void 0!==o?o:i.key,r=null!=e?{kind:"method",placement:"prototype",key:s,descriptor:e(i.key)}:{...i,key:s};return null!=t&&(r.finisher=function(e){t(e,s)}),r}{const o=i.constructor;void 0!==e&&Object.defineProperty(i,s,e(s)),null==t||t(o,s)}})({descriptor:i=>{const s={get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t))&&void 0!==i?i:null},enumerable:!0,configurable:!0};if(e){const e="symbol"==typeof i?Symbol():"__"+i;s.get=function(){var i,s;return void 0===this[e]&&(this[e]=null!==(s=null===(i=this.renderRoot)||void 0===i?void 0:i.querySelector(t))&&void 0!==s?s:null),this[e]}}return s}})}
52
- /**
53
- * @license
54
- * Copyright 2021 Google LLC
55
- * SPDX-License-Identifier: BSD-3-Clause
56
- */var Vt;null===(Vt=window.HTMLSlotElement)||void 0===Vt||Vt.prototype.assignedElements;const Ht=((t,...e)=>{const s=1===t.length?t[0]:e.reduce(((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1]),t[0]);return new o(s,t,i)})`
57
- :host {
58
- /* Layout and sizing */
59
- --nuraly-select-local-min-height: 40px;
60
- --nuraly-select-local-padding-top: 8px;
61
- --nuraly-select-local-padding-bottom: 8px;
62
- --nuraly-select-local-padding-left: 12px;
63
- --nuraly-select-local-padding-right: 12px;
64
- --nuraly-select-local-wrapper-margin: 0;
65
- --nuraly-select-local-border-radius: 6px;
66
- --nuraly-select-local-border-width: 1px;
67
-
68
- /* Dropdown settings */
69
- --nuraly-select-local-dropdown-z-index: 9999;
70
- --nuraly-select-local-dropdown-max-height: 200px;
71
- --nuraly-select-local-dropdown-width: max-content; /* Default to auto-size to content */
72
- --nuraly-select-local-placeholder-font-size: 14px;
73
- --nuraly-select-local-option-font-size: 14px;
74
-
75
- /* Sizes */
76
- --nuraly-select-local-medium-height: 40px;
77
- --nuraly-select-local-medium-font-size: 14px;
78
- --nuraly-select-local-medium-padding: 8px 12px;
79
- --nuraly-select-local-small-font-size: 12px;
80
-
81
- /* Animation and transitions */
82
- --nuraly-select-local-dropdown-animation-duration: 0.15s;
83
-
84
- /* Multi-select specific */
85
- --nuraly-select-local-tag-border-radius: 4px;
86
- --nuraly-select-local-tag-padding: 2px 6px;
87
- --nuraly-select-local-tag-margin: 2px;
88
-
89
- /* Validation message */
90
- --nuraly-select-local-message-font-size: 12px;
91
- --nuraly-select-local-message-margin-top: 4px;
92
- }
93
-
94
- :host {
95
- width: fit-content;
96
- display: block;
97
- font-family: var(--nuraly-select-font-family, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif);
98
- font-size: var(--nuraly-select-font-size, 14px);
99
- line-height: var(--nuraly-select-line-height, 1.5);
100
- margin: var(--nuraly-select-margin, var(--nuraly-select-local-wrapper-margin));
101
- }
102
-
103
- /* Host attribute selectors for configuration */
104
- :host([disabled]) {
105
- opacity: var(--nuraly-select-disabled-opacity, 0.5);
106
- pointer-events: none;
107
- }
108
-
109
- :host([disabled]) .wrapper {
110
- background-color: var(--nuraly-select-disabled-background, #f9fafb);
111
- border-color: var(--nuraly-select-disabled-border-color, #d9d9d9);
112
- color: var(--nuraly-select-disabled-text-color, #8c8c8c);
113
- cursor: not-allowed;
114
- }
115
-
116
- /* Size variants */
117
- :host([size='small']) .wrapper {
118
- height: var(--nuraly-select-small-height, 24px);
119
- min-height: var(--nuraly-select-small-height, 24px);
120
- font-size: var(--nuraly-select-small-font-size, var(--nuraly-select-local-small-font-size));
121
- }
122
-
123
- :host([size='small']) .select-trigger {
124
- padding: var(--nuraly-select-small-padding, 2px 8px);
125
- padding-right: calc(var(--nuraly-select-icon-size, 16px) + 20px);
126
- }
127
-
128
- :host([size='medium']) .wrapper {
129
- min-height: var(--nuraly-select-medium-height, var(--nuraly-select-local-medium-height));
130
- font-size: var(--nuraly-select-medium-font-size, var(--nuraly-select-local-medium-font-size));
131
- }
132
-
133
- :host([size='medium']) .select-trigger {
134
- padding: var(--nuraly-select-medium-padding, var(--nuraly-select-local-medium-padding));
135
- padding-right: calc(var(--nuraly-select-icon-size, 16px) + 20px);
136
- }
137
-
138
- :host([size='large']) .wrapper {
139
- min-height: var(--nuraly-select-large-height, 48px);
140
- font-size: var(--nuraly-select-large-font-size, 16px);
141
- }
142
-
143
- :host([size='large']) .select-trigger {
144
- padding: var(--nuraly-select-large-padding, 12px 16px);
145
- padding-right: calc(var(--nuraly-select-icon-size, 16px) + 20px);
146
- }
147
-
148
- /* Status variants */
149
- :host([status='error']) .wrapper {
150
- border-color: var(--nuraly-select-error-border-color, #ef4444);
151
- }
152
-
153
- :host([status='warning']) .wrapper {
154
- border-color: var(--nuraly-select-warning-border-color, #f59e0b);
155
- }
156
-
157
- :host([status='success']) .wrapper {
158
- border-color: var(--nuraly-select-success-border-color, #10b981);
159
- }
160
-
161
- /* Type variants */
162
- :host([type='inline']) {
163
- display: flex;
164
- align-items: center;
165
- gap: 8px;
166
- }
167
-
168
- :host([type='inline']) .wrapper {
169
- flex: 1;
170
- }
171
-
172
- /* Block (full width) */
173
- :host([block]) {
174
- width: 100%;
175
- }
176
-
177
- :host([block]) .wrapper {
178
- width: 100%;
179
- }
180
-
181
- /* Show dropdown */
182
- :host([show]) .options {
183
- display: flex !important;
184
- }
185
-
186
- /* Main wrapper container */
187
- .wrapper {
188
- position: relative;
189
- width: var(--nuraly-select-width, fit-content);
190
- background-color: var(--nuraly-select-background-color, #ffffff);
191
- border: var(--nuraly-select-border-width, var(--nuraly-select-local-border-width)) solid
192
- var(--nuraly-select-border-color, #d9d9d9);
193
- border-radius: var(--nuraly-select-border-radius, var(--nuraly-select-local-border-radius));
194
- transition: all var(--nuraly-select-transition-duration, 0.2s)
195
- var(--nuraly-select-transition-timing, ease-in-out);
196
- cursor: pointer;
197
- outline: none;
198
- margin: var(--nuraly-select-wrapper-margin, 0);
199
- min-height: var(--nuraly-select-min-height, var(--nuraly-select-local-min-height));
200
- box-sizing: border-box;
201
- display: flex;
202
- align-items: center;
203
- /* Ensure dropdown can overflow the wrapper */
204
- overflow: visible;
205
- }
206
-
207
- .wrapper:hover:not(:disabled) {
208
- border-color: var(--nuraly-select-border-hover, #7c3aed);
209
- }
210
-
211
- .wrapper:focus,
212
- .wrapper:focus-within {
213
- border-color: var(--nuraly-select-border-focus, #7c3aed);
214
- box-shadow: 0 0 0 2px var(--nuraly-select-focus-outline, rgba(124, 58, 237, 0.2));
215
- }
216
-
217
- /* Select container */
218
- .select {
219
- display: flex;
220
- flex-direction: column;
221
- }
222
-
223
- /* Select trigger (main display area) */
224
- .select-trigger {
225
- display: flex;
226
- align-items: center;
227
- padding: var(--nuraly-select-padding-top, var(--nuraly-select-local-padding-top))
228
- calc(var(--nuraly-select-icon-size, 16px) + 20px)
229
- var(--nuraly-select-padding-bottom, var(--nuraly-select-local-padding-bottom))
230
- var(--nuraly-select-padding-left, var(--nuraly-select-local-padding-left));
231
- color: var(--nuraly-select-text-color, #262626);
232
- font-size: inherit;
233
- line-height: inherit;
234
- word-break: break-word;
235
- flex: 1;
236
- min-height: 0;
237
- flex-wrap: wrap;
238
- gap: var(--nuraly-select-tag-margin, var(--nuraly-select-local-tag-margin));
239
- box-sizing: border-box;
240
- }
241
-
242
- .select-trigger:empty:before {
243
- content: attr(data-placeholder);
244
- color: var(--nuraly-select-placeholder-color, #8c8c8c);
245
- font-size: var(--nuraly-select-placeholder-font-size, var(--nuraly-select-local-placeholder-font-size));
246
- }
247
-
248
- /* Multi-select tags */
249
- .tag {
250
- display: inline-flex;
251
- align-items: center;
252
- gap: 4px;
253
- background-color: var(--nuraly-select-tag-background, var(--nuraly-select-local-tag-background));
254
- color: var(--nuraly-select-tag-color, var(--nuraly-select-local-tag-color));
255
- padding: var(--nuraly-select-tag-padding, var(--nuraly-select-local-tag-padding));
256
- border-radius: var(--nuraly-select-tag-border-radius, var(--nuraly-select-local-tag-border-radius));
257
- font-size: calc(var(--nuraly-select-font-size, var(--nuraly-select-local-font-size)) - 1px);
258
- max-width: 100%;
259
- }
260
-
261
- .tag-label {
262
- overflow: hidden;
263
- text-overflow: ellipsis;
264
- white-space: nowrap;
265
- }
266
-
267
- .tag-close {
268
- color: var(--nuraly-select-tag-close-color, var(--nuraly-select-local-tag-close-color));
269
- cursor: pointer;
270
- display: flex;
271
- align-items: center;
272
- justify-content: center;
273
- width: var(--nuraly-select-icon-size, var(--nuraly-select-local-icon-size));
274
- height: var(--nuraly-select-icon-size, var(--nuraly-select-local-icon-size));
275
- border-radius: 50%;
276
- transition: color var(--nuraly-select-transition-duration, var(--nuraly-select-local-transition-duration));
277
- }
278
-
279
- .tag-close:hover {
280
- color: var(--nuraly-select-tag-close-hover-color, var(--nuraly-select-local-tag-close-hover-color));
281
- }
282
-
283
- /* Icons container */
284
- .icons-container {
285
- position: absolute;
286
- top: 50%;
287
- right: 12px;
288
- transform: translateY(-50%);
289
- display: flex;
290
- align-items: center;
291
- gap: 4px;
292
- pointer-events: none;
293
- }
294
-
295
- .icons-container nr-icon {
296
- --nuraly-icon-width: var(--nuraly-select-icon-size, var(--nuraly-select-local-icon-size));
297
- --nuraly-icon-color: var(--nuraly-select-icon-color, var(--nuraly-select-local-icon-color));
298
- pointer-events: auto;
299
- cursor: pointer;
300
- transition: color var(--nuraly-select-transition-duration, var(--nuraly-select-local-transition-duration));
301
- }
302
-
303
- .icons-container nr-icon:hover {
304
- --nuraly-icon-color: var(--nuraly-select-icon-hover-color, var(--nuraly-select-local-icon-hover-color));
305
- }
306
-
307
- .arrow-icon {
308
- --nuraly-icon-width: var(--nuraly-select-arrow-icon-size, var(--nuraly-select-local-arrow-icon-size));
309
- transition: transform var(--nuraly-select-transition-duration, var(--nuraly-select-local-transition-duration));
310
- pointer-events: none !important;
311
- }
312
-
313
- :host([show]) .arrow-icon {
314
- transform: rotate(180deg);
315
- }
316
-
317
- /* Dropdown options */
318
- .options {
319
- /* Default positioning - will be overridden by controller when opened */
320
- position: absolute;
321
- top: 100%;
322
- margin-top: 1px;
323
- left: 0;
324
- right: 0;
325
- background-color: var(--nuraly-select-dropdown-background, #ffffff);
326
- border: var(--nuraly-select-dropdown-border-width, var(--nuraly-select-border-width, 1px)) solid
327
- var(--nuraly-select-dropdown-border-color, #d9d9d9);
328
- border-radius: var(--nuraly-select-dropdown-border-radius, var(--nuraly-select-border-radius, 6px));
329
- box-shadow: var(--nuraly-select-dropdown-shadow, 0 6px 16px 0 rgba(0, 0, 0, 0.08));
330
- z-index: var(--nuraly-select-dropdown-z-index, 9999);
331
- max-height: var(--nuraly-select-dropdown-max-height, 200px);
332
- overflow-y: auto;
333
- overflow-x: hidden;
334
- display: none;
335
- flex-direction: column;
336
- animation: dropdown-enter var(--nuraly-select-dropdown-animation-duration, 0.15s) ease-out;
337
- /* Ensure proper containment and exact wrapper width */
338
- box-sizing: border-box;
339
- /* Allow overriding width via either of these custom props */
340
- width: var(
341
- --nuraly-select-dropdown-width,
342
- var(--select-dropdown-width, var(--nuraly-select-local-dropdown-width))
343
- );
344
- min-width: 100%; /* Ensure dropdown is at least as wide as the wrapper */
345
- /* Create new stacking context to prevent layering issues */
346
- isolation: isolate;
347
- /* Ensure solid background to prevent visual bleed-through */
348
- backdrop-filter: none;
349
- -webkit-backdrop-filter: none;
350
- /* Force above other elements */
351
- transform: translateZ(0);
352
- }
353
-
354
- .options.placement-top {
355
- top: auto;
356
- bottom: 100%;
357
- margin-bottom: 1px;
358
- margin-top: 0;
359
- animation: dropdown-enter-top var(--nuraly-select-dropdown-animation-duration, var(--nuraly-select-local-dropdown-animation-duration)) ease-out;
360
- }
361
-
362
- @keyframes dropdown-enter {
363
- from {
364
- opacity: 0;
365
- transform: translateY(-8px);
366
- }
367
- to {
368
- opacity: 1;
369
- transform: translateY(0);
370
- }
371
- }
372
-
373
- @keyframes dropdown-enter-top {
374
- from {
375
- opacity: 0;
376
- transform: translateY(8px);
377
- }
378
- to {
379
- opacity: 1;
380
- transform: translateY(0);
381
- }
382
- }
383
-
384
- /* Search container - sticky at top of dropdown */
385
- .search-container {
386
- position: sticky;
387
- top: 0;
388
- z-index: 10;
389
- background-color: var(--nuraly-select-dropdown-background, #ffffff);
390
- border-bottom: var(--nuraly-select-border-width, 1px) solid
391
- var(--nuraly-select-dropdown-border-color, #d9d9d9);
392
- padding: 8px;
393
- margin: 0;
394
- /* Ensure it stays above options during scroll */
395
- backdrop-filter: blur(8px);
396
- -webkit-backdrop-filter: blur(8px);
397
- /* Ensure proper stacking and smooth scrolling */
398
- will-change: transform;
399
- transform: translateZ(0);
400
- }
401
-
402
- /* Search input styling */
403
- .search-container .search-input {
404
- width: 100%;
405
- --nuraly-input-border-radius: var(--nuraly-select-border-radius, var(--nuraly-select-local-border-radius));
406
- --nuraly-input-background-color: var(--nuraly-select-background-color, var(--nuraly-select-local-background-color));
407
- --nuraly-input-border-color: var(--nuraly-select-border-color, var(--nuraly-select-local-border-color));
408
- --nuraly-input-text-color: var(--nuraly-select-text-color, var(--nuraly-select-local-text-color));
409
- --nuraly-input-placeholder-color: var(--nuraly-select-placeholder-color, var(--nuraly-select-local-placeholder-color));
410
- }
411
-
412
- /* Search icon in the search input */
413
- .search-container .search-icon {
414
- --nuraly-icon-color: var(--nuraly-select-icon-color, var(--nuraly-select-local-icon-color));
415
- }
416
-
417
- /* Options list container - ensure proper scroll behavior with sticky search */
418
- .options:has(.search-container) {
419
- /* Add small padding-top when search is present to ensure proper separation */
420
- padding-top: 0;
421
- }
422
-
423
- /* Option items */
424
- .option {
425
- display: flex;
426
- align-items: center;
427
- gap: 8px;
428
- padding: var(--nuraly-select-option-padding, 8px 12px);
429
- min-height: var(--nuraly-select-option-min-height, auto);
430
- color: var(--nuraly-select-option-text-color, var(--nuraly-select-text-color, #262626));
431
- font-size: var(--nuraly-select-option-font-size, 14px);
432
- cursor: pointer;
433
- transition: background-color var(--nuraly-select-transition-duration, 0.2s);
434
- position: relative;
435
- }
436
-
437
- /* First option after search container should have no extra margin */
438
- .search-container + .option {
439
- margin-top: 0;
440
- }
441
-
442
- .option:hover {
443
- background-color: var(--nuraly-select-option-hover-background, #f5f5f5);
444
- }
445
-
446
- .option.selected {
447
- background-color: var(--nuraly-select-option-selected-background, #e0e0e0);
448
- color: var(--nuraly-select-option-selected-color, #7c3aed);
449
- }
450
-
451
- .option.focused {
452
- background-color: var(--nuraly-select-option-hover-background, #f5f5f5);
453
- outline: 2px solid var(--nuraly-select-border-focus, #7c3aed);
454
- outline-offset: -2px;
455
- }
456
-
457
- .option.disabled {
458
- opacity: var(--nuraly-select-disabled-opacity, var(--nuraly-select-local-disabled-opacity));
459
- cursor: not-allowed;
460
- }
461
-
462
- .option-content {
463
- flex: 1;
464
- display: flex;
465
- align-items: center;
466
- gap: 8px;
467
- }
468
-
469
- .option-icon {
470
- --nuraly-icon-width: var(--nuraly-select-icon-size, var(--nuraly-select-local-icon-size));
471
- --nuraly-icon-color: currentColor;
472
- }
473
-
474
- .option-text {
475
- flex: 1;
476
- overflow: hidden;
477
- text-overflow: ellipsis;
478
- white-space: nowrap;
479
- }
480
-
481
- .option-description {
482
- font-size: calc(var(--nuraly-select-option-font-size, var(--nuraly-select-local-option-font-size)) - 1px);
483
- opacity: 0.7;
484
- margin-top: 2px;
485
- }
486
-
487
- .check-icon {
488
- --nuraly-icon-width: var(--nuraly-select-icon-size, var(--nuraly-select-local-icon-size));
489
- --nuraly-icon-color: var(--nuraly-select-option-selected-color, var(--nuraly-select-local-option-selected-color));
490
- }
491
-
492
- .no-options {
493
- display: flex;
494
- align-items: center;
495
- justify-content: center;
496
- padding: var(--select-no-options-padding, 24px 16px);
497
- color: var(--select-no-options-color, #8c8c8c);
498
- font-size: var(--nuraly-select-option-font-size, var(--nuraly-select-local-option-font-size));
499
- cursor: default;
500
- user-select: none;
501
- }
502
-
503
- .no-options-content {
504
- display: flex;
505
- flex-direction: column;
506
- align-items: center;
507
- gap: var(--select-no-options-gap, 8px);
508
- text-align: center;
509
- }
510
-
511
- .no-options-icon {
512
- --nuraly-icon-width: 24px;
513
- --nuraly-icon-color: var(--select-no-options-icon-color, #d9d9d9);
514
- opacity: 0.8;
515
- }
516
-
517
- .no-options-text {
518
- font-size: var(--nuraly-select-option-font-size, var(--nuraly-select-local-option-font-size));
519
- color: var(--select-no-options-color, #8c8c8c);
520
- line-height: 1.4;
521
- }
522
-
523
- /* Validation message */
524
- .validation-message {
525
- display: block;
526
- margin-top: var(--nuraly-select-message-margin-top, var(--nuraly-select-local-message-margin-top));
527
- font-size: var(--nuraly-select-message-font-size, var(--nuraly-select-local-message-font-size));
528
- color: var(--nuraly-select-error-message-color, var(--nuraly-select-local-error-message-color));
529
- }
530
-
531
- .validation-message.warning {
532
- color: var(--nuraly-select-warning-message-color, var(--nuraly-select-local-warning-message-color));
533
- }
534
-
535
- .validation-message.success {
536
- color: var(--nuraly-select-success-message-color, var(--nuraly-select-local-success-message-color));
537
- }
538
-
539
- /* Slotted content styles */
540
- ::slotted([slot='label']) {
541
- display: block;
542
- margin-bottom: 4px;
543
- font-weight: 500;
544
- color: var(--nuraly-select-text-color, var(--nuraly-select-local-text-color));
545
- }
546
-
547
- ::slotted([slot='helper-text']) {
548
- display: block;
549
- margin-top: var(--nuraly-select-message-margin-top, var(--nuraly-select-local-message-margin-top));
550
- font-size: var(--nuraly-select-message-font-size, var(--nuraly-select-local-message-font-size));
551
- color: var(--nuraly-select-placeholder-color, var(--nuraly-select-local-placeholder-color));
552
- }
553
-
554
- /* Accessibility improvements */
555
- @media (prefers-reduced-motion: reduce) {
556
- .options,
557
- .wrapper,
558
- .tag-close,
559
- .arrow-icon,
560
- .option {
561
- transition: none;
562
- animation: none;
563
- }
564
- }
565
-
566
- /* High contrast mode support */
567
- @media (prefers-contrast: high) {
568
- .wrapper {
569
- border-width: 2px;
570
- }
571
-
572
- .wrapper:focus,
573
- .wrapper:focus-within {
574
- outline: 3px solid;
575
- }
576
- }
577
- `
578
- /**
579
- * @license
580
- * Copyright 2021 Google LLC
581
- * SPDX-License-Identifier: BSD-3-Clause
582
- */;function*Wt(t,e){if(void 0!==t){let i=0;for(const s of t)yield e(s,i++)}}
583
- /**
584
- * @license
585
- * Copyright 2021 Google LLC
586
- * SPDX-License-Identifier: BSD-3-Clause
587
- */const Gt=1,Kt=t=>(...e)=>({_$litDirective$:t,values:e});
588
- /**
589
- * @license
590
- * Copyright 2017 Google LLC
591
- * SPDX-License-Identifier: BSD-3-Clause
592
- */class qt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
593
- /**
594
- * @license
595
- * Copyright 2018 Google LLC
596
- * SPDX-License-Identifier: BSD-3-Clause
597
- */const Yt=Kt(class extends qt{constructor(t){var e;if(super(t),t.type!==Gt||"class"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){var i,s;if(void 0===this.it){this.it=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!(null===(i=this.nt)||void 0===i?void 0:i.has(t))&&this.it.add(t);return this.render(e)}const o=t.element.classList;this.it.forEach((t=>{t in e||(o.remove(t),this.it.delete(t))}));for(const t in e){const i=!!e[t];i===this.it.has(t)||(null===(s=this.nt)||void 0===s?void 0:s.has(t))||(i?(o.add(t),this.it.add(t)):(o.remove(t),this.it.delete(t)))}return U}}),Zt="important",Qt=" !"+Zt,Xt=Kt(class extends qt{constructor(t){var e;if(super(t),t.type!==Gt||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,i)=>{const s=t[i];return null==s?e:e+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(t,[e]){const{style:i}=t.element;if(void 0===this.ht){this.ht=new Set;for(const t in e)this.ht.add(t);return this.render(e)}this.ht.forEach((t=>{null==e[t]&&(this.ht.delete(t),t.includes("-")?i.removeProperty(t):i[t]="")}));for(const t in e){const s=e[t];if(null!=s){this.ht.add(t);const e="string"==typeof s&&s.endsWith(Qt);t.includes("-")||e?i.setProperty(t,e?s.slice(0,-11):s,e?Zt:""):i[t]=s}}return U}}),Jt=t=>class extends t{constructor(){super(...arguments),this.handleSystemThemeChange=()=>{this.closest("[data-theme]")||document.documentElement.hasAttribute("data-theme")||this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setupThemeObserver(),this.setupDesignSystemObserver(),this.setupSystemThemeListener()}disconnectedCallback(){var t,e,i;super.disconnectedCallback(),null===(t=this.themeObserver)||void 0===t||t.disconnect(),null===(e=this.designSystemObserver)||void 0===e||e.disconnect(),null===(i=this.mediaQuery)||void 0===i||i.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var t,e;const i=(null===(t=this.closest("[data-theme]"))||void 0===t?void 0:t.getAttribute("data-theme"))||document.documentElement.getAttribute("data-theme");return i||((null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light")}get currentDesignSystem(){var t;const e=(null===(t=this.closest("[design-system]"))||void 0===t?void 0:t.getAttribute("design-system"))||document.documentElement.getAttribute("design-system");return"carbon"===e?e:"default"}setupThemeObserver(){this.themeObserver=new MutationObserver((()=>{this.requestUpdate()})),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}setupDesignSystemObserver(){this.designSystemObserver=new MutationObserver((()=>{this.requestUpdate()})),this.designSystemObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["design-system"]})}setupSystemThemeListener(){window.matchMedia&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.mediaQuery.addEventListener("change",this.handleSystemThemeChange))}},te=()=>{var t;return void 0!==globalThis.litElementVersions||"undefined"!=typeof process&&"development"===(null===(t=process.env)||void 0===t?void 0:t.NODE_ENV)||"undefined"!=typeof window&&("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname)},ee=t=>class extends t{constructor(){super(...arguments),this.requiredComponents=[]}validateDependencies(){if(te())for(const t of this.requiredComponents)if(!this.isComponentAvailable(t))throw new Error(`Required component "${t}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}. Example: import '@nuralyui/${t}';`)}validateDependenciesWithHandler(t){if(!te())return!0;let e=!0;for(const i of this.requiredComponents)if(!this.isComponentAvailable(i)){e=!1;const s=new Error(`Required component "${i}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}.`);t?t(i,s):console.error(s.message)}return e}isComponentAvailable(t){return!!customElements.get(t)}getMissingDependencies(){return this.requiredComponents.filter((t=>!this.isComponentAvailable(t)))}areDependenciesAvailable(){return this.requiredComponents.every((t=>this.isComponentAvailable(t)))}addRequiredComponent(t){this.requiredComponents.includes(t)||this.requiredComponents.push(t)}removeRequiredComponent(t){const e=this.requiredComponents.indexOf(t);e>-1&&this.requiredComponents.splice(e,1)}},ie=t=>class extends t{dispatchCustomEvent(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchEventWithMetadata(t,e){var i;const s=Object.assign(Object.assign({},e),{timestamp:Date.now(),componentName:(null===(i=this.tagName)||void 0===i?void 0:i.toLowerCase())||"unknown"});this.dispatchCustomEvent(t,s)}dispatchInputEvent(t,e){const i=Object.assign({target:e.target||this,value:e.value,originalEvent:e.originalEvent},e);this.dispatchCustomEvent(t,i)}dispatchFocusEvent(t,e){const i=Object.assign({target:e.target||this,value:e.value,focused:e.focused,cursorPosition:e.cursorPosition,selectedText:e.selectedText},e);this.dispatchCustomEvent(t,i)}dispatchValidationEvent(t,e){var i;const s=Object.assign({target:e.target||this,value:e.value,isValid:null!==(i=e.isValid)&&void 0!==i&&i,error:e.error},e);this.dispatchCustomEvent(t,s)}dispatchActionEvent(t,e){const i=Object.assign({target:e.target||this,action:e.action,previousValue:e.previousValue,newValue:e.newValue},e);this.dispatchCustomEvent(t,i)}isReadonlyKeyAllowed(t){if(t.ctrlKey||t.metaKey){return["KeyA","KeyC"].includes(t.code)}return["Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key)}isActivationKey(t){return"Enter"===t.key||" "===t.key}};
598
- /**
599
- * @license
600
- * Copyright 2018 Google LLC
601
- * SPDX-License-Identifier: BSD-3-Clause
602
- */var se,oe,re,ne,le,ae,ce,he,de;!function(t){t.Default="default",t.Inline="inline",t.Button="button",t.Slot="slot"}(se||(se={})),function(t){t.Default="default",t.Warning="warning",t.Error="error",t.Success="success"}(oe||(oe={})),function(t){t.Small="small",t.Medium="medium",t.Large="large"}(re||(re={})),function(t){t.Small="small",t.Medium="medium",t.Large="large"}(ne||(ne={})),function(t){t.Horizontal="horizontal",t.Vertical="vertical"}(le||(le={})),function(t){t.Default="default",t.Solid="solid",t.Outline="outline",t.Borderless="borderless"}(ae||(ae={})),function(t){t.Bottom="bottom",t.Top="top",t.Auto="auto"}(ce||(ce={})),function(t){t.None="none",t.StartsWith="starts-with",t.Contains="contains",t.Fuzzy="fuzzy"}(he||(he={}));class ue{constructor(t){this._host=t,this._host.addController(this)}get host(){return this._host}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}handleError(t,e){console.error(`[SelectController:${this.constructor.name}] Error in ${e}:`,t),this._host.dispatchEvent(new CustomEvent("nr-select-error",{detail:{error:t.message,context:e,controller:this.constructor.name},bubbles:!0,composed:!0}))}requestUpdate(){try{this._host.requestUpdate()}catch(t){this.handleError(t,"requestUpdate")}}dispatchEvent(t){try{return this._host.dispatchEvent(t)}catch(t){return this.handleError(t,"dispatchEvent"),!1}}}class pe extends ue{constructor(){super(...arguments),this._selectedOptions=[],this._initialized=!1}getSelectedOptions(){return[...this._selectedOptions]}getSelectedOption(){return this._selectedOptions[0]}selectOption(t){try{if(this.isOptionDisabled(t))return;const e=this.host.multiple,i=this.getCurrentValue();e?this.isOptionSelected(t)||(this._selectedOptions=[...this._selectedOptions,t],this.updateHostValue(),this.dispatchChangeEvent(i)):(this.isOptionSelected(t)?this._selectedOptions=[]:this._selectedOptions=[t],this.updateHostValue(),this.dispatchChangeEvent(i)),this.requestUpdate()}catch(t){this.handleError(t,"selectOption")}}unselectOption(t){try{if(this.isOptionSelected(t)){const e=this.getCurrentValue();this._selectedOptions=this._selectedOptions.filter((e=>e.value!==t.value)),this.updateHostValue(),this.dispatchChangeEvent(e),this.requestUpdate()}}catch(t){this.handleError(t,"unselectOption")}}clearSelection(){try{if(this._selectedOptions.length>0){const t=this.getCurrentValue();this._selectedOptions=[],this.updateHostValue(),this.dispatchChangeEvent(t),this.requestUpdate()}}catch(t){this.handleError(t,"clearSelection")}}isOptionSelected(t){return this._selectedOptions.some((e=>e.value===t.value))}isOptionDisabled(t){return Boolean(t.disabled)||this.host.disabled}toggleOption(t){this.isOptionSelected(t)?this.unselectOption(t):this.selectOption(t)}initializeFromValue(){try{if(this._initialized)return;const t=this.host.value;if(!t||Array.isArray(t)&&0===t.length)return;const e=Array.isArray(t)?t:[t],i=this.host.options.filter((t=>e.includes(t.value)));i.length>0&&(this._selectedOptions=this.host.multiple?i:[i[0]],this.requestUpdate()),this._initialized=!0}catch(t){this.handleError(t,"initializeFromValue")}}updateHostValue(){var t;const e=this.host.multiple?this._selectedOptions.map((t=>t.value)):(null===(t=this._selectedOptions[0])||void 0===t?void 0:t.value)||"",i=this.host.value;let s=!1;if(this.host.multiple){const t=Array.isArray(i)?i:[],o=Array.isArray(e)?e:[];s=t.length===o.length&&t.every(((t,e)=>t===o[e]))}else s=i===e;s||(this.host.value=e)}getCurrentValue(){var t;return this.host.multiple?this._selectedOptions.map((t=>t.value)):(null===(t=this._selectedOptions[0])||void 0===t?void 0:t.value)||""}dispatchChangeEvent(t){const e={value:this.getCurrentValue(),selectedOptions:this.getSelectedOptions(),previousValue:t};this.dispatchEvent(new CustomEvent("nr-change",{detail:e,bubbles:!0,composed:!0}))}hostUpdated(){this.syncWithHostOptions()}syncWithHostOptions(){try{this._selectedOptions=this._selectedOptions.filter((t=>this.host.options.some((e=>e.value===t.value)))),this._selectedOptions=this._selectedOptions.map((t=>this.host.options.find((e=>e.value===t.value))||t)),this.updateHostValue()}catch(t){this.handleError(t,"syncWithHostOptions")}}}class ve extends ue{constructor(t,e,i){super(t),this.selectionController=e,this.dropdownController=i,this._focusedIndex=-1,this._hasKeyboardNavigated=!1}handleKeyDown(t){try{const e=this.isSearchInputFocused();switch(t.key){case"ArrowDown":t.preventDefault(),this.dropdownController.isOpen?this.navigateNext():this.openDropdown();break;case"ArrowUp":t.preventDefault(),this.dropdownController.isOpen?this.navigatePrevious():this.openDropdown();break;case"Enter":this.dropdownController.isOpen?e&&this._focusedIndex>=0?(t.preventDefault(),this.selectFocused()):e||(t.preventDefault(),this.selectFocused()):(t.preventDefault(),this.openDropdown());break;case" ":e||(t.preventDefault(),this.dropdownController.isOpen?this.selectFocused():this.openDropdown());break;case"Escape":t.preventDefault(),this.closeDropdown();break;case"Tab":this.closeDropdown();break;case"Home":this.dropdownController.isOpen&&(t.preventDefault(),this.setFocusedIndex(0));break;case"End":this.dropdownController.isOpen&&(t.preventDefault(),this.setFocusedIndex(this.host.options.length-1));break;default:1===t.key.length&&/[a-zA-Z0-9]/.test(t.key)&&this.handleAlphanumericKey(t.key.toLowerCase())}}catch(t){this.handleError(t,"handleKeyDown")}}navigateNext(){try{const t=this.getNavigableOptions();if(0===t.length)return;if(this.isSearchInputFocused()&&(this._focusedIndex<0||!this._hasKeyboardNavigated))return this._hasKeyboardNavigated=!0,void this.setFocusedIndex(0);let e=this._focusedIndex+1;e>=t.length&&(e=0),this.setFocusedIndex(e)}catch(t){this.handleError(t,"navigateNext")}}navigatePrevious(){try{const t=this.getNavigableOptions();if(0===t.length)return;if(this.isSearchInputFocused()&&(this._focusedIndex<0||!this._hasKeyboardNavigated))return this._hasKeyboardNavigated=!0,void this.setFocusedIndex(t.length-1);let e=this._focusedIndex-1;e<0&&(e=t.length-1),this.setFocusedIndex(e)}catch(t){this.handleError(t,"navigatePrevious")}}selectFocused(){try{const t=this.getNavigableOptions()[this._focusedIndex];t&&!this.selectionController.isOptionDisabled(t)&&(this.selectionController.selectOption(t),this.host.multiple||this.closeDropdown())}catch(t){this.handleError(t,"selectFocused")}}openDropdown(){try{this.dropdownController.open(),this._hasKeyboardNavigated=!1,this._focusedIndex=-1}catch(t){this.handleError(t,"openDropdown")}}closeDropdown(){try{this.dropdownController.close(),this._focusedIndex=-1,this._hasKeyboardNavigated=!1}catch(t){this.handleError(t,"closeDropdown")}}setFocusedIndex(t){try{const e=this.getNavigableOptions();t>=0&&t<e.length&&(this._focusedIndex=t,this.dispatchFocusEvent(e[t],t),this.requestUpdate(),this.scrollToFocusedOption(t))}catch(t){this.handleError(t,"setFocusedIndex")}}scrollToFocusedOption(t){var e;try{const i=null===(e=this.host.shadowRoot)||void 0===e?void 0:e.querySelector(".options");if(!i)return;setTimeout((()=>{const e=i.querySelector(".option.focused");if(e)e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"});else{const e=40,s=i.clientHeight,o=i.scrollTop,r=t*e,n=r+e,l=o+s;r<o?i.scrollTo({top:r,behavior:"smooth"}):n>l&&i.scrollTo({top:n-s,behavior:"smooth"})}}),10)}catch(t){console.warn("Failed to scroll to focused option:",t)}}get focusedIndex(){return this._focusedIndex}get focusedOption(){return this.getNavigableOptions()[this._focusedIndex]}handleAlphanumericKey(t){try{const e=this.getNavigableOptions(),i=this._focusedIndex+1;for(let s=0;s<e.length;s++){const o=(i+s)%e.length;if(e[o].label.toLowerCase().startsWith(t)){this.setFocusedIndex(o),this.dropdownController.isOpen||this.openDropdown();break}}}catch(t){this.handleError(t,"handleAlphanumericKey")}}getNavigableOptions(){const t=this.host;if(!t.options||!Array.isArray(t.options))return[];let e=t.options;return t.searchable&&t.searchQuery&&"function"==typeof t.getFilteredOptions&&(e=t.getFilteredOptions()),e.filter((t=>!t.disabled))}dispatchFocusEvent(t,e){const i={focusedOption:t,focusedIndex:e};this.dispatchEvent(new CustomEvent("nr-select-focus",{detail:i,bubbles:!0,composed:!0}))}isSearchInputFocused(){var t;try{const e=this.host;if(!e.searchable)return!1;const i=null===(t=e.shadowRoot)||void 0===t?void 0:t.querySelector(".search-input");return!!i&&(document.activeElement===i||i.shadowRoot&&i.shadowRoot.querySelector("input")===i.shadowRoot.activeElement||i.contains(document.activeElement))}catch(t){return!1}}hostUpdated(){this.dropdownController.isOpen||-1===this._focusedIndex||(this._focusedIndex=-1)}}class ye extends ue{constructor(){super(...arguments),this._isOpen=!1,this._position={top:0,left:0,width:0,placement:"bottom"},this._dropdownElement=null,this._triggerElement=null,this.handleResize=()=>{this._isOpen&&this.calculatePosition()},this.handleScroll=()=>{var t;if(this._isOpen&&this._triggerElement){const e=this._triggerElement.getBoundingClientRect(),i=(null===(t=window.visualViewport)||void 0===t?void 0:t.height)||window.innerHeight;(e.bottom<0||e.top>i)&&this.close()}}}get isOpen(){return this._isOpen}get position(){return Object.assign({},this._position)}open(){try{this._isOpen||(this._isOpen=!0,this.host.show=!0,this.requestUpdate(),this.findElements(),setTimeout((()=>{this.calculatePosition()}),10),this.host&&"function"==typeof this.host.setupEventListeners&&setTimeout((()=>{this.host.setupEventListeners()}),50),this.focusSearchInput(),this.dispatchEvent(new CustomEvent("nr-dropdown-open",{bubbles:!0,composed:!0})))}catch(t){this.handleError(t,"open")}}close(){try{this._isOpen&&(this._isOpen=!1,this.host.show=!1,this.resetPosition(),this.requestUpdate(),this.host&&"function"==typeof this.host.removeEventListeners&&this.host.removeEventListeners(),this.dispatchEvent(new CustomEvent("nr-dropdown-close",{bubbles:!0,composed:!0})))}catch(t){this.handleError(t,"close")}}toggle(){this._isOpen?this.close():this.open()}focusSearchInput(){try{const t=this.host;t&&t.searchable&&setTimeout((()=>{var e;const i=null===(e=t.shadowRoot)||void 0===e?void 0:e.querySelector(".search-input");i&&"function"==typeof i.focus&&i.focus()}),100)}catch(t){console.warn("Failed to focus search input:",t)}}calculatePosition(){var t;try{if(this._dropdownElement&&this._triggerElement||this.findElements(),!this._dropdownElement||!this._triggerElement)return;const e=this._triggerElement.getBoundingClientRect(),i=((null===(t=window.visualViewport)||void 0===t?void 0:t.height)||window.innerHeight)-e.bottom,s=e.top,o=200,r=this.determineOptimalPlacement(o,s,i);this._position={left:0,width:0,placement:r,top:0},this.applyPosition()}catch(t){this.handleError(t,"calculatePosition")}}resetPosition(){try{if(this._dropdownElement){this._dropdownElement.style.removeProperty("position"),this._dropdownElement.style.removeProperty("top"),this._dropdownElement.style.removeProperty("left"),this._dropdownElement.style.removeProperty("width"),this._dropdownElement.style.removeProperty("min-width");this.host.maxHeight||this._dropdownElement.style.removeProperty("max-height"),this._dropdownElement.style.removeProperty("min-height"),this._dropdownElement.style.removeProperty("height"),this._dropdownElement.style.removeProperty("overflow-y"),this._dropdownElement.style.removeProperty("transform"),this._dropdownElement.style.removeProperty("display"),this._dropdownElement.style.removeProperty("opacity"),this._dropdownElement.style.removeProperty("visibility"),this._dropdownElement.style.removeProperty("z-index"),this._dropdownElement.classList.remove("placement-top","placement-bottom")}}catch(t){this.handleError(t,"resetPosition")}}setElements(t,e){this._dropdownElement=t,this._triggerElement=e}findElements(){try{const t=this._host;if(t.optionsElement&&t.wrapper)return this._dropdownElement=t.optionsElement,void(this._triggerElement=t.wrapper);t.shadowRoot&&(this._dropdownElement=t.shadowRoot.querySelector(".options"),this._triggerElement=t.shadowRoot.querySelector(".wrapper"))}catch(t){this.handleError(t,"findElements")}}determineOptimalPlacement(t,e,i){return i>=t?"bottom":e>=t||e>i?"top":"bottom"}applyPosition(){var t;try{if(!this._dropdownElement||!this._triggerElement)return;const e=this.host.maxHeight,{placement:i}=this._position,s=this._triggerElement.getBoundingClientRect(),o=s.width;this._dropdownElement.style.position="absolute",this._dropdownElement.style.left="0",this._dropdownElement.style.right="auto",this._dropdownElement.style.minWidth=`${o}px`,this._dropdownElement.style.removeProperty("width"),this._dropdownElement.style.zIndex="1000",this._dropdownElement.style.height="auto",e||(this._dropdownElement.style.maxHeight="none"),this._dropdownElement.style.minHeight="auto","bottom"===i?(this._dropdownElement.style.top="100%",this._dropdownElement.style.bottom="auto"):(this._dropdownElement.style.top="auto",this._dropdownElement.style.bottom="100%");const r=this._dropdownElement.scrollHeight,n=(null===(t=window.visualViewport)||void 0===t?void 0:t.height)||window.innerHeight;let l;l="bottom"===i?n-s.bottom-10:s.top-10,e?(this._dropdownElement.style.maxHeight=e,this._dropdownElement.style.overflowY="auto"):r>l?(this._dropdownElement.style.maxHeight=`${l}px`,this._dropdownElement.style.overflowY="auto"):(this._dropdownElement.style.maxHeight=`${r}px`,this._dropdownElement.style.overflowY="auto"),this._dropdownElement.classList.remove("placement-top","placement-bottom"),this._dropdownElement.classList.add(`placement-${i}`)}catch(t){this.handleError(t,"applyPosition")}}getAvailableSpace(){var t,e;if(!this._triggerElement)return{above:0,below:0,left:0,right:0};const i=this._triggerElement.getBoundingClientRect(),s=(null===(t=window.visualViewport)||void 0===t?void 0:t.height)||window.innerHeight,o=(null===(e=window.visualViewport)||void 0===e?void 0:e.width)||window.innerWidth;return{above:i.top,below:s-i.bottom,left:i.left,right:o-i.right}}hostConnected(){window.addEventListener("resize",this.handleResize),window.addEventListener("scroll",this.handleScroll,!0)}hostDisconnected(){window.removeEventListener("resize",this.handleResize),window.removeEventListener("scroll",this.handleScroll,!0)}}class fe extends ue{constructor(){super(...arguments),this._focusedIndex=-1,this._hasFocus=!1}get focusedIndex(){return this._focusedIndex}getFocusedOption(){if(this._focusedIndex>=0&&this._focusedIndex<this.host.options.length)return this.host.options[this._focusedIndex]}get hasFocus(){return this._hasFocus}setFocusedOption(t){try{t>=0&&t<this.host.options.length&&(this._focusedIndex=t,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-focus-change",{detail:{focusedIndex:t,focusedOption:this.getFocusedOption()},bubbles:!0,composed:!0})))}catch(t){this.handleError(t,"setFocusedOption")}}focus(){var t;try{const e=null===(t=this._host.shadowRoot)||void 0===t?void 0:t.querySelector(".wrapper");e&&(e.focus(),this._hasFocus=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-focus",{bubbles:!0,composed:!0})))}catch(t){this.handleError(t,"focus")}}blur(){var t;try{const e=null===(t=this._host.shadowRoot)||void 0===t?void 0:t.querySelector(".wrapper");e&&e.blur(),this._hasFocus=!1,this._focusedIndex=-1,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-blur",{bubbles:!0,composed:!0}))}catch(t){this.handleError(t,"blur")}}focusNext(){try{const t=this.getNextFocusableIndex(this._focusedIndex);-1!==t&&this.setFocusedOption(t)}catch(t){this.handleError(t,"focusNext")}}focusPrevious(){try{const t=this.getPreviousFocusableIndex(this._focusedIndex);-1!==t&&this.setFocusedOption(t)}catch(t){this.handleError(t,"focusPrevious")}}focusFirst(){try{const t=this.getNextFocusableIndex(-1);-1!==t&&this.setFocusedOption(t)}catch(t){this.handleError(t,"focusFirst")}}focusLast(){try{const t=this.getPreviousFocusableIndex(this.host.options.length);-1!==t&&this.setFocusedOption(t)}catch(t){this.handleError(t,"focusLast")}}clearFocus(){this._focusedIndex=-1,this._hasFocus=!1,this.requestUpdate()}handleFocus(){this._hasFocus=!0,this.requestUpdate()}handleBlur(){this._hasFocus=!1,this._focusedIndex=-1,this.requestUpdate()}getNextFocusableIndex(t){const e=this.host.options;for(let i=t+1;i<e.length;i++)if(!e[i].disabled)return i;for(let i=0;i<=t;i++)if(!e[i].disabled)return i;return-1}getPreviousFocusableIndex(t){const e=this.host.options;for(let i=t-1;i>=0;i--)if(!e[i].disabled)return i;for(let i=e.length-1;i>=t;i--)if(!e[i].disabled)return i;return-1}findOptionIndex(t){return this.host.options.findIndex((e=>e.value===t))}focusOptionByValue(t){const e=this.findOptionIndex(t);-1!==e&&this.setFocusedOption(e)}}!function(t){t.Valid="valid",t.Invalid="invalid",t.Pending="pending",t.Pristine="pristine"}(de||(de={}));class ge extends ue{constructor(t,e){super(t),this.selectionController=e,this._isValid=!0,this._validationMessage="",this._validationState=de.Pristine}get isValid(){return this._isValid}get validationMessage(){return this._validationMessage}get validationState(){return this._validationState}validate(){try{this._validationState=de.Pending;const t=this.selectionController.getSelectedOptions().length>0;return this.host.required&&!t?(this.setValidationResult(!1,"This field is required",de.Invalid),!1):(this.setValidationResult(!0,"",de.Valid),!0)}catch(t){return this.handleError(t,"validate"),this.setValidationResult(!1,"Validation error occurred",de.Invalid),!1}}reset(){try{this._isValid=!0,this._validationMessage="",this._validationState=de.Pristine,this.requestUpdate(),this.dispatchValidationEvent()}catch(t){this.handleError(t,"reset")}}getFormData(){var t;try{const e=this._host,i=e.name||e.getAttribute("name")||"select",s=this.selectionController.getSelectedOptions();return this.host.multiple?{[i]:s.map((t=>t.value))}:{[i]:(null===(t=s[0])||void 0===t?void 0:t.value)||""}}catch(t){return this.handleError(t,"getFormData"),{}}}checkValidity(){return this.validate()}reportValidity(){var t;const e=this.validate();if(!e){const e=null===(t=this._host.shadowRoot)||void 0===t?void 0:t.querySelector(".wrapper");e&&e.focus()}return e}setCustomValidity(t){try{t?this.setValidationResult(!1,t,de.Invalid):this.validate()}catch(t){this.handleError(t,"setCustomValidity")}}validateOnChange(){this._validationState!==de.Pristine&&this.validate()}validateOnBlur(){this._validationState===de.Pristine&&(this._validationState=de.Pending),this.validate()}setValidationResult(t,e,i){const s=this._isValid!==t||this._validationMessage!==e||this._validationState!==i;this._isValid=t,this._validationMessage=e,this._validationState=i,s&&(this.requestUpdate(),this.dispatchValidationEvent())}dispatchValidationEvent(){const t={isValid:this._isValid,validationMessage:this._validationMessage,validationState:this._validationState};this.dispatchEvent(new CustomEvent("nr-validation",{detail:t,bubbles:!0,composed:!0}))}hostUpdated(){this.validateOnChange()}getValidationClasses(){return{valid:this._isValid&&this._validationState===de.Valid,invalid:!this._isValid&&this._validationState===de.Invalid,pending:this._validationState===de.Pending,pristine:this._validationState===de.Pristine}}getAriaAttributes(){const t={};return this.host.required&&(t["aria-required"]="true"),this._isValid||(t["aria-invalid"]="true",this._validationMessage&&(t["aria-describedby"]="validation-message")),t}}class me extends ue{constructor(){super(...arguments),this._searchQuery="",this.handleSearchInput=t=>{this.setSearchQuery(t.detail.value||"")},this.handleSearchClear=()=>{this.clearSearch()},this.handleSearchKeyDown=t=>{if(["ArrowDown","ArrowUp","Enter","Home","End"].includes(t.key)){const e=this.host.keyboardController;e&&e.handleKeyDown(t)}else t.stopPropagation(),"Escape"===t.key&&(this.host.closeDropdown(),this.host.focus())}}get searchQuery(){return this._searchQuery}get hasSearch(){return""!==this._searchQuery.trim()}setSearchQuery(t){this._searchQuery=t,this.host.searchQuery=t,this.host.requestUpdate()}search(t){this.setSearchQuery(t)}clearSearch(){this.setSearchQuery("")}getFilteredOptions(t){if(!this.host.searchable||!this._searchQuery.trim())return t;const e=this._searchQuery.toLowerCase().trim();return t.filter((t=>t.label.toLowerCase().includes(e)||t.value.toLowerCase().includes(e)||t.description&&t.description.toLowerCase().includes(e)))}renderSearchInput(){return this.host.searchable?mt`
603
- <div class="search-container">
604
- <nr-input
605
- type="text"
606
- class="search-input"
607
- placeholder="${this.host.searchPlaceholder}"
608
- .value="${this._searchQuery}"
609
- allowClear
610
- @nr-input="${this.handleSearchInput}"
611
- @nr-clear="${this.handleSearchClear}"
612
- @keydown="${this.handleSearchKeyDown}"
613
- @click="${t=>t.stopPropagation()}"
614
- >
615
- <nr-icon
616
- name="search"
617
- class="search-icon"
618
- slot="prefix"
619
- aria-hidden="true">
620
- </nr-icon>
621
- </nr-input>
622
- </div>
623
- `:wt}renderNoResults(){return mt`
624
- <div class="no-options" role="option" aria-disabled="true">
625
- <div class="no-options-content">
626
- <nr-icon
627
- name="search"
628
- class="no-options-icon"
629
- aria-hidden="true">
630
- </nr-icon>
631
- <span class="no-options-text">No results found for "${this._searchQuery}"</span>
632
- </div>
633
- </div>
634
- `}hasNoResults(t){return this.host.searchable&&""!==this._searchQuery.trim()&&0===this.getFilteredOptions(t).length}getCurrentQuery(){return this.host.searchQuery||this._searchQuery}hostUpdated(){super.hostUpdated(),this.host.searchQuery!==this._searchQuery&&(this._searchQuery=this.host.searchQuery)}hostConnected(){super.hostConnected(),this._searchQuery=""}}class be extends ue{constructor(){super(...arguments),this.handleTriggerClick=t=>{this.host.disabled||(t.preventDefault(),t.stopPropagation(),this.host.toggleDropdown())},this.handleOptionClick=(t,e)=>{t.stopPropagation(),e.disabled||(this.host.multiple?this.host.toggleOption(e):(this.host.selectOption(e),this.host.closeDropdown()))},this.handleTagRemove=(t,e)=>{t.stopPropagation(),this.host.unselectOption(e)},this.handleClearAll=t=>{t.stopPropagation(),this.host.clearSelection()},this.handleKeyDown=t=>{const e=this.host.keyboardController;e&&e.handleKeyDown(t)},this.handleFocus=()=>{const t=this.host.focusController;t&&t.handleFocus()},this.handleBlur=()=>{const t=this.host.focusController;t&&t.handleBlur()},this.handleWindowClick=t=>{const e=t.target;this.host.contains(e)||this.host.closeDropdown()}}setupEventListeners(){window.addEventListener("click",this.handleWindowClick)}removeEventListeners(){window.removeEventListener("click",this.handleWindowClick)}hostDisconnected(){super.hostDisconnected(),this.removeEventListeners()}}
1
+ import{css as t,nothing as e,html as i,LitElement as s}from"lit";import{property as o,query as r,customElement as n}from"lit/decorators.js";import{map as a}from"lit/directives/map.js";import{choose as l}from"lit/directives/choose.js";import{classMap as c}from"lit/directives/class-map.js";import{styleMap as h}from"lit/directives/style-map.js";import{NuralyUIBaseMixin as d}from"@nuralyui/common/mixins";const u=t`:host{--nuraly-select-local-min-height:40px;--nuraly-select-local-padding-top:8px;--nuraly-select-local-padding-bottom:8px;--nuraly-select-local-padding-left:12px;--nuraly-select-local-padding-right:12px;--nuraly-select-local-wrapper-margin:0;--nuraly-select-local-border-radius:6px;--nuraly-select-local-border-width:1px;--nuraly-select-local-dropdown-z-index:9999;--nuraly-select-local-dropdown-max-height:200px;--nuraly-select-local-dropdown-width:max-content;--nuraly-select-local-placeholder-font-size:14px;--nuraly-select-local-option-font-size:14px;--nuraly-select-local-medium-height:40px;--nuraly-select-local-medium-font-size:14px;--nuraly-select-local-medium-padding:8px 12px;--nuraly-select-local-small-font-size:12px;--nuraly-select-local-dropdown-animation-duration:0.15s;--nuraly-select-local-tag-border-radius:4px;--nuraly-select-local-tag-padding:2px 6px;--nuraly-select-local-tag-margin:2px;--nuraly-select-local-message-font-size:12px;--nuraly-select-local-message-margin-top:4px}:host{width:fit-content;display:block;font-family:var(--nuraly-select-font-family, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif);font-size:var(--nuraly-select-font-size,14px);line-height:var(--nuraly-select-line-height,1.5);margin:var(--nuraly-select-margin,var(--nuraly-select-local-wrapper-margin))}:host([disabled]){opacity:var(--nuraly-select-disabled-opacity,.5);pointer-events:none}:host([disabled]) .wrapper{background-color:var(--nuraly-select-disabled-background,#f9fafb);border-color:var(--nuraly-select-disabled-border-color,#d9d9d9);color:var(--nuraly-select-disabled-text-color,#8c8c8c);cursor:not-allowed}:host([size=small]) .wrapper{height:var(--nuraly-select-small-height,24px);min-height:var(--nuraly-select-small-height,24px);font-size:var(--nuraly-select-small-font-size,var(--nuraly-select-local-small-font-size))}:host([size=small]) .select-trigger{padding:var(--nuraly-select-small-padding,2px 8px);padding-right:calc(var(--nuraly-select-icon-size,16px) + 20px)}:host([size=medium]) .wrapper{min-height:var(--nuraly-select-medium-height,var(--nuraly-select-local-medium-height));font-size:var(--nuraly-select-medium-font-size,var(--nuraly-select-local-medium-font-size))}:host([size=medium]) .select-trigger{padding:var(--nuraly-select-medium-padding,var(--nuraly-select-local-medium-padding));padding-right:calc(var(--nuraly-select-icon-size,16px) + 20px)}:host([size=large]) .wrapper{min-height:var(--nuraly-select-large-height,48px);font-size:var(--nuraly-select-large-font-size,16px)}:host([size=large]) .select-trigger{padding:var(--nuraly-select-large-padding,12px 16px);padding-right:calc(var(--nuraly-select-icon-size,16px) + 20px)}:host([status=error]) .wrapper{border-color:var(--nuraly-select-error-border-color,#ef4444)}:host([status=warning]) .wrapper{border-color:var(--nuraly-select-warning-border-color,#f59e0b)}:host([status=success]) .wrapper{border-color:var(--nuraly-select-success-border-color,#10b981)}:host([type=inline]){display:flex;align-items:center;gap:8px}:host([type=inline]) .wrapper{flex:1}:host([block]){width:100%}:host([block]) .wrapper{width:100%}:host([show]) .options{display:flex!important}.wrapper{position:relative;width:var(--nuraly-select-width,fit-content);background-color:var(--nuraly-select-background-color,#fff);border:var(--nuraly-select-border-width,var(--nuraly-select-local-border-width)) solid var(--nuraly-select-border-color,#d9d9d9);border-radius:var(--nuraly-select-border-radius,var(--nuraly-select-local-border-radius));transition:all var(--nuraly-select-transition-duration,.2s) var(--nuraly-select-transition-timing,ease-in-out);cursor:pointer;outline:0;margin:var(--nuraly-select-wrapper-margin,0);min-height:var(--nuraly-select-min-height,var(--nuraly-select-local-min-height));box-sizing:border-box;display:flex;align-items:center;overflow:visible}.wrapper:hover:not(:disabled){border-color:var(--nuraly-select-border-hover,#7c3aed)}.wrapper:focus,.wrapper:focus-within{border-color:var(--nuraly-select-border-focus,#7c3aed);box-shadow:0 0 0 2px var(--nuraly-select-focus-outline,rgba(124,58,237,.2))}.select{display:flex;flex-direction:column}.select-trigger{display:flex;align-items:center;padding:var(--nuraly-select-padding-top,var(--nuraly-select-local-padding-top)) calc(var(--nuraly-select-icon-size,16px) + 20px) var(--nuraly-select-padding-bottom,var(--nuraly-select-local-padding-bottom)) var(--nuraly-select-padding-left,var(--nuraly-select-local-padding-left));color:var(--nuraly-select-text-color,#262626);font-size:inherit;line-height:inherit;word-break:break-word;flex:1;min-height:0;flex-wrap:wrap;gap:var(--nuraly-select-tag-margin,var(--nuraly-select-local-tag-margin));box-sizing:border-box}.select-trigger:empty:before{content:attr(data-placeholder);color:var(--nuraly-select-placeholder-color,#8c8c8c);font-size:var(--nuraly-select-placeholder-font-size,var(--nuraly-select-local-placeholder-font-size))}.tag{display:inline-flex;align-items:center;gap:4px;background-color:var(--nuraly-select-tag-background,var(--nuraly-select-local-tag-background));color:var(--nuraly-select-tag-color,var(--nuraly-select-local-tag-color));padding:var(--nuraly-select-tag-padding,var(--nuraly-select-local-tag-padding));border-radius:var(--nuraly-select-tag-border-radius,var(--nuraly-select-local-tag-border-radius));font-size:calc(var(--nuraly-select-font-size,var(--nuraly-select-local-font-size)) - 1px);max-width:100%}.tag-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tag-close{color:var(--nuraly-select-tag-close-color,var(--nuraly-select-local-tag-close-color));cursor:pointer;display:flex;align-items:center;justify-content:center;width:var(--nuraly-select-icon-size,var(--nuraly-select-local-icon-size));height:var(--nuraly-select-icon-size,var(--nuraly-select-local-icon-size));border-radius:50%;transition:color var(--nuraly-select-transition-duration,var(--nuraly-select-local-transition-duration))}.tag-close:hover{color:var(--nuraly-select-tag-close-hover-color,var(--nuraly-select-local-tag-close-hover-color))}.icons-container{position:absolute;top:50%;right:12px;transform:translateY(-50%);display:flex;align-items:center;gap:4px;pointer-events:none}.icons-container nr-icon{--nuraly-icon-width:var(--nuraly-select-icon-size, var(--nuraly-select-local-icon-size));--nuraly-icon-color:var(--nuraly-select-icon-color, var(--nuraly-select-local-icon-color));pointer-events:auto;cursor:pointer;transition:color var(--nuraly-select-transition-duration,var(--nuraly-select-local-transition-duration))}.icons-container nr-icon:hover{--nuraly-icon-color:var(--nuraly-select-icon-hover-color, var(--nuraly-select-local-icon-hover-color))}.arrow-icon{--nuraly-icon-width:var(--nuraly-select-arrow-icon-size, var(--nuraly-select-local-arrow-icon-size));transition:transform var(--nuraly-select-transition-duration,var(--nuraly-select-local-transition-duration));pointer-events:none!important}:host([show]) .arrow-icon{transform:rotate(180deg)}.options{position:absolute;top:100%;margin-top:1px;left:0;right:0;background-color:var(--nuraly-select-dropdown-background,#fff);border:var(--nuraly-select-dropdown-border-width,var(--nuraly-select-border-width,1px)) solid var(--nuraly-select-dropdown-border-color,#d9d9d9);border-radius:var(--nuraly-select-dropdown-border-radius,var(--nuraly-select-border-radius,6px));box-shadow:var(--nuraly-select-dropdown-shadow,0 6px 16px 0 rgba(0,0,0,.08));z-index:var(--nuraly-select-dropdown-z-index,9999);max-height:var(--nuraly-select-dropdown-max-height,200px);overflow-y:auto;overflow-x:hidden;display:none;flex-direction:column;animation:dropdown-enter var(--nuraly-select-dropdown-animation-duration,.15s) ease-out;box-sizing:border-box;width:var(--nuraly-select-dropdown-width,var(--select-dropdown-width,var(--nuraly-select-local-dropdown-width)));min-width:100%;isolation:isolate;backdrop-filter:none;-webkit-backdrop-filter:none;transform:translateZ(0)}.options.placement-top{top:auto;bottom:100%;margin-bottom:1px;margin-top:0;animation:dropdown-enter-top var(--nuraly-select-dropdown-animation-duration,var(--nuraly-select-local-dropdown-animation-duration)) ease-out}@keyframes dropdown-enter{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}@keyframes dropdown-enter-top{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.search-container{position:sticky;top:0;z-index:10;background-color:var(--nuraly-select-dropdown-background,#fff);border-bottom:var(--nuraly-select-border-width,1px) solid var(--nuraly-select-dropdown-border-color,#d9d9d9);padding:8px;margin:0;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);will-change:transform;transform:translateZ(0)}.search-container .search-input{width:100%;--nuraly-input-border-radius:var(--nuraly-select-border-radius, var(--nuraly-select-local-border-radius));--nuraly-input-background-color:var(--nuraly-select-background-color, var(--nuraly-select-local-background-color));--nuraly-input-border-color:var(--nuraly-select-border-color, var(--nuraly-select-local-border-color));--nuraly-input-text-color:var(--nuraly-select-text-color, var(--nuraly-select-local-text-color));--nuraly-input-placeholder-color:var(--nuraly-select-placeholder-color, var(--nuraly-select-local-placeholder-color))}.search-container .search-icon{--nuraly-icon-color:var(--nuraly-select-icon-color, var(--nuraly-select-local-icon-color))}.options:has(.search-container){padding-top:0}.option{display:flex;align-items:center;gap:8px;padding:var(--nuraly-select-option-padding,8px 12px);min-height:var(--nuraly-select-option-min-height,auto);color:var(--nuraly-select-option-text-color,var(--nuraly-select-text-color,#262626));font-size:var(--nuraly-select-option-font-size,14px);cursor:pointer;transition:background-color var(--nuraly-select-transition-duration,.2s);position:relative}.search-container+.option{margin-top:0}.option:hover{background-color:var(--nuraly-select-option-hover-background,#f5f5f5)}.option.selected{background-color:var(--nuraly-select-option-selected-background,#e0e0e0);color:var(--nuraly-select-option-selected-color,#7c3aed)}.option.focused{background-color:var(--nuraly-select-option-hover-background,#f5f5f5);outline:2px solid var(--nuraly-select-border-focus,#7c3aed);outline-offset:-2px}.option.disabled{opacity:var(--nuraly-select-disabled-opacity,var(--nuraly-select-local-disabled-opacity));cursor:not-allowed}.option-content{flex:1;display:flex;align-items:center;gap:8px}.option-icon{--nuraly-icon-width:var(--nuraly-select-icon-size, var(--nuraly-select-local-icon-size));--nuraly-icon-color:currentColor}.option-text{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.option-description{font-size:calc(var(--nuraly-select-option-font-size,var(--nuraly-select-local-option-font-size)) - 1px);opacity:.7;margin-top:2px}.check-icon{--nuraly-icon-width:var(--nuraly-select-icon-size, var(--nuraly-select-local-icon-size));--nuraly-icon-color:var(--nuraly-select-option-selected-color, var(--nuraly-select-local-option-selected-color))}.no-options{display:flex;align-items:center;justify-content:center;padding:var(--select-no-options-padding,24px 16px);color:var(--select-no-options-color,#8c8c8c);font-size:var(--nuraly-select-option-font-size,var(--nuraly-select-local-option-font-size));cursor:default;user-select:none}.no-options-content{display:flex;flex-direction:column;align-items:center;gap:var(--select-no-options-gap,8px);text-align:center}.no-options-icon{--nuraly-icon-width:24px;--nuraly-icon-color:var(--select-no-options-icon-color, #d9d9d9);opacity:.8}.no-options-text{font-size:var(--nuraly-select-option-font-size,var(--nuraly-select-local-option-font-size));color:var(--select-no-options-color,#8c8c8c);line-height:1.4}.validation-message{display:block;margin-top:var(--nuraly-select-message-margin-top,var(--nuraly-select-local-message-margin-top));font-size:var(--nuraly-select-message-font-size,var(--nuraly-select-local-message-font-size));color:var(--nuraly-select-error-message-color,var(--nuraly-select-local-error-message-color))}.validation-message.warning{color:var(--nuraly-select-warning-message-color,var(--nuraly-select-local-warning-message-color))}.validation-message.success{color:var(--nuraly-select-success-message-color,var(--nuraly-select-local-success-message-color))}::slotted([slot=label]){display:block;margin-bottom:4px;font-weight:500;color:var(--nuraly-select-text-color,var(--nuraly-select-local-text-color))}::slotted([slot=helper-text]){display:block;margin-top:var(--nuraly-select-message-margin-top,var(--nuraly-select-local-message-margin-top));font-size:var(--nuraly-select-message-font-size,var(--nuraly-select-local-message-font-size));color:var(--nuraly-select-placeholder-color,var(--nuraly-select-local-placeholder-color))}@media (prefers-reduced-motion:reduce){.arrow-icon,.option,.options,.tag-close,.wrapper{transition:none;animation:none}}@media (prefers-contrast:high){.wrapper{border-width:2px}.wrapper:focus,.wrapper:focus-within{outline:3px solid}}`;var p,v,y,g,m,f,b,w,x;!function(t){t.Default="default",t.Inline="inline",t.Button="button",t.Slot="slot"}(p||(p={})),function(t){t.Default="default",t.Warning="warning",t.Error="error",t.Success="success"}(v||(v={})),function(t){t.Small="small",t.Medium="medium",t.Large="large"}(y||(y={})),function(t){t.Small="small",t.Medium="medium",t.Large="large"}(g||(g={})),function(t){t.Horizontal="horizontal",t.Vertical="vertical"}(m||(m={})),function(t){t.Default="default",t.Solid="solid",t.Outline="outline",t.Borderless="borderless"}(f||(f={})),function(t){t.Bottom="bottom",t.Top="top",t.Auto="auto"}(b||(b={})),function(t){t.None="none",t.StartsWith="starts-with",t.Contains="contains",t.Fuzzy="fuzzy"}(w||(w={}));class O{constructor(t){this._host=t,this._host.addController(this)}get host(){return this._host}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}handleError(t,e){console.error(`[SelectController:${this.constructor.name}] Error in ${e}:`,t),this._host.dispatchEvent(new CustomEvent("nr-select-error",{detail:{error:t.message,context:e,controller:this.constructor.name},bubbles:!0,composed:!0}))}requestUpdate(){try{this._host.requestUpdate()}catch(t){this.handleError(t,"requestUpdate")}}dispatchEvent(t){try{return this._host.dispatchEvent(t)}catch(t){return this.handleError(t,"dispatchEvent"),!1}}}class E extends O{constructor(){super(...arguments),this._selectedOptions=[],this._initialized=!1}getSelectedOptions(){return[...this._selectedOptions]}getSelectedOption(){return this._selectedOptions[0]}selectOption(t){try{if(this.isOptionDisabled(t))return;const e=this.host.multiple,i=this.getCurrentValue();e?this.isOptionSelected(t)||(this._selectedOptions=[...this._selectedOptions,t],this.updateHostValue(),this.dispatchChangeEvent(i)):(this.isOptionSelected(t)?this._selectedOptions=[]:this._selectedOptions=[t],this.updateHostValue(),this.dispatchChangeEvent(i)),this.requestUpdate()}catch(t){this.handleError(t,"selectOption")}}unselectOption(t){try{if(this.isOptionSelected(t)){const e=this.getCurrentValue();this._selectedOptions=this._selectedOptions.filter((e=>e.value!==t.value)),this.updateHostValue(),this.dispatchChangeEvent(e),this.requestUpdate()}}catch(t){this.handleError(t,"unselectOption")}}clearSelection(){try{if(this._selectedOptions.length>0){const t=this.getCurrentValue();this._selectedOptions=[],this.updateHostValue(),this.dispatchChangeEvent(t),this.requestUpdate()}}catch(t){this.handleError(t,"clearSelection")}}isOptionSelected(t){return this._selectedOptions.some((e=>e.value===t.value))}isOptionDisabled(t){return Boolean(t.disabled)||this.host.disabled}toggleOption(t){this.isOptionSelected(t)?this.unselectOption(t):this.selectOption(t)}initializeFromValue(){try{if(this._initialized)return;const t=this.host.value;if(!t||Array.isArray(t)&&0===t.length)return;const e=Array.isArray(t)?t:[t],i=this.host.options.filter((t=>e.includes(t.value)));i.length>0&&(this._selectedOptions=this.host.multiple?i:[i[0]],this.requestUpdate()),this._initialized=!0}catch(t){this.handleError(t,"initializeFromValue")}}updateHostValue(){var t;const e=this.host.multiple?this._selectedOptions.map((t=>t.value)):(null===(t=this._selectedOptions[0])||void 0===t?void 0:t.value)||"",i=this.host.value;let s=!1;if(this.host.multiple){const t=Array.isArray(i)?i:[],o=Array.isArray(e)?e:[];s=t.length===o.length&&t.every(((t,e)=>t===o[e]))}else s=i===e;s||(this.host.value=e)}getCurrentValue(){var t;return this.host.multiple?this._selectedOptions.map((t=>t.value)):(null===(t=this._selectedOptions[0])||void 0===t?void 0:t.value)||""}dispatchChangeEvent(t){const e={value:this.getCurrentValue(),selectedOptions:this.getSelectedOptions(),previousValue:t};this.dispatchEvent(new CustomEvent("nr-change",{detail:e,bubbles:!0,composed:!0}))}hostUpdated(){this.syncWithHostOptions()}syncWithHostOptions(){try{this._selectedOptions=this._selectedOptions.filter((t=>this.host.options.some((e=>e.value===t.value)))),this._selectedOptions=this._selectedOptions.map((t=>this.host.options.find((e=>e.value===t.value))||t)),this.updateHostValue()}catch(t){this.handleError(t,"syncWithHostOptions")}}}class z extends O{constructor(t,e,i){super(t),this.selectionController=e,this.dropdownController=i,this._focusedIndex=-1,this._hasKeyboardNavigated=!1}handleKeyDown(t){try{const e=this.isSearchInputFocused();switch(t.key){case"ArrowDown":t.preventDefault(),this.dropdownController.isOpen?this.navigateNext():this.openDropdown();break;case"ArrowUp":t.preventDefault(),this.dropdownController.isOpen?this.navigatePrevious():this.openDropdown();break;case"Enter":this.dropdownController.isOpen?e&&this._focusedIndex>=0?(t.preventDefault(),this.selectFocused()):e||(t.preventDefault(),this.selectFocused()):(t.preventDefault(),this.openDropdown());break;case" ":e||(t.preventDefault(),this.dropdownController.isOpen?this.selectFocused():this.openDropdown());break;case"Escape":t.preventDefault(),this.closeDropdown();break;case"Tab":this.closeDropdown();break;case"Home":this.dropdownController.isOpen&&(t.preventDefault(),this.setFocusedIndex(0));break;case"End":this.dropdownController.isOpen&&(t.preventDefault(),this.setFocusedIndex(this.host.options.length-1));break;default:1===t.key.length&&/[a-zA-Z0-9]/.test(t.key)&&this.handleAlphanumericKey(t.key.toLowerCase())}}catch(t){this.handleError(t,"handleKeyDown")}}navigateNext(){try{const t=this.getNavigableOptions();if(0===t.length)return;if(this.isSearchInputFocused()&&(this._focusedIndex<0||!this._hasKeyboardNavigated))return this._hasKeyboardNavigated=!0,void this.setFocusedIndex(0);let e=this._focusedIndex+1;e>=t.length&&(e=0),this.setFocusedIndex(e)}catch(t){this.handleError(t,"navigateNext")}}navigatePrevious(){try{const t=this.getNavigableOptions();if(0===t.length)return;if(this.isSearchInputFocused()&&(this._focusedIndex<0||!this._hasKeyboardNavigated))return this._hasKeyboardNavigated=!0,void this.setFocusedIndex(t.length-1);let e=this._focusedIndex-1;e<0&&(e=t.length-1),this.setFocusedIndex(e)}catch(t){this.handleError(t,"navigatePrevious")}}selectFocused(){try{const t=this.getNavigableOptions()[this._focusedIndex];t&&!this.selectionController.isOptionDisabled(t)&&(this.selectionController.selectOption(t),this.host.multiple||this.closeDropdown())}catch(t){this.handleError(t,"selectFocused")}}openDropdown(){try{this.dropdownController.open(),this._hasKeyboardNavigated=!1,this._focusedIndex=-1}catch(t){this.handleError(t,"openDropdown")}}closeDropdown(){try{this.dropdownController.close(),this._focusedIndex=-1,this._hasKeyboardNavigated=!1}catch(t){this.handleError(t,"closeDropdown")}}setFocusedIndex(t){try{const e=this.getNavigableOptions();t>=0&&t<e.length&&(this._focusedIndex=t,this.dispatchFocusEvent(e[t],t),this.requestUpdate(),this.scrollToFocusedOption(t))}catch(t){this.handleError(t,"setFocusedIndex")}}scrollToFocusedOption(t){var e;try{const i=null===(e=this.host.shadowRoot)||void 0===e?void 0:e.querySelector(".options");if(!i)return;setTimeout((()=>{const e=i.querySelector(".option.focused");if(e)e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"});else{const e=40,s=i.clientHeight,o=i.scrollTop,r=t*e,n=r+e,a=o+s;r<o?i.scrollTo({top:r,behavior:"smooth"}):n>a&&i.scrollTo({top:n-s,behavior:"smooth"})}}),10)}catch(t){console.warn("Failed to scroll to focused option:",t)}}get focusedIndex(){return this._focusedIndex}get focusedOption(){return this.getNavigableOptions()[this._focusedIndex]}handleAlphanumericKey(t){try{const e=this.getNavigableOptions(),i=this._focusedIndex+1;for(let s=0;s<e.length;s++){const o=(i+s)%e.length;if(e[o].label.toLowerCase().startsWith(t)){this.setFocusedIndex(o),this.dropdownController.isOpen||this.openDropdown();break}}}catch(t){this.handleError(t,"handleAlphanumericKey")}}getNavigableOptions(){const t=this.host;if(!t.options||!Array.isArray(t.options))return[];let e=t.options;return t.searchable&&t.searchQuery&&"function"==typeof t.getFilteredOptions&&(e=t.getFilteredOptions()),e.filter((t=>!t.disabled))}dispatchFocusEvent(t,e){const i={focusedOption:t,focusedIndex:e};this.dispatchEvent(new CustomEvent("nr-select-focus",{detail:i,bubbles:!0,composed:!0}))}isSearchInputFocused(){var t;try{const e=this.host;if(!e.searchable)return!1;const i=null===(t=e.shadowRoot)||void 0===t?void 0:t.querySelector(".search-input");return!!i&&(document.activeElement===i||i.shadowRoot&&i.shadowRoot.querySelector("input")===i.shadowRoot.activeElement||i.contains(document.activeElement))}catch(t){return!1}}hostUpdated(){this.dropdownController.isOpen||-1===this._focusedIndex||(this._focusedIndex=-1)}}class $ extends O{constructor(){super(...arguments),this._isOpen=!1,this._position={top:0,left:0,width:0,placement:"bottom"},this._dropdownElement=null,this._triggerElement=null,this.handleResize=()=>{this._isOpen&&this.calculatePosition()},this.handleScroll=()=>{var t;if(this._isOpen&&this._triggerElement){const e=this._triggerElement.getBoundingClientRect(),i=(null===(t=window.visualViewport)||void 0===t?void 0:t.height)||window.innerHeight;(e.bottom<0||e.top>i)&&this.close()}}}get isOpen(){return this._isOpen}get position(){return Object.assign({},this._position)}open(){try{this._isOpen||(this._isOpen=!0,this.host.show=!0,this.requestUpdate(),this.findElements(),setTimeout((()=>{this.calculatePosition()}),10),this.host&&"function"==typeof this.host.setupEventListeners&&setTimeout((()=>{this.host.setupEventListeners()}),50),this.focusSearchInput(),this.dispatchEvent(new CustomEvent("nr-dropdown-open",{bubbles:!0,composed:!0})))}catch(t){this.handleError(t,"open")}}close(){try{this._isOpen&&(this._isOpen=!1,this.host.show=!1,this.resetPosition(),this.requestUpdate(),this.host&&"function"==typeof this.host.removeEventListeners&&this.host.removeEventListeners(),this.dispatchEvent(new CustomEvent("nr-dropdown-close",{bubbles:!0,composed:!0})))}catch(t){this.handleError(t,"close")}}toggle(){this._isOpen?this.close():this.open()}focusSearchInput(){try{const t=this.host;t&&t.searchable&&setTimeout((()=>{var e;const i=null===(e=t.shadowRoot)||void 0===e?void 0:e.querySelector(".search-input");i&&"function"==typeof i.focus&&i.focus()}),100)}catch(t){console.warn("Failed to focus search input:",t)}}calculatePosition(){var t;try{if(this._dropdownElement&&this._triggerElement||this.findElements(),!this._dropdownElement||!this._triggerElement)return;const e=this._triggerElement.getBoundingClientRect(),i=((null===(t=window.visualViewport)||void 0===t?void 0:t.height)||window.innerHeight)-e.bottom,s=e.top,o=200,r=this.determineOptimalPlacement(o,s,i);this._position={left:0,width:0,placement:r,top:0},this.applyPosition()}catch(t){this.handleError(t,"calculatePosition")}}resetPosition(){try{if(this._dropdownElement){this._dropdownElement.style.removeProperty("position"),this._dropdownElement.style.removeProperty("top"),this._dropdownElement.style.removeProperty("left"),this._dropdownElement.style.removeProperty("width"),this._dropdownElement.style.removeProperty("min-width");this.host.maxHeight||this._dropdownElement.style.removeProperty("max-height"),this._dropdownElement.style.removeProperty("min-height"),this._dropdownElement.style.removeProperty("height"),this._dropdownElement.style.removeProperty("overflow-y"),this._dropdownElement.style.removeProperty("transform"),this._dropdownElement.style.removeProperty("display"),this._dropdownElement.style.removeProperty("opacity"),this._dropdownElement.style.removeProperty("visibility"),this._dropdownElement.style.removeProperty("z-index"),this._dropdownElement.classList.remove("placement-top","placement-bottom")}}catch(t){this.handleError(t,"resetPosition")}}setElements(t,e){this._dropdownElement=t,this._triggerElement=e}findElements(){try{const t=this._host;if(t.optionsElement&&t.wrapper)return this._dropdownElement=t.optionsElement,void(this._triggerElement=t.wrapper);t.shadowRoot&&(this._dropdownElement=t.shadowRoot.querySelector(".options"),this._triggerElement=t.shadowRoot.querySelector(".wrapper"))}catch(t){this.handleError(t,"findElements")}}determineOptimalPlacement(t,e,i){return i>=t?"bottom":e>=t||e>i?"top":"bottom"}applyPosition(){var t;try{if(!this._dropdownElement||!this._triggerElement)return;const e=this.host.maxHeight,{placement:i}=this._position,s=this._triggerElement.getBoundingClientRect(),o=s.width;this._dropdownElement.style.position="absolute",this._dropdownElement.style.left="0",this._dropdownElement.style.right="auto",this._dropdownElement.style.minWidth=`${o}px`,this._dropdownElement.style.removeProperty("width"),this._dropdownElement.style.zIndex="1000",this._dropdownElement.style.height="auto",e||(this._dropdownElement.style.maxHeight="none"),this._dropdownElement.style.minHeight="auto","bottom"===i?(this._dropdownElement.style.top="100%",this._dropdownElement.style.bottom="auto"):(this._dropdownElement.style.top="auto",this._dropdownElement.style.bottom="100%");const r=this._dropdownElement.scrollHeight,n=(null===(t=window.visualViewport)||void 0===t?void 0:t.height)||window.innerHeight;let a;a="bottom"===i?n-s.bottom-10:s.top-10,e?(this._dropdownElement.style.maxHeight=e,this._dropdownElement.style.overflowY="auto"):r>a?(this._dropdownElement.style.maxHeight=`${a}px`,this._dropdownElement.style.overflowY="auto"):(this._dropdownElement.style.maxHeight=`${r}px`,this._dropdownElement.style.overflowY="auto"),this._dropdownElement.classList.remove("placement-top","placement-bottom"),this._dropdownElement.classList.add(`placement-${i}`)}catch(t){this.handleError(t,"applyPosition")}}getAvailableSpace(){var t,e;if(!this._triggerElement)return{above:0,below:0,left:0,right:0};const i=this._triggerElement.getBoundingClientRect(),s=(null===(t=window.visualViewport)||void 0===t?void 0:t.height)||window.innerHeight,o=(null===(e=window.visualViewport)||void 0===e?void 0:e.width)||window.innerWidth;return{above:i.top,below:s-i.bottom,left:i.left,right:o-i.right}}hostConnected(){window.addEventListener("resize",this.handleResize),window.addEventListener("scroll",this.handleScroll,!0)}hostDisconnected(){window.removeEventListener("resize",this.handleResize),window.removeEventListener("scroll",this.handleScroll,!0)}}class S extends O{constructor(){super(...arguments),this._focusedIndex=-1,this._hasFocus=!1}get focusedIndex(){return this._focusedIndex}getFocusedOption(){if(this._focusedIndex>=0&&this._focusedIndex<this.host.options.length)return this.host.options[this._focusedIndex]}get hasFocus(){return this._hasFocus}setFocusedOption(t){try{t>=0&&t<this.host.options.length&&(this._focusedIndex=t,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-focus-change",{detail:{focusedIndex:t,focusedOption:this.getFocusedOption()},bubbles:!0,composed:!0})))}catch(t){this.handleError(t,"setFocusedOption")}}focus(){var t;try{const e=null===(t=this._host.shadowRoot)||void 0===t?void 0:t.querySelector(".wrapper");e&&(e.focus(),this._hasFocus=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-focus",{bubbles:!0,composed:!0})))}catch(t){this.handleError(t,"focus")}}blur(){var t;try{const e=null===(t=this._host.shadowRoot)||void 0===t?void 0:t.querySelector(".wrapper");e&&e.blur(),this._hasFocus=!1,this._focusedIndex=-1,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-blur",{bubbles:!0,composed:!0}))}catch(t){this.handleError(t,"blur")}}focusNext(){try{const t=this.getNextFocusableIndex(this._focusedIndex);-1!==t&&this.setFocusedOption(t)}catch(t){this.handleError(t,"focusNext")}}focusPrevious(){try{const t=this.getPreviousFocusableIndex(this._focusedIndex);-1!==t&&this.setFocusedOption(t)}catch(t){this.handleError(t,"focusPrevious")}}focusFirst(){try{const t=this.getNextFocusableIndex(-1);-1!==t&&this.setFocusedOption(t)}catch(t){this.handleError(t,"focusFirst")}}focusLast(){try{const t=this.getPreviousFocusableIndex(this.host.options.length);-1!==t&&this.setFocusedOption(t)}catch(t){this.handleError(t,"focusLast")}}clearFocus(){this._focusedIndex=-1,this._hasFocus=!1,this.requestUpdate()}handleFocus(){this._hasFocus=!0,this.requestUpdate()}handleBlur(){this._hasFocus=!1,this._focusedIndex=-1,this.requestUpdate()}getNextFocusableIndex(t){const e=this.host.options;for(let i=t+1;i<e.length;i++)if(!e[i].disabled)return i;for(let i=0;i<=t;i++)if(!e[i].disabled)return i;return-1}getPreviousFocusableIndex(t){const e=this.host.options;for(let i=t-1;i>=0;i--)if(!e[i].disabled)return i;for(let i=e.length-1;i>=t;i--)if(!e[i].disabled)return i;return-1}findOptionIndex(t){return this.host.options.findIndex((e=>e.value===t))}focusOptionByValue(t){const e=this.findOptionIndex(t);-1!==e&&this.setFocusedOption(e)}}!function(t){t.Valid="valid",t.Invalid="invalid",t.Pending="pending",t.Pristine="pristine"}(x||(x={}));class k extends O{constructor(t,e){super(t),this.selectionController=e,this._isValid=!0,this._validationMessage="",this._validationState=x.Pristine}get isValid(){return this._isValid}get validationMessage(){return this._validationMessage}get validationState(){return this._validationState}validate(){try{this._validationState=x.Pending;const t=this.selectionController.getSelectedOptions().length>0;return this.host.required&&!t?(this.setValidationResult(!1,"This field is required",x.Invalid),!1):(this.setValidationResult(!0,"",x.Valid),!0)}catch(t){return this.handleError(t,"validate"),this.setValidationResult(!1,"Validation error occurred",x.Invalid),!1}}reset(){try{this._isValid=!0,this._validationMessage="",this._validationState=x.Pristine,this.requestUpdate(),this.dispatchValidationEvent()}catch(t){this.handleError(t,"reset")}}getFormData(){var t;try{const e=this._host,i=e.name||e.getAttribute("name")||"select",s=this.selectionController.getSelectedOptions();return this.host.multiple?{[i]:s.map((t=>t.value))}:{[i]:(null===(t=s[0])||void 0===t?void 0:t.value)||""}}catch(t){return this.handleError(t,"getFormData"),{}}}checkValidity(){return this.validate()}reportValidity(){var t;const e=this.validate();if(!e){const e=null===(t=this._host.shadowRoot)||void 0===t?void 0:t.querySelector(".wrapper");e&&e.focus()}return e}setCustomValidity(t){try{t?this.setValidationResult(!1,t,x.Invalid):this.validate()}catch(t){this.handleError(t,"setCustomValidity")}}validateOnChange(){this._validationState!==x.Pristine&&this.validate()}validateOnBlur(){this._validationState===x.Pristine&&(this._validationState=x.Pending),this.validate()}setValidationResult(t,e,i){const s=this._isValid!==t||this._validationMessage!==e||this._validationState!==i;this._isValid=t,this._validationMessage=e,this._validationState=i,s&&(this.requestUpdate(),this.dispatchValidationEvent())}dispatchValidationEvent(){const t={isValid:this._isValid,validationMessage:this._validationMessage,validationState:this._validationState};this.dispatchEvent(new CustomEvent("nr-validation",{detail:t,bubbles:!0,composed:!0}))}hostUpdated(){this.validateOnChange()}getValidationClasses(){return{valid:this._isValid&&this._validationState===x.Valid,invalid:!this._isValid&&this._validationState===x.Invalid,pending:this._validationState===x.Pending,pristine:this._validationState===x.Pristine}}getAriaAttributes(){const t={};return this.host.required&&(t["aria-required"]="true"),this._isValid||(t["aria-invalid"]="true",this._validationMessage&&(t["aria-describedby"]="validation-message")),t}}class C extends O{constructor(){super(...arguments),this._searchQuery="",this.handleSearchInput=t=>{this.setSearchQuery(t.detail.value||"")},this.handleSearchClear=()=>{this.clearSearch()},this.handleSearchKeyDown=t=>{if(["ArrowDown","ArrowUp","Enter","Home","End"].includes(t.key)){const e=this.host.keyboardController;e&&e.handleKeyDown(t)}else t.stopPropagation(),"Escape"===t.key&&(this.host.closeDropdown(),this.host.focus())}}get searchQuery(){return this._searchQuery}get hasSearch(){return""!==this._searchQuery.trim()}setSearchQuery(t){this._searchQuery=t,this.host.searchQuery=t,this.host.requestUpdate()}search(t){this.setSearchQuery(t)}clearSearch(){this.setSearchQuery("")}getFilteredOptions(t){if(!this.host.searchable||!this._searchQuery.trim())return t;const e=this._searchQuery.toLowerCase().trim();return t.filter((t=>t.label.toLowerCase().includes(e)||t.value.toLowerCase().includes(e)||t.description&&t.description.toLowerCase().includes(e)))}renderSearchInput(){return this.host.searchable?i`<div class="search-container"><nr-input type="text" class="search-input" placeholder="${this.host.searchPlaceholder}" .value="${this._searchQuery}" allowClear @nr-input="${this.handleSearchInput}" @nr-clear="${this.handleSearchClear}" @keydown="${this.handleSearchKeyDown}" @click="${t=>t.stopPropagation()}"><nr-icon name="search" class="search-icon" slot="prefix" aria-hidden="true"></nr-icon></nr-input></div>`:e}renderNoResults(){return i`<div class="no-options" role="option" aria-disabled="true"><div class="no-options-content"><nr-icon name="search" class="no-options-icon" aria-hidden="true"></nr-icon><span class="no-options-text">No results found for "${this._searchQuery}"</span></div></div>`}hasNoResults(t){return this.host.searchable&&""!==this._searchQuery.trim()&&0===this.getFilteredOptions(t).length}getCurrentQuery(){return this.host.searchQuery||this._searchQuery}hostUpdated(){super.hostUpdated(),this.host.searchQuery!==this._searchQuery&&(this._searchQuery=this.host.searchQuery)}hostConnected(){super.hostConnected(),this._searchQuery=""}}class A extends O{constructor(){super(...arguments),this.handleTriggerClick=t=>{this.host.disabled||(t.preventDefault(),t.stopPropagation(),this.host.toggleDropdown())},this.handleOptionClick=(t,e)=>{t.stopPropagation(),e.disabled||(this.host.multiple?this.host.toggleOption(e):(this.host.selectOption(e),this.host.closeDropdown()))},this.handleTagRemove=(t,e)=>{t.stopPropagation(),this.host.unselectOption(e)},this.handleClearAll=t=>{t.stopPropagation(),this.host.clearSelection()},this.handleKeyDown=t=>{const e=this.host.keyboardController;e&&e.handleKeyDown(t)},this.handleFocus=()=>{const t=this.host.focusController;t&&t.handleFocus()},this.handleBlur=()=>{const t=this.host.focusController;t&&t.handleBlur()},this.handleWindowClick=t=>{const e=t.target;this.host.contains(e)||this.host.closeDropdown()}}setupEventListeners(){window.addEventListener("click",this.handleWindowClick)}removeEventListeners(){window.removeEventListener("click",this.handleWindowClick)}hostDisconnected(){super.hostDisconnected(),this.removeEventListeners()}}
635
2
  /**
636
3
  * @license
637
4
  * Copyright 2023 Nuraly, Laabidi Aymen
638
5
  * SPDX-License-Identifier: MIT
639
- */var we=function(t,e,i,s){for(var o,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(o=t[l])&&(n=(r<3?o(n):r>3?o(e,i,n):o(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};let xe=class extends((t=>ee(Jt(ie(t))))(Lt)){constructor(){super(...arguments),this.requiredComponents=["nr-input","nr-icon"],this.options=[],this.placeholder="Select an option",this.disabled=!1,this.type=se.Default,this.multiple=!1,this.show=!1,this.status=oe.Default,this.size=re.Medium,this.required=!1,this.name="",this.value="",this.noOptionsMessage="No options available",this.noOptionsIcon="circle-info",this.searchable=!1,this.clearable=!1,this.searchPlaceholder="Search options...",this.searchQuery="",this.useCustomSelectedDisplay=!1,this.maxHeight="",this.block=!1,this.selectionController=new pe(this),this.dropdownController=new ye(this),this.keyboardController=new ve(this,this.selectionController,this.dropdownController),this.focusController=new fe(this),this.validationController=new ge(this,this.selectionController),this.searchController=new me(this),this.eventController=new be(this),this.handleTriggerClick=t=>{this.eventController.handleTriggerClick(t)},this.handleOptionClick=(t,e)=>{this.eventController.handleOptionClick(t,e)},this.handleTagRemove=(t,e)=>{this.eventController.handleTagRemove(t,e)},this.handleClearAll=t=>{this.eventController.handleClearAll(t)},this.handleKeyDown=t=>{this.eventController.handleKeyDown(t)},this.handleFocus=()=>{this.eventController.handleFocus()},this.handleBlur=()=>{this.eventController.handleBlur()}}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}willUpdate(t){super.willUpdate(t),(t.has("options")||t.has("value"))&&this.options.length>0&&this.value&&(Array.isArray(this.value)?this.value.length>0:""!==this.value)&&(this.selectionController._initialized=!1,this.selectionController.initializeFromValue())}firstUpdated(t){super.firstUpdated(t),this.optionsElement&&this.wrapper?this.dropdownController.setElements(this.optionsElement,this.wrapper):setTimeout((()=>{this.optionsElement&&this.wrapper&&this.dropdownController.setElements(this.optionsElement,this.wrapper)}),100),this.value&&(Array.isArray(this.value)?this.value.length>0:""!==this.value)&&this.selectionController.initializeFromValue()}get selectedOptions(){return this.selectionController.getSelectedOptions()}get selectedOption(){return this.selectionController.getSelectedOption()}selectOption(t){this.selectionController.selectOption(t)}unselectOption(t){this.selectionController.unselectOption(t)}toggleOption(t){this.selectionController.toggleOption(t)}clearSelection(){this.selectionController.clearSelection()}isOptionSelected(t){return this.selectionController.isOptionSelected(t)}toggleDropdown(){this.dropdownController.toggle()}openDropdown(){this.dropdownController.open()}closeDropdown(){this.dropdownController.close()}focus(){this.focusController.focus()}blur(){this.focusController.blur()}validate(){return this.validationController.validate()}checkValidity(){return this.validationController.checkValidity()}reportValidity(){return this.validationController.reportValidity()}setCustomValidity(t){this.validationController.setCustomValidity(t)}searchOptions(t){this.searchController.search(t)}clearSearch(){this.searchController.clearSearch()}getSearchFilteredOptions(){return this.searchController.getFilteredOptions(this.options)}getCurrentSearchQuery(){return this.searchController.searchQuery}getSelectedOptions(){return this.selectedOptions}setupGlobalEventListeners(){this.eventController.setupEventListeners()}removeGlobalEventListeners(){this.eventController.removeEventListeners()}getFilteredOptions(){return this.searchController.getFilteredOptions(this.options)}setupEventListeners(){this.eventController.setupEventListeners()}removeEventListeners(){this.eventController.removeEventListeners()}render(){return mt`${((t,e,i)=>{for(const i of e)if(i[0]===t)return(0,i[1])();return null==i?void 0:i()})(this.type,[[se.Default,()=>this.renderDefault()],[se.Inline,()=>this.renderInline()],[se.Button,()=>this.renderButton()],[se.Slot,()=>this.renderSlot()]])}`}renderDefault(){const t=this.selectedOptions,e=this.validationController.getValidationClasses();return mt`
640
- <slot name="label"></slot>
641
- <div
642
- class="${Yt(Object.assign({wrapper:!0},e))}"
643
- data-theme="${this.currentTheme}"
644
- tabindex="0"
645
- role="combobox"
646
- aria-expanded="${this.show}"
647
- aria-haspopup="listbox"
648
- aria-labelledby="select-label"
649
-
650
- @click=${this.handleTriggerClick}
651
- @keydown=${this.handleKeyDown}
652
- @focus=${this.handleFocus}
653
- @blur=${this.handleBlur}
654
- >
655
- <div class="select">
656
- <div class="select-trigger">
657
- ${this.renderSelectedContent(t)}
658
- </div>
659
-
660
- <div class="icons-container">
661
- ${this.renderStatusIcon()}
662
- ${this.renderClearButton(t)}
663
- <nr-icon
664
- name="angle-down"
665
- size="${this.size}"
666
- class="arrow-icon"
667
- aria-hidden="true"
668
- ></nr-icon>
669
- </div>
670
-
671
- <div
672
- class="options"
673
- role="listbox"
674
- aria-multiselectable="${this.multiple}"
675
- style=${this.maxHeight?Xt({"max-height":this.maxHeight}):wt}
676
- >
677
- ${this.searchable?this.renderSearchInput():wt}
678
- ${this.renderSelectOptions()}
679
- </div>
680
- </div>
681
- </div>
682
-
683
- ${this.renderValidationMessage()}
684
- <slot name="helper-text"></slot>
685
- `}renderInline(){return mt`
686
- <slot name="label"></slot>
687
- ${this.renderDefault()}
688
- <slot name="helper-text"></slot>
689
- `}renderButton(){const t=this.selectedOptions;return mt`
690
- <button
691
- class="select-button"
692
- ?disabled=${this.disabled}
693
- @click=${this.handleTriggerClick}
694
- @keydown=${this.handleKeyDown}
695
- >
696
- ${t.length>0?t[0].label:this.placeholder}
697
- <nr-icon name="angle-down" class="arrow-icon"></nr-icon>
698
- </button>
699
-
700
- <div
701
- class="options"
702
- role="listbox"
703
- style=${this.maxHeight?Xt({"max-height":this.maxHeight}):wt}
704
- >
705
- ${this.searchable?this.renderSearchInput():wt}
706
- ${this.renderSelectOptions()}
707
- </div>
708
- `}renderSlot(){return mt`
709
- <slot name="trigger" @click=${this.handleTriggerClick}></slot>
710
- <div
711
- class="options"
712
- role="listbox"
713
- style=${this.maxHeight?Xt({"max-height":this.maxHeight}):wt}
714
- >
715
- ${this.searchable?this.renderSearchInput():wt}
716
- ${this.renderSelectOptions()}
717
- </div>
718
- `}renderSelectedContent(t){return 0===t.length?mt`<span class="placeholder" aria-hidden="true">${this.placeholder}</span>`:this.multiple?this.useCustomSelectedDisplay?mt`<slot name="selected-display" .selectedOptions=${t}></slot>`:Wt(t,(t=>mt`
719
- <span class="tag">
720
- <span class="tag-label">${t.label}</span>
721
- <nr-icon
722
- name="remove"
723
- size="${this.size}"
724
- class="tag-close"
725
- @click=${e=>this.handleTagRemove(e,t)}
726
- aria-label="Remove ${t.label}"
727
- ></nr-icon>
728
- </span>
729
- `)):mt`${t[0].label}`}renderStatusIcon(){switch(this.status){case oe.Warning:return mt`<nr-icon name="warning" size="${this.size}" class="status-icon warning"></nr-icon>`;case oe.Error:return mt`<nr-icon name="exclamation-circle" size="${this.size}" class="status-icon error"></nr-icon>`;case oe.Success:return mt`<nr-icon name="check-circle" size="${this.size}" class="status-icon success"></nr-icon>`;default:return wt}}renderClearButton(t){return!this.clearable||0===t.length||this.disabled?wt:mt`
730
- <nr-icon
731
- name="remove"
732
- size="${this.size}"
733
- class="clear-icon"
734
- @click=${this.handleClearAll}
735
- aria-label="Clear selection"
736
- tabindex="-1"
737
- ></nr-icon>
738
- `}renderSelectOptions(){const t=this.getFilteredOptions();if(!this.options||0===this.options.length)return mt`
739
- <div class="no-options" role="option" aria-disabled="true">
740
- <div class="no-options-content">
741
- <nr-icon
742
- name="${this.noOptionsIcon}"
743
- class="no-options-icon"
744
- aria-hidden="true">
745
- </nr-icon>
746
- <span class="no-options-text">${this.noOptionsMessage}</span>
747
- </div>
748
- </div>
749
- `;if(this.searchController.hasNoResults(this.options))return this.searchController.renderNoResults();const e=this.keyboardController.focusedOption;return Wt(t,(t=>{const i=this.isOptionSelected(t),s=e&&e.value===t.value;return mt`
750
- <div
751
- class="${Yt({option:!0,selected:i,focused:s,disabled:Boolean(t.disabled)})}"
752
- role="option"
753
- aria-selected="${i}"
754
- aria-disabled="${Boolean(t.disabled)}"
755
- data-value="${t.value}"
756
- @click=${e=>this.handleOptionClick(e,t)}
757
- style=${Xt(t.style?{style:t.style}:{})}
758
- title="${t.title||""}"
759
- >
760
- <div class="option-content">
761
- ${t.icon?mt`<nr-icon name="${t.icon}" size="${this.size}" class="option-icon"></nr-icon>`:wt}
762
- <div class="option-text">
763
- ${t.htmlContent?mt`<div .innerHTML=${t.htmlContent}></div>`:t.label}
764
- ${t.description?mt`<div class="option-description">${t.description}</div>`:wt}
765
- </div>
766
- </div>
767
-
768
- ${i?mt`<nr-icon name="check" size="${this.size}" class="check-icon" aria-hidden="true"></nr-icon>`:wt}
769
-
770
- ${t.state&&t.message?mt`
771
- <div class="option-message ${t.state}">
772
- <nr-icon name="${"error"===t.state?"exclamation-circle":"warning"}" size="${this.size}"></nr-icon>
773
- <span>${t.message}</span>
774
- </div>
775
- `:wt}
776
- </div>
777
- `}))}renderSearchInput(){return this.searchController.renderSearchInput()}renderValidationMessage(){const t=this.validationController.validationMessage;return t?mt`
778
- <div class="validation-message ${this.status}" id="validation-message">
779
- ${t}
780
- </div>
781
- `:wt}};xe.styles=Ht,we([Bt({type:Array})],xe.prototype,"options",void 0),we([Bt({type:String})],xe.prototype,"placeholder",void 0),we([Bt({type:Boolean,reflect:!0})],xe.prototype,"disabled",void 0),we([Bt({type:String,reflect:!0})],xe.prototype,"type",void 0),we([Bt({type:Boolean,attribute:"multiple"})],xe.prototype,"multiple",void 0),we([Bt({type:Boolean,reflect:!0})],xe.prototype,"show",void 0),we([Bt({type:String,reflect:!0})],xe.prototype,"status",void 0),we([Bt({type:String,reflect:!0})],xe.prototype,"size",void 0),we([Bt({type:Boolean,reflect:!0})],xe.prototype,"required",void 0),we([Bt({type:String})],xe.prototype,"name",void 0),we([Bt()],xe.prototype,"value",void 0),we([Bt({type:String,attribute:"no-options-message"})],xe.prototype,"noOptionsMessage",void 0),we([Bt({type:String,attribute:"no-options-icon"})],xe.prototype,"noOptionsIcon",void 0),we([Bt({type:Boolean,reflect:!0})],xe.prototype,"searchable",void 0),we([Bt({type:Boolean,reflect:!0})],xe.prototype,"clearable",void 0),we([Bt({type:String,attribute:"search-placeholder"})],xe.prototype,"searchPlaceholder",void 0),we([Bt({type:String})],xe.prototype,"searchQuery",void 0),we([Bt({type:Boolean,attribute:"use-custom-selected-display"})],xe.prototype,"useCustomSelectedDisplay",void 0),we([Bt({type:String,attribute:"max-height"})],xe.prototype,"maxHeight",void 0),we([Bt({type:Boolean,reflect:!0})],xe.prototype,"block",void 0),we([jt(".options")],xe.prototype,"optionsElement",void 0),we([jt(".wrapper")],xe.prototype,"wrapper",void 0),we([jt(".search-input")],xe.prototype,"searchInput",void 0),xe=we([(t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:i,elements:s}=e;return{kind:i,elements:s,finisher(e){customElements.define(t,e)}}})(t,e))("nr-select")],xe);
6
+ */var I=function(t,e,i,s){for(var o,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,a=t.length-1;a>=0;a--)(o=t[a])&&(n=(r<3?o(n):r>3?o(e,i,n):o(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};let N=class extends(d(s)){constructor(){super(...arguments),this.requiredComponents=["nr-input","nr-icon"],this.options=[],this.placeholder="Select an option",this.disabled=!1,this.type=p.Default,this.multiple=!1,this.show=!1,this.status=v.Default,this.size=y.Medium,this.required=!1,this.name="",this.value="",this.noOptionsMessage="No options available",this.noOptionsIcon="circle-info",this.searchable=!1,this.clearable=!1,this.searchPlaceholder="Search options...",this.searchQuery="",this.useCustomSelectedDisplay=!1,this.maxHeight="",this.block=!1,this.selectionController=new E(this),this.dropdownController=new $(this),this.keyboardController=new z(this,this.selectionController,this.dropdownController),this.focusController=new S(this),this.validationController=new k(this,this.selectionController),this.searchController=new C(this),this.eventController=new A(this),this.handleTriggerClick=t=>{this.eventController.handleTriggerClick(t)},this.handleOptionClick=(t,e)=>{this.eventController.handleOptionClick(t,e)},this.handleTagRemove=(t,e)=>{this.eventController.handleTagRemove(t,e)},this.handleClearAll=t=>{this.eventController.handleClearAll(t)},this.handleKeyDown=t=>{this.eventController.handleKeyDown(t)},this.handleFocus=()=>{this.eventController.handleFocus()},this.handleBlur=()=>{this.eventController.handleBlur()}}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}willUpdate(t){super.willUpdate(t),(t.has("options")||t.has("value"))&&this.options.length>0&&this.value&&(Array.isArray(this.value)?this.value.length>0:""!==this.value)&&(this.selectionController._initialized=!1,this.selectionController.initializeFromValue())}firstUpdated(t){super.firstUpdated(t),this.optionsElement&&this.wrapper?this.dropdownController.setElements(this.optionsElement,this.wrapper):setTimeout((()=>{this.optionsElement&&this.wrapper&&this.dropdownController.setElements(this.optionsElement,this.wrapper)}),100),this.value&&(Array.isArray(this.value)?this.value.length>0:""!==this.value)&&this.selectionController.initializeFromValue()}get selectedOptions(){return this.selectionController.getSelectedOptions()}get selectedOption(){return this.selectionController.getSelectedOption()}selectOption(t){this.selectionController.selectOption(t)}unselectOption(t){this.selectionController.unselectOption(t)}toggleOption(t){this.selectionController.toggleOption(t)}clearSelection(){this.selectionController.clearSelection()}isOptionSelected(t){return this.selectionController.isOptionSelected(t)}toggleDropdown(){this.dropdownController.toggle()}openDropdown(){this.dropdownController.open()}closeDropdown(){this.dropdownController.close()}focus(){this.focusController.focus()}blur(){this.focusController.blur()}validate(){return this.validationController.validate()}checkValidity(){return this.validationController.checkValidity()}reportValidity(){return this.validationController.reportValidity()}setCustomValidity(t){this.validationController.setCustomValidity(t)}searchOptions(t){this.searchController.search(t)}clearSearch(){this.searchController.clearSearch()}getSearchFilteredOptions(){return this.searchController.getFilteredOptions(this.options)}getCurrentSearchQuery(){return this.searchController.searchQuery}getSelectedOptions(){return this.selectedOptions}setupGlobalEventListeners(){this.eventController.setupEventListeners()}removeGlobalEventListeners(){this.eventController.removeEventListeners()}getFilteredOptions(){return this.searchController.getFilteredOptions(this.options)}setupEventListeners(){this.eventController.setupEventListeners()}removeEventListeners(){this.eventController.removeEventListeners()}render(){return i`${l(this.type,[[p.Default,()=>this.renderDefault()],[p.Inline,()=>this.renderInline()],[p.Button,()=>this.renderButton()],[p.Slot,()=>this.renderSlot()]])}`}renderDefault(){const t=this.selectedOptions,s=this.validationController.getValidationClasses();return i`<slot name="label"></slot><div class="${c(Object.assign({wrapper:!0},s))}" data-theme="${this.currentTheme}" tabindex="0" role="combobox" aria-expanded="${this.show}" aria-haspopup="listbox" aria-labelledby="select-label" @click="${this.handleTriggerClick}" @keydown="${this.handleKeyDown}" @focus="${this.handleFocus}" @blur="${this.handleBlur}"><div class="select"><div class="select-trigger">${this.renderSelectedContent(t)}</div><div class="icons-container">${this.renderStatusIcon()} ${this.renderClearButton(t)}<nr-icon name="angle-down" size="${this.size}" class="arrow-icon" aria-hidden="true"></nr-icon></div><div class="options" role="listbox" aria-multiselectable="${this.multiple}" style="${this.maxHeight?h({"max-height":this.maxHeight}):e}">${this.searchable?this.renderSearchInput():e} ${this.renderSelectOptions()}</div></div></div>${this.renderValidationMessage()}<slot name="helper-text"></slot>`}renderInline(){return i`<slot name="label"></slot>${this.renderDefault()}<slot name="helper-text"></slot>`}renderButton(){const t=this.selectedOptions;return i`<button class="select-button" ?disabled="${this.disabled}" @click="${this.handleTriggerClick}" @keydown="${this.handleKeyDown}">${t.length>0?t[0].label:this.placeholder}<nr-icon name="angle-down" class="arrow-icon"></nr-icon></button><div class="options" role="listbox" style="${this.maxHeight?h({"max-height":this.maxHeight}):e}">${this.searchable?this.renderSearchInput():e} ${this.renderSelectOptions()}</div>`}renderSlot(){return i`<slot name="trigger" @click="${this.handleTriggerClick}"></slot><div class="options" role="listbox" style="${this.maxHeight?h({"max-height":this.maxHeight}):e}">${this.searchable?this.renderSearchInput():e} ${this.renderSelectOptions()}</div>`}renderSelectedContent(t){return 0===t.length?i`<span class="placeholder" aria-hidden="true">${this.placeholder}</span>`:this.multiple?this.useCustomSelectedDisplay?i`<slot name="selected-display" .selectedOptions="${t}"></slot>`:a(t,(t=>i`<span class="tag"><span class="tag-label">${t.label}</span><nr-icon name="remove" size="${this.size}" class="tag-close" @click="${e=>this.handleTagRemove(e,t)}" aria-label="Remove ${t.label}"></nr-icon></span>`)):i`${t[0].label}`}renderStatusIcon(){switch(this.status){case v.Warning:return i`<nr-icon name="warning" size="${this.size}" class="status-icon warning"></nr-icon>`;case v.Error:return i`<nr-icon name="exclamation-circle" size="${this.size}" class="status-icon error"></nr-icon>`;case v.Success:return i`<nr-icon name="check-circle" size="${this.size}" class="status-icon success"></nr-icon>`;default:return e}}renderClearButton(t){return!this.clearable||0===t.length||this.disabled?e:i`<nr-icon name="remove" size="${this.size}" class="clear-icon" @click="${this.handleClearAll}" aria-label="Clear selection" tabindex="-1"></nr-icon>`}renderSelectOptions(){const t=this.getFilteredOptions();if(!this.options||0===this.options.length)return i`<div class="no-options" role="option" aria-disabled="true"><div class="no-options-content"><nr-icon name="${this.noOptionsIcon}" class="no-options-icon" aria-hidden="true"></nr-icon><span class="no-options-text">${this.noOptionsMessage}</span></div></div>`;if(this.searchController.hasNoResults(this.options))return this.searchController.renderNoResults();const s=this.keyboardController.focusedOption;return a(t,(t=>{const o=this.isOptionSelected(t),r=s&&s.value===t.value;return i`<div class="${c({option:!0,selected:o,focused:r,disabled:Boolean(t.disabled)})}" role="option" aria-selected="${o}" aria-disabled="${Boolean(t.disabled)}" data-value="${t.value}" @click="${e=>this.handleOptionClick(e,t)}" style="${h(t.style?{style:t.style}:{})}" title="${t.title||""}"><div class="option-content">${t.icon?i`<nr-icon name="${t.icon}" size="${this.size}" class="option-icon"></nr-icon>`:e}<div class="option-text">${t.htmlContent?i`<div .innerHTML="${t.htmlContent}"></div>`:t.label} ${t.description?i`<div class="option-description">${t.description}</div>`:e}</div></div>${o?i`<nr-icon name="check" size="${this.size}" class="check-icon" aria-hidden="true"></nr-icon>`:e} ${t.state&&t.message?i`<div class="option-message ${t.state}"><nr-icon name="${"error"===t.state?"exclamation-circle":"warning"}" size="${this.size}"></nr-icon><span>${t.message}</span></div>`:e}</div>`}))}renderSearchInput(){return this.searchController.renderSearchInput()}renderValidationMessage(){const t=this.validationController.validationMessage;return t?i`<div class="validation-message ${this.status}" id="validation-message">${t}</div>`:e}};N.styles=u,I([o({type:Array})],N.prototype,"options",void 0),I([o({type:String})],N.prototype,"placeholder",void 0),I([o({type:Boolean,reflect:!0})],N.prototype,"disabled",void 0),I([o({type:String,reflect:!0})],N.prototype,"type",void 0),I([o({type:Boolean,attribute:"multiple"})],N.prototype,"multiple",void 0),I([o({type:Boolean,reflect:!0})],N.prototype,"show",void 0),I([o({type:String,reflect:!0})],N.prototype,"status",void 0),I([o({type:String,reflect:!0})],N.prototype,"size",void 0),I([o({type:Boolean,reflect:!0})],N.prototype,"required",void 0),I([o({type:String})],N.prototype,"name",void 0),I([o()],N.prototype,"value",void 0),I([o({type:String,attribute:"no-options-message"})],N.prototype,"noOptionsMessage",void 0),I([o({type:String,attribute:"no-options-icon"})],N.prototype,"noOptionsIcon",void 0),I([o({type:Boolean,reflect:!0})],N.prototype,"searchable",void 0),I([o({type:Boolean,reflect:!0})],N.prototype,"clearable",void 0),I([o({type:String,attribute:"search-placeholder"})],N.prototype,"searchPlaceholder",void 0),I([o({type:String})],N.prototype,"searchQuery",void 0),I([o({type:Boolean,attribute:"use-custom-selected-display"})],N.prototype,"useCustomSelectedDisplay",void 0),I([o({type:String,attribute:"max-height"})],N.prototype,"maxHeight",void 0),I([o({type:Boolean,reflect:!0})],N.prototype,"block",void 0),I([r(".options")],N.prototype,"optionsElement",void 0),I([r(".wrapper")],N.prototype,"wrapper",void 0),I([r(".search-input")],N.prototype,"searchInput",void 0),N=I([n("nr-select")],N);
782
7
  /**
783
8
  * @license
784
9
  * Copyright 2023 Nuraly, Laabidi Aymen
785
10
  * SPDX-License-Identifier: MIT
786
11
  */
787
- const $e={CHANGE:"nr-change",FOCUS:"nr-focus",BLUR:"nr-blur",DROPDOWN_OPEN:"nr-dropdown-open",DROPDOWN_CLOSE:"nr-dropdown-close",VALIDATION:"nr-validation",ERROR:"nr-select-error"},Ee={WRAPPER:"wrapper",SELECT:"select",TRIGGER:"select-trigger",OPTIONS:"options",OPTION:"option",SELECTED:"selected",FOCUSED:"focused",DISABLED:"disabled",TAG:"tag",TAG_LABEL:"tag-label",TAG_CLOSE:"tag-close",ICONS_CONTAINER:"icons-container",ARROW_ICON:"arrow-icon",CLEAR_ICON:"clear-icon",STATUS_ICON:"status-icon",CHECK_ICON:"check-icon",VALIDATION_MESSAGE:"validation-message",PLACEHOLDER:"placeholder",NO_OPTIONS:"no-options",NO_OPTIONS_CONTENT:"no-options-content",NO_OPTIONS_ICON:"no-options-icon",NO_OPTIONS_TEXT:"no-options-text",SEARCH_CONTAINER:"search-container",SEARCH_INPUT:"search-input",SEARCH_ICON:"search-icon",SEARCH_CLEAR:"search-clear"},Se={COMBOBOX:"combobox",LISTBOX:"listbox",OPTION:"option",EXPANDED:"aria-expanded",HASPOPUP:"aria-haspopup",MULTISELECTABLE:"aria-multiselectable",SELECTED:"aria-selected",DISABLED:"aria-disabled",REQUIRED:"aria-required",INVALID:"aria-invalid",DESCRIBEDBY:"aria-describedby",LABELLEDBY:"aria-labelledby"},Oe={PLACEHOLDER:"Select an option",MAX_HEIGHT:"200px",DROPDOWN_OFFSET:4,TAG_MAX_WIDTH:"150px",TRANSITION_DURATION:200,DEBOUNCE_DELAY:300},Ae={ENTER:"Enter",SPACE:" ",ESCAPE:"Escape",ARROW_DOWN:"ArrowDown",ARROW_UP:"ArrowUp",HOME:"Home",END:"End",TAB:"Tab"},ke="",ze=", ";export{ue as BaseSelectController,ce as DropdownPlacement,ke as EMPTY_STRING,xe as HySelectComponent,ze as MULTIPLE_OPTIONS_SEPARATOR,ne as OptionSize,Se as SELECT_ARIA,Ee as SELECT_CLASSES,Oe as SELECT_DEFAULTS,$e as SELECT_EVENTS,Ae as SELECT_KEYS,he as SearchMode,le as SelectDirection,ye as SelectDropdownController,be as SelectEventController,fe as SelectFocusController,ve as SelectKeyboardController,me as SelectSearchController,pe as SelectSelectionController,re as SelectSize,oe as SelectStatus,se as SelectType,ge as SelectValidationController,ae as SelectVariant};
12
+ const D={CHANGE:"nr-change",FOCUS:"nr-focus",BLUR:"nr-blur",DROPDOWN_OPEN:"nr-dropdown-open",DROPDOWN_CLOSE:"nr-dropdown-close",VALIDATION:"nr-validation",ERROR:"nr-select-error"},T={WRAPPER:"wrapper",SELECT:"select",TRIGGER:"select-trigger",OPTIONS:"options",OPTION:"option",SELECTED:"selected",FOCUSED:"focused",DISABLED:"disabled",TAG:"tag",TAG_LABEL:"tag-label",TAG_CLOSE:"tag-close",ICONS_CONTAINER:"icons-container",ARROW_ICON:"arrow-icon",CLEAR_ICON:"clear-icon",STATUS_ICON:"status-icon",CHECK_ICON:"check-icon",VALIDATION_MESSAGE:"validation-message",PLACEHOLDER:"placeholder",NO_OPTIONS:"no-options",NO_OPTIONS_CONTENT:"no-options-content",NO_OPTIONS_ICON:"no-options-icon",NO_OPTIONS_TEXT:"no-options-text",SEARCH_CONTAINER:"search-container",SEARCH_INPUT:"search-input",SEARCH_ICON:"search-icon",SEARCH_CLEAR:"search-clear"},R={COMBOBOX:"combobox",LISTBOX:"listbox",OPTION:"option",EXPANDED:"aria-expanded",HASPOPUP:"aria-haspopup",MULTISELECTABLE:"aria-multiselectable",SELECTED:"aria-selected",DISABLED:"aria-disabled",REQUIRED:"aria-required",INVALID:"aria-invalid",DESCRIBEDBY:"aria-describedby",LABELLEDBY:"aria-labelledby"},L={PLACEHOLDER:"Select an option",MAX_HEIGHT:"200px",DROPDOWN_OFFSET:4,TAG_MAX_WIDTH:"150px",TRANSITION_DURATION:200,DEBOUNCE_DELAY:300},P={ENTER:"Enter",SPACE:" ",ESCAPE:"Escape",ARROW_DOWN:"ArrowDown",ARROW_UP:"ArrowUp",HOME:"Home",END:"End",TAB:"Tab"},B="",F=", ";export{O as BaseSelectController,b as DropdownPlacement,B as EMPTY_STRING,N as HySelectComponent,F as MULTIPLE_OPTIONS_SEPARATOR,g as OptionSize,R as SELECT_ARIA,T as SELECT_CLASSES,L as SELECT_DEFAULTS,D as SELECT_EVENTS,P as SELECT_KEYS,w as SearchMode,m as SelectDirection,$ as SelectDropdownController,A as SelectEventController,S as SelectFocusController,z as SelectKeyboardController,C as SelectSearchController,E as SelectSelectionController,y as SelectSize,v as SelectStatus,p as SelectType,k as SelectValidationController,f as SelectVariant};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuralyui/select",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "A comprehensive select component with advanced features including multi-selection, keyboard navigation, validation, and accessibility support.",
5
5
  "main": "index.js",
6
6
  "type": "module",