@nuralyui/dropdown 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bundle.js +2 -574
  2. package/package.json +1 -1
package/bundle.js CHANGED
@@ -1,578 +1,6 @@
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,o=Symbol(),n=new WeakMap;class e{constructor(t,i,n){if(this._$cssResult$=!0,n!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o;const o=this.t;if(i&&void 0===t){const i=void 0!==o&&1===o.length;i&&(t=n.get(o)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&n.set(o,t))}return t}toString(){return this.cssText}}const s=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let i="";for(const o of t.cssRules)i+=o.cssText;return(t=>new e("string"==typeof t?t:t+"",void 0,o))(i)})(t):t
7
- /**
8
- * @license
9
- * Copyright 2017 Google LLC
10
- * SPDX-License-Identifier: BSD-3-Clause
11
- */;var r;const d=window,a=d.trustedTypes,l=a?a.emptyScript:"",h=d.reactiveElementPolyfillSupport,u={toAttribute(t,i){switch(i){case Boolean:t=t?l:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,i){let o=t;switch(i){case Boolean:o=null!==t;break;case Number:o=null===t?null:Number(t);break;case Object:case Array:try{o=JSON.parse(t)}catch(t){o=null}}return o}},c=(t,i)=>i!==t&&(i==i||t==t),p={attribute:!0,type:String,converter:u,reflect:!1,hasChanged:c},v="finalized";class w 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,o)=>{const n=this._$Ep(o,i);void 0!==n&&(this._$Ev.set(n,o),t.push(n))})),t}static createProperty(t,i=p){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){const o="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,o,i);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,i,o){return{get(){return this[i]},set(n){const e=this[t];this[i]=n,this.requestUpdate(t,e,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||p}static finalize(){if(this.hasOwnProperty(v))return!1;this[v]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const o of i)this.createProperty(o,t[o])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const i=[];if(Array.isArray(t)){const o=new Set(t.flat(1/0).reverse());for(const t of o)i.unshift(s(t))}else void 0!==t&&i.push(s(t));return i}static _$Ep(t,i){const o=i.attribute;return!1===o?void 0:"string"==typeof o?o:"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,o;(null!==(i=this._$ES)&&void 0!==i?i:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(o=t.hostConnected)||void 0===o||o.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 o;const n=null!==(o=this.shadowRoot)&&void 0!==o?o:this.attachShadow(this.constructor.shadowRootOptions);return((o,n)=>{i?o.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):n.forEach((i=>{const n=document.createElement("style"),e=t.litNonce;void 0!==e&&n.setAttribute("nonce",e),n.textContent=i.cssText,o.appendChild(n)}))})(n,this.constructor.elementStyles),n}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,o){this._$AK(t,o)}_$EO(t,i,o=p){var n;const e=this.constructor._$Ep(t,o);if(void 0!==e&&!0===o.reflect){const s=(void 0!==(null===(n=o.converter)||void 0===n?void 0:n.toAttribute)?o.converter:u).toAttribute(i,o.type);this._$El=t,null==s?this.removeAttribute(e):this.setAttribute(e,s),this._$El=null}}_$AK(t,i){var o;const n=this.constructor,e=n._$Ev.get(t);if(void 0!==e&&this._$El!==e){const t=n.getPropertyOptions(e),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(o=t.converter)||void 0===o?void 0:o.fromAttribute)?t.converter:u;this._$El=e,this[e]=s.fromAttribute(i,t.type),this._$El=null}}requestUpdate(t,i,o){let n=!0;void 0!==t&&(((o=o||this.constructor.getPropertyOptions(t)).hasChanged||c)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),!0===o.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,o))):n=!1),!this.isUpdatePending&&n&&(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 o=this._$AL;try{i=this.shouldUpdate(o),i?(this.willUpdate(o),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(o)):this._$Ek()}catch(t){throw i=!1,this._$Ek(),t}i&&this._$AE(o)}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 m;w[v]=!0,w.elementProperties=new Map,w.elementStyles=[],w.shadowRootOptions={mode:"open"},null==h||h({ReactiveElement:w}),(null!==(r=d.reactiveElementVersions)&&void 0!==r?r:d.reactiveElementVersions=[]).push("1.6.3");const f=window,_=f.trustedTypes,y=_?_.createPolicy("lit-html",{createHTML:t=>t}):void 0,b="$lit$",g=`lit$${(Math.random()+"").slice(9)}$`,$="?"+g,x=`<${$}>`,S=document,k=()=>S.createComment(""),A=t=>null===t||"object"!=typeof t&&"function"!=typeof t,E=Array.isArray,C="[ \t\n\f\r]",T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,z=/-->/g,O=/>/g,U=RegExp(`>|${C}(?:([^\\s"'>=/]+)(${C}*=${C}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),j=/'/g,M=/"/g,N=/^(?:script|style|textarea|title)$/i,R=Symbol.for("lit-noChange"),D=Symbol.for("lit-nothing"),I=new WeakMap,L=S.createTreeWalker(S,129,null,!1);function P(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==y?y.createHTML(i):i}class B{constructor({strings:t,_$litType$:i},o){let n;this.parts=[];let e=0,s=0;const r=t.length-1,d=this.parts,[a,l]=((t,i)=>{const o=t.length-1,n=[];let e,s=2===i?"<svg>":"",r=T;for(let i=0;i<o;i++){const o=t[i];let d,a,l=-1,h=0;for(;h<o.length&&(r.lastIndex=h,a=r.exec(o),null!==a);)h=r.lastIndex,r===T?"!--"===a[1]?r=z:void 0!==a[1]?r=O:void 0!==a[2]?(N.test(a[2])&&(e=RegExp("</"+a[2],"g")),r=U):void 0!==a[3]&&(r=U):r===U?">"===a[0]?(r=null!=e?e:T,l=-1):void 0===a[1]?l=-2:(l=r.lastIndex-a[2].length,d=a[1],r=void 0===a[3]?U:'"'===a[3]?M:j):r===M||r===j?r=U:r===z||r===O?r=T:(r=U,e=void 0);const u=r===U&&t[i+1].startsWith("/>")?" ":"";s+=r===T?o+x:l>=0?(n.push(d),o.slice(0,l)+b+o.slice(l)+g+u):o+g+(-2===l?(n.push(void 0),i):u)}return[P(t,s+(t[o]||"<?>")+(2===i?"</svg>":"")),n]})(t,i);if(this.el=B.createElement(a,o),L.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(n=L.nextNode())&&d.length<r;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const i of n.getAttributeNames())if(i.endsWith(b)||i.startsWith(g)){const o=l[s++];if(t.push(i),void 0!==o){const t=n.getAttribute(o.toLowerCase()+b).split(g),i=/([.?@])?(.*)/.exec(o);d.push({type:1,index:e,name:i[2],strings:t,ctor:"."===i[1]?W:"?"===i[1]?q:"@"===i[1]?V:K})}else d.push({type:6,index:e})}for(const i of t)n.removeAttribute(i)}if(N.test(n.tagName)){const t=n.textContent.split(g),i=t.length-1;if(i>0){n.textContent=_?_.emptyScript:"";for(let o=0;o<i;o++)n.append(t[o],k()),L.nextNode(),d.push({type:2,index:++e});n.append(t[i],k())}}}else if(8===n.nodeType)if(n.data===$)d.push({type:2,index:e});else{let t=-1;for(;-1!==(t=n.data.indexOf(g,t+1));)d.push({type:7,index:e}),t+=g.length-1}e++}}static createElement(t,i){const o=S.createElement("template");return o.innerHTML=t,o}}function F(t,i,o=t,n){var e,s,r,d;if(i===R)return i;let a=void 0!==n?null===(e=o._$Co)||void 0===e?void 0:e[n]:o._$Cl;const l=A(i)?void 0:i._$litDirective$;return(null==a?void 0:a.constructor)!==l&&(null===(s=null==a?void 0:a._$AO)||void 0===s||s.call(a,!1),void 0===l?a=void 0:(a=new l(t),a._$AT(t,o,n)),void 0!==n?(null!==(r=(d=o)._$Co)&&void 0!==r?r:d._$Co=[])[n]=a:o._$Cl=a),void 0!==a&&(i=F(t,a._$AS(t,i.values),a,n)),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:o},parts:n}=this._$AD,e=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:S).importNode(o,!0);L.currentNode=e;let s=L.nextNode(),r=0,d=0,a=n[0];for(;void 0!==a;){if(r===a.index){let i;2===a.type?i=new Y(s,s.nextSibling,this,t):1===a.type?i=new a.ctor(s,a.name,a.strings,this,t):6===a.type&&(i=new Z(s,this,t)),this._$AV.push(i),a=n[++d]}r!==(null==a?void 0:a.index)&&(s=L.nextNode(),r++)}return L.currentNode=S,e}v(t){let i=0;for(const o of this._$AV)void 0!==o&&(void 0!==o.strings?(o._$AI(t,o,i),i+=o.strings.length-2):o._$AI(t[i])),i++}}class Y{constructor(t,i,o,n){var e;this.type=2,this._$AH=D,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=o,this.options=n,this._$Cp=null===(e=null==n?void 0:n.isConnected)||void 0===e||e}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=F(this,t,i),A(t)?t===D||null==t||""===t?(this._$AH!==D&&this._$AR(),this._$AH=D):t!==this._$AH&&t!==R&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>E(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!==D&&A(this._$AH)?this._$AA.nextSibling.data=t:this.$(S.createTextNode(t)),this._$AH=t}g(t){var i;const{values:o,_$litType$:n}=t,e="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=B.createElement(P(n.h,n.h[0]),this.options)),n);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===e)this._$AH.v(o);else{const t=new H(e,this),i=t.u(this.options);t.v(o),this.$(i),this._$AH=t}}_$AC(t){let i=I.get(t.strings);return void 0===i&&I.set(t.strings,i=new B(t)),i}T(t){E(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let o,n=0;for(const e of t)n===i.length?i.push(o=new Y(this.k(k()),this.k(k()),this,this.options)):o=i[n],o._$AI(e),n++;n<i.length&&(this._$AR(o&&o._$AB.nextSibling,n),i.length=n)}_$AR(t=this._$AA.nextSibling,i){var o;for(null===(o=this._$AP)||void 0===o||o.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 K{constructor(t,i,o,n,e){this.type=1,this._$AH=D,this._$AN=void 0,this.element=t,this.name=i,this._$AM=n,this.options=e,o.length>2||""!==o[0]||""!==o[1]?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=D}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,o,n){const e=this.strings;let s=!1;if(void 0===e)t=F(this,t,i,0),s=!A(t)||t!==this._$AH&&t!==R,s&&(this._$AH=t);else{const n=t;let r,d;for(t=e[0],r=0;r<e.length-1;r++)d=F(this,n[o+r],i,r),d===R&&(d=this._$AH[r]),s||(s=!A(d)||d!==this._$AH[r]),d===D?t=D:t!==D&&(t+=(null!=d?d:"")+e[r+1]),this._$AH[r]=d}s&&!n&&this.j(t)}j(t){t===D?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class W extends K{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===D?void 0:t}}const X=_?_.emptyScript:"";class q extends K{constructor(){super(...arguments),this.type=4}j(t){t&&t!==D?this.element.setAttribute(this.name,X):this.element.removeAttribute(this.name)}}class V extends K{constructor(t,i,o,n,e){super(t,i,o,n,e),this.type=5}_$AI(t,i=this){var o;if((t=null!==(o=F(this,t,i,0))&&void 0!==o?o:D)===R)return;const n=this._$AH,e=t===D&&n!==D||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==D&&(n===D||e);e&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,o;"function"==typeof this._$AH?this._$AH.call(null!==(o=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==o?o:this.element,t):this._$AH.handleEvent(t)}}class Z{constructor(t,i,o){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=o}get _$AU(){return this._$AM._$AU}_$AI(t){F(this,t)}}const J=f.litHtmlPolyfillSupport;
18
- /**
19
- * @license
20
- * Copyright 2017 Google LLC
21
- * SPDX-License-Identifier: BSD-3-Clause
22
- */
23
- var G;null==J||J(B,Y),(null!==(m=f.litHtmlVersions)&&void 0!==m?m:f.litHtmlVersions=[]).push("2.8.0");const Q=window,tt=Q.trustedTypes,it=tt?tt.createPolicy("lit-html",{createHTML:t=>t}):void 0,ot="$lit$",nt=`lit$${(Math.random()+"").slice(9)}$`,et="?"+nt,st=`<${et}>`,rt=document,dt=()=>rt.createComment(""),at=t=>null===t||"object"!=typeof t&&"function"!=typeof t,lt=Array.isArray,ht="[ \t\n\f\r]",ut=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ct=/-->/g,pt=/>/g,vt=RegExp(`>|${ht}(?:([^\\s"'>=/]+)(${ht}*=${ht}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),wt=/'/g,mt=/"/g,ft=/^(?:script|style|textarea|title)$/i,_t=(t=>(i,...o)=>({_$litType$:t,strings:i,values:o}))(1),yt=Symbol.for("lit-noChange"),bt=Symbol.for("lit-nothing"),gt=new WeakMap,$t=rt.createTreeWalker(rt,129,null,!1);function xt(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==it?it.createHTML(i):i}const St=(t,i)=>{const o=t.length-1,n=[];let e,s=2===i?"<svg>":"",r=ut;for(let i=0;i<o;i++){const o=t[i];let d,a,l=-1,h=0;for(;h<o.length&&(r.lastIndex=h,a=r.exec(o),null!==a);)h=r.lastIndex,r===ut?"!--"===a[1]?r=ct:void 0!==a[1]?r=pt:void 0!==a[2]?(ft.test(a[2])&&(e=RegExp("</"+a[2],"g")),r=vt):void 0!==a[3]&&(r=vt):r===vt?">"===a[0]?(r=null!=e?e:ut,l=-1):void 0===a[1]?l=-2:(l=r.lastIndex-a[2].length,d=a[1],r=void 0===a[3]?vt:'"'===a[3]?mt:wt):r===mt||r===wt?r=vt:r===ct||r===pt?r=ut:(r=vt,e=void 0);const u=r===vt&&t[i+1].startsWith("/>")?" ":"";s+=r===ut?o+st:l>=0?(n.push(d),o.slice(0,l)+ot+o.slice(l)+nt+u):o+nt+(-2===l?(n.push(void 0),i):u)}return[xt(t,s+(t[o]||"<?>")+(2===i?"</svg>":"")),n]};class kt{constructor({strings:t,_$litType$:i},o){let n;this.parts=[];let e=0,s=0;const r=t.length-1,d=this.parts,[a,l]=St(t,i);if(this.el=kt.createElement(a,o),$t.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(n=$t.nextNode())&&d.length<r;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const i of n.getAttributeNames())if(i.endsWith(ot)||i.startsWith(nt)){const o=l[s++];if(t.push(i),void 0!==o){const t=n.getAttribute(o.toLowerCase()+ot).split(nt),i=/([.?@])?(.*)/.exec(o);d.push({type:1,index:e,name:i[2],strings:t,ctor:"."===i[1]?zt:"?"===i[1]?Ut:"@"===i[1]?jt:Tt})}else d.push({type:6,index:e})}for(const i of t)n.removeAttribute(i)}if(ft.test(n.tagName)){const t=n.textContent.split(nt),i=t.length-1;if(i>0){n.textContent=tt?tt.emptyScript:"";for(let o=0;o<i;o++)n.append(t[o],dt()),$t.nextNode(),d.push({type:2,index:++e});n.append(t[i],dt())}}}else if(8===n.nodeType)if(n.data===et)d.push({type:2,index:e});else{let t=-1;for(;-1!==(t=n.data.indexOf(nt,t+1));)d.push({type:7,index:e}),t+=nt.length-1}e++}}static createElement(t,i){const o=rt.createElement("template");return o.innerHTML=t,o}}function At(t,i,o=t,n){var e,s,r,d;if(i===yt)return i;let a=void 0!==n?null===(e=o._$Co)||void 0===e?void 0:e[n]:o._$Cl;const l=at(i)?void 0:i._$litDirective$;return(null==a?void 0:a.constructor)!==l&&(null===(s=null==a?void 0:a._$AO)||void 0===s||s.call(a,!1),void 0===l?a=void 0:(a=new l(t),a._$AT(t,o,n)),void 0!==n?(null!==(r=(d=o)._$Co)&&void 0!==r?r:d._$Co=[])[n]=a:o._$Cl=a),void 0!==a&&(i=At(t,a._$AS(t,i.values),a,n)),i}class Et{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:o},parts:n}=this._$AD,e=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:rt).importNode(o,!0);$t.currentNode=e;let s=$t.nextNode(),r=0,d=0,a=n[0];for(;void 0!==a;){if(r===a.index){let i;2===a.type?i=new Ct(s,s.nextSibling,this,t):1===a.type?i=new a.ctor(s,a.name,a.strings,this,t):6===a.type&&(i=new Mt(s,this,t)),this._$AV.push(i),a=n[++d]}r!==(null==a?void 0:a.index)&&(s=$t.nextNode(),r++)}return $t.currentNode=rt,e}v(t){let i=0;for(const o of this._$AV)void 0!==o&&(void 0!==o.strings?(o._$AI(t,o,i),i+=o.strings.length-2):o._$AI(t[i])),i++}}class Ct{constructor(t,i,o,n){var e;this.type=2,this._$AH=bt,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=o,this.options=n,this._$Cp=null===(e=null==n?void 0:n.isConnected)||void 0===e||e}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=At(this,t,i),at(t)?t===bt||null==t||""===t?(this._$AH!==bt&&this._$AR(),this._$AH=bt):t!==this._$AH&&t!==yt&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>lt(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!==bt&&at(this._$AH)?this._$AA.nextSibling.data=t:this.$(rt.createTextNode(t)),this._$AH=t}g(t){var i;const{values:o,_$litType$:n}=t,e="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=kt.createElement(xt(n.h,n.h[0]),this.options)),n);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===e)this._$AH.v(o);else{const t=new Et(e,this),i=t.u(this.options);t.v(o),this.$(i),this._$AH=t}}_$AC(t){let i=gt.get(t.strings);return void 0===i&&gt.set(t.strings,i=new kt(t)),i}T(t){lt(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let o,n=0;for(const e of t)n===i.length?i.push(o=new Ct(this.k(dt()),this.k(dt()),this,this.options)):o=i[n],o._$AI(e),n++;n<i.length&&(this._$AR(o&&o._$AB.nextSibling,n),i.length=n)}_$AR(t=this._$AA.nextSibling,i){var o;for(null===(o=this._$AP)||void 0===o||o.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,o,n,e){this.type=1,this._$AH=bt,this._$AN=void 0,this.element=t,this.name=i,this._$AM=n,this.options=e,o.length>2||""!==o[0]||""!==o[1]?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=bt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,o,n){const e=this.strings;let s=!1;if(void 0===e)t=At(this,t,i,0),s=!at(t)||t!==this._$AH&&t!==yt,s&&(this._$AH=t);else{const n=t;let r,d;for(t=e[0],r=0;r<e.length-1;r++)d=At(this,n[o+r],i,r),d===yt&&(d=this._$AH[r]),s||(s=!at(d)||d!==this._$AH[r]),d===bt?t=bt:t!==bt&&(t+=(null!=d?d:"")+e[r+1]),this._$AH[r]=d}s&&!n&&this.j(t)}j(t){t===bt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class zt extends Tt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===bt?void 0:t}}const Ot=tt?tt.emptyScript:"";class Ut extends Tt{constructor(){super(...arguments),this.type=4}j(t){t&&t!==bt?this.element.setAttribute(this.name,Ot):this.element.removeAttribute(this.name)}}class jt extends Tt{constructor(t,i,o,n,e){super(t,i,o,n,e),this.type=5}_$AI(t,i=this){var o;if((t=null!==(o=At(this,t,i,0))&&void 0!==o?o:bt)===yt)return;const n=this._$AH,e=t===bt&&n!==bt||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==bt&&(n===bt||e);e&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,o;"function"==typeof this._$AH?this._$AH.call(null!==(o=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==o?o:this.element,t):this._$AH.handleEvent(t)}}class Mt{constructor(t,i,o){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=o}get _$AU(){return this._$AM._$AU}_$AI(t){At(this,t)}}const Nt=Q.litHtmlPolyfillSupport;null==Nt||Nt(kt,Ct),(null!==(G=Q.litHtmlVersions)&&void 0!==G?G:Q.litHtmlVersions=[]).push("2.8.0");
24
- /**
25
- * @license
26
- * Copyright 2017 Google LLC
27
- * SPDX-License-Identifier: BSD-3-Clause
28
- */
29
- var Rt,Dt;class It extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,i;const o=super.createRenderRoot();return null!==(t=(i=this.renderOptions).renderBefore)&&void 0!==t||(i.renderBefore=o.firstChild),o}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,i,o)=>{var n,e;const s=null!==(n=null==o?void 0:o.renderBefore)&&void 0!==n?n:i;let r=s._$litPart$;if(void 0===r){const t=null!==(e=null==o?void 0:o.renderBefore)&&void 0!==e?e:null;s._$litPart$=r=new Ct(i.insertBefore(dt(),t),t,void 0,null!=o?o:{})}return r._$AI(t),r})(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 yt}}It.finalized=!0,It._$litElement$=!0,null===(Rt=globalThis.litElementHydrateSupport)||void 0===Rt||Rt.call(globalThis,{LitElement:It});const Lt=globalThis.litElementPolyfillSupport;null==Lt||Lt({LitElement:It}),(null!==(Dt=globalThis.litElementVersions)&&void 0!==Dt?Dt:globalThis.litElementVersions=[]).push("3.3.3");
30
- /**
31
- * @license
32
- * Copyright 2017 Google LLC
33
- * SPDX-License-Identifier: BSD-3-Clause
34
- */
35
- const Pt=(t,i)=>"method"===i.kind&&i.descriptor&&!("value"in i.descriptor)?{...i,finisher(o){o.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(o){o.createProperty(i.key,t)}};
36
- /**
37
- * @license
38
- * Copyright 2017 Google LLC
39
- * SPDX-License-Identifier: BSD-3-Clause
40
- */function Bt(t){return(i,o)=>void 0!==o?((t,i,o)=>{i.constructor.createProperty(o,t)})(t,i,o):Pt(t,i)
41
- /**
42
- * @license
43
- * Copyright 2021 Google LLC
44
- * SPDX-License-Identifier: BSD-3-Clause
45
- */}var Ft;null===(Ft=window.HTMLSlotElement)||void 0===Ft||Ft.prototype.assignedElements;const Ht=((t,...i)=>{const n=1===t.length?t[0]:i.reduce(((i,o,n)=>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.")})(o)+t[n+1]),t[0]);return new e(n,t,o)})`
46
- :host {
47
- display: inline-block;
48
- position: relative;
49
- color: var(--nuraly-color-text);
50
- font-family: var(--nuraly-dropdown-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif);
51
- }
52
-
53
- .dropdown {
54
- position: relative;
55
- display: inline-block;
56
- }
57
-
58
- .dropdown__trigger {
59
- display: inline-block;
60
- cursor: pointer;
61
- }
62
-
63
- .dropdown__trigger:focus-within {
64
- outline: var(--nuraly-focus-outline, 2px solid #0f62fe);
65
- outline-offset: var(--nuraly-focus-outline-offset, 1px);
66
- }
67
-
68
- .dropdown__panel {
69
- position: absolute;
70
- top: 100%;
71
- left: 0;
72
- z-index: var(--nuraly-dropdown-z-index, 9999);
73
- background: var(--nuraly-color-dropdown-background, #ffffff);
74
- border: var(--nuraly-dropdown-border-width, 1px) solid var(--nuraly-color-dropdown-border, #e0e0e0);
75
- border-radius: var(--nuraly-dropdown-border-radius, 6px);
76
- box-shadow: var(--nuraly-dropdown-shadow, 0 2px 6px rgba(0, 0, 0, 0.15));
77
- min-width: var(--nuraly-dropdown-min-width, 10rem);
78
- max-width: var(--nuraly-dropdown-max-width, 20rem);
79
- max-height: var(--nuraly-dropdown-max-height, 200px);
80
- overflow: auto;
81
- /* Use opacity and visibility for smooth animations */
82
- opacity: 0;
83
- visibility: hidden;
84
- transform: translateY(-8px);
85
- transition: all var(--nuraly-dropdown-animation-duration, 0.15s) var(--nuraly-dropdown-animation-timing, ease);
86
- /* Ensure proper containment */
87
- box-sizing: border-box;
88
- /* Create new stacking context to prevent layering issues */
89
- isolation: isolate;
90
- /* Force above other elements */
91
- transform-origin: top center;
92
- }
93
-
94
- .dropdown__panel--open {
95
- opacity: 1;
96
- visibility: visible;
97
- transform: translateY(0);
98
- }
99
-
100
- /* Alternative attribute-based selector (like select component) */
101
- :host([open]) .dropdown__panel {
102
- opacity: 1;
103
- visibility: visible;
104
- transform: translateY(0);
105
- }
106
-
107
- /* Placement variants */
108
- .dropdown__panel--top,
109
- .dropdown__panel--top-start,
110
- .dropdown__panel--top-end {
111
- top: auto;
112
- bottom: 100%;
113
- margin-bottom: 1px;
114
- margin-top: 0;
115
- transform: translateY(8px);
116
- }
117
-
118
- .dropdown__panel--top.dropdown__panel--open,
119
- .dropdown__panel--top-start.dropdown__panel--open,
120
- .dropdown__panel--top-end.dropdown__panel--open {
121
- transform: translateY(0);
122
- }
123
-
124
- .dropdown__panel--bottom-end,
125
- .dropdown__panel--top-end {
126
- left: auto;
127
- right: 0;
128
- }
129
-
130
- .dropdown__panel--bottom-start,
131
- .dropdown__panel--top-start {
132
- left: 0;
133
- right: auto;
134
- }
135
-
136
- /* Size variants */
137
- .dropdown__panel--small {
138
- font-size: var(--nuraly-dropdown-small-font-size, 0.75rem);
139
- }
140
-
141
- .dropdown__panel--medium {
142
- font-size: var(--nuraly-dropdown-font-size, 0.875rem);
143
- }
144
-
145
- .dropdown__panel--large {
146
- font-size: var(--nuraly-dropdown-large-font-size, 1rem);
147
- }
148
-
149
- /* Animation variants */
150
-
151
- /* No animation - instant show/hide */
152
- .dropdown__panel--none {
153
- transition: none;
154
- }
155
-
156
- .dropdown__panel--none:not(.dropdown__panel--open) {
157
- opacity: 0;
158
- visibility: hidden;
159
- transform: none;
160
- }
161
-
162
- .dropdown__panel--none.dropdown__panel--open {
163
- opacity: 1;
164
- visibility: visible;
165
- transform: none;
166
- }
167
-
168
- /* Fade animation - opacity only */
169
- .dropdown__panel--fade {
170
- transition: opacity var(--nuraly-dropdown-animation-duration, 0.15s) var(--nuraly-dropdown-animation-timing, ease),
171
- visibility var(--nuraly-dropdown-animation-duration, 0.15s) var(--nuraly-dropdown-animation-timing, ease);
172
- }
173
-
174
- .dropdown__panel--fade:not(.dropdown__panel--open) {
175
- opacity: 0;
176
- visibility: hidden;
177
- transform: none;
178
- }
179
-
180
- .dropdown__panel--fade.dropdown__panel--open {
181
- opacity: 1;
182
- visibility: visible;
183
- transform: none;
184
- }
185
-
186
- /* Slide animation - slide down/up with opacity */
187
- .dropdown__panel--slide {
188
- transition: opacity var(--nuraly-dropdown-animation-duration, 0.15s) var(--nuraly-dropdown-animation-timing, ease),
189
- visibility var(--nuraly-dropdown-animation-duration, 0.15s) var(--nuraly-dropdown-animation-timing, ease),
190
- transform var(--nuraly-dropdown-animation-duration, 0.15s) var(--nuraly-dropdown-animation-timing, ease);
191
- }
192
-
193
- .dropdown__panel--slide:not(.dropdown__panel--open) {
194
- opacity: 0;
195
- visibility: hidden;
196
- transform: translateY(-12px);
197
- }
198
-
199
- .dropdown__panel--slide.dropdown__panel--open {
200
- opacity: 1;
201
- visibility: visible;
202
- transform: translateY(0);
203
- }
204
-
205
- /* For top-positioned dropdowns, slide direction is reversed */
206
- .dropdown__panel--slide.dropdown__panel--top:not(.dropdown__panel--open),
207
- .dropdown__panel--slide.dropdown__panel--top-start:not(.dropdown__panel--open),
208
- .dropdown__panel--slide.dropdown__panel--top-end:not(.dropdown__panel--open) {
209
- transform: translateY(12px);
210
- }
211
-
212
- /* Scale animation - scale and opacity */
213
- .dropdown__panel--scale {
214
- transition: opacity var(--nuraly-dropdown-animation-duration, 0.15s) var(--nuraly-dropdown-animation-timing, ease),
215
- visibility var(--nuraly-dropdown-animation-duration, 0.15s) var(--nuraly-dropdown-animation-timing, ease),
216
- transform var(--nuraly-dropdown-animation-duration, 0.15s) cubic-bezier(0.25, 0.46, 0.45, 0.94);
217
- }
218
-
219
- .dropdown__panel--scale:not(.dropdown__panel--open) {
220
- opacity: 0;
221
- visibility: hidden;
222
- transform: scale(0.9) translateY(-8px);
223
- }
224
-
225
- .dropdown__panel--scale.dropdown__panel--open {
226
- opacity: 1;
227
- visibility: visible;
228
- transform: scale(1) translateY(0);
229
- }
230
-
231
- /* For top-positioned scale dropdowns */
232
- .dropdown__panel--scale.dropdown__panel--top:not(.dropdown__panel--open),
233
- .dropdown__panel--scale.dropdown__panel--top-start:not(.dropdown__panel--open),
234
- .dropdown__panel--scale.dropdown__panel--top-end:not(.dropdown__panel--open) {
235
- transform: scale(0.9) translateY(8px);
236
- }
237
-
238
- .dropdown__panel--scale.dropdown__panel--top.dropdown__panel--open,
239
- .dropdown__panel--scale.dropdown__panel--top-start.dropdown__panel--open,
240
- .dropdown__panel--scale.dropdown__panel--top-end.dropdown__panel--open {
241
- transform: scale(1) translateY(0);
242
- }
243
-
244
- /* Arrow */
245
- .dropdown__arrow {
246
- position: absolute;
247
- width: 0;
248
- height: 0;
249
- border: var(--nuraly-dropdown-arrow-size) solid transparent;
250
- border-bottom-color: var(--nuraly-dropdown-background);
251
- top: calc(-1 * var(--nuraly-dropdown-arrow-size) * 2);
252
- left: 50%;
253
- transform: translateX(-50%);
254
- }
255
-
256
- .dropdown__arrow::before {
257
- content: '';
258
- position: absolute;
259
- width: 0;
260
- height: 0;
261
- border: calc(var(--nuraly-dropdown-arrow-size) + 1px) solid transparent;
262
- border-bottom-color: var(--nuraly-dropdown-border-color);
263
- top: calc(-1 * var(--nuraly-dropdown-arrow-size) - 1px);
264
- left: calc(-1 * var(--nuraly-dropdown-arrow-size) - 1px);
265
- }
266
-
267
- /* Content areas */
268
- .dropdown__content {
269
- overflow: auto;
270
- }
271
-
272
- .dropdown__items {
273
- display: flex;
274
- flex-direction: column;
275
- margin: 0;
276
- padding: 0;
277
- list-style: none;
278
- overflow: visible; /* Allow submenus to extend outside */
279
- }
280
-
281
- .dropdown__item {
282
- display: flex;
283
- align-items: center;
284
- gap: var(--nuraly-dropdown-item-gap);
285
- padding: var(--nuraly-dropdown-item-padding);
286
- background: var(--nuraly-color-dropdown-item-background);
287
- border: none;
288
- color: var(--nuraly-color-dropdown-item-text);
289
- cursor: pointer;
290
- text-align: left;
291
- width: 100%;
292
- min-height: var(--nuraly-dropdown-item-min-height);
293
- transition: var(--nuraly-dropdown-item-transition);
294
- font-size: inherit;
295
- font-family: inherit;
296
- line-height: var(--nuraly-dropdown-item-line-height);
297
- position: relative;
298
- }
299
-
300
- .dropdown__item:hover:not(.dropdown__item--disabled) {
301
- background: var(--nuraly-color-dropdown-item-background-hover);
302
- color: var(--nuraly-color-dropdown-item-text-hover);
303
- }
304
-
305
- .dropdown__item:focus {
306
- outline: none;
307
- background: var(--nuraly-color-dropdown-item-background-focus);
308
- color: var(--nuraly-color-dropdown-item-text-focus);
309
- }
310
-
311
- .dropdown__item:focus-visible {
312
- outline: 2px solid var(--nuraly-focus-color, #0f62fe);
313
- outline-offset: -2px;
314
- background: var(--nuraly-color-dropdown-item-background-focus);
315
- color: var(--nuraly-color-dropdown-item-text-focus);
316
- }
317
-
318
- .dropdown__item:active:not(.dropdown__item--disabled) {
319
- background: var(--nuraly-color-dropdown-item-background-active);
320
- color: var(--nuraly-color-dropdown-item-text-active);
321
- }
322
-
323
- .dropdown__item--disabled {
324
- opacity: var(--nuraly-dropdown-item-disabled-opacity, 0.5);
325
- cursor: not-allowed;
326
- pointer-events: none;
327
- }
328
-
329
- .dropdown__item-icon {
330
- flex-shrink: 0;
331
- width: var(--nuraly-dropdown-item-icon-size);
332
- height: var(--nuraly-dropdown-item-icon-size);
333
- }
334
-
335
- .dropdown__item-label {
336
- flex: 1;
337
- overflow: hidden;
338
- text-overflow: ellipsis;
339
- white-space: nowrap;
340
- }
341
-
342
- .dropdown__divider {
343
- height: 1px;
344
- background: var(--nuraly-dropdown-divider-color);
345
- margin: var(--nuraly-dropdown-divider-margin);
346
- }
347
-
348
- /* Cascading dropdown styles */
349
- .dropdown__item-container {
350
- position: relative;
351
- }
352
-
353
- /* Allow submenus to overflow when dropdown has cascading items */
354
- :host([has-cascading]) .dropdown__panel {
355
- overflow: visible !important;
356
- max-height: none !important; /* Remove height restriction for cascading */
357
- }
358
-
359
- :host([has-cascading]) .dropdown__items {
360
- overflow: visible !important;
361
- }
362
-
363
- /* For cascading dropdowns, we need to handle scrolling differently */
364
- :host([has-cascading]) .dropdown__content {
365
- overflow: visible !important;
366
- }
367
-
368
- .dropdown__item--has-submenu {
369
- display: flex;
370
- justify-content: space-between;
371
- align-items: center;
372
- }
373
-
374
- .dropdown__submenu-arrow {
375
- margin-left: auto;
376
- font-size: 0.75em;
377
- opacity: 0.6;
378
- transition: transform 0.15s ease;
379
- }
380
-
381
- .dropdown__item--has-submenu:hover .dropdown__submenu-arrow {
382
- opacity: 1;
383
- }
384
-
385
- .dropdown__submenu {
386
- position: absolute;
387
- top: 0;
388
- z-index: calc(var(--nuraly-dropdown-z-index, 9999) + 1);
389
- background: var(--nuraly-color-dropdown-background, #ffffff);
390
- border: var(--nuraly-dropdown-border-width, 1px) solid var(--nuraly-color-dropdown-border, #e0e0e0);
391
- border-radius: var(--nuraly-dropdown-border-radius, 6px);
392
- box-shadow: var(--nuraly-dropdown-shadow, 0 2px 6px rgba(0, 0, 0, 0.15));
393
- min-width: var(--nuraly-dropdown-min-width, 10rem);
394
- max-width: var(--nuraly-dropdown-max-width, 20rem);
395
- max-height: var(--nuraly-dropdown-max-height, 200px);
396
- overflow: auto;
397
- box-sizing: border-box;
398
- animation: fadeInSubmenu 0.15s ease;
399
- /* Ensure submenu is visible */
400
- opacity: 1;
401
- visibility: visible;
402
- pointer-events: auto;
403
- }
404
-
405
- .dropdown__custom-content {
406
- padding: var(--nuraly-dropdown-item-padding, 8px 12px);
407
- max-width: 100%;
408
- box-sizing: border-box;
409
- }
410
-
411
- /* Custom content styling */
412
- .dropdown__custom-content h3,
413
- .dropdown__custom-content h4 {
414
- margin: 0 0 8px 0;
415
- font-size: 0.875rem;
416
- font-weight: 600;
417
- color: var(--nuraly-color-text-primary);
418
- }
419
-
420
- .dropdown__custom-content p {
421
- margin: 0 0 8px 0;
422
- font-size: 0.75rem;
423
- color: var(--nuraly-color-text-secondary);
424
- line-height: 1.4;
425
- }
426
-
427
- .dropdown__custom-content button,
428
- .dropdown__custom-content input,
429
- .dropdown__custom-content select {
430
- width: 100%;
431
- margin-bottom: 8px;
432
- }
433
-
434
- .dropdown__custom-content button:last-child,
435
- .dropdown__custom-content input:last-child,
436
- .dropdown__custom-content p:last-child {
437
- margin-bottom: 0;
438
- }
439
-
440
- .dropdown__submenu--right {
441
- left: 100%;
442
- margin-left: 4px;
443
- }
444
-
445
- .dropdown__submenu--left {
446
- right: 100%;
447
- margin-right: 4px;
448
- }
449
-
450
- @keyframes fadeInSubmenu {
451
- from {
452
- opacity: 0;
453
- transform: translateX(-8px);
454
- }
455
- to {
456
- opacity: 1;
457
- transform: translateX(0);
458
- }
459
- }
460
-
461
- .dropdown__submenu--left {
462
- animation-name: fadeInSubmenuLeft;
463
- }
464
-
465
- @keyframes fadeInSubmenuLeft {
466
- from {
467
- opacity: 0;
468
- transform: translateX(8px);
469
- }
470
- to {
471
- opacity: 1;
472
- transform: translateX(0);
473
- }
474
- }
475
-
476
- /* Focus styles for accessibility */
477
- :host(:focus-within) .dropdown__trigger {
478
- outline: var(--nuraly-dropdown-focus-outline);
479
- outline-offset: var(--nuraly-dropdown-focus-offset);
480
- }
481
-
482
- /* Disabled state */
483
- :host([disabled]) {
484
- opacity: var(--nuraly-dropdown-disabled-opacity, 0.5);
485
- pointer-events: none;
486
- }
487
-
488
- /* Hidden state */
489
- [hidden] {
490
- display: none !important;
491
- }
492
-
493
- `
494
- /**
495
- * @license
496
- * Copyright 2017 Google LLC
497
- * SPDX-License-Identifier: BSD-3-Clause
498
- */,Yt=1,Kt=t=>(...i)=>({_$litDirective$:t,values:i});class Wt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,i,o){this._$Ct=t,this._$AM=i,this._$Ci=o}_$AS(t,i){return this.update(t,i)}update(t,i){return this.render(...i)}}
499
- /**
500
- * @license
501
- * Copyright 2018 Google LLC
502
- * SPDX-License-Identifier: BSD-3-Clause
503
- */const Xt=Kt(class extends Wt{constructor(t){var i;if(super(t),t.type!==Yt||"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 o,n;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===(o=this.nt)||void 0===o?void 0:o.has(t))&&this.it.add(t);return this.render(i)}const e=t.element.classList;this.it.forEach((t=>{t in i||(e.remove(t),this.it.delete(t))}));for(const t in i){const o=!!i[t];o===this.it.has(t)||(null===(n=this.nt)||void 0===n?void 0:n.has(t))||(o?(e.add(t),this.it.add(t)):(e.remove(t),this.it.delete(t)))}return R}}),qt="important",Vt=" !"+qt,Zt=Kt(class extends Wt{constructor(t){var i;if(super(t),t.type!==Yt||"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,o)=>{const n=t[o];return null==n?i:i+`${o=o.includes("-")?o:o.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`}),"")}update(t,[i]){const{style:o}=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("-")?o.removeProperty(t):o[t]="")}));for(const t in i){const n=i[t];if(null!=n){this.ht.add(t);const i="string"==typeof n&&n.endsWith(Vt);t.includes("-")||i?o.setProperty(t,i?n.slice(0,-11):n,i?qt:""):o[t]=n}}return R}}),Jt=t=>class extends t{constructor(){super(...arguments),this.handleSystemThemeChange=()=>{this.closest("[data-theme]")||document.documentElement.hasAttribute("data-theme")||this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setupThemeObserver(),this.setupDesignSystemObserver(),this.setupSystemThemeListener()}disconnectedCallback(){var t,i,o;super.disconnectedCallback(),null===(t=this.themeObserver)||void 0===t||t.disconnect(),null===(i=this.designSystemObserver)||void 0===i||i.disconnect(),null===(o=this.mediaQuery)||void 0===o||o.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var t,i;const o=(null===(t=this.closest("[data-theme]"))||void 0===t?void 0:t.getAttribute("data-theme"))||document.documentElement.getAttribute("data-theme");return o||((null===(i=window.matchMedia)||void 0===i?void 0:i.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light")}get currentDesignSystem(){var t;const i=(null===(t=this.closest("[design-system]"))||void 0===t?void 0:t.getAttribute("design-system"))||document.documentElement.getAttribute("design-system");return"carbon"===i?i:"default"}setupThemeObserver(){this.themeObserver=new MutationObserver((()=>{this.requestUpdate()})),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}setupDesignSystemObserver(){this.designSystemObserver=new MutationObserver((()=>{this.requestUpdate()})),this.designSystemObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["design-system"]})}setupSystemThemeListener(){window.matchMedia&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.mediaQuery.addEventListener("change",this.handleSystemThemeChange))}},Gt=()=>{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)},Qt=t=>class extends t{constructor(){super(...arguments),this.requiredComponents=[]}validateDependencies(){if(Gt())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(!Gt())return!0;let i=!0;for(const o of this.requiredComponents)if(!this.isComponentAvailable(o)){i=!1;const n=new Error(`Required component "${o}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}.`);t?t(o,n):console.error(n.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)}},ti=t=>class extends t{dispatchCustomEvent(t,i){this.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))}dispatchEventWithMetadata(t,i){var o;const n=Object.assign(Object.assign({},i),{timestamp:Date.now(),componentName:(null===(o=this.tagName)||void 0===o?void 0:o.toLowerCase())||"unknown"});this.dispatchCustomEvent(t,n)}dispatchInputEvent(t,i){const o=Object.assign({target:i.target||this,value:i.value,originalEvent:i.originalEvent},i);this.dispatchCustomEvent(t,o)}dispatchFocusEvent(t,i){const o=Object.assign({target:i.target||this,value:i.value,focused:i.focused,cursorPosition:i.cursorPosition,selectedText:i.selectedText},i);this.dispatchCustomEvent(t,o)}dispatchValidationEvent(t,i){var o;const n=Object.assign({target:i.target||this,value:i.value,isValid:null!==(o=i.isValid)&&void 0!==o&&o,error:i.error},i);this.dispatchCustomEvent(t,n)}dispatchActionEvent(t,i){const o=Object.assign({target:i.target||this,action:i.action,previousValue:i.previousValue,newValue:i.newValue},i);this.dispatchCustomEvent(t,o)}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}};
504
- /**
505
- * @license
506
- * Copyright 2018 Google LLC
507
- * SPDX-License-Identifier: BSD-3-Clause
508
- */class ii{constructor(t){this._host=t,this._host.addController(this)}get host(){return this._host}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}requestUpdate(){this._host.requestUpdate()}dispatchEvent(t){return this._host.dispatchEvent(t)}handleError(t,i){console.error(`Dropdown Controller Error in ${i}:`,t)}findElement(t){var i;return null===(i=this._host.shadowRoot)||void 0===i?void 0:i.querySelector(t)}findElements(t){var i;return null===(i=this._host.shadowRoot)||void 0===i?void 0:i.querySelectorAll(t)}}class oi extends ii{constructor(t){super(t),this._isOpen=!1,this._position={top:0,left:0,width:0,placement:"bottom"},this._triggerElement=null,this._dropdownElement=null,this._outsideClickHandler=null,this._keydownHandler=null,this._hoverTimer=null,this._triggerClickHandler=null,this._triggerHoverHandler=null,this._triggerLeaveHandler=null,this._triggerFocusHandler=null,this._triggerBlurHandler=null,this._scrollHandler=null,this._resizeHandler=null,this._isOpen=t.open}get isOpen(){return this._isOpen}get position(){return Object.assign({},this._position)}hostConnected(){}hostUpdated(){this._isOpen!==this.host.open&&(this._isOpen=this.host.open),this._triggerElement||this.setupTriggerListeners()}hostDisconnected(){this.cleanup()}open(){try{this._isOpen||this.host.disabled||(this._isOpen=!0,this.host.open=!0,this.requestUpdate(),setTimeout((()=>{this.calculatePosition(),this.setupEventListeners()}),10),this.dispatchEvent(new CustomEvent("nr-dropdown-open",{bubbles:!0,composed:!0,detail:{dropdown:this.host}})))}catch(t){this.handleError(t,"open")}}close(){try{this._isOpen&&(this.removeEventListeners(),this._isOpen=!1,this.host.open=!1,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-dropdown-close",{bubbles:!0,composed:!0,detail:{dropdown:this.host}})))}catch(t){this.handleError(t,"close")}}toggle(){try{this._isOpen?this.close():this.open()}catch(t){this.handleError(t,"toggle")}}removeTriggerListeners(){this._triggerElement&&(this._triggerClickHandler&&(this._triggerElement.removeEventListener("click",this._triggerClickHandler),this._triggerClickHandler=null),this._triggerHoverHandler&&(this._triggerElement.removeEventListener("mouseenter",this._triggerHoverHandler),this._triggerHoverHandler=null),this._triggerLeaveHandler&&(this._triggerElement.removeEventListener("mouseleave",this._triggerLeaveHandler),this._triggerLeaveHandler=null),this._triggerFocusHandler&&(this._triggerElement.removeEventListener("focusin",this._triggerFocusHandler),this._triggerFocusHandler=null),this._triggerBlurHandler&&(this._triggerElement.removeEventListener("focusout",this._triggerBlurHandler),this._triggerBlurHandler=null))}findDropdownElements(){this._dropdownElement=this.findElement(".dropdown__panel"),this._triggerElement=this.findElement(".dropdown__trigger")}setupTriggerListeners(){if(this.findDropdownElements(),this._triggerElement)switch(this.removeTriggerListeners(),this.host.trigger){case"click":this._triggerClickHandler=this.handleTriggerClick.bind(this),this._triggerElement.addEventListener("click",this._triggerClickHandler);break;case"hover":this._triggerHoverHandler=this.handleTriggerHover.bind(this),this._triggerLeaveHandler=this.handleTriggerLeave.bind(this),this._triggerElement.addEventListener("mouseenter",this._triggerHoverHandler),this._triggerElement.addEventListener("mouseleave",this._triggerLeaveHandler);break;case"focus":this._triggerFocusHandler=this.handleTriggerFocus.bind(this),this._triggerBlurHandler=this.handleTriggerBlur.bind(this),this._triggerElement.addEventListener("focusin",this._triggerFocusHandler),this._triggerElement.addEventListener("focusout",this._triggerBlurHandler)}}setupEventListeners(){this.host.closeOnOutsideClick&&(this._outsideClickHandler=this.handleOutsideClick.bind(this),document.addEventListener("click",this._outsideClickHandler,!0)),this.host.closeOnEscape&&(this._keydownHandler=this.handleKeydown.bind(this),document.addEventListener("keydown",this._keydownHandler)),this._scrollHandler=this.handleScroll.bind(this),this._resizeHandler=this.handleResize.bind(this),window.addEventListener("scroll",this._scrollHandler,!0),window.addEventListener("resize",this._resizeHandler)}removeEventListeners(){this._outsideClickHandler&&(document.removeEventListener("click",this._outsideClickHandler,!0),this._outsideClickHandler=null),this._keydownHandler&&(document.removeEventListener("keydown",this._keydownHandler),this._keydownHandler=null),this._scrollHandler&&(window.removeEventListener("scroll",this._scrollHandler,!0),this._scrollHandler=null),this._resizeHandler&&(window.removeEventListener("resize",this._resizeHandler),this._resizeHandler=null)}handleTriggerClick(){this.host.disabled||this.toggle()}handleTriggerHover(){this.host.disabled||(this._hoverTimer&&clearTimeout(this._hoverTimer),this._hoverTimer=window.setTimeout((()=>{this.open()}),this.host.delay))}handleTriggerLeave(){this._hoverTimer&&(clearTimeout(this._hoverTimer),this._hoverTimer=null),setTimeout((()=>{this.isHoveringDropdown()||this.close()}),100)}handleTriggerFocus(){this.host.disabled||this.open()}handleTriggerBlur(){setTimeout((()=>{this.isDropdownFocused()||this.close()}),100)}handleOutsideClick(t){var i,o;const n=t.target;if(null===(i=this._triggerElement)||void 0===i?void 0:i.contains(n))return;if(n.closest(".dropdown__panel"))return;if(null===(o=this._dropdownElement)||void 0===o?void 0:o.contains(n))return;if(n.closest("nr-dropdown"))return;if(n.closest(".dropdown__custom-content"))return;if(["INPUT","BUTTON","TEXTAREA","SELECT","A"].includes(n.tagName)){if(n.closest(".dropdown__panel"))return}n.closest(".dropdown")||n.closest('[class*="dropdown"]')||this.host.closeOnOutsideClick&&this.close()}handleKeydown(t){"Escape"===t.key&&this.close()}handleScroll(){}handleResize(){this._isOpen&&this.calculatePosition()}calculatePosition(){var t;try{if(this._dropdownElement&&this._triggerElement||this.findDropdownElements(),!this._dropdownElement||!this._triggerElement)return;const i=this._triggerElement.getBoundingClientRect(),o=((null===(t=window.visualViewport)||void 0===t?void 0:t.height)||window.innerHeight)-i.bottom,n=i.top,e=200,s=this.determineOptimalPlacement(e,n,o);this.applyPlacement(s)}catch(t){this.handleError(t,"calculatePosition")}}determineOptimalPlacement(t,i,o){return o>=t?"bottom":i>=t||i>o?"top":"bottom"}applyPlacement(t){this._dropdownElement&&(this._dropdownElement.classList.remove("dropdown__panel--top","dropdown__panel--bottom"),this._dropdownElement.classList.add(`dropdown__panel--${t}`),this._position.placement=t)}isHoveringDropdown(){var t;return(null===(t=this._dropdownElement)||void 0===t?void 0:t.matches(":hover"))||!1}isDropdownFocused(){var t;const i=document.activeElement;if(!i)return!1;if(null===(t=this._dropdownElement)||void 0===t?void 0:t.contains(i))return!0;if(i.closest(".dropdown__custom-content"))return!0;if(["INPUT","BUTTON","TEXTAREA","SELECT","A"].includes(i.tagName)){if(i.closest(".dropdown__panel"))return!0}return!1}handleItemClick(t){this.dispatchEvent(new CustomEvent("nr-dropdown-item-click",{bubbles:!0,composed:!0,detail:{item:t,dropdown:this.host}})),this.host.autoClose&&this.close()}cleanup(){this.removeEventListeners(),this.removeTriggerListeners(),this._hoverTimer&&(clearTimeout(this._hoverTimer),this._hoverTimer=null)}}
1
+ import{css as o,LitElement as t,nothing as n,html as i}from"lit";import{property as r,customElement as e}from"lit/decorators.js";import{classMap as d}from"lit/directives/class-map.js";import{styleMap as s}from"lit/directives/style-map.js";import{NuralyUIBaseMixin as a}from"@nuralyui/common/mixins";const l=o`:host{display:inline-block;position:relative;color:var(--nuraly-color-text);font-family:var(--nuraly-dropdown-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif)}.dropdown{position:relative;display:inline-block}.dropdown__trigger{display:inline-block;cursor:pointer}.dropdown__trigger:focus-within{outline:var(--nuraly-focus-outline,2px solid #0f62fe);outline-offset:var(--nuraly-focus-outline-offset,1px)}.dropdown__panel{position:absolute;top:100%;left:0;z-index:var(--nuraly-dropdown-z-index,9999);background:var(--nuraly-color-dropdown-background,#fff);border:var(--nuraly-dropdown-border-width,1px) solid var(--nuraly-color-dropdown-border,#e0e0e0);border-radius:var(--nuraly-dropdown-border-radius,6px);box-shadow:var(--nuraly-dropdown-shadow,0 2px 6px rgba(0,0,0,.15));min-width:var(--nuraly-dropdown-min-width,10rem);max-width:var(--nuraly-dropdown-max-width,20rem);max-height:var(--nuraly-dropdown-max-height,200px);overflow:auto;opacity:0;visibility:hidden;transform:translateY(-8px);transition:all var(--nuraly-dropdown-animation-duration,.15s) var(--nuraly-dropdown-animation-timing,ease);box-sizing:border-box;isolation:isolate;transform-origin:top center}.dropdown__panel--open{opacity:1;visibility:visible;transform:translateY(0)}:host([open]) .dropdown__panel{opacity:1;visibility:visible;transform:translateY(0)}.dropdown__panel--top,.dropdown__panel--top-end,.dropdown__panel--top-start{top:auto;bottom:100%;margin-bottom:1px;margin-top:0;transform:translateY(8px)}.dropdown__panel--top-end.dropdown__panel--open,.dropdown__panel--top-start.dropdown__panel--open,.dropdown__panel--top.dropdown__panel--open{transform:translateY(0)}.dropdown__panel--bottom-end,.dropdown__panel--top-end{left:auto;right:0}.dropdown__panel--bottom-start,.dropdown__panel--top-start{left:0;right:auto}.dropdown__panel--small{font-size:var(--nuraly-dropdown-small-font-size,.75rem)}.dropdown__panel--medium{font-size:var(--nuraly-dropdown-font-size,.875rem)}.dropdown__panel--large{font-size:var(--nuraly-dropdown-large-font-size,1rem)}.dropdown__panel--none{transition:none}.dropdown__panel--none:not(.dropdown__panel--open){opacity:0;visibility:hidden;transform:none}.dropdown__panel--none.dropdown__panel--open{opacity:1;visibility:visible;transform:none}.dropdown__panel--fade{transition:opacity var(--nuraly-dropdown-animation-duration,.15s) var(--nuraly-dropdown-animation-timing,ease),visibility var(--nuraly-dropdown-animation-duration,.15s) var(--nuraly-dropdown-animation-timing,ease)}.dropdown__panel--fade:not(.dropdown__panel--open){opacity:0;visibility:hidden;transform:none}.dropdown__panel--fade.dropdown__panel--open{opacity:1;visibility:visible;transform:none}.dropdown__panel--slide{transition:opacity var(--nuraly-dropdown-animation-duration,.15s) var(--nuraly-dropdown-animation-timing,ease),visibility var(--nuraly-dropdown-animation-duration,.15s) var(--nuraly-dropdown-animation-timing,ease),transform var(--nuraly-dropdown-animation-duration,.15s) var(--nuraly-dropdown-animation-timing,ease)}.dropdown__panel--slide:not(.dropdown__panel--open){opacity:0;visibility:hidden;transform:translateY(-12px)}.dropdown__panel--slide.dropdown__panel--open{opacity:1;visibility:visible;transform:translateY(0)}.dropdown__panel--slide.dropdown__panel--top-end:not(.dropdown__panel--open),.dropdown__panel--slide.dropdown__panel--top-start:not(.dropdown__panel--open),.dropdown__panel--slide.dropdown__panel--top:not(.dropdown__panel--open){transform:translateY(12px)}.dropdown__panel--scale{transition:opacity var(--nuraly-dropdown-animation-duration,.15s) var(--nuraly-dropdown-animation-timing,ease),visibility var(--nuraly-dropdown-animation-duration,.15s) var(--nuraly-dropdown-animation-timing,ease),transform var(--nuraly-dropdown-animation-duration,.15s) cubic-bezier(.25,.46,.45,.94)}.dropdown__panel--scale:not(.dropdown__panel--open){opacity:0;visibility:hidden;transform:scale(.9) translateY(-8px)}.dropdown__panel--scale.dropdown__panel--open{opacity:1;visibility:visible;transform:scale(1) translateY(0)}.dropdown__panel--scale.dropdown__panel--top-end:not(.dropdown__panel--open),.dropdown__panel--scale.dropdown__panel--top-start:not(.dropdown__panel--open),.dropdown__panel--scale.dropdown__panel--top:not(.dropdown__panel--open){transform:scale(.9) translateY(8px)}.dropdown__panel--scale.dropdown__panel--top-end.dropdown__panel--open,.dropdown__panel--scale.dropdown__panel--top-start.dropdown__panel--open,.dropdown__panel--scale.dropdown__panel--top.dropdown__panel--open{transform:scale(1) translateY(0)}.dropdown__arrow{position:absolute;width:0;height:0;border:var(--nuraly-dropdown-arrow-size) solid transparent;border-bottom-color:var(--nuraly-dropdown-background);top:calc(-1 * var(--nuraly-dropdown-arrow-size) * 2);left:50%;transform:translateX(-50%)}.dropdown__arrow::before{content:'';position:absolute;width:0;height:0;border:calc(var(--nuraly-dropdown-arrow-size) + 1px) solid transparent;border-bottom-color:var(--nuraly-dropdown-border-color);top:calc(-1 * var(--nuraly-dropdown-arrow-size) - 1px);left:calc(-1 * var(--nuraly-dropdown-arrow-size) - 1px)}.dropdown__content{overflow:auto}.dropdown__items{display:flex;flex-direction:column;margin:0;padding:0;list-style:none;overflow:visible}.dropdown__item{display:flex;align-items:center;gap:var(--nuraly-dropdown-item-gap);padding:var(--nuraly-dropdown-item-padding);background:var(--nuraly-color-dropdown-item-background);border:none;color:var(--nuraly-color-dropdown-item-text);cursor:pointer;text-align:left;width:100%;min-height:var(--nuraly-dropdown-item-min-height);transition:var(--nuraly-dropdown-item-transition);font-size:inherit;font-family:inherit;line-height:var(--nuraly-dropdown-item-line-height);position:relative}.dropdown__item:hover:not(.dropdown__item--disabled){background:var(--nuraly-color-dropdown-item-background-hover);color:var(--nuraly-color-dropdown-item-text-hover)}.dropdown__item:focus{outline:0;background:var(--nuraly-color-dropdown-item-background-focus);color:var(--nuraly-color-dropdown-item-text-focus)}.dropdown__item:focus-visible{outline:2px solid var(--nuraly-focus-color,#0f62fe);outline-offset:-2px;background:var(--nuraly-color-dropdown-item-background-focus);color:var(--nuraly-color-dropdown-item-text-focus)}.dropdown__item:active:not(.dropdown__item--disabled){background:var(--nuraly-color-dropdown-item-background-active);color:var(--nuraly-color-dropdown-item-text-active)}.dropdown__item--disabled{opacity:var(--nuraly-dropdown-item-disabled-opacity,.5);cursor:not-allowed;pointer-events:none}.dropdown__item-icon{flex-shrink:0;width:var(--nuraly-dropdown-item-icon-size);height:var(--nuraly-dropdown-item-icon-size)}.dropdown__item-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dropdown__divider{height:1px;background:var(--nuraly-dropdown-divider-color);margin:var(--nuraly-dropdown-divider-margin)}.dropdown__item-container{position:relative}:host([has-cascading]) .dropdown__panel{overflow:visible!important;max-height:none!important}:host([has-cascading]) .dropdown__items{overflow:visible!important}:host([has-cascading]) .dropdown__content{overflow:visible!important}.dropdown__item--has-submenu{display:flex;justify-content:space-between;align-items:center}.dropdown__submenu-arrow{margin-left:auto;font-size:.75em;opacity:.6;transition:transform .15s ease}.dropdown__item--has-submenu:hover .dropdown__submenu-arrow{opacity:1}.dropdown__submenu{position:absolute;top:0;z-index:calc(var(--nuraly-dropdown-z-index,9999) + 1);background:var(--nuraly-color-dropdown-background,#fff);border:var(--nuraly-dropdown-border-width,1px) solid var(--nuraly-color-dropdown-border,#e0e0e0);border-radius:var(--nuraly-dropdown-border-radius,6px);box-shadow:var(--nuraly-dropdown-shadow,0 2px 6px rgba(0,0,0,.15));min-width:var(--nuraly-dropdown-min-width,10rem);max-width:var(--nuraly-dropdown-max-width,20rem);max-height:var(--nuraly-dropdown-max-height,200px);overflow:auto;box-sizing:border-box;animation:fadeInSubmenu .15s ease;opacity:1;visibility:visible;pointer-events:auto}.dropdown__custom-content{padding:var(--nuraly-dropdown-item-padding,8px 12px);max-width:100%;box-sizing:border-box}.dropdown__custom-content h3,.dropdown__custom-content h4{margin:0 0 8px 0;font-size:.875rem;font-weight:600;color:var(--nuraly-color-text-primary)}.dropdown__custom-content p{margin:0 0 8px 0;font-size:.75rem;color:var(--nuraly-color-text-secondary);line-height:1.4}.dropdown__custom-content button,.dropdown__custom-content input,.dropdown__custom-content select{width:100%;margin-bottom:8px}.dropdown__custom-content button:last-child,.dropdown__custom-content input:last-child,.dropdown__custom-content p:last-child{margin-bottom:0}.dropdown__submenu--right{left:100%;margin-left:4px}.dropdown__submenu--left{right:100%;margin-right:4px}@keyframes fadeInSubmenu{from{opacity:0;transform:translateX(-8px)}to{opacity:1;transform:translateX(0)}}.dropdown__submenu--left{animation-name:fadeInSubmenuLeft}@keyframes fadeInSubmenuLeft{from{opacity:0;transform:translateX(8px)}to{opacity:1;transform:translateX(0)}}:host(:focus-within) .dropdown__trigger{outline:var(--nuraly-dropdown-focus-outline);outline-offset:var(--nuraly-dropdown-focus-offset)}:host([disabled]){opacity:var(--nuraly-dropdown-disabled-opacity,.5);pointer-events:none}[hidden]{display:none!important}`;class p{constructor(o){this._host=o,this._host.addController(this)}get host(){return this._host}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}requestUpdate(){this._host.requestUpdate()}dispatchEvent(o){return this._host.dispatchEvent(o)}handleError(o,t){console.error(`Dropdown Controller Error in ${t}:`,o)}findElement(o){var t;return null===(t=this._host.shadowRoot)||void 0===t?void 0:t.querySelector(o)}findElements(o){var t;return null===(t=this._host.shadowRoot)||void 0===t?void 0:t.querySelectorAll(o)}}class h extends p{constructor(o){super(o),this._isOpen=!1,this._position={top:0,left:0,width:0,placement:"bottom"},this._triggerElement=null,this._dropdownElement=null,this._outsideClickHandler=null,this._keydownHandler=null,this._hoverTimer=null,this._triggerClickHandler=null,this._triggerHoverHandler=null,this._triggerLeaveHandler=null,this._triggerFocusHandler=null,this._triggerBlurHandler=null,this._scrollHandler=null,this._resizeHandler=null,this._isOpen=o.open}get isOpen(){return this._isOpen}get position(){return Object.assign({},this._position)}hostConnected(){}hostUpdated(){this._isOpen!==this.host.open&&(this._isOpen=this.host.open),this._triggerElement||this.setupTriggerListeners()}hostDisconnected(){this.cleanup()}open(){try{this._isOpen||this.host.disabled||(this._isOpen=!0,this.host.open=!0,this.requestUpdate(),setTimeout((()=>{this.calculatePosition(),this.setupEventListeners()}),10),this.dispatchEvent(new CustomEvent("nr-dropdown-open",{bubbles:!0,composed:!0,detail:{dropdown:this.host}})))}catch(o){this.handleError(o,"open")}}close(){try{this._isOpen&&(this.removeEventListeners(),this._isOpen=!1,this.host.open=!1,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-dropdown-close",{bubbles:!0,composed:!0,detail:{dropdown:this.host}})))}catch(o){this.handleError(o,"close")}}toggle(){try{this._isOpen?this.close():this.open()}catch(o){this.handleError(o,"toggle")}}removeTriggerListeners(){this._triggerElement&&(this._triggerClickHandler&&(this._triggerElement.removeEventListener("click",this._triggerClickHandler),this._triggerClickHandler=null),this._triggerHoverHandler&&(this._triggerElement.removeEventListener("mouseenter",this._triggerHoverHandler),this._triggerHoverHandler=null),this._triggerLeaveHandler&&(this._triggerElement.removeEventListener("mouseleave",this._triggerLeaveHandler),this._triggerLeaveHandler=null),this._triggerFocusHandler&&(this._triggerElement.removeEventListener("focusin",this._triggerFocusHandler),this._triggerFocusHandler=null),this._triggerBlurHandler&&(this._triggerElement.removeEventListener("focusout",this._triggerBlurHandler),this._triggerBlurHandler=null))}findDropdownElements(){this._dropdownElement=this.findElement(".dropdown__panel"),this._triggerElement=this.findElement(".dropdown__trigger")}setupTriggerListeners(){if(this.findDropdownElements(),this._triggerElement)switch(this.removeTriggerListeners(),this.host.trigger){case"click":this._triggerClickHandler=this.handleTriggerClick.bind(this),this._triggerElement.addEventListener("click",this._triggerClickHandler);break;case"hover":this._triggerHoverHandler=this.handleTriggerHover.bind(this),this._triggerLeaveHandler=this.handleTriggerLeave.bind(this),this._triggerElement.addEventListener("mouseenter",this._triggerHoverHandler),this._triggerElement.addEventListener("mouseleave",this._triggerLeaveHandler);break;case"focus":this._triggerFocusHandler=this.handleTriggerFocus.bind(this),this._triggerBlurHandler=this.handleTriggerBlur.bind(this),this._triggerElement.addEventListener("focusin",this._triggerFocusHandler),this._triggerElement.addEventListener("focusout",this._triggerBlurHandler)}}setupEventListeners(){this.host.closeOnOutsideClick&&(this._outsideClickHandler=this.handleOutsideClick.bind(this),document.addEventListener("click",this._outsideClickHandler,!0)),this.host.closeOnEscape&&(this._keydownHandler=this.handleKeydown.bind(this),document.addEventListener("keydown",this._keydownHandler)),this._scrollHandler=this.handleScroll.bind(this),this._resizeHandler=this.handleResize.bind(this),window.addEventListener("scroll",this._scrollHandler,!0),window.addEventListener("resize",this._resizeHandler)}removeEventListeners(){this._outsideClickHandler&&(document.removeEventListener("click",this._outsideClickHandler,!0),this._outsideClickHandler=null),this._keydownHandler&&(document.removeEventListener("keydown",this._keydownHandler),this._keydownHandler=null),this._scrollHandler&&(window.removeEventListener("scroll",this._scrollHandler,!0),this._scrollHandler=null),this._resizeHandler&&(window.removeEventListener("resize",this._resizeHandler),this._resizeHandler=null)}handleTriggerClick(){this.host.disabled||this.toggle()}handleTriggerHover(){this.host.disabled||(this._hoverTimer&&clearTimeout(this._hoverTimer),this._hoverTimer=window.setTimeout((()=>{this.open()}),this.host.delay))}handleTriggerLeave(){this._hoverTimer&&(clearTimeout(this._hoverTimer),this._hoverTimer=null),setTimeout((()=>{this.isHoveringDropdown()||this.close()}),100)}handleTriggerFocus(){this.host.disabled||this.open()}handleTriggerBlur(){setTimeout((()=>{this.isDropdownFocused()||this.close()}),100)}handleOutsideClick(o){var t,n;const i=o.target;if(null===(t=this._triggerElement)||void 0===t?void 0:t.contains(i))return;if(i.closest(".dropdown__panel"))return;if(null===(n=this._dropdownElement)||void 0===n?void 0:n.contains(i))return;if(i.closest("nr-dropdown"))return;if(i.closest(".dropdown__custom-content"))return;if(["INPUT","BUTTON","TEXTAREA","SELECT","A"].includes(i.tagName)){if(i.closest(".dropdown__panel"))return}i.closest(".dropdown")||i.closest('[class*="dropdown"]')||this.host.closeOnOutsideClick&&this.close()}handleKeydown(o){"Escape"===o.key&&this.close()}handleScroll(){}handleResize(){this._isOpen&&this.calculatePosition()}calculatePosition(){var o;try{if(this._dropdownElement&&this._triggerElement||this.findDropdownElements(),!this._dropdownElement||!this._triggerElement)return;const t=this._triggerElement.getBoundingClientRect(),n=((null===(o=window.visualViewport)||void 0===o?void 0:o.height)||window.innerHeight)-t.bottom,i=t.top,r=200,e=this.determineOptimalPlacement(r,i,n);this.applyPlacement(e)}catch(o){this.handleError(o,"calculatePosition")}}determineOptimalPlacement(o,t,n){return n>=o?"bottom":t>=o||t>n?"top":"bottom"}applyPlacement(o){this._dropdownElement&&(this._dropdownElement.classList.remove("dropdown__panel--top","dropdown__panel--bottom"),this._dropdownElement.classList.add(`dropdown__panel--${o}`),this._position.placement=o)}isHoveringDropdown(){var o;return(null===(o=this._dropdownElement)||void 0===o?void 0:o.matches(":hover"))||!1}isDropdownFocused(){var o;const t=document.activeElement;if(!t)return!1;if(null===(o=this._dropdownElement)||void 0===o?void 0:o.contains(t))return!0;if(t.closest(".dropdown__custom-content"))return!0;if(["INPUT","BUTTON","TEXTAREA","SELECT","A"].includes(t.tagName)){if(t.closest(".dropdown__panel"))return!0}return!1}handleItemClick(o){this.dispatchEvent(new CustomEvent("nr-dropdown-item-click",{bubbles:!0,composed:!0,detail:{item:o,dropdown:this.host}})),this.host.autoClose&&this.close()}cleanup(){this.removeEventListeners(),this.removeTriggerListeners(),this._hoverTimer&&(clearTimeout(this._hoverTimer),this._hoverTimer=null)}}
509
2
  /**
510
3
  * @license
511
4
  * Copyright 2023 Nuraly, Laabidi Aymen
512
5
  * SPDX-License-Identifier: MIT
513
- */var ni=function(t,i,o,n){for(var e,s=arguments.length,r=s<3?i:null===n?n=Object.getOwnPropertyDescriptor(i,o):n,d=t.length-1;d>=0;d--)(e=t[d])&&(r=(s<3?e(r):s>3?e(i,o,r):e(i,o))||r);return s>3&&r&&Object.defineProperty(i,o,r),r};let ei=class extends((t=>Qt(Jt(ti(t))))(It)){constructor(){super(...arguments),this.requiredComponents=["nr-icon"],this.items=[],this.open=!1,this.placement="bottom",this.trigger="hover",this.size="medium",this.animation="fade",this.disabled=!1,this.arrow=!1,this.autoClose=!1,this.closeOnOutsideClick=!0,this.closeOnEscape=!0,this.offset=4,this.delay=50,this.maxHeight="300px",this.minWidth="auto",this.cascadeDirection="auto",this.cascadeDelay=50,this.cascadeOnHover=!0,this.dropdownController=new oi(this),this.openSubmenus=new Set,this.submenuTimers=new Map,this.handleDropdownPanelClick=t=>{t.stopPropagation()},this.handleItemClick=t=>{t.disabled||(t.options&&t.options.length>0||t.customContent?this.toggleSubmenu(t.id):this.dropdownController.handleItemClick(t))},this.handleItemHover=t=>{var i;if(((null===(i=t.options)||void 0===i?void 0:i.length)||t.customContent)&&(this.clearSubmenuTimer(t.id),this.cascadeOnHover)){const i=window.setTimeout((()=>{this.showSubmenu(t.id)}),this.cascadeDelay);this.submenuTimers.set(t.id,i)}},this.handleItemLeave=t=>{var i;if(!(null===(i=t.options)||void 0===i?void 0:i.length)&&!t.customContent)return;this.clearSubmenuTimer(t.id);const o=window.setTimeout((()=>{this.hideSubmenu(t.id)}),100);this.submenuTimers.set(`hide-${t.id}`,o)},this.handleSubmenuEnter=t=>{this.clearSubmenuTimer(`hide-${t}`)},this.handleSubmenuLeave=t=>{const i=window.setTimeout((()=>{this.hideSubmenu(t)}),100);this.submenuTimers.set(`hide-${t}`,i)}}connectedCallback(){super.connectedCallback(),this.updateCascadingAttribute()}updated(t){super.updated(t),t.has("items")&&this.updateCascadingAttribute()}disconnectedCallback(){super.disconnectedCallback()}firstUpdated(){}updateCascadingAttribute(){this.items.some((t=>t.options&&t.options.length>0||!!t.customContent))?this.setAttribute("has-cascading",""):this.removeAttribute("has-cascading")}clearSubmenuTimer(t){const i=this.submenuTimers.get(t);i&&(clearTimeout(i),this.submenuTimers.delete(t))}toggleSubmenu(t){this.openSubmenus.has(t)?this.hideSubmenu(t):this.showSubmenu(t)}showSubmenu(t){this.openSubmenus.add(t),this.requestUpdate()}hideSubmenu(t){this.openSubmenus.delete(t),this.requestUpdate()}show(){this.dropdownController.open()}hide(){this.dropdownController.close()}toggle(){this.dropdownController.toggle()}renderItems(){return this.items.length?_t`
514
- <div class="dropdown__items">
515
- ${this.items.map((t=>{if(t.divider)return _t`<div class="dropdown__divider"></div>`;const i=!!(t.options&&t.options.length>0)||!!t.customContent,o=i&&this.openSubmenus.has(t.id);return _t`
516
- <div class="dropdown__item-container ${Xt({"dropdown__item-container--has-submenu":i})}">
517
- <button
518
- class="dropdown__item ${Xt({"dropdown__item--disabled":!!t.disabled,"dropdown__item--has-submenu":i})}"
519
- ?disabled="${t.disabled}"
520
- @click="${()=>this.handleItemClick(t)}"
521
- @mouseenter="${()=>i&&this.handleItemHover(t)}"
522
- @mouseleave="${()=>i&&this.handleItemLeave(t)}"
523
- >
524
- ${t.icon?_t`<nr-icon name="${t.icon}" class="dropdown__item-icon"></nr-icon>`:bt}
525
- <span class="dropdown__item-label">${t.label}</span>
526
- ${i?_t`<nr-icon name="chevron-right" class="dropdown__submenu-arrow"></nr-icon>`:bt}
527
- </button>
528
-
529
- ${i&&o?_t`
530
- <div class="dropdown__submenu ${Xt({"dropdown__submenu--right":"right"===this.cascadeDirection||"auto"===this.cascadeDirection,"dropdown__submenu--left":"left"===this.cascadeDirection})}"
531
- @mouseenter="${()=>this.handleSubmenuEnter(t.id)}"
532
- @mouseleave="${()=>this.handleSubmenuLeave(t.id)}">
533
- ${t.customContent?_t`
534
- <div class="dropdown__custom-content">
535
- ${"string"==typeof t.customContent?_t`<div .innerHTML="${t.customContent}"></div>`:t.customContent}
536
- </div>
537
- `:_t`
538
- <div class="dropdown__items">
539
- ${t.options.map((t=>t.divider?_t`<div class="dropdown__divider"></div>`:_t`
540
- <button
541
- class="dropdown__item ${Xt({"dropdown__item--disabled":!!t.disabled})}"
542
- ?disabled="${t.disabled}"
543
- @click="${()=>this.handleItemClick(t)}"
544
- >
545
- ${t.icon?_t`<nr-icon name="${t.icon}" class="dropdown__item-icon"></nr-icon>`:bt}
546
- <span class="dropdown__item-label">${t.label}</span>
547
- </button>
548
- `))}
549
- </div>
550
- `}
551
- </div>
552
- `:bt}
553
- </div>
554
- `}))}
555
- </div>
556
- `:bt}render(){const t={dropdown__panel:!0,"dropdown__panel--open":this.open,[`dropdown__panel--${this.size}`]:!0,[`dropdown__panel--${this.animation}`]:!0,[`dropdown__panel--${this.placement}`]:!0,"dropdown__panel--with-arrow":this.arrow},i={maxHeight:this.maxHeight,minWidth:this.minWidth};return _t`
557
- <div class="dropdown">
558
- <div class="dropdown__trigger">
559
- <slot name="trigger"></slot>
560
- </div>
561
-
562
- <div
563
- class="${Xt(t)}"
564
- style="${Zt(i)}"
565
- @click="${this.handleDropdownPanelClick}"
566
- >
567
- ${this.arrow?_t`<div class="dropdown__arrow"></div>`:bt}
568
-
569
- <slot name="header"></slot>
570
-
571
- <div class="dropdown__content">
572
- <slot name="content">${this.renderItems()}</slot>
573
- </div>
574
-
575
- <slot name="footer"></slot>
576
- </div>
577
- </div>
578
- `}};ei.styles=Ht,ni([Bt({type:Array})],ei.prototype,"items",void 0),ni([Bt({type:Boolean,reflect:!0})],ei.prototype,"open",void 0),ni([Bt({type:String})],ei.prototype,"placement",void 0),ni([Bt({type:String})],ei.prototype,"trigger",void 0),ni([Bt({type:String})],ei.prototype,"size",void 0),ni([Bt({type:String})],ei.prototype,"animation",void 0),ni([Bt({type:Boolean})],ei.prototype,"disabled",void 0),ni([Bt({type:Boolean})],ei.prototype,"arrow",void 0),ni([Bt({type:Boolean,attribute:"auto-close"})],ei.prototype,"autoClose",void 0),ni([Bt({type:Boolean,attribute:"close-on-outside-click"})],ei.prototype,"closeOnOutsideClick",void 0),ni([Bt({type:Boolean,attribute:"close-on-escape"})],ei.prototype,"closeOnEscape",void 0),ni([Bt({type:Number})],ei.prototype,"offset",void 0),ni([Bt({type:Number})],ei.prototype,"delay",void 0),ni([Bt({type:String,attribute:"max-height"})],ei.prototype,"maxHeight",void 0),ni([Bt({type:String,attribute:"min-width"})],ei.prototype,"minWidth",void 0),ni([Bt({type:String,attribute:"cascade-direction"})],ei.prototype,"cascadeDirection",void 0),ni([Bt({type:Number,attribute:"cascade-delay"})],ei.prototype,"cascadeDelay",void 0),ni([Bt({type:Boolean,attribute:"cascade-on-hover"})],ei.prototype,"cascadeOnHover",void 0),ei=ni([(t=>i=>"function"==typeof i?((t,i)=>(customElements.define(t,i),i))(t,i):((t,i)=>{const{kind:o,elements:n}=i;return{kind:o,elements:n,finisher(i){customElements.define(t,i)}}})(t,i))("nr-dropdown")],ei);export{ei as NrDropdownElement};
6
+ */var u=function(o,t,n,i){for(var r,e=arguments.length,d=e<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i,s=o.length-1;s>=0;s--)(r=o[s])&&(d=(e<3?r(d):e>3?r(t,n,d):r(t,n))||d);return e>3&&d&&Object.defineProperty(t,n,d),d};let c=class extends(a(t)){constructor(){super(...arguments),this.requiredComponents=["nr-icon"],this.items=[],this.open=!1,this.placement="bottom",this.trigger="hover",this.size="medium",this.animation="fade",this.disabled=!1,this.arrow=!1,this.autoClose=!1,this.closeOnOutsideClick=!0,this.closeOnEscape=!0,this.offset=4,this.delay=50,this.maxHeight="300px",this.minWidth="auto",this.cascadeDirection="auto",this.cascadeDelay=50,this.cascadeOnHover=!0,this.dropdownController=new h(this),this.openSubmenus=new Set,this.submenuTimers=new Map,this.handleDropdownPanelClick=o=>{o.stopPropagation()},this.handleItemClick=o=>{o.disabled||(o.options&&o.options.length>0||o.customContent?this.toggleSubmenu(o.id):this.dropdownController.handleItemClick(o))},this.handleItemHover=o=>{var t;if(((null===(t=o.options)||void 0===t?void 0:t.length)||o.customContent)&&(this.clearSubmenuTimer(o.id),this.cascadeOnHover)){const t=window.setTimeout((()=>{this.showSubmenu(o.id)}),this.cascadeDelay);this.submenuTimers.set(o.id,t)}},this.handleItemLeave=o=>{var t;if(!(null===(t=o.options)||void 0===t?void 0:t.length)&&!o.customContent)return;this.clearSubmenuTimer(o.id);const n=window.setTimeout((()=>{this.hideSubmenu(o.id)}),100);this.submenuTimers.set(`hide-${o.id}`,n)},this.handleSubmenuEnter=o=>{this.clearSubmenuTimer(`hide-${o}`)},this.handleSubmenuLeave=o=>{const t=window.setTimeout((()=>{this.hideSubmenu(o)}),100);this.submenuTimers.set(`hide-${o}`,t)}}connectedCallback(){super.connectedCallback(),this.updateCascadingAttribute()}updated(o){super.updated(o),o.has("items")&&this.updateCascadingAttribute()}disconnectedCallback(){super.disconnectedCallback()}firstUpdated(){}updateCascadingAttribute(){this.items.some((o=>o.options&&o.options.length>0||!!o.customContent))?this.setAttribute("has-cascading",""):this.removeAttribute("has-cascading")}clearSubmenuTimer(o){const t=this.submenuTimers.get(o);t&&(clearTimeout(t),this.submenuTimers.delete(o))}toggleSubmenu(o){this.openSubmenus.has(o)?this.hideSubmenu(o):this.showSubmenu(o)}showSubmenu(o){this.openSubmenus.add(o),this.requestUpdate()}hideSubmenu(o){this.openSubmenus.delete(o),this.requestUpdate()}show(){this.dropdownController.open()}hide(){this.dropdownController.close()}toggle(){this.dropdownController.toggle()}renderItems(){return this.items.length?i`<div class="dropdown__items">${this.items.map((o=>{if(o.divider)return i`<div class="dropdown__divider"></div>`;const t=!!(o.options&&o.options.length>0)||!!o.customContent,r=t&&this.openSubmenus.has(o.id);return i`<div class="dropdown__item-container ${d({"dropdown__item-container--has-submenu":t})}"><button class="dropdown__item ${d({"dropdown__item--disabled":!!o.disabled,"dropdown__item--has-submenu":t})}" ?disabled="${o.disabled}" @click="${()=>this.handleItemClick(o)}" @mouseenter="${()=>t&&this.handleItemHover(o)}" @mouseleave="${()=>t&&this.handleItemLeave(o)}">${o.icon?i`<nr-icon name="${o.icon}" class="dropdown__item-icon"></nr-icon>`:n} <span class="dropdown__item-label">${o.label}</span> ${t?i`<nr-icon name="chevron-right" class="dropdown__submenu-arrow"></nr-icon>`:n}</button> ${t&&r?i`<div class="dropdown__submenu ${d({"dropdown__submenu--right":"right"===this.cascadeDirection||"auto"===this.cascadeDirection,"dropdown__submenu--left":"left"===this.cascadeDirection})}" @mouseenter="${()=>this.handleSubmenuEnter(o.id)}" @mouseleave="${()=>this.handleSubmenuLeave(o.id)}">${o.customContent?i`<div class="dropdown__custom-content">${"string"==typeof o.customContent?i`<div .innerHTML="${o.customContent}"></div>`:o.customContent}</div>`:i`<div class="dropdown__items">${o.options.map((o=>o.divider?i`<div class="dropdown__divider"></div>`:i`<button class="dropdown__item ${d({"dropdown__item--disabled":!!o.disabled})}" ?disabled="${o.disabled}" @click="${()=>this.handleItemClick(o)}">${o.icon?i`<nr-icon name="${o.icon}" class="dropdown__item-icon"></nr-icon>`:n} <span class="dropdown__item-label">${o.label}</span></button>`))}</div>`}</div>`:n}</div>`}))}</div>`:n}render(){const o={dropdown__panel:!0,"dropdown__panel--open":this.open,[`dropdown__panel--${this.size}`]:!0,[`dropdown__panel--${this.animation}`]:!0,[`dropdown__panel--${this.placement}`]:!0,"dropdown__panel--with-arrow":this.arrow},t={maxHeight:this.maxHeight,minWidth:this.minWidth};return i`<div class="dropdown"><div class="dropdown__trigger"><slot name="trigger"></slot></div><div class="${d(o)}" style="${s(t)}" @click="${this.handleDropdownPanelClick}">${this.arrow?i`<div class="dropdown__arrow"></div>`:n}<slot name="header"></slot><div class="dropdown__content"><slot name="content">${this.renderItems()}</slot></div><slot name="footer"></slot></div></div>`}};c.styles=l,u([r({type:Array})],c.prototype,"items",void 0),u([r({type:Boolean,reflect:!0})],c.prototype,"open",void 0),u([r({type:String})],c.prototype,"placement",void 0),u([r({type:String})],c.prototype,"trigger",void 0),u([r({type:String})],c.prototype,"size",void 0),u([r({type:String})],c.prototype,"animation",void 0),u([r({type:Boolean})],c.prototype,"disabled",void 0),u([r({type:Boolean})],c.prototype,"arrow",void 0),u([r({type:Boolean,attribute:"auto-close"})],c.prototype,"autoClose",void 0),u([r({type:Boolean,attribute:"close-on-outside-click"})],c.prototype,"closeOnOutsideClick",void 0),u([r({type:Boolean,attribute:"close-on-escape"})],c.prototype,"closeOnEscape",void 0),u([r({type:Number})],c.prototype,"offset",void 0),u([r({type:Number})],c.prototype,"delay",void 0),u([r({type:String,attribute:"max-height"})],c.prototype,"maxHeight",void 0),u([r({type:String,attribute:"min-width"})],c.prototype,"minWidth",void 0),u([r({type:String,attribute:"cascade-direction"})],c.prototype,"cascadeDirection",void 0),u([r({type:Number,attribute:"cascade-delay"})],c.prototype,"cascadeDelay",void 0),u([r({type:Boolean,attribute:"cascade-on-hover"})],c.prototype,"cascadeOnHover",void 0),c=u([e("nr-dropdown")],c);export{c as NrDropdownElement};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuralyui/dropdown",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "Dropdown component for NuralyUI",
5
5
  "main": "index.js",
6
6
  "type": "module",