@nuralyui/collapse 0.0.10 → 0.0.11
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 +6 -347
- package/package.json +1 -1
package/bundle.js
CHANGED
|
@@ -1,374 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2019 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/
|
|
6
|
-
const t=window,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new WeakMap;class o{constructor(t,e,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const i=this.t;if(e&&void 0===t){const e=void 0!==i&&1===i.length;e&&(t=s.get(i)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&s.set(i,t))}return t}toString(){return this.cssText}}const n=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new o("string"==typeof t?t:t+"",void 0,i))(e)})(t):t
|
|
7
|
-
/**
|
|
8
|
-
* @license
|
|
9
|
-
* Copyright 2017 Google LLC
|
|
10
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/;var r;const l=window,a=l.trustedTypes,c=a?a.emptyScript:"",h=l.reactiveElementPolyfillSupport,d={toAttribute(t,e){switch(e){case Boolean:t=t?c:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},u=(t,e)=>e!==t&&(e==e||t==t),v={attribute:!0,type:String,converter:d,reflect:!1,hasChanged:u},p="finalized";class f extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const s=this._$Ep(i,e);void 0!==s&&(this._$Ev.set(s,i),t.push(s))})),t}static createProperty(t,e=v){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const o=this[t];this[e]=s,this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||v}static finalize(){if(this.hasOwnProperty(p))return!1;this[p]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(n(t))}else void 0!==t&&e.push(n(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var i;const s=null!==(i=this.shadowRoot)&&void 0!==i?i:this.attachShadow(this.constructor.shadowRootOptions);return((i,s)=>{e?i.adoptedStyleSheets=s.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):s.forEach((e=>{const s=document.createElement("style"),o=t.litNonce;void 0!==o&&s.setAttribute("nonce",o),s.textContent=e.cssText,i.appendChild(s)}))})(s,this.constructor.elementStyles),s}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=v){var s;const o=this.constructor._$Ep(t,i);if(void 0!==o&&!0===i.reflect){const n=(void 0!==(null===(s=i.converter)||void 0===s?void 0:s.toAttribute)?i.converter:d).toAttribute(e,i.type);this._$El=t,null==n?this.removeAttribute(o):this.setAttribute(o,n),this._$El=null}}_$AK(t,e){var i;const s=this.constructor,o=s._$Ev.get(t);if(void 0!==o&&this._$El!==o){const t=s.getPropertyOptions(o),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:d;this._$El=o,this[o]=n.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let s=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||u)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}
|
|
12
|
-
/**
|
|
13
|
-
* @license
|
|
14
|
-
* Copyright 2017 Google LLC
|
|
15
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
-
*/
|
|
17
|
-
var g;f[p]=!0,f.elementProperties=new Map,f.elementStyles=[],f.shadowRootOptions={mode:"open"},null==h||h({ReactiveElement:f}),(null!==(r=l.reactiveElementVersions)&&void 0!==r?r:l.reactiveElementVersions=[]).push("1.6.3");const y=window,b=y.trustedTypes,m=b?b.createPolicy("lit-html",{createHTML:t=>t}):void 0,w="$lit$",$=`lit$${(Math.random()+"").slice(9)}$`,x="?"+$,S=`<${x}>`,A=document,k=()=>A.createComment(""),E=t=>null===t||"object"!=typeof t&&"function"!=typeof t,C=Array.isArray,_="[ \t\n\f\r]",O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,j=/-->/g,M=/>/g,T=RegExp(`>|${_}(?:([^\\s"'>=/]+)(${_}*=${_}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),z=/'/g,U=/"/g,R=/^(?:script|style|textarea|title)$/i,D=Symbol.for("lit-noChange"),I=Symbol.for("lit-nothing"),N=new WeakMap,P=A.createTreeWalker(A,129,null,!1);function H(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==m?m.createHTML(e):e}class V{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let o=0,n=0;const r=t.length-1,l=this.parts,[a,c]=((t,e)=>{const i=t.length-1,s=[];let o,n=2===e?"<svg>":"",r=O;for(let e=0;e<i;e++){const i=t[e];let l,a,c=-1,h=0;for(;h<i.length&&(r.lastIndex=h,a=r.exec(i),null!==a);)h=r.lastIndex,r===O?"!--"===a[1]?r=j:void 0!==a[1]?r=M:void 0!==a[2]?(R.test(a[2])&&(o=RegExp("</"+a[2],"g")),r=T):void 0!==a[3]&&(r=T):r===T?">"===a[0]?(r=null!=o?o:O,c=-1):void 0===a[1]?c=-2:(c=r.lastIndex-a[2].length,l=a[1],r=void 0===a[3]?T:'"'===a[3]?U:z):r===U||r===z?r=T:r===j||r===M?r=O:(r=T,o=void 0);const d=r===T&&t[e+1].startsWith("/>")?" ":"";n+=r===O?i+S:c>=0?(s.push(l),i.slice(0,c)+w+i.slice(c)+$+d):i+$+(-2===c?(s.push(void 0),e):d)}return[H(t,n+(t[i]||"<?>")+(2===e?"</svg>":"")),s]})(t,e);if(this.el=V.createElement(a,i),P.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=P.nextNode())&&l.length<r;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const e of s.getAttributeNames())if(e.endsWith(w)||e.startsWith($)){const i=c[n++];if(t.push(e),void 0!==i){const t=s.getAttribute(i.toLowerCase()+w).split($),e=/([.?@])?(.*)/.exec(i);l.push({type:1,index:o,name:e[2],strings:t,ctor:"."===e[1]?F:"?"===e[1]?Z:"@"===e[1]?J:B})}else l.push({type:6,index:o})}for(const e of t)s.removeAttribute(e)}if(R.test(s.tagName)){const t=s.textContent.split($),e=t.length-1;if(e>0){s.textContent=b?b.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],k()),P.nextNode(),l.push({type:2,index:++o});s.append(t[e],k())}}}else if(8===s.nodeType)if(s.data===x)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,e){const i=A.createElement("template");return i.innerHTML=t,i}}function q(t,e,i=t,s){var o,n,r,l;if(e===D)return e;let a=void 0!==s?null===(o=i._$Co)||void 0===o?void 0:o[s]:i._$Cl;const c=E(e)?void 0:e._$litDirective$;return(null==a?void 0:a.constructor)!==c&&(null===(n=null==a?void 0:a._$AO)||void 0===n||n.call(a,!1),void 0===c?a=void 0:(a=new c(t),a._$AT(t,i,s)),void 0!==s?(null!==(r=(l=i)._$Co)&&void 0!==r?r:l._$Co=[])[s]=a:i._$Cl=a),void 0!==a&&(e=q(t,a._$AS(t,e.values),a,s)),e}class L{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:i},parts:s}=this._$AD,o=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:A).importNode(i,!0);P.currentNode=o;let n=P.nextNode(),r=0,l=0,a=s[0];for(;void 0!==a;){if(r===a.index){let e;2===a.type?e=new K(n,n.nextSibling,this,t):1===a.type?e=new a.ctor(n,a.name,a.strings,this,t):6===a.type&&(e=new G(n,this,t)),this._$AV.push(e),a=s[++l]}r!==(null==a?void 0:a.index)&&(n=P.nextNode(),r++)}return P.currentNode=A,o}v(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class K{constructor(t,e,i,s){var o;this.type=2,this._$AH=I,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cp=null===(o=null==s?void 0:s.isConnected)||void 0===o||o}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=q(this,t,e),E(t)?t===I||null==t||""===t?(this._$AH!==I&&this._$AR(),this._$AH=I):t!==this._$AH&&t!==D&&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!==I&&E(this._$AH)?this._$AA.nextSibling.data=t:this.$(A.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:s}=t,o="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=V.createElement(H(s.h,s.h[0]),this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===o)this._$AH.v(i);else{const t=new L(o,this),e=t.u(this.options);t.v(i),this.$(e),this._$AH=t}}_$AC(t){let e=N.get(t.strings);return void 0===e&&N.set(t.strings,e=new V(t)),e}T(t){C(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const o of t)s===e.length?e.push(i=new K(this.k(k()),this.k(k()),this,this.options)):i=e[s],i._$AI(o),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class B{constructor(t,e,i,s,o){this.type=1,this._$AH=I,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=I}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const o=this.strings;let n=!1;if(void 0===o)t=q(this,t,e,0),n=!E(t)||t!==this._$AH&&t!==D,n&&(this._$AH=t);else{const s=t;let r,l;for(t=o[0],r=0;r<o.length-1;r++)l=q(this,s[i+r],e,r),l===D&&(l=this._$AH[r]),n||(n=!E(l)||l!==this._$AH[r]),l===I?t=I:t!==I&&(t+=(null!=l?l:"")+o[r+1]),this._$AH[r]=l}n&&!s&&this.j(t)}j(t){t===I?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class F extends B{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===I?void 0:t}}const W=b?b.emptyScript:"";class Z extends B{constructor(){super(...arguments),this.type=4}j(t){t&&t!==I?this.element.setAttribute(this.name,W):this.element.removeAttribute(this.name)}}class J extends B{constructor(t,e,i,s,o){super(t,e,i,s,o),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=q(this,t,e,0))&&void 0!==i?i:I)===D)return;const s=this._$AH,o=t===I&&s!==I||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==I&&(s===I||o);o&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class G{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){q(this,t)}}const Q=y.litHtmlPolyfillSupport;
|
|
18
|
-
/**
|
|
19
|
-
* @license
|
|
20
|
-
* Copyright 2017 Google LLC
|
|
21
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/
|
|
23
|
-
var X;null==Q||Q(V,K),(null!==(g=y.litHtmlVersions)&&void 0!==g?g:y.litHtmlVersions=[]).push("2.8.0");const Y=window,tt=Y.trustedTypes,et=tt?tt.createPolicy("lit-html",{createHTML:t=>t}):void 0,it="$lit$",st=`lit$${(Math.random()+"").slice(9)}$`,ot="?"+st,nt=`<${ot}>`,rt=document,lt=()=>rt.createComment(""),at=t=>null===t||"object"!=typeof t&&"function"!=typeof t,ct=Array.isArray,ht="[ \t\n\f\r]",dt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ut=/-->/g,vt=/>/g,pt=RegExp(`>|${ht}(?:([^\\s"'>=/]+)(${ht}*=${ht}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),ft=/'/g,gt=/"/g,yt=/^(?:script|style|textarea|title)$/i,bt=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),mt=Symbol.for("lit-noChange"),wt=Symbol.for("lit-nothing"),$t=new WeakMap,xt=rt.createTreeWalker(rt,129,null,!1);function St(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==et?et.createHTML(e):e}const At=(t,e)=>{const i=t.length-1,s=[];let o,n=2===e?"<svg>":"",r=dt;for(let e=0;e<i;e++){const i=t[e];let l,a,c=-1,h=0;for(;h<i.length&&(r.lastIndex=h,a=r.exec(i),null!==a);)h=r.lastIndex,r===dt?"!--"===a[1]?r=ut:void 0!==a[1]?r=vt:void 0!==a[2]?(yt.test(a[2])&&(o=RegExp("</"+a[2],"g")),r=pt):void 0!==a[3]&&(r=pt):r===pt?">"===a[0]?(r=null!=o?o:dt,c=-1):void 0===a[1]?c=-2:(c=r.lastIndex-a[2].length,l=a[1],r=void 0===a[3]?pt:'"'===a[3]?gt:ft):r===gt||r===ft?r=pt:r===ut||r===vt?r=dt:(r=pt,o=void 0);const d=r===pt&&t[e+1].startsWith("/>")?" ":"";n+=r===dt?i+nt:c>=0?(s.push(l),i.slice(0,c)+it+i.slice(c)+st+d):i+st+(-2===c?(s.push(void 0),e):d)}return[St(t,n+(t[i]||"<?>")+(2===e?"</svg>":"")),s]};class kt{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let o=0,n=0;const r=t.length-1,l=this.parts,[a,c]=At(t,e);if(this.el=kt.createElement(a,i),xt.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=xt.nextNode())&&l.length<r;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const e of s.getAttributeNames())if(e.endsWith(it)||e.startsWith(st)){const i=c[n++];if(t.push(e),void 0!==i){const t=s.getAttribute(i.toLowerCase()+it).split(st),e=/([.?@])?(.*)/.exec(i);l.push({type:1,index:o,name:e[2],strings:t,ctor:"."===e[1]?jt:"?"===e[1]?Tt:"@"===e[1]?zt:Ot})}else l.push({type:6,index:o})}for(const e of t)s.removeAttribute(e)}if(yt.test(s.tagName)){const t=s.textContent.split(st),e=t.length-1;if(e>0){s.textContent=tt?tt.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],lt()),xt.nextNode(),l.push({type:2,index:++o});s.append(t[e],lt())}}}else if(8===s.nodeType)if(s.data===ot)l.push({type:2,index:o});else{let t=-1;for(;-1!==(t=s.data.indexOf(st,t+1));)l.push({type:7,index:o}),t+=st.length-1}o++}}static createElement(t,e){const i=rt.createElement("template");return i.innerHTML=t,i}}function Et(t,e,i=t,s){var o,n,r,l;if(e===mt)return e;let a=void 0!==s?null===(o=i._$Co)||void 0===o?void 0:o[s]:i._$Cl;const c=at(e)?void 0:e._$litDirective$;return(null==a?void 0:a.constructor)!==c&&(null===(n=null==a?void 0:a._$AO)||void 0===n||n.call(a,!1),void 0===c?a=void 0:(a=new c(t),a._$AT(t,i,s)),void 0!==s?(null!==(r=(l=i)._$Co)&&void 0!==r?r:l._$Co=[])[s]=a:i._$Cl=a),void 0!==a&&(e=Et(t,a._$AS(t,e.values),a,s)),e}class Ct{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:i},parts:s}=this._$AD,o=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:rt).importNode(i,!0);xt.currentNode=o;let n=xt.nextNode(),r=0,l=0,a=s[0];for(;void 0!==a;){if(r===a.index){let e;2===a.type?e=new _t(n,n.nextSibling,this,t):1===a.type?e=new a.ctor(n,a.name,a.strings,this,t):6===a.type&&(e=new Ut(n,this,t)),this._$AV.push(e),a=s[++l]}r!==(null==a?void 0:a.index)&&(n=xt.nextNode(),r++)}return xt.currentNode=rt,o}v(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class _t{constructor(t,e,i,s){var o;this.type=2,this._$AH=wt,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cp=null===(o=null==s?void 0:s.isConnected)||void 0===o||o}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Et(this,t,e),at(t)?t===wt||null==t||""===t?(this._$AH!==wt&&this._$AR(),this._$AH=wt):t!==this._$AH&&t!==mt&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>ct(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==wt&&at(this._$AH)?this._$AA.nextSibling.data=t:this.$(rt.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:s}=t,o="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=kt.createElement(St(s.h,s.h[0]),this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===o)this._$AH.v(i);else{const t=new Ct(o,this),e=t.u(this.options);t.v(i),this.$(e),this._$AH=t}}_$AC(t){let e=$t.get(t.strings);return void 0===e&&$t.set(t.strings,e=new kt(t)),e}T(t){ct(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const o of t)s===e.length?e.push(i=new _t(this.k(lt()),this.k(lt()),this,this.options)):i=e[s],i._$AI(o),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class Ot{constructor(t,e,i,s,o){this.type=1,this._$AH=wt,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=wt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const o=this.strings;let n=!1;if(void 0===o)t=Et(this,t,e,0),n=!at(t)||t!==this._$AH&&t!==mt,n&&(this._$AH=t);else{const s=t;let r,l;for(t=o[0],r=0;r<o.length-1;r++)l=Et(this,s[i+r],e,r),l===mt&&(l=this._$AH[r]),n||(n=!at(l)||l!==this._$AH[r]),l===wt?t=wt:t!==wt&&(t+=(null!=l?l:"")+o[r+1]),this._$AH[r]=l}n&&!s&&this.j(t)}j(t){t===wt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class jt extends Ot{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===wt?void 0:t}}const Mt=tt?tt.emptyScript:"";class Tt extends Ot{constructor(){super(...arguments),this.type=4}j(t){t&&t!==wt?this.element.setAttribute(this.name,Mt):this.element.removeAttribute(this.name)}}class zt extends Ot{constructor(t,e,i,s,o){super(t,e,i,s,o),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=Et(this,t,e,0))&&void 0!==i?i:wt)===mt)return;const s=this._$AH,o=t===wt&&s!==wt||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==wt&&(s===wt||o);o&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class Ut{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Et(this,t)}}const Rt=Y.litHtmlPolyfillSupport;null==Rt||Rt(kt,_t),(null!==(X=Y.litHtmlVersions)&&void 0!==X?X:Y.litHtmlVersions=[]).push("2.8.0");
|
|
24
|
-
/**
|
|
25
|
-
* @license
|
|
26
|
-
* Copyright 2017 Google LLC
|
|
27
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
28
|
-
*/
|
|
29
|
-
var Dt,It;class Nt extends f{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{var s,o;const n=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:e;let r=n._$litPart$;if(void 0===r){const t=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:null;n._$litPart$=r=new _t(e.insertBefore(lt(),t),t,void 0,null!=i?i:{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return mt}}Nt.finalized=!0,Nt._$litElement$=!0,null===(Dt=globalThis.litElementHydrateSupport)||void 0===Dt||Dt.call(globalThis,{LitElement:Nt});const Pt=globalThis.litElementPolyfillSupport;null==Pt||Pt({LitElement:Nt}),(null!==(It=globalThis.litElementVersions)&&void 0!==It?It:globalThis.litElementVersions=[]).push("3.3.3");
|
|
30
|
-
/**
|
|
31
|
-
* @license
|
|
32
|
-
* Copyright 2017 Google LLC
|
|
33
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
|
-
*/
|
|
35
|
-
const Ht=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};
|
|
36
|
-
/**
|
|
37
|
-
* @license
|
|
38
|
-
* Copyright 2017 Google LLC
|
|
39
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
40
|
-
*/function Vt(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):Ht(t,e)
|
|
41
|
-
/**
|
|
42
|
-
* @license
|
|
43
|
-
* Copyright 2021 Google LLC
|
|
44
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
45
|
-
*/}var qt;null===(qt=window.HTMLSlotElement)||void 0===qt||qt.prototype.assignedElements;
|
|
1
|
+
import{css as e,LitElement as o,html as t,nothing as n}from"lit";import{property as i,customElement as a}from"lit/decorators.js";import{NuralyUIBaseMixin as l}from"@nuralyui/common/mixins";import{map as s}from"lit/directives/map.js";import{classMap as r}from"lit/directives/class-map.js";import{ifDefined as c}from"lit/directives/if-defined.js";
|
|
46
2
|
/**
|
|
47
3
|
* @license
|
|
48
4
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
49
5
|
* SPDX-License-Identifier: MIT
|
|
50
6
|
*/
|
|
51
|
-
const
|
|
52
|
-
:host {
|
|
53
|
-
display: block;
|
|
54
|
-
width: 100%;
|
|
55
|
-
|
|
56
|
-
/* Force CSS custom property inheritance to ensure theme switching works properly */
|
|
57
|
-
color: var(--nuraly-color-text);
|
|
58
|
-
background-color: var(--nuraly-color-background);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/* Force re-evaluation of theme-dependent properties on theme change */
|
|
62
|
-
:host([data-theme]) {
|
|
63
|
-
color: inherit;
|
|
64
|
-
background-color: inherit;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.collapse-container {
|
|
68
|
-
display: flex;
|
|
69
|
-
flex-direction: column;
|
|
70
|
-
gap: var(--nuraly-spacing-collapse-gap);
|
|
71
|
-
border: var(--nuraly-color-collapse-border);
|
|
72
|
-
border-radius: var(--nuraly-border-radius-collapse);
|
|
73
|
-
background-color: var(--nuraly-color-collapse-bordered-background);
|
|
74
|
-
overflow: hidden;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.collapse-section {
|
|
78
|
-
position: relative;
|
|
79
|
-
border-bottom: 1px solid var(--nuraly-color-collapse-border);
|
|
80
|
-
transition: var(--nuraly-transition-collapse);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.collapse-section:last-child {
|
|
84
|
-
border-bottom: none;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.collapse-section--disabled {
|
|
88
|
-
opacity: var(--nuraly-opacity-collapse-disabled);
|
|
89
|
-
pointer-events: none;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.collapse-section--non-collapsible .collapse-header {
|
|
93
|
-
cursor: default;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.collapse-section--animating .collapse-content {
|
|
97
|
-
overflow: hidden;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/* Header Styles */
|
|
101
|
-
.collapse-header {
|
|
102
|
-
display: flex;
|
|
103
|
-
align-items: center;
|
|
104
|
-
justify-content: space-between;
|
|
105
|
-
padding: var(--nuraly-spacing-collapse-padding);
|
|
106
|
-
background-color: var(--nuraly-color-collapse-header-background);
|
|
107
|
-
color: var(--nuraly-color-collapse-header-text);
|
|
108
|
-
font-weight: var(--nuraly-font-collapse-header-weight);
|
|
109
|
-
font-size: var(--nuraly-font-collapse-header-size);
|
|
110
|
-
line-height: var(--nuraly-font-collapse-header-line-height);
|
|
111
|
-
border: none;
|
|
112
|
-
cursor: pointer;
|
|
113
|
-
user-select: none;
|
|
114
|
-
transition: var(--nuraly-collapse-transition-duration) var(--nuraly-collapse-transition-easing);
|
|
115
|
-
border-radius: var(--nuraly-border-radius-collapse-header);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.collapse-header--clickable:hover {
|
|
119
|
-
background-color: var(--nuraly-color-collapse-header-background-hover);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.collapse-header--clickable:active {
|
|
123
|
-
background-color: var(--nuraly-color-collapse-header-background-active);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.collapse-header--expanded {
|
|
127
|
-
background-color: var(--nuraly-color-collapse-header-background-expanded);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.collapse-header--disabled {
|
|
131
|
-
color: var(--nuraly-color-collapse-header-text-disabled);
|
|
132
|
-
cursor: not-allowed;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.collapse-header:focus-visible {
|
|
136
|
-
outline: 2px solid var(--nuraly-color-collapse-focus-outline);
|
|
137
|
-
outline-offset: 2px;
|
|
138
|
-
box-shadow: var(--nuraly-shadow-collapse-focus);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.collapse-header-text {
|
|
142
|
-
flex: 1;
|
|
143
|
-
text-align: left;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.collapse-header-right {
|
|
147
|
-
display: flex;
|
|
148
|
-
align-items: center;
|
|
149
|
-
gap: var(--nuraly-spacing-collapse-header-right-gap, 0.5rem);
|
|
150
|
-
margin-left: var(--nuraly-spacing-collapse-header-right-margin, 0.75rem);
|
|
151
|
-
color: var(--nuraly-color-collapse-header-right-text, inherit);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.collapse-header-right > * {
|
|
155
|
-
flex-shrink: 0;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/* Icon Styles */
|
|
159
|
-
.collapse-icon {
|
|
160
|
-
display: flex;
|
|
161
|
-
align-items: center;
|
|
162
|
-
justify-content: center;
|
|
163
|
-
width: var(--nuraly-collapse-icon-size);
|
|
164
|
-
height: var(--nuraly-collapse-icon-size);
|
|
165
|
-
color: var(--nuraly-color-collapse-icon);
|
|
166
|
-
transition: var(--nuraly-collapse-icon-transition);
|
|
167
|
-
transform-origin: center;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.collapse-header--disabled .collapse-icon {
|
|
171
|
-
color: var(--nuraly-color-collapse-icon-disabled);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/* Content Styles */
|
|
175
|
-
.collapse-content {
|
|
176
|
-
background-color: var(--nuraly-color-collapse-content-background);
|
|
177
|
-
border-radius: var(--nuraly-border-radius-collapse-content);
|
|
178
|
-
transition: var(--nuraly-collapse-transition-duration) var(--nuraly-collapse-transition-easing);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.collapse-content-inner {
|
|
182
|
-
padding: var(--nuraly-spacing-collapse-content-padding);
|
|
183
|
-
color: var(--nuraly-color-collapse-content-text);
|
|
184
|
-
font-weight: var(--nuraly-font-collapse-content-weight);
|
|
185
|
-
font-size: var(--nuraly-font-collapse-content-size);
|
|
186
|
-
line-height: var(--nuraly-font-collapse-content-line-height);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/* Size Variants */
|
|
190
|
-
:host([size="small"]) .collapse-header {
|
|
191
|
-
padding: var(--nuraly-spacing-collapse-small-padding);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
:host([size="small"]) .collapse-content-inner {
|
|
195
|
-
padding: var(--nuraly-spacing-collapse-small-content-padding);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
:host([size="medium"]) .collapse-header {
|
|
199
|
-
padding: var(--nuraly-spacing-collapse-medium-padding);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
:host([size="medium"]) .collapse-content-inner {
|
|
203
|
-
padding: var(--nuraly-spacing-collapse-medium-content-padding);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
:host([size="large"]) .collapse-header {
|
|
207
|
-
padding: var(--nuraly-spacing-collapse-large-padding);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
:host([size="large"]) .collapse-content-inner {
|
|
211
|
-
padding: var(--nuraly-spacing-collapse-large-content-padding);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/* Variant Styles */
|
|
215
|
-
:host([variant="default"]) .collapse-container {
|
|
216
|
-
background-color: var(--nuraly-color-collapse-content-background);
|
|
217
|
-
border: 1px solid var(--nuraly-color-collapse-border);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
:host([variant="bordered"]) .collapse-container {
|
|
221
|
-
background-color: var(--nuraly-color-collapse-bordered-background);
|
|
222
|
-
border: 2px solid var(--nuraly-color-collapse-bordered-border);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
:host([variant="ghost"]) .collapse-container {
|
|
226
|
-
background-color: var(--nuraly-color-collapse-ghost-background);
|
|
227
|
-
border: 1px solid var(--nuraly-color-collapse-ghost-border);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
:host([variant="ghost"]) .collapse-header:hover {
|
|
231
|
-
background-color: var(--nuraly-color-collapse-ghost-hover);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/* Accordion Mode */
|
|
235
|
-
:host([accordion]) .collapse-section {
|
|
236
|
-
border-bottom: 1px solid var(--nuraly-color-collapse-border);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/* Shadow Variants */
|
|
240
|
-
:host(:not([variant="ghost"])) .collapse-container {
|
|
241
|
-
box-shadow: var(--nuraly-shadow-collapse);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
:host(:not([variant="ghost"])) .collapse-container:hover {
|
|
245
|
-
box-shadow: var(--nuraly-shadow-collapse-hover);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/* Accessibility */
|
|
249
|
-
@media (prefers-reduced-motion: reduce) {
|
|
250
|
-
.collapse-header,
|
|
251
|
-
.collapse-icon,
|
|
252
|
-
.collapse-content,
|
|
253
|
-
.collapse-section {
|
|
254
|
-
transition: none;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
.collapse-icon--expanded {
|
|
258
|
-
transform: none;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/* High Contrast Mode */
|
|
263
|
-
@media (prefers-contrast: high) {
|
|
264
|
-
.collapse-header {
|
|
265
|
-
border: 2px solid var(--nuraly-color-collapse-border-focus);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
.collapse-header:focus-visible {
|
|
269
|
-
outline: 3px solid var(--nuraly-color-collapse-focus-outline);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
`,Kt=t=>class extends t{constructor(){super(...arguments),this.handleSystemThemeChange=()=>{this.closest("[data-theme]")||document.documentElement.hasAttribute("data-theme")||this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setupThemeObserver(),this.setupDesignSystemObserver(),this.setupSystemThemeListener()}disconnectedCallback(){var t,e,i;super.disconnectedCallback(),null===(t=this.themeObserver)||void 0===t||t.disconnect(),null===(e=this.designSystemObserver)||void 0===e||e.disconnect(),null===(i=this.mediaQuery)||void 0===i||i.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var t,e;const i=(null===(t=this.closest("[data-theme]"))||void 0===t?void 0:t.getAttribute("data-theme"))||document.documentElement.getAttribute("data-theme");return i||((null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light")}get currentDesignSystem(){var t;const e=(null===(t=this.closest("[design-system]"))||void 0===t?void 0:t.getAttribute("design-system"))||document.documentElement.getAttribute("design-system");return"carbon"===e?e:"default"}setupThemeObserver(){this.themeObserver=new MutationObserver((()=>{this.requestUpdate()})),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}setupDesignSystemObserver(){this.designSystemObserver=new MutationObserver((()=>{this.requestUpdate()})),this.designSystemObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["design-system"]})}setupSystemThemeListener(){window.matchMedia&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.mediaQuery.addEventListener("change",this.handleSystemThemeChange))}},Bt=()=>{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)},Ft=t=>class extends t{constructor(){super(...arguments),this.requiredComponents=[]}validateDependencies(){if(Bt())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(!Bt())return!0;let e=!0;for(const i of this.requiredComponents)if(!this.isComponentAvailable(i)){e=!1;const s=new Error(`Required component "${i}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}.`);t?t(i,s):console.error(s.message)}return e}isComponentAvailable(t){return!!customElements.get(t)}getMissingDependencies(){return this.requiredComponents.filter((t=>!this.isComponentAvailable(t)))}areDependenciesAvailable(){return this.requiredComponents.every((t=>this.isComponentAvailable(t)))}addRequiredComponent(t){this.requiredComponents.includes(t)||this.requiredComponents.push(t)}removeRequiredComponent(t){const e=this.requiredComponents.indexOf(t);e>-1&&this.requiredComponents.splice(e,1)}},Wt=t=>class extends t{dispatchCustomEvent(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchEventWithMetadata(t,e){var i;const s=Object.assign(Object.assign({},e),{timestamp:Date.now(),componentName:(null===(i=this.tagName)||void 0===i?void 0:i.toLowerCase())||"unknown"});this.dispatchCustomEvent(t,s)}dispatchInputEvent(t,e){const i=Object.assign({target:e.target||this,value:e.value,originalEvent:e.originalEvent},e);this.dispatchCustomEvent(t,i)}dispatchFocusEvent(t,e){const i=Object.assign({target:e.target||this,value:e.value,focused:e.focused,cursorPosition:e.cursorPosition,selectedText:e.selectedText},e);this.dispatchCustomEvent(t,i)}dispatchValidationEvent(t,e){var i;const s=Object.assign({target:e.target||this,value:e.value,isValid:null!==(i=e.isValid)&&void 0!==i&&i,error:e.error},e);this.dispatchCustomEvent(t,s)}dispatchActionEvent(t,e){const i=Object.assign({target:e.target||this,action:e.action,previousValue:e.previousValue,newValue:e.newValue},e);this.dispatchCustomEvent(t,i)}isReadonlyKeyAllowed(t){if(t.ctrlKey||t.metaKey){return["KeyA","KeyC"].includes(t.code)}return["Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key)}isActivationKey(t){return"Enter"===t.key||" "===t.key}};
|
|
7
|
+
const d=e`:host{display:block;width:100%;color:var(--nuraly-color-text);background-color:var(--nuraly-color-background)}:host([data-theme]){color:inherit;background-color:inherit}.collapse-container{display:flex;flex-direction:column;gap:var(--nuraly-spacing-collapse-gap);border:var(--nuraly-color-collapse-border);border-radius:var(--nuraly-border-radius-collapse);background-color:var(--nuraly-color-collapse-bordered-background);overflow:hidden}.collapse-section{position:relative;border-bottom:1px solid var(--nuraly-color-collapse-border);transition:var(--nuraly-transition-collapse)}.collapse-section:last-child{border-bottom:none}.collapse-section--disabled{opacity:var(--nuraly-opacity-collapse-disabled);pointer-events:none}.collapse-section--non-collapsible .collapse-header{cursor:default}.collapse-section--animating .collapse-content{overflow:hidden}.collapse-header{display:flex;align-items:center;justify-content:space-between;padding:var(--nuraly-spacing-collapse-padding);background-color:var(--nuraly-color-collapse-header-background);color:var(--nuraly-color-collapse-header-text);font-weight:var(--nuraly-font-collapse-header-weight);font-size:var(--nuraly-font-collapse-header-size);line-height:var(--nuraly-font-collapse-header-line-height);border:none;cursor:pointer;user-select:none;transition:var(--nuraly-collapse-transition-duration) var(--nuraly-collapse-transition-easing);border-radius:var(--nuraly-border-radius-collapse-header)}.collapse-header--clickable:hover{background-color:var(--nuraly-color-collapse-header-background-hover)}.collapse-header--clickable:active{background-color:var(--nuraly-color-collapse-header-background-active)}.collapse-header--expanded{background-color:var(--nuraly-color-collapse-header-background-expanded)}.collapse-header--disabled{color:var(--nuraly-color-collapse-header-text-disabled);cursor:not-allowed}.collapse-header:focus-visible{outline:2px solid var(--nuraly-color-collapse-focus-outline);outline-offset:2px;box-shadow:var(--nuraly-shadow-collapse-focus)}.collapse-header-text{flex:1;text-align:left}.collapse-header-right{display:flex;align-items:center;gap:var(--nuraly-spacing-collapse-header-right-gap,.5rem);margin-left:var(--nuraly-spacing-collapse-header-right-margin,.75rem);color:var(--nuraly-color-collapse-header-right-text,inherit)}.collapse-header-right>*{flex-shrink:0}.collapse-icon{display:flex;align-items:center;justify-content:center;width:var(--nuraly-collapse-icon-size);height:var(--nuraly-collapse-icon-size);color:var(--nuraly-color-collapse-icon);transition:var(--nuraly-collapse-icon-transition);transform-origin:center}.collapse-header--disabled .collapse-icon{color:var(--nuraly-color-collapse-icon-disabled)}.collapse-content{background-color:var(--nuraly-color-collapse-content-background);border-radius:var(--nuraly-border-radius-collapse-content);transition:var(--nuraly-collapse-transition-duration) var(--nuraly-collapse-transition-easing)}.collapse-content-inner{padding:var(--nuraly-spacing-collapse-content-padding);color:var(--nuraly-color-collapse-content-text);font-weight:var(--nuraly-font-collapse-content-weight);font-size:var(--nuraly-font-collapse-content-size);line-height:var(--nuraly-font-collapse-content-line-height)}:host([size=small]) .collapse-header{padding:var(--nuraly-spacing-collapse-small-padding)}:host([size=small]) .collapse-content-inner{padding:var(--nuraly-spacing-collapse-small-content-padding)}:host([size=medium]) .collapse-header{padding:var(--nuraly-spacing-collapse-medium-padding)}:host([size=medium]) .collapse-content-inner{padding:var(--nuraly-spacing-collapse-medium-content-padding)}:host([size=large]) .collapse-header{padding:var(--nuraly-spacing-collapse-large-padding)}:host([size=large]) .collapse-content-inner{padding:var(--nuraly-spacing-collapse-large-content-padding)}:host([variant=default]) .collapse-container{background-color:var(--nuraly-color-collapse-content-background);border:1px solid var(--nuraly-color-collapse-border)}:host([variant=bordered]) .collapse-container{background-color:var(--nuraly-color-collapse-bordered-background);border:2px solid var(--nuraly-color-collapse-bordered-border)}:host([variant=ghost]) .collapse-container{background-color:var(--nuraly-color-collapse-ghost-background);border:1px solid var(--nuraly-color-collapse-ghost-border)}:host([variant=ghost]) .collapse-header:hover{background-color:var(--nuraly-color-collapse-ghost-hover)}:host([accordion]) .collapse-section{border-bottom:1px solid var(--nuraly-color-collapse-border)}:host(:not([variant=ghost])) .collapse-container{box-shadow:var(--nuraly-shadow-collapse)}:host(:not([variant=ghost])) .collapse-container:hover{box-shadow:var(--nuraly-shadow-collapse-hover)}@media (prefers-reduced-motion:reduce){.collapse-content,.collapse-header,.collapse-icon,.collapse-section{transition:none}.collapse-icon--expanded{transform:none}}@media (prefers-contrast:high){.collapse-header{border:2px solid var(--nuraly-color-collapse-border-focus)}.collapse-header:focus-visible{outline:3px solid var(--nuraly-color-collapse-focus-outline)}}`;
|
|
273
8
|
/**
|
|
274
9
|
* @license
|
|
275
10
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
276
11
|
* SPDX-License-Identifier: MIT
|
|
277
12
|
*/
|
|
278
|
-
/**
|
|
279
|
-
* @license
|
|
280
|
-
* Copyright 2017 Google LLC
|
|
281
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
282
|
-
*/
|
|
283
|
-
const Zt=1;class Jt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
|
|
284
|
-
/**
|
|
285
|
-
* @license
|
|
286
|
-
* Copyright 2018 Google LLC
|
|
287
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
288
|
-
*/const Gt=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends Jt{constructor(t){var e;if(super(t),t.type!==Zt||"class"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){var i,s;if(void 0===this.it){this.it=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!(null===(i=this.nt)||void 0===i?void 0:i.has(t))&&this.it.add(t);return this.render(e)}const o=t.element.classList;this.it.forEach((t=>{t in e||(o.remove(t),this.it.delete(t))}));for(const t in e){const i=!!e[t];i===this.it.has(t)||(null===(s=this.nt)||void 0===s?void 0:s.has(t))||(i?(o.add(t),this.it.add(t)):(o.remove(t),this.it.delete(t)))}return D}});
|
|
289
|
-
/**
|
|
290
|
-
* @license
|
|
291
|
-
* Copyright 2018 Google LLC
|
|
292
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
293
|
-
*/
|
|
294
13
|
/**
|
|
295
14
|
* @license
|
|
296
15
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
297
16
|
* SPDX-License-Identifier: MIT
|
|
298
17
|
*/
|
|
299
|
-
class
|
|
18
|
+
class p{constructor(e){this.host=e,e.addController(this)}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}getSection(e){return this.host.sections[e]}updateSection(e,o){if(this.host.updateSection)return void this.host.updateSection(e,o);const t=this.getSection(e);if(t){const n=[...this.host.sections];n[e]=Object.assign(Object.assign({},t),o),this.host.sections=n,this.host.requestUpdate()}}updateSections(e){if(this.host.updateSections)return void this.host.updateSections(e);const o=[...this.host.sections];let t=!1;e.forEach((({index:e,updates:n})=>{const i=this.getSection(e);i&&(o[e]=Object.assign(Object.assign({},i),n),t=!0)})),t&&(this.host.sections=o,this.host.requestUpdate())}getOpenSections(){return this.host.sections.map(((e,o)=>e.open?o:-1)).filter((e=>-1!==e))}}
|
|
300
19
|
/**
|
|
301
20
|
* @license
|
|
302
21
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
303
22
|
* SPDX-License-Identifier: MIT
|
|
304
|
-
*/var
|
|
23
|
+
*/var h=function(e,o,t,n){return new(t||(t=Promise))((function(i,a){function l(e){try{r(n.next(e))}catch(e){a(e)}}function s(e){try{r(n.throw(e))}catch(e){a(e)}}function r(e){var o;e.done?i(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(l,s)}r((n=n.apply(e,o||[])).next())}))};class u extends p{constructor(e){super(e),this.animatingSections=new Set,this.animationDuration=300}animateToggle(e,o){return h(this,void 0,void 0,(function*(){if(this.getSection(e)&&!this.animatingSections.has(e)){this.animatingSections.add(e);try{const t=this.getContentElement(e);if(!t)return;o?yield this.animateExpand(t):yield this.animateCollapse(t)}finally{this.animatingSections.delete(e)}}}))}animateExpand(e){return h(this,void 0,void 0,(function*(){const o=e.scrollHeight;return e.style.height="0px",e.style.overflow="hidden",e.style.transition=`height ${this.animationDuration}ms ease-out`,e.offsetHeight,e.style.height=`${o}px`,new Promise((o=>{const t=()=>{e.style.height="",e.style.overflow="",e.style.transition="",e.removeEventListener("transitionend",t),o()};e.addEventListener("transitionend",t),setTimeout(t,this.animationDuration+50)}))}))}animateCollapse(e){return h(this,void 0,void 0,(function*(){const o=e.scrollHeight;return e.style.height=`${o}px`,e.style.overflow="hidden",e.style.transition=`height ${this.animationDuration}ms ease-out`,e.offsetHeight,e.style.height="0px",new Promise((o=>{const t=()=>{e.style.height="",e.style.overflow="",e.style.transition="",e.removeEventListener("transitionend",t),o()};e.addEventListener("transitionend",t),setTimeout(t,this.animationDuration+50)}))}))}getContentElement(e){var o;return(null===(o=this.host.shadowRoot)||void 0===o?void 0:o.querySelector(`.collapse-content[data-section-index="${e}"]`))||null}isAnimating(e){return this.animatingSections.has(e)}setAnimationDuration(e){this.animationDuration=Math.max(0,e)}}
|
|
305
24
|
/**
|
|
306
25
|
* @license
|
|
307
26
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
308
27
|
* SPDX-License-Identifier: MIT
|
|
309
|
-
*/class
|
|
28
|
+
*/class v extends p{constructor(e){super(e)}handleSectionToggle(e,o){this.host.accordion&&o&&!this.host.allowMultiple&&this.closeOtherSections(e)}closeOtherSections(e){this.host.sections.forEach(((o,t)=>{t!==e&&o.open&&!1!==o.collapsible&&this.updateSection(t,{open:!1})}))}enforceAccordionMode(){if(!this.host.accordion||this.host.allowMultiple)return;const e=this.getOpenSections();if(e.length>1){const o=e.slice(1).map((e=>({index:e,updates:{open:!1}})));this.updateSections(o)}}openSection(e){const o=this.getSection(e);o&&!o.disabled&&!1!==o.collapsible&&(this.host.accordion&&!this.host.allowMultiple&&this.closeOtherSections(e),this.updateSection(e,{open:!0}))}closeSection(e){const o=this.getSection(e);o&&!o.disabled&&!1!==o.collapsible&&this.updateSection(e,{open:!1})}closeAllSections(){const e=this.host.sections.map(((e,o)=>({section:e,index:o}))).filter((({section:e})=>e.open&&!1!==e.collapsible&&!e.disabled)).map((({index:e})=>({index:e,updates:{open:!1}})));e.length>0&&this.updateSections(e)}openAllSections(){if(this.host.accordion&&!this.host.allowMultiple){const e=this.host.sections.findIndex((e=>!1!==e.collapsible&&!e.disabled));return void(-1!==e&&this.openSection(e))}const e=this.host.sections.map(((e,o)=>({section:e,index:o}))).filter((({section:e})=>!e.open&&!1!==e.collapsible&&!e.disabled)).map((({index:e})=>({index:e,updates:{open:!0}})));e.length>0&&this.updateSections(e)}getActiveSectionIndex(){if(!this.host.accordion)return-1;const e=this.getOpenSections();return e.length>0?e[0]:-1}isAccordionMode(){return!!this.host.accordion}allowsMultiple(){return!!this.host.allowMultiple}}
|
|
310
29
|
/**
|
|
311
30
|
* @license
|
|
312
31
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
313
32
|
* SPDX-License-Identifier: MIT
|
|
314
|
-
*/var
|
|
315
|
-
<div class="collapse-container ${Gt({[`collapse-${this.size}`]:!0,[`collapse-${this.variant}`]:!0,"collapse-accordion":this.accordion,"collapse-disabled":this.disabled})}">
|
|
316
|
-
${
|
|
317
|
-
/**
|
|
318
|
-
* @license
|
|
319
|
-
* Copyright 2021 Google LLC
|
|
320
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
321
|
-
*/
|
|
322
|
-
function*(t,e){if(void 0!==t){let i=0;for(const s of t)yield e(s,i++)}}(this.sections,((t,e)=>this.renderSection(t,e)))}
|
|
323
|
-
</div>
|
|
324
|
-
`}renderSection(t,e){const i=!!t.open,s=this.disabled||t.disabled,o=!1!==t.collapsible,n=this.isSectionAnimating(e);return bt`
|
|
325
|
-
<div
|
|
326
|
-
class="collapse-section ${Gt({"collapse-section--open":i,"collapse-section--disabled":null!=s&&s,"collapse-section--non-collapsible":!o,"collapse-section--animating":n,[t.className||""]:!!t.className})}"
|
|
327
|
-
data-section-index="${e}"
|
|
328
|
-
>
|
|
329
|
-
<!-- Section Header -->
|
|
330
|
-
<div
|
|
331
|
-
class="collapse-header ${Gt({"collapse-header--expanded":i,"collapse-header--disabled":null!=s&&s,"collapse-header--clickable":o&&!s})}"
|
|
332
|
-
data-section-index="${e}"
|
|
333
|
-
role="button"
|
|
334
|
-
tabindex="${o&&!s?"0":"-1"}"
|
|
335
|
-
aria-expanded="${i}"
|
|
336
|
-
aria-controls="collapse-content-${e}"
|
|
337
|
-
aria-disabled="${(t=>null!=t?t:I)(s)}"
|
|
338
|
-
@click="${o&&!s?()=>this.toggleSection(e):wt}"
|
|
339
|
-
>
|
|
340
|
-
${o?bt`
|
|
341
|
-
<nr-icon
|
|
342
|
-
class="collapse-icon ${Gt({"collapse-icon--expanded":i})}"
|
|
343
|
-
name="${this.getSectionIcon(t)}"
|
|
344
|
-
aria-hidden="true"
|
|
345
|
-
></nr-icon>
|
|
346
|
-
`:wt}
|
|
347
|
-
|
|
348
|
-
<span class="collapse-header-text">
|
|
349
|
-
${t.headerSlot?bt`<slot name="${t.headerSlot}"></slot>`:t.header}
|
|
350
|
-
</span>
|
|
351
|
-
|
|
352
|
-
${t.headerRight||t.headerRightSlot?bt`
|
|
353
|
-
<div class="collapse-header-right" @click="${t=>t.stopPropagation()}">
|
|
354
|
-
${t.headerRightSlot?bt`<slot name="${t.headerRightSlot}"></slot>`:t.headerRight}
|
|
355
|
-
</div>
|
|
356
|
-
`:wt}
|
|
357
|
-
</div>
|
|
358
|
-
|
|
359
|
-
<!-- Section Content -->
|
|
360
|
-
${i?bt`
|
|
361
|
-
<div
|
|
362
|
-
id="collapse-content-${e}"
|
|
363
|
-
class="collapse-content"
|
|
364
|
-
data-section-index="${e}"
|
|
365
|
-
role="region"
|
|
366
|
-
aria-labelledby="collapse-header-${e}"
|
|
367
|
-
>
|
|
368
|
-
<div class="collapse-content-inner">
|
|
369
|
-
${t.contentSlot?bt`<slot name="${t.contentSlot}"></slot>`:t.content}
|
|
370
|
-
</div>
|
|
371
|
-
</div>
|
|
372
|
-
`:wt}
|
|
373
|
-
</div>
|
|
374
|
-
`}};se.styles=Lt,ee([Vt({type:Array})],se.prototype,"sections",void 0),ee([Vt({type:String})],se.prototype,"size",void 0),ee([Vt({type:String})],se.prototype,"variant",void 0),ee([Vt({type:String})],se.prototype,"animation",void 0),ee([Vt({type:Boolean})],se.prototype,"accordion",void 0),ee([Vt({type:Boolean,attribute:"allow-multiple"})],se.prototype,"allowMultiple",void 0),ee([Vt({type:Boolean})],se.prototype,"disabled",void 0),ee([Vt({type:String,attribute:"expand-icon"})],se.prototype,"expandIcon",void 0),ee([Vt({type:String,attribute:"collapse-icon"})],se.prototype,"collapseIcon",void 0),se=ee([(t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:i,elements:s}=e;return{kind:i,elements:s,finisher(e){customElements.define(t,e)}}})(t,e))("nr-collapse")],se);export{se as HyCollapse};
|
|
33
|
+
*/var g=function(e,o,t,n){for(var i,a=arguments.length,l=a<3?o:null===n?n=Object.getOwnPropertyDescriptor(o,t):n,s=e.length-1;s>=0;s--)(i=e[s])&&(l=(a<3?i(l):a>3?i(o,t,l):i(o,t))||l);return a>3&&l&&Object.defineProperty(o,t,l),l},b=function(e,o,t,n){return new(t||(t=Promise))((function(i,a){function l(e){try{r(n.next(e))}catch(e){a(e)}}function s(e){try{r(n.throw(e))}catch(e){a(e)}}function r(e){var o;e.done?i(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(l,s)}r((n=n.apply(e,o||[])).next())}))};let y=class extends(l(o)){constructor(){super(...arguments),this.requiredComponents=["nr-icon"],this.animationController=new u(this),this.accordionController=new v(this),this.sections=[],this.size="medium",this.variant="default",this.animation="slide",this.accordion=!1,this.allowMultiple=!1,this.disabled=!1,this.expandIcon="chevron-right",this.collapseIcon="chevron-down",this.handleToggleRequest=e=>{const{index:o}=e.detail;this.toggleSection(o)}}connectedCallback(){super.connectedCallback(),this.addEventListener("section-toggle-requested",this.handleToggleRequest)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("section-toggle-requested",this.handleToggleRequest)}updated(e){super.updated(e),(e.has("accordion")||e.has("allowMultiple"))&&this.accordionController.enforceAccordionMode()}toggleSection(e){return b(this,void 0,void 0,(function*(){const o=this.sections[e];if(!o||o.disabled||!1===o.collapsible)return;const t=!!o.open,n=!t,i=new CustomEvent("section-before-toggle",{detail:{index:e,section:o,isOpen:t,preventDefault:()=>i.preventDefault()},cancelable:!0,bubbles:!0});this.dispatchEvent(i)&&(this.accordionController.handleSectionToggle(e,n),this.updateSection(e,{open:n}),"none"!==this.animation&&(yield this.animationController.animateToggle(e,n)),this.dispatchEvent(new CustomEvent("section-toggle",{detail:{index:e,section:this.sections[e],isOpen:n},bubbles:!0})))}))}openSection(e){return b(this,void 0,void 0,(function*(){const o=this.sections[e];o&&!o.open&&(yield this.toggleSection(e))}))}closeSection(e){return b(this,void 0,void 0,(function*(){const o=this.sections[e];o&&o.open&&(yield this.toggleSection(e))}))}openAllSections(){this.accordionController.openAllSections()}closeAllSections(){this.accordionController.closeAllSections()}updateSection(e,o){e<0||e>=this.sections.length||(this.sections=this.sections.map(((t,n)=>n===e?Object.assign(Object.assign({},t),o):t)))}updateSections(e){0!==e.length&&(this.sections=this.sections.map(((o,t)=>{const n=e.find((e=>e.index===t));return n?Object.assign(Object.assign({},o),n.updates):o})))}getSectionIcon(e){return e.expandIcon&&e.collapseIcon?e.open?e.collapseIcon:e.expandIcon:e.headerIcon?e.headerIcon:e.open?this.collapseIcon:this.expandIcon}isSectionAnimating(e){return this.animationController.isAnimating(e)}render(){return t`<div class="collapse-container ${r({[`collapse-${this.size}`]:!0,[`collapse-${this.variant}`]:!0,"collapse-accordion":this.accordion,"collapse-disabled":this.disabled})}">${s(this.sections,((e,o)=>this.renderSection(e,o)))}</div>`}renderSection(e,o){const i=!!e.open,a=this.disabled||e.disabled,l=!1!==e.collapsible,s=this.isSectionAnimating(o);return t`<div class="collapse-section ${r({"collapse-section--open":i,"collapse-section--disabled":null!=a&&a,"collapse-section--non-collapsible":!l,"collapse-section--animating":s,[e.className||""]:!!e.className})}" data-section-index="${o}"><div class="collapse-header ${r({"collapse-header--expanded":i,"collapse-header--disabled":null!=a&&a,"collapse-header--clickable":l&&!a})}" data-section-index="${o}" role="button" tabindex="${l&&!a?"0":"-1"}" aria-expanded="${i}" aria-controls="collapse-content-${o}" aria-disabled="${c(a)}" @click="${l&&!a?()=>this.toggleSection(o):n}">${l?t`<nr-icon class="collapse-icon ${r({"collapse-icon--expanded":i})}" name="${this.getSectionIcon(e)}" aria-hidden="true"></nr-icon>`:n} <span class="collapse-header-text">${e.headerSlot?t`<slot name="${e.headerSlot}"></slot>`:e.header} </span>${e.headerRight||e.headerRightSlot?t`<div class="collapse-header-right" @click="${e=>e.stopPropagation()}">${e.headerRightSlot?t`<slot name="${e.headerRightSlot}"></slot>`:e.headerRight}</div>`:n}</div>${i?t`<div id="collapse-content-${o}" class="collapse-content" data-section-index="${o}" role="region" aria-labelledby="collapse-header-${o}"><div class="collapse-content-inner">${e.contentSlot?t`<slot name="${e.contentSlot}"></slot>`:e.content}</div></div>`:n}</div>`}};y.styles=d,g([i({type:Array})],y.prototype,"sections",void 0),g([i({type:String})],y.prototype,"size",void 0),g([i({type:String})],y.prototype,"variant",void 0),g([i({type:String})],y.prototype,"animation",void 0),g([i({type:Boolean})],y.prototype,"accordion",void 0),g([i({type:Boolean,attribute:"allow-multiple"})],y.prototype,"allowMultiple",void 0),g([i({type:Boolean})],y.prototype,"disabled",void 0),g([i({type:String,attribute:"expand-icon"})],y.prototype,"expandIcon",void 0),g([i({type:String,attribute:"collapse-icon"})],y.prototype,"collapseIcon",void 0),y=g([a("nr-collapse")],y);export{y as HyCollapse};
|