UNPKG

@nuitral/react-ui-suite

Version:
73 lines (72 loc) 36.6 kB
import t,{useMemo as e,useRef as s,useEffect as i,useState as r}from"react"; /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const n=globalThis,o=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),l=new WeakMap;let c=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(o&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=l.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&l.set(e,t))}return t}toString(){return this.cssText}};const h=o?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new c("string"==typeof t?t:t+"",void 0,a))(e)})(t):t,{is:d,defineProperty:u,getOwnPropertyDescriptor:p,getOwnPropertyNames:f,getOwnPropertySymbols:y,getPrototypeOf:$}=Object,m=globalThis,_=m.trustedTypes,v=_?_.emptyScript:"",b=m.reactiveElementPolyfillSupport,g=(t,e)=>t,S={toAttribute(t,e){switch(e){case Boolean:t=t?v:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},E=(t,e)=>!d(t,e),A={attribute:!0,type:String,converter:S,reflect:!1,useDefault:!1,hasChanged:E}; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */Symbol.metadata??=Symbol("metadata"),m.litPropertyMetadata??=new WeakMap;let w=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=A){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);void 0!==i&&u(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:r}=p(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const n=i?.call(this);r?.call(this,e),this.requestUpdate(t,n,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??A}static _$Ei(){if(this.hasOwnProperty(g("elementProperties")))return;const t=$(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(g("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(g("properties"))){const t=this.properties,e=[...f(t),...y(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(h(t))}else void 0!==t&&e.push(h(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(o)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const s of e){const e=document.createElement("style"),i=n.litNonce;void 0!==i&&e.setAttribute("nonce",i),e.textContent=s.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(void 0!==i&&!0===s.reflect){const r=(void 0!==s.converter?.toAttribute?s.converter:S).toAttribute(e,s.type);this._$Em=t,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=s.getPropertyOptions(i),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:S;this._$Em=i;const n=r.fromAttribute(e,t.type);this[i]=n??this._$Ej?.get(i)??n,this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){const i=this.constructor,r=this[t];if(s??=i.getPropertyOptions(t),!((s.hasChanged??E)(r,e)||s.useDefault&&s.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:r},n){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??e??this[t]),!0!==r||void 0!==n)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===i&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,s,i)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[g("elementProperties")]=new Map,w[g("finalized")]=new Map,b?.({ReactiveElement:w}),(m.reactiveElementVersions??=[]).push("2.1.1"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const P=globalThis,O=P.trustedTypes,x=O?O.createPolicy("lit-html",{createHTML:t=>t}):void 0,C="$lit$",j=`lit$${Math.random().toFixed(9).slice(2)}$`,k="?"+j,N=`<${k}>`,U=document,R=()=>U.createComment(""),M=t=>null===t||"object"!=typeof t&&"function"!=typeof t,T=Array.isArray,H="[ \t\n\f\r]",D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,z=/-->/g,L=/>/g,I=RegExp(`>|${H}(?:([^\\s"'>=/]+)(${H}*=${H}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),B=/'/g,V=/"/g,W=/^(?:script|style|textarea|title)$/i,q=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),F=Symbol.for("lit-noChange"),J=Symbol.for("lit-nothing"),K=new WeakMap,X=U.createTreeWalker(U,129);function Y(t,e){if(!T(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==x?x.createHTML(e):e}class Z{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let r=0,n=0;const o=t.length-1,a=this.parts,[l,c]=((t,e)=>{const s=t.length-1,i=[];let r,n=2===e?"<svg>":3===e?"<math>":"",o=D;for(let e=0;e<s;e++){const s=t[e];let a,l,c=-1,h=0;for(;h<s.length&&(o.lastIndex=h,l=o.exec(s),null!==l);)h=o.lastIndex,o===D?"!--"===l[1]?o=z:void 0!==l[1]?o=L:void 0!==l[2]?(W.test(l[2])&&(r=RegExp("</"+l[2],"g")),o=I):void 0!==l[3]&&(o=I):o===I?">"===l[0]?(o=r??D,c=-1):void 0===l[1]?c=-2:(c=o.lastIndex-l[2].length,a=l[1],o=void 0===l[3]?I:'"'===l[3]?V:B):o===V||o===B?o=I:o===z||o===L?o=D:(o=I,r=void 0);const d=o===I&&t[e+1].startsWith("/>")?" ":"";n+=o===D?s+N:c>=0?(i.push(a),s.slice(0,c)+C+s.slice(c)+j+d):s+j+(-2===c?e:d)}return[Y(t,n+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]})(t,e);if(this.el=Z.createElement(l,s),X.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=X.nextNode())&&a.length<o;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(C)){const e=c[n++],s=i.getAttribute(t).split(j),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:r,name:o[2],strings:s,ctor:"."===o[1]?st:"?"===o[1]?it:"@"===o[1]?rt:et}),i.removeAttribute(t)}else t.startsWith(j)&&(a.push({type:6,index:r}),i.removeAttribute(t));if(W.test(i.tagName)){const t=i.textContent.split(j),e=t.length-1;if(e>0){i.textContent=O?O.emptyScript:"";for(let s=0;s<e;s++)i.append(t[s],R()),X.nextNode(),a.push({type:2,index:++r});i.append(t[e],R())}}}else if(8===i.nodeType)if(i.data===k)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=i.data.indexOf(j,t+1));)a.push({type:7,index:r}),t+=j.length-1}r++}}static createElement(t,e){const s=U.createElement("template");return s.innerHTML=t,s}}function G(t,e,s=t,i){if(e===F)return e;let r=void 0!==i?s._$Co?.[i]:s._$Cl;const n=M(e)?void 0:e._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),void 0===n?r=void 0:(r=new n(t),r._$AT(t,s,i)),void 0!==i?(s._$Co??=[])[i]=r:s._$Cl=r),void 0!==r&&(e=G(t,r._$AS(t,e.values),r,i)),e}class Q{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){const{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??U).importNode(e,!0);X.currentNode=i;let r=X.nextNode(),n=0,o=0,a=s[0];for(;void 0!==a;){if(n===a.index){let e;2===a.type?e=new tt(r,r.nextSibling,this,t):1===a.type?e=new a.ctor(r,a.name,a.strings,this,t):6===a.type&&(e=new nt(r,this,t)),this._$AV.push(e),a=s[++o]}n!==a?.index&&(r=X.nextNode(),n++)}return X.currentNode=U,i}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}let tt=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=J,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=G(this,t,e),M(t)?t===J||null==t||""===t?(this._$AH!==J&&this._$AR(),this._$AH=J):t!==this._$AH&&t!==F&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>T(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==J&&M(this._$AH)?this._$AA.nextSibling.data=t:this.T(U.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,i="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=Z.createElement(Y(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new Q(i,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=K.get(t.strings);return void 0===e&&K.set(t.strings,e=new Z(t)),e}k(e){T(this._$AH)||(this._$AH=[],this._$AR());const s=this._$AH;let i,r=0;for(const n of e)r===s.length?s.push(i=new t(this.O(R()),this.O(R()),this,this.options)):i=s[r],i._$AI(n),r++;r<s.length&&(this._$AR(i&&i._$AB.nextSibling,r),s.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}};class et{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,r){this.type=1,this._$AH=J,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=r,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=J}_$AI(t,e=this,s,i){const r=this.strings;let n=!1;if(void 0===r)t=G(this,t,e,0),n=!M(t)||t!==this._$AH&&t!==F,n&&(this._$AH=t);else{const i=t;let o,a;for(t=r[0],o=0;o<r.length-1;o++)a=G(this,i[s+o],e,o),a===F&&(a=this._$AH[o]),n||=!M(a)||a!==this._$AH[o],a===J?t=J:t!==J&&(t+=(a??"")+r[o+1]),this._$AH[o]=a}n&&!i&&this.j(t)}j(t){t===J?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class st extends et{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===J?void 0:t}}class it extends et{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==J)}}class rt extends et{constructor(t,e,s,i,r){super(t,e,s,i,r),this.type=5}_$AI(t,e=this){if((t=G(this,t,e,0)??J)===F)return;const s=this._$AH,i=t===J&&s!==J||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==J&&(s===J||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class nt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){G(this,t)}}const ot=P.litHtmlPolyfillSupport;ot?.(Z,tt),(P.litHtmlVersions??=[]).push("3.3.1");const at=globalThis; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */let lt=class extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,s)=>{const i=s?.renderBefore??e;let r=i._$litPart$;if(void 0===r){const t=s?.renderBefore??null;i._$litPart$=r=new tt(e.insertBefore(R(),t),t,void 0,s??{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return F}};lt._$litElement$=!0,lt.finalized=!0,at.litElementHydrateSupport?.({LitElement:lt});const ct=at.litElementPolyfillSupport;function ht(t,e,s,i){var r,n=arguments.length,o=n<3?e:i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,s,o):r(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o}ct?.({LitElement:lt}),(at.litElementVersions??=[]).push("4.2.1"),"function"==typeof SuppressedError&&SuppressedError; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const dt=t=>(e,s)=>{void 0!==s?s.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},ut=globalThis,pt=ut.ShadowRoot&&(void 0===ut.ShadyCSS||ut.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ft=Symbol(),yt=new WeakMap; /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */let $t=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==ft)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(pt&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=yt.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&yt.set(e,t))}return t}toString(){return this.cssText}};const mt=pt?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new $t("string"==typeof t?t:t+"",void 0,ft))(e)})(t):t,{is:_t,defineProperty:vt,getOwnPropertyDescriptor:bt,getOwnPropertyNames:gt,getOwnPropertySymbols:St,getPrototypeOf:Et}=Object,At=globalThis,wt=At.trustedTypes,Pt=wt?wt.emptyScript:"",Ot=At.reactiveElementPolyfillSupport,xt=(t,e)=>t,Ct={toAttribute(t,e){switch(e){case Boolean:t=t?Pt:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},jt=(t,e)=>!_t(t,e),kt={attribute:!0,type:String,converter:Ct,reflect:!1,useDefault:!1,hasChanged:jt}; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */Symbol.metadata??=Symbol("metadata"),At.litPropertyMetadata??=new WeakMap;class Nt extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=kt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);void 0!==i&&vt(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:r}=bt(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const n=i?.call(this);r?.call(this,e),this.requestUpdate(t,n,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??kt}static _$Ei(){if(this.hasOwnProperty(xt("elementProperties")))return;const t=Et(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(xt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(xt("properties"))){const t=this.properties,e=[...gt(t),...St(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(mt(t))}else void 0!==t&&e.push(mt(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(pt)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const s of e){const e=document.createElement("style"),i=ut.litNonce;void 0!==i&&e.setAttribute("nonce",i),e.textContent=s.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(void 0!==i&&!0===s.reflect){const r=(void 0!==s.converter?.toAttribute?s.converter:Ct).toAttribute(e,s.type);this._$Em=t,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=s.getPropertyOptions(i),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:Ct;this._$Em=i;const n=r.fromAttribute(e,t.type);this[i]=n??this._$Ej?.get(i)??n,this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){const i=this.constructor,r=this[t];if(s??=i.getPropertyOptions(t),!((s.hasChanged??jt)(r,e)||s.useDefault&&s.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:r},n){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??e??this[t]),!0!==r||void 0!==n)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===i&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,s,i)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}}Nt.elementStyles=[],Nt.shadowRootOptions={mode:"open"},Nt[xt("elementProperties")]=new Map,Nt[xt("finalized")]=new Map,Ot?.({ReactiveElement:Nt}),(At.reactiveElementVersions??=[]).push("2.1.1"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const Ut={attribute:!0,type:String,converter:Ct,reflect:!1,hasChanged:jt},Rt=(t=Ut,e,s)=>{const{kind:i,metadata:r}=s;let n=globalThis.litPropertyMetadata.get(r);if(void 0===n&&globalThis.litPropertyMetadata.set(r,n=new Map),"setter"===i&&((t=Object.create(t)).wrapped=!0),n.set(s.name,t),"accessor"===i){const{name:i}=s;return{set(s){const r=e.get.call(this);e.set.call(this,s),this.requestUpdate(i,r,t)},init(e){return void 0!==e&&this.C(i,void 0,t,e),e}}}if("setter"===i){const{name:i}=s;return function(s){const r=this[i];e.call(this,s),this.requestUpdate(i,r,t)}}throw Error("Unsupported decorator location: "+i)};function Mt(t){return(e,s)=>"object"==typeof s?Rt(t,e,s):((t,e,s)=>{const i=e.hasOwnProperty(s);return e.constructor.createProperty(s,t),i?Object.getOwnPropertyDescriptor(e,s):void 0})(t,e,s)}let Tt=class extends lt{constructor(){super(...arguments),this.icon=null}createRenderRoot(){return this}render(){return this.icon?q`<div class="nuitral-icon nuitral-icon-${this.icon}"></div>`:null}};ht([Mt()],Tt.prototype,"icon",void 0),Tt=ht([dt("nuitral-core-icon")],Tt);let Ht=class extends lt{constructor(){super(...arguments),this.value="",this.classes="",this.type="text",this.iconPosition="left",this.icon=null,this.placeholder="",this.disabled=!1,this.onInput=t=>{const e=t.target;this.value=e.value,this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this.value},bubbles:!0,composed:!0}))}}iconOrderClass(){return"left"===this.iconPosition?"order-1":"order-2"}inputOrderClass(){return"left"===this.iconPosition?"order-2":"order-1"}iconRender(){return q` ${this.icon?q`<nuitral-core-icon icon="${this.icon}" class="${this.iconOrderClass()}" ></nuitral-core-icon>`:""} `}inputRender(){return q` <input .value=${this.value} @input=${this.onInput} type=${this.type} placeholder=${this.placeholder} ?disabled=${this.disabled} class="nuitral-input-element ${this.inputOrderClass()}" /> `}createRenderRoot(){return this}render(){return q` <div class="nuitral-input nuitral-input-text-color ${this.classes}"> ${this.iconRender()} ${this.inputRender()} </div> `}};ht([Mt({type:String,reflect:!0})],Ht.prototype,"value",void 0),ht([Mt()],Ht.prototype,"classes",void 0),ht([Mt()],Ht.prototype,"type",void 0),ht([Mt()],Ht.prototype,"iconPosition",void 0),ht([Mt()],Ht.prototype,"icon",void 0),ht([Mt()],Ht.prototype,"placeholder",void 0),ht([Mt()],Ht.prototype,"disabled",void 0),Ht=ht([dt("nuitral-core-input")],Ht);var Dt,zt={exports:{}},Lt={};var It,Bt,Vt={}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */function Wt(){return It||(It=1,"production"!==process.env.NODE_ENV&&function(){function e(t){if(null==t)return null;if("function"==typeof t)return t.$$typeof===w?null:t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case f:return"Fragment";case $:return"Profiler";case y:return"StrictMode";case b:return"Suspense";case g:return"SuspenseList";case A:return"Activity"}if("object"==typeof t)switch("number"==typeof t.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case p:return"Portal";case _:return t.displayName||"Context";case m:return(t._context.displayName||"Context")+".Consumer";case v:var s=t.render;return(t=t.displayName)||(t=""!==(t=s.displayName||s.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case S:return null!==(s=t.displayName||null)?s:e(t.type)||"Memo";case E:s=t._payload,t=t._init;try{return e(t(s))}catch(t){}}return null}function s(t){return""+t}function i(t){try{s(t);var e=!1}catch(t){e=!0}if(e){var i=(e=console).error,r="function"==typeof Symbol&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return i.call(e,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",r),s(t)}}function r(t){if(t===f)return"<>";if("object"==typeof t&&null!==t&&t.$$typeof===E)return"<...>";try{var s=e(t);return s?"<"+s+">":"<...>"}catch(t){return"<...>"}}function n(){return Error("react-stack-top-frame")}function o(){var t=e(this.type);return j[t]||(j[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),void 0!==(t=this.props.ref)?t:null}function a(t,s,r,n,a,c){var d,p=s.children;if(void 0!==p)if(n)if(x(p)){for(n=0;n<p.length;n++)l(p[n]);Object.freeze&&Object.freeze(p)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else l(p);if(O.call(s,"key")){p=e(t);var f=Object.keys(s).filter(function(t){return"key"!==t});n=0<f.length?"{key: someKey, "+f.join(": ..., ")+": ...}":"{key: someKey}",U[p+n]||(f=0<f.length?"{"+f.join(": ..., ")+": ...}":"{}",console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',n,p,f,p),U[p+n]=!0)}if(p=null,void 0!==r&&(i(r),p=""+r),function(t){if(O.call(t,"key")){var e=Object.getOwnPropertyDescriptor(t,"key").get;if(e&&e.isReactWarning)return!1}return void 0!==t.key}(s)&&(i(s.key),p=""+s.key),"key"in s)for(var y in r={},s)"key"!==y&&(r[y]=s[y]);else r=s;return p&&function(t,e){function s(){h||(h=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",e))}s.isReactWarning=!0,Object.defineProperty(t,"key",{get:s,configurable:!0})}(r,"function"==typeof t?t.displayName||t.name||"Unknown":t),function(t,e,s,i,r,n){var a=s.ref;return t={$$typeof:u,type:t,key:e,props:s,_owner:i},null!==(void 0!==a?a:null)?Object.defineProperty(t,"ref",{enumerable:!1,get:o}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:r}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:n}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}(t,p,r,null===(d=P.A)?null:d.getOwner(),a,c)}function l(t){c(t)?t._store&&(t._store.validated=1):"object"==typeof t&&null!==t&&t.$$typeof===E&&("fulfilled"===t._payload.status?c(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1))}function c(t){return"object"==typeof t&&null!==t&&t.$$typeof===u}var h,d=t,u=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),$=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),_=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),A=Symbol.for("react.activity"),w=Symbol.for("react.client.reference"),P=d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=Object.prototype.hasOwnProperty,x=Array.isArray,C=console.createTask?console.createTask:function(){return null},j={},k=(d={react_stack_bottom_frame:function(t){return t()}}).react_stack_bottom_frame.bind(d,n)(),N=C(r(n)),U={};Vt.Fragment=f,Vt.jsx=function(t,e,s){var i=1e4>P.recentlyCreatedOwnerStacks++;return a(t,e,s,!1,i?Error("react-stack-top-frame"):k,i?C(r(t)):N)},Vt.jsxs=function(t,e,s){var i=1e4>P.recentlyCreatedOwnerStacks++;return a(t,e,s,!0,i?Error("react-stack-top-frame"):k,i?C(r(t)):N)}}()),Vt}var qt=(Bt||(Bt=1,"production"===process.env.NODE_ENV?zt.exports=function(){if(Dt)return Lt;Dt=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function s(e,s,i){var r=null;if(void 0!==i&&(r=""+i),void 0!==s.key&&(r=""+s.key),"key"in s)for(var n in i={},s)"key"!==n&&(i[n]=s[n]);else i=s;return s=i.ref,{$$typeof:t,type:e,key:r,ref:void 0!==s?s:null,props:i}}return Lt.Fragment=e,Lt.jsx=s,Lt.jsxs=s,Lt}():zt.exports=Wt()),zt.exports);const Ft=(t,s=[])=>e(()=>{const e={};for(const i in t)if(!s.includes(i)){const s=t[i];e[i]="boolean"==typeof s?s.toString():s}return e},[t,s]),Jt=()=>{const t=e(()=>["primary","secondary","accent","error","success","warning","info","neutral","background","surface"],[]),s=e(()=>["100","200","300","400","500","600","700","800","900"],[]),i=[];t.forEach(t=>{i.push(`${t}`),s.forEach(e=>{i.push(`${t}-${e}`)}),i.push(`border-${t}`),s.forEach(e=>{i.push(`border-${t}-${e}`)})});return{isValidAttribute:t=>i.includes(t)}},Kt=({title:t,description:s,...i})=>{const r=Ft(i),{isValidAttribute:n}=Jt(),o=e(()=>{const t={};for(const e in r)n(e)&&(t[e]=r[e]);return Object.keys(t).map(t=>`nuitral-box-${t}`)},[r]);return qt.jsxs("div",{className:`nuitral-box ${o}`,children:[qt.jsx("div",{className:"nuitral-box-title",children:t}),qt.jsx("div",{children:s})]})},Xt=({icon:t=null})=>qt.jsx("nuitral-core-icon",{icon:t}),Yt=({classes:t="",type:s="button",disabled:i=!1,icon:r,iconPosition:n="left",children:o,leftSide:a,rightSide:l,...c})=>{const h=Ft(c),{isValidAttribute:d}=Jt(),u=e(()=>{const t={};for(const e in h)d(e)&&(t[e]=h[e]);return Object.keys(t).map(t=>`nuitral-button-background-${t}`)},[h]);return qt.jsxs("button",{className:`nuitral-button ${t} ${u} ${i?"disabled":""}`,type:s,disabled:i,...h,children:[a&&qt.jsx("div",{className:"left-side",children:a}),r&&"left"===n&&qt.jsx(Xt,{icon:r}),o,r&&"right"===n&&qt.jsx(Xt,{icon:r}),l&&qt.jsx("div",{className:"right-side",children:l})]})},Zt=({classes:t="",children:s,header:i,footer:r,hasShadow:n=!1,...o})=>{const a=Ft(o),{isValidAttribute:l}=Jt(),c=e(()=>{const t={};for(const e in a)l(e)&&!e.startsWith("border-")&&(t[e]=a[e]);return Object.keys(t).length?Object.keys(t).map(t=>`nuitral-card-${t}`):"nuitral-card-background"},[a]),h=e(()=>{const t={};for(const e in a)l(e)&&e.startsWith("border-")&&(t[e]=a[e]);return Object.keys(t).length?Object.keys(t).map(t=>`nuitral-card-${t}`):"nuitral-card-border-primary"},[a]);return qt.jsxs(qt.Fragment,{children:[qt.jsx("div",{children:c}),qt.jsxs("div",{...a,className:`nuitral-card ${t} ${c} ${n?"nuitral-card-shadow":h}`,children:[i&&qt.jsx("div",{className:"nuitral-card-header",children:i}),s,r&&qt.jsx("div",{className:"nuitral-card-footer",children:r})]})]})},Gt=({type:t="text",placeholder:e="",disabled:r=!1,icon:n=null,iconPosition:o="left",classes:a="",value:l="",onChange:c})=>{const h=s(null),d=`${a} ${r?"disabled":""}`.trim();return i(()=>{const t=h.current;if(!t)return;const e=t=>{c?.(t.detail.value)};return t.addEventListener("value-change",e),()=>{t.removeEventListener("value-change",e)}},[c]),i(()=>{h.current&&h.current.value!==l&&(h.current.value=l)},[l]),qt.jsx("nuitral-core-input",{ref:h,value:l,type:t,icon:n,iconPosition:o,placeholder:e,disabled:r,classes:d})},Qt=()=>qt.jsx(qt.Fragment,{}),te=({items:s=[],children:i=[],classes:n="",selected:o=0,onSelection:a,...l})=>{const[c,h]=r(o),d=Ft(l),{isValidAttribute:u}=Jt(),p=e(()=>{const t={};for(const e in d)u(e)&&(t[e]=d[e]);return Object.keys(t).map(t=>`nuitral-tab-${t}`).join(" ")},[d]),f=t=>{h(t.index),(t=>{a&&a(t)})(t)},y=e(()=>{const e={label:"",children:null,component:null,icon:null,iconPosition:"left",classes:"",disabled:!1,leftSide:null,rightSide:null};return s.length>0?s.map(t=>({...e,...t})):t.Children.map(i,s=>t.isValidElement(s)?{...e,...s.props}:null)?.filter(t=>null!==t)||[]},[s,i]);return qt.jsxs(qt.Fragment,{children:[qt.jsx("div",{className:`nuitral-tabs ${p} ${n}`,children:y.map((t,e)=>qt.jsxs("div",{className:`nuitral-tab ${e===c?"nuitral-tab-active":""} ${t.disabled?"disabled":""}`,onClick:()=>!t.disabled&&f({item:t,index:e}),children:[t.leftSide&&qt.jsx("div",{className:"left-side",children:t.leftSide}),t.icon&&"left"===t.iconPosition&&qt.jsx(Xt,{icon:t.icon}),t.label,t.icon&&"right"===t.iconPosition&&qt.jsx(Xt,{icon:t.icon}),t.rightSide&&qt.jsx("div",{className:"right-side",children:t.rightSide})]},e))}),qt.jsx("div",{className:`nuitral-tab-content ${y[c].classes}`,children:y[c]?.component?t.createElement(y[c].component):y[c]?.children?qt.jsx("div",{children:y[c].children}):null})]})},ee=({theme:t="nuitral",darkMode:e=!1,lightModeName:n="nuitral-light-mode",darkModeName:o="nuitral-dark-mode",rootId:a="nuitral-app",saveSettings:l=!1})=>{const c=(t,e)=>{l&&localStorage.setItem("nuitral",JSON.stringify({darkMode:t,theme:e}))},{theme:h,darkMode:d}=(()=>{if(!l)return{theme:t,darkMode:e};const s=localStorage.getItem("nuitral");return s?JSON.parse(s):{theme:t,darkMode:e}})(),[u,p]=r(d),[f,y]=r(h),$=s(null),m=()=>{if($.current){const t=u?o:n;$.current.setAttribute("nuitral-theme",f),$.current.classList.add(t),$.current.classList.remove(u?n:o)}};return i(()=>{$.current=document.getElementById(a),m()},[a]),i(()=>{m()},[u,f]),{manageDarkMode:()=>{p(t=>{const e=!t;return c(e,f),e})},isDarkMode:u,manageTheme:t=>{y(t),c(u,t)},themeName:f}};export{Kt as NuitralBox,Yt as NuitralButton,Zt as NuitralCard,Xt as NuitralIcon,Gt as NuitralInput,Qt as NuitralTab,te as NuitralTabs,Ft as useAttrs,Jt as useColorsAttributesValidator,ee as useNuitralTheming}; //# sourceMappingURL=react-ui-suite.esm.js.map