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