@nuralyui/button 0.0.14 → 0.0.16
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 +619 -0
- package/button.component.d.ts +64 -25
- package/button.component.js +136 -52
- package/button.component.js.map +1 -1
- package/button.style.d.ts +6 -15
- package/button.style.js +406 -545
- package/button.style.js.map +1 -1
- package/button.types.d.ts +38 -2
- package/button.types.js.map +1 -1
- package/package.json +29 -2
- package/button.component.d.ts.map +0 -1
- package/button.style.d.ts.map +0 -1
- package/button.style.variables.d.ts +0 -11
- package/button.style.variables.d.ts.map +0 -1
- package/button.style.variables.js +0 -194
- package/button.style.variables.js.map +0 -1
- package/button.types.d.ts.map +0 -1
- package/demo/buttons-demo.d.ts +0 -17
- package/demo/buttons-demo.d.ts.map +0 -1
- package/demo/buttons-demo.js +0 -273
- package/demo/buttons-demo.js.map +0 -1
- package/index.d.ts.map +0 -1
- package/mixins/index.d.ts +0 -14
- package/mixins/index.d.ts.map +0 -1
- package/mixins/index.js +0 -10
- package/mixins/index.js.map +0 -1
- package/mixins/keyboard-mixin.d.ts +0 -52
- package/mixins/keyboard-mixin.d.ts.map +0 -1
- package/mixins/keyboard-mixin.js +0 -78
- package/mixins/keyboard-mixin.js.map +0 -1
- package/mixins/link-mixin.d.ts +0 -67
- package/mixins/link-mixin.d.ts.map +0 -1
- package/mixins/link-mixin.js +0 -87
- package/mixins/link-mixin.js.map +0 -1
- package/mixins/ripple-mixin.d.ts +0 -53
- package/mixins/ripple-mixin.d.ts.map +0 -1
- package/mixins/ripple-mixin.js +0 -77
- package/mixins/ripple-mixin.js.map +0 -1
- package/react.d.ts.map +0 -1
- package/test/nr-button_test.d.ts +0 -2
- package/test/nr-button_test.d.ts.map +0 -1
- package/test/nr-button_test.js +0 -91
- package/test/nr-button_test.js.map +0 -1
package/bundle.js
ADDED
|
@@ -0,0 +1,619 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
const t=window,o=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,e=Symbol(),i=new WeakMap;class r{constructor(t,o,i){if(this._$cssResult$=!0,i!==e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=o}get styleSheet(){let t=this.o;const e=this.t;if(o&&void 0===t){const o=void 0!==e&&1===e.length;o&&(t=i.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),o&&i.set(e,t))}return t}toString(){return this.cssText}}const n=o?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let o="";for(const e of t.cssRules)o+=e.cssText;return(t=>new r("string"==typeof t?t:t+"",void 0,e))(o)})(t):t
|
|
7
|
+
/**
|
|
8
|
+
* @license
|
|
9
|
+
* Copyright 2017 Google LLC
|
|
10
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
+
*/;var s;const a=window,l=a.trustedTypes,c=l?l.emptyScript:"",h=a.reactiveElementPolyfillSupport,d={toAttribute(t,o){switch(o){case Boolean:t=t?c:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,o){let e=t;switch(o){case Boolean:e=null!==t;break;case Number:e=null===t?null:Number(t);break;case Object:case Array:try{e=JSON.parse(t)}catch(t){e=null}}return e}},u=(t,o)=>o!==t&&(o==o||t==t),v={attribute:!0,type:String,converter:d,reflect:!1,hasChanged:u},b="finalized";class p extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var o;this.finalize(),(null!==(o=this.h)&&void 0!==o?o:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((o,e)=>{const i=this._$Ep(e,o);void 0!==i&&(this._$Ev.set(i,e),t.push(i))})),t}static createProperty(t,o=v){if(o.state&&(o.attribute=!1),this.finalize(),this.elementProperties.set(t,o),!o.noAccessor&&!this.prototype.hasOwnProperty(t)){const e="symbol"==typeof t?Symbol():"__"+t,i=this.getPropertyDescriptor(t,e,o);void 0!==i&&Object.defineProperty(this.prototype,t,i)}}static getPropertyDescriptor(t,o,e){return{get(){return this[o]},set(i){const r=this[t];this[o]=i,this.requestUpdate(t,r,e)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||v}static finalize(){if(this.hasOwnProperty(b))return!1;this[b]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,o=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const e of o)this.createProperty(e,t[e])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const o=[];if(Array.isArray(t)){const e=new Set(t.flat(1/0).reverse());for(const t of e)o.unshift(n(t))}else void 0!==t&&o.push(n(t));return o}static _$Ep(t,o){const e=o.attribute;return!1===e?void 0:"string"==typeof e?e:"string"==typeof t?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var o,e;(null!==(o=this._$ES)&&void 0!==o?o:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(e=t.hostConnected)||void 0===e||e.call(t))}removeController(t){var o;null===(o=this._$ES)||void 0===o||o.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,o)=>{this.hasOwnProperty(o)&&(this._$Ei.set(o,this[o]),delete this[o])}))}createRenderRoot(){var e;const i=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,i)=>{o?e.adoptedStyleSheets=i.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):i.forEach((o=>{const i=document.createElement("style"),r=t.litNonce;void 0!==r&&i.setAttribute("nonce",r),i.textContent=o.cssText,e.appendChild(i)}))})(i,this.constructor.elementStyles),i}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 o;return null===(o=t.hostConnected)||void 0===o?void 0:o.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var o;return null===(o=t.hostDisconnected)||void 0===o?void 0:o.call(t)}))}attributeChangedCallback(t,o,e){this._$AK(t,e)}_$EO(t,o,e=v){var i;const r=this.constructor._$Ep(t,e);if(void 0!==r&&!0===e.reflect){const n=(void 0!==(null===(i=e.converter)||void 0===i?void 0:i.toAttribute)?e.converter:d).toAttribute(o,e.type);this._$El=t,null==n?this.removeAttribute(r):this.setAttribute(r,n),this._$El=null}}_$AK(t,o){var e;const i=this.constructor,r=i._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=i.getPropertyOptions(r),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(e=t.converter)||void 0===e?void 0:e.fromAttribute)?t.converter:d;this._$El=r,this[r]=n.fromAttribute(o,t.type),this._$El=null}}requestUpdate(t,o,e){let i=!0;void 0!==t&&(((e=e||this.constructor.getPropertyOptions(t)).hasChanged||u)(this[t],o)?(this._$AL.has(t)||this._$AL.set(t,o),!0===e.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,e))):i=!1),!this.isUpdatePending&&i&&(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,o)=>this[o]=t)),this._$Ei=void 0);let o=!1;const e=this._$AL;try{o=this.shouldUpdate(e),o?(this.willUpdate(e),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var o;return null===(o=t.hostUpdate)||void 0===o?void 0:o.call(t)})),this.update(e)):this._$Ek()}catch(t){throw o=!1,this._$Ek(),t}o&&this._$AE(e)}willUpdate(t){}_$AE(t){var o;null===(o=this._$ES)||void 0===o||o.forEach((t=>{var o;return null===(o=t.hostUpdated)||void 0===o?void 0:o.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,o)=>this._$EO(o,this[o],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 y;p[b]=!0,p.elementProperties=new Map,p.elementStyles=[],p.shadowRootOptions={mode:"open"},null==h||h({ReactiveElement:p}),(null!==(s=a.reactiveElementVersions)&&void 0!==s?s:a.reactiveElementVersions=[]).push("1.6.3");const f=window,g=f.trustedTypes,m=g?g.createPolicy("lit-html",{createHTML:t=>t}):void 0,w="$lit$",x=`lit$${(Math.random()+"").slice(9)}$`,$="?"+x,k=`<${$}>`,S=document,E=()=>S.createComment(""),A=t=>null===t||"object"!=typeof t&&"function"!=typeof t,C=Array.isArray,z="[ \t\n\f\r]",R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,j=/>/g,T=RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),D=/'/g,O=/"/g,I=/^(?:script|style|textarea|title)$/i,U=Symbol.for("lit-noChange"),M=Symbol.for("lit-nothing"),N=new WeakMap,B=S.createTreeWalker(S,129,null,!1);function L(t,o){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==m?m.createHTML(o):o}class P{constructor({strings:t,_$litType$:o},e){let i;this.parts=[];let r=0,n=0;const s=t.length-1,a=this.parts,[l,c]=((t,o)=>{const e=t.length-1,i=[];let r,n=2===o?"<svg>":"",s=R;for(let o=0;o<e;o++){const e=t[o];let a,l,c=-1,h=0;for(;h<e.length&&(s.lastIndex=h,l=s.exec(e),null!==l);)h=s.lastIndex,s===R?"!--"===l[1]?s=_:void 0!==l[1]?s=j:void 0!==l[2]?(I.test(l[2])&&(r=RegExp("</"+l[2],"g")),s=T):void 0!==l[3]&&(s=T):s===T?">"===l[0]?(s=null!=r?r:R,c=-1):void 0===l[1]?c=-2:(c=s.lastIndex-l[2].length,a=l[1],s=void 0===l[3]?T:'"'===l[3]?O:D):s===O||s===D?s=T:s===_||s===j?s=R:(s=T,r=void 0);const d=s===T&&t[o+1].startsWith("/>")?" ":"";n+=s===R?e+k:c>=0?(i.push(a),e.slice(0,c)+w+e.slice(c)+x+d):e+x+(-2===c?(i.push(void 0),o):d)}return[L(t,n+(t[e]||"<?>")+(2===o?"</svg>":"")),i]})(t,o);if(this.el=P.createElement(l,e),B.currentNode=this.el.content,2===o){const t=this.el.content,o=t.firstChild;o.remove(),t.append(...o.childNodes)}for(;null!==(i=B.nextNode())&&a.length<s;){if(1===i.nodeType){if(i.hasAttributes()){const t=[];for(const o of i.getAttributeNames())if(o.endsWith(w)||o.startsWith(x)){const e=c[n++];if(t.push(o),void 0!==e){const t=i.getAttribute(e.toLowerCase()+w).split(x),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:r,name:o[2],strings:t,ctor:"."===o[1]?V:"?"===o[1]?Z:"@"===o[1]?G:H})}else a.push({type:6,index:r})}for(const o of t)i.removeAttribute(o)}if(I.test(i.tagName)){const t=i.textContent.split(x),o=t.length-1;if(o>0){i.textContent=g?g.emptyScript:"";for(let e=0;e<o;e++)i.append(t[e],E()),B.nextNode(),a.push({type:2,index:++r});i.append(t[o],E())}}}else if(8===i.nodeType)if(i.data===$)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=i.data.indexOf(x,t+1));)a.push({type:7,index:r}),t+=x.length-1}r++}}static createElement(t,o){const e=S.createElement("template");return e.innerHTML=t,e}}function K(t,o,e=t,i){var r,n,s,a;if(o===U)return o;let l=void 0!==i?null===(r=e._$Co)||void 0===r?void 0:r[i]:e._$Cl;const c=A(o)?void 0:o._$litDirective$;return(null==l?void 0:l.constructor)!==c&&(null===(n=null==l?void 0:l._$AO)||void 0===n||n.call(l,!1),void 0===c?l=void 0:(l=new c(t),l._$AT(t,e,i)),void 0!==i?(null!==(s=(a=e)._$Co)&&void 0!==s?s:a._$Co=[])[i]=l:e._$Cl=l),void 0!==l&&(o=K(t,l._$AS(t,o.values),l,i)),o}class q{constructor(t,o){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=o}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var o;const{el:{content:e},parts:i}=this._$AD,r=(null!==(o=null==t?void 0:t.creationScope)&&void 0!==o?o:S).importNode(e,!0);B.currentNode=r;let n=B.nextNode(),s=0,a=0,l=i[0];for(;void 0!==l;){if(s===l.index){let o;2===l.type?o=new F(n,n.nextSibling,this,t):1===l.type?o=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(o=new J(n,this,t)),this._$AV.push(o),l=i[++a]}s!==(null==l?void 0:l.index)&&(n=B.nextNode(),s++)}return B.currentNode=S,r}v(t){let o=0;for(const e of this._$AV)void 0!==e&&(void 0!==e.strings?(e._$AI(t,e,o),o+=e.strings.length-2):e._$AI(t[o])),o++}}class F{constructor(t,o,e,i){var r;this.type=2,this._$AH=M,this._$AN=void 0,this._$AA=t,this._$AB=o,this._$AM=e,this.options=i,this._$Cp=null===(r=null==i?void 0:i.isConnected)||void 0===r||r}get _$AU(){var t,o;return null!==(o=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==o?o:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const o=this._$AM;return void 0!==o&&11===(null==t?void 0:t.nodeType)&&(t=o.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,o=this){t=K(this,t,o),A(t)?t===M||null==t||""===t?(this._$AH!==M&&this._$AR(),this._$AH=M):t!==this._$AH&&t!==U&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>C(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==M&&A(this._$AH)?this._$AA.nextSibling.data=t:this.$(S.createTextNode(t)),this._$AH=t}g(t){var o;const{values:e,_$litType$:i}=t,r="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=P.createElement(L(i.h,i.h[0]),this.options)),i);if((null===(o=this._$AH)||void 0===o?void 0:o._$AD)===r)this._$AH.v(e);else{const t=new q(r,this),o=t.u(this.options);t.v(e),this.$(o),this._$AH=t}}_$AC(t){let o=N.get(t.strings);return void 0===o&&N.set(t.strings,o=new P(t)),o}T(t){C(this._$AH)||(this._$AH=[],this._$AR());const o=this._$AH;let e,i=0;for(const r of t)i===o.length?o.push(e=new F(this.k(E()),this.k(E()),this,this.options)):e=o[i],e._$AI(r),i++;i<o.length&&(this._$AR(e&&e._$AB.nextSibling,i),o.length=i)}_$AR(t=this._$AA.nextSibling,o){var e;for(null===(e=this._$AP)||void 0===e||e.call(this,!1,!0,o);t&&t!==this._$AB;){const o=t.nextSibling;t.remove(),t=o}}setConnected(t){var o;void 0===this._$AM&&(this._$Cp=t,null===(o=this._$AP)||void 0===o||o.call(this,t))}}class H{constructor(t,o,e,i,r){this.type=1,this._$AH=M,this._$AN=void 0,this.element=t,this.name=o,this._$AM=i,this.options=r,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=M}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,o=this,e,i){const r=this.strings;let n=!1;if(void 0===r)t=K(this,t,o,0),n=!A(t)||t!==this._$AH&&t!==U,n&&(this._$AH=t);else{const i=t;let s,a;for(t=r[0],s=0;s<r.length-1;s++)a=K(this,i[e+s],o,s),a===U&&(a=this._$AH[s]),n||(n=!A(a)||a!==this._$AH[s]),a===M?t=M:t!==M&&(t+=(null!=a?a:"")+r[s+1]),this._$AH[s]=a}n&&!i&&this.j(t)}j(t){t===M?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class V extends H{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===M?void 0:t}}const W=g?g.emptyScript:"";class Z extends H{constructor(){super(...arguments),this.type=4}j(t){t&&t!==M?this.element.setAttribute(this.name,W):this.element.removeAttribute(this.name)}}class G extends H{constructor(t,o,e,i,r){super(t,o,e,i,r),this.type=5}_$AI(t,o=this){var e;if((t=null!==(e=K(this,t,o,0))&&void 0!==e?e:M)===U)return;const i=this._$AH,r=t===M&&i!==M||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,n=t!==M&&(i===M||r);r&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var o,e;"function"==typeof this._$AH?this._$AH.call(null!==(e=null===(o=this.options)||void 0===o?void 0:o.host)&&void 0!==e?e:this.element,t):this._$AH.handleEvent(t)}}class J{constructor(t,o,e){this.element=t,this.type=6,this._$AN=void 0,this._$AM=o,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(t){K(this,t)}}const Y=f.litHtmlPolyfillSupport;
|
|
18
|
+
/**
|
|
19
|
+
* @license
|
|
20
|
+
* Copyright 2017 Google LLC
|
|
21
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
+
*/
|
|
23
|
+
var Q;null==Y||Y(P,F),(null!==(y=f.litHtmlVersions)&&void 0!==y?y:f.litHtmlVersions=[]).push("2.8.0");const X=window,tt=X.trustedTypes,ot=tt?tt.createPolicy("lit-html",{createHTML:t=>t}):void 0,et="$lit$",it=`lit$${(Math.random()+"").slice(9)}$`,rt="?"+it,nt=`<${rt}>`,st=document,at=()=>st.createComment(""),lt=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,bt=RegExp(`>|${ht}(?:([^\\s"'>=/]+)(${ht}*=${ht}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),pt=/'/g,yt=/"/g,ft=/^(?:script|style|textarea|title)$/i,gt=(t=>(o,...e)=>({_$litType$:t,strings:o,values:e}))(1),mt=Symbol.for("lit-noChange"),wt=Symbol.for("lit-nothing"),xt=new WeakMap,$t=st.createTreeWalker(st,129,null,!1);function kt(t,o){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==ot?ot.createHTML(o):o}const St=(t,o)=>{const e=t.length-1,i=[];let r,n=2===o?"<svg>":"",s=dt;for(let o=0;o<e;o++){const e=t[o];let a,l,c=-1,h=0;for(;h<e.length&&(s.lastIndex=h,l=s.exec(e),null!==l);)h=s.lastIndex,s===dt?"!--"===l[1]?s=ut:void 0!==l[1]?s=vt:void 0!==l[2]?(ft.test(l[2])&&(r=RegExp("</"+l[2],"g")),s=bt):void 0!==l[3]&&(s=bt):s===bt?">"===l[0]?(s=null!=r?r:dt,c=-1):void 0===l[1]?c=-2:(c=s.lastIndex-l[2].length,a=l[1],s=void 0===l[3]?bt:'"'===l[3]?yt:pt):s===yt||s===pt?s=bt:s===ut||s===vt?s=dt:(s=bt,r=void 0);const d=s===bt&&t[o+1].startsWith("/>")?" ":"";n+=s===dt?e+nt:c>=0?(i.push(a),e.slice(0,c)+et+e.slice(c)+it+d):e+it+(-2===c?(i.push(void 0),o):d)}return[kt(t,n+(t[e]||"<?>")+(2===o?"</svg>":"")),i]};class Et{constructor({strings:t,_$litType$:o},e){let i;this.parts=[];let r=0,n=0;const s=t.length-1,a=this.parts,[l,c]=St(t,o);if(this.el=Et.createElement(l,e),$t.currentNode=this.el.content,2===o){const t=this.el.content,o=t.firstChild;o.remove(),t.append(...o.childNodes)}for(;null!==(i=$t.nextNode())&&a.length<s;){if(1===i.nodeType){if(i.hasAttributes()){const t=[];for(const o of i.getAttributeNames())if(o.endsWith(et)||o.startsWith(it)){const e=c[n++];if(t.push(o),void 0!==e){const t=i.getAttribute(e.toLowerCase()+et).split(it),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:r,name:o[2],strings:t,ctor:"."===o[1]?_t:"?"===o[1]?Tt:"@"===o[1]?Dt:Rt})}else a.push({type:6,index:r})}for(const o of t)i.removeAttribute(o)}if(ft.test(i.tagName)){const t=i.textContent.split(it),o=t.length-1;if(o>0){i.textContent=tt?tt.emptyScript:"";for(let e=0;e<o;e++)i.append(t[e],at()),$t.nextNode(),a.push({type:2,index:++r});i.append(t[o],at())}}}else if(8===i.nodeType)if(i.data===rt)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=i.data.indexOf(it,t+1));)a.push({type:7,index:r}),t+=it.length-1}r++}}static createElement(t,o){const e=st.createElement("template");return e.innerHTML=t,e}}function At(t,o,e=t,i){var r,n,s,a;if(o===mt)return o;let l=void 0!==i?null===(r=e._$Co)||void 0===r?void 0:r[i]:e._$Cl;const c=lt(o)?void 0:o._$litDirective$;return(null==l?void 0:l.constructor)!==c&&(null===(n=null==l?void 0:l._$AO)||void 0===n||n.call(l,!1),void 0===c?l=void 0:(l=new c(t),l._$AT(t,e,i)),void 0!==i?(null!==(s=(a=e)._$Co)&&void 0!==s?s:a._$Co=[])[i]=l:e._$Cl=l),void 0!==l&&(o=At(t,l._$AS(t,o.values),l,i)),o}class Ct{constructor(t,o){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=o}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var o;const{el:{content:e},parts:i}=this._$AD,r=(null!==(o=null==t?void 0:t.creationScope)&&void 0!==o?o:st).importNode(e,!0);$t.currentNode=r;let n=$t.nextNode(),s=0,a=0,l=i[0];for(;void 0!==l;){if(s===l.index){let o;2===l.type?o=new zt(n,n.nextSibling,this,t):1===l.type?o=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(o=new Ot(n,this,t)),this._$AV.push(o),l=i[++a]}s!==(null==l?void 0:l.index)&&(n=$t.nextNode(),s++)}return $t.currentNode=st,r}v(t){let o=0;for(const e of this._$AV)void 0!==e&&(void 0!==e.strings?(e._$AI(t,e,o),o+=e.strings.length-2):e._$AI(t[o])),o++}}class zt{constructor(t,o,e,i){var r;this.type=2,this._$AH=wt,this._$AN=void 0,this._$AA=t,this._$AB=o,this._$AM=e,this.options=i,this._$Cp=null===(r=null==i?void 0:i.isConnected)||void 0===r||r}get _$AU(){var t,o;return null!==(o=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==o?o:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const o=this._$AM;return void 0!==o&&11===(null==t?void 0:t.nodeType)&&(t=o.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,o=this){t=At(this,t,o),lt(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&<(this._$AH)?this._$AA.nextSibling.data=t:this.$(st.createTextNode(t)),this._$AH=t}g(t){var o;const{values:e,_$litType$:i}=t,r="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=Et.createElement(kt(i.h,i.h[0]),this.options)),i);if((null===(o=this._$AH)||void 0===o?void 0:o._$AD)===r)this._$AH.v(e);else{const t=new Ct(r,this),o=t.u(this.options);t.v(e),this.$(o),this._$AH=t}}_$AC(t){let o=xt.get(t.strings);return void 0===o&&xt.set(t.strings,o=new Et(t)),o}T(t){ct(this._$AH)||(this._$AH=[],this._$AR());const o=this._$AH;let e,i=0;for(const r of t)i===o.length?o.push(e=new zt(this.k(at()),this.k(at()),this,this.options)):e=o[i],e._$AI(r),i++;i<o.length&&(this._$AR(e&&e._$AB.nextSibling,i),o.length=i)}_$AR(t=this._$AA.nextSibling,o){var e;for(null===(e=this._$AP)||void 0===e||e.call(this,!1,!0,o);t&&t!==this._$AB;){const o=t.nextSibling;t.remove(),t=o}}setConnected(t){var o;void 0===this._$AM&&(this._$Cp=t,null===(o=this._$AP)||void 0===o||o.call(this,t))}}class Rt{constructor(t,o,e,i,r){this.type=1,this._$AH=wt,this._$AN=void 0,this.element=t,this.name=o,this._$AM=i,this.options=r,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=wt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,o=this,e,i){const r=this.strings;let n=!1;if(void 0===r)t=At(this,t,o,0),n=!lt(t)||t!==this._$AH&&t!==mt,n&&(this._$AH=t);else{const i=t;let s,a;for(t=r[0],s=0;s<r.length-1;s++)a=At(this,i[e+s],o,s),a===mt&&(a=this._$AH[s]),n||(n=!lt(a)||a!==this._$AH[s]),a===wt?t=wt:t!==wt&&(t+=(null!=a?a:"")+r[s+1]),this._$AH[s]=a}n&&!i&&this.j(t)}j(t){t===wt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class _t extends Rt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===wt?void 0:t}}const jt=tt?tt.emptyScript:"";class Tt extends Rt{constructor(){super(...arguments),this.type=4}j(t){t&&t!==wt?this.element.setAttribute(this.name,jt):this.element.removeAttribute(this.name)}}class Dt extends Rt{constructor(t,o,e,i,r){super(t,o,e,i,r),this.type=5}_$AI(t,o=this){var e;if((t=null!==(e=At(this,t,o,0))&&void 0!==e?e:wt)===mt)return;const i=this._$AH,r=t===wt&&i!==wt||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,n=t!==wt&&(i===wt||r);r&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var o,e;"function"==typeof this._$AH?this._$AH.call(null!==(e=null===(o=this.options)||void 0===o?void 0:o.host)&&void 0!==e?e:this.element,t):this._$AH.handleEvent(t)}}class Ot{constructor(t,o,e){this.element=t,this.type=6,this._$AN=void 0,this._$AM=o,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(t){At(this,t)}}const It=X.litHtmlPolyfillSupport;null==It||It(Et,zt),(null!==(Q=X.litHtmlVersions)&&void 0!==Q?Q:X.litHtmlVersions=[]).push("2.8.0");
|
|
24
|
+
/**
|
|
25
|
+
* @license
|
|
26
|
+
* Copyright 2017 Google LLC
|
|
27
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
28
|
+
*/
|
|
29
|
+
var Ut,Mt;class Nt extends p{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,o;const e=super.createRenderRoot();return null!==(t=(o=this.renderOptions).renderBefore)&&void 0!==t||(o.renderBefore=e.firstChild),e}update(t){const o=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,o,e)=>{var i,r;const n=null!==(i=null==e?void 0:e.renderBefore)&&void 0!==i?i:o;let s=n._$litPart$;if(void 0===s){const t=null!==(r=null==e?void 0:e.renderBefore)&&void 0!==r?r:null;n._$litPart$=s=new zt(o.insertBefore(at(),t),t,void 0,null!=e?e:{})}return s._$AI(t),s})(o,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===(Ut=globalThis.litElementHydrateSupport)||void 0===Ut||Ut.call(globalThis,{LitElement:Nt});const Bt=globalThis.litElementPolyfillSupport;null==Bt||Bt({LitElement:Nt}),(null!==(Mt=globalThis.litElementVersions)&&void 0!==Mt?Mt:globalThis.litElementVersions=[]).push("3.3.3");
|
|
30
|
+
/**
|
|
31
|
+
* @license
|
|
32
|
+
* Copyright 2017 Google LLC
|
|
33
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
|
+
*/
|
|
35
|
+
const Lt=(t,o)=>"method"===o.kind&&o.descriptor&&!("value"in o.descriptor)?{...o,finisher(e){e.createProperty(o.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:o.key,initializer(){"function"==typeof o.initializer&&(this[o.key]=o.initializer.call(this))},finisher(e){e.createProperty(o.key,t)}};
|
|
36
|
+
/**
|
|
37
|
+
* @license
|
|
38
|
+
* Copyright 2017 Google LLC
|
|
39
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
40
|
+
*/function Pt(t){return(o,e)=>void 0!==e?((t,o,e)=>{o.constructor.createProperty(e,t)})(t,o,e):Lt(t,o)
|
|
41
|
+
/**
|
|
42
|
+
* @license
|
|
43
|
+
* Copyright 2021 Google LLC
|
|
44
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
45
|
+
*/}var Kt;null===(Kt=window.HTMLSlotElement)||void 0===Kt||Kt.prototype.assignedElements;
|
|
46
|
+
/**
|
|
47
|
+
* @license
|
|
48
|
+
* Copyright 2018 Google LLC
|
|
49
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
50
|
+
*/
|
|
51
|
+
const qt=t=>null!=t?t:M,Ft="",Ht=((t,...o)=>{const i=1===t.length?t[0]:o.reduce(((o,e,i)=>o+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(e)+t[i+1]),t[0]);return new r(i,t,e)})`
|
|
52
|
+
:host {
|
|
53
|
+
display: inline-block;
|
|
54
|
+
vertical-align: middle;
|
|
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
|
+
border-color: var(--nuraly-color-border);
|
|
60
|
+
|
|
61
|
+
/* Ensure clean state transitions when theme changes */
|
|
62
|
+
* {
|
|
63
|
+
transition: all var(--nuraly-transition-fast, 0.15s) ease;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* Force re-evaluation of theme-dependent properties on theme change */
|
|
68
|
+
:host([data-theme]) {
|
|
69
|
+
color: inherit;
|
|
70
|
+
background-color: inherit;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
button {
|
|
74
|
+
display: inline-flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
position: relative;
|
|
78
|
+
font-family: var(--nuraly-font-family);
|
|
79
|
+
font-size: 0.875rem;
|
|
80
|
+
font-weight: var(--nuraly-font-weight-regular);
|
|
81
|
+
line-height: 1.125rem;
|
|
82
|
+
letter-spacing: 0.16px;
|
|
83
|
+
min-width: 5rem;
|
|
84
|
+
height: 3rem;
|
|
85
|
+
padding: var(--nuraly-spacing-2) var(--nuraly-spacing-4);
|
|
86
|
+
border: 1px solid transparent;
|
|
87
|
+
border-radius: var(--nuraly-border-radius-button, var(--nuraly-border-radius-medium, 0));
|
|
88
|
+
background-color: var(--nuraly-color-background);
|
|
89
|
+
color: var(--nuraly-color-text);
|
|
90
|
+
text-decoration: none;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
transition: all var(--nuraly-transition-fast, 0.15s) ease;
|
|
93
|
+
white-space: nowrap;
|
|
94
|
+
overflow: hidden;
|
|
95
|
+
text-overflow: ellipsis;
|
|
96
|
+
|
|
97
|
+
/* Reset any inherited styles that might interfere with theme switching */
|
|
98
|
+
box-shadow: none;
|
|
99
|
+
text-shadow: none;
|
|
100
|
+
|
|
101
|
+
&:focus {
|
|
102
|
+
outline: var(--nuraly-focus-outline);
|
|
103
|
+
outline-offset: var(--nuraly-focus-outline-offset);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&:disabled {
|
|
107
|
+
cursor: not-allowed;
|
|
108
|
+
/* Remove generic opacity - use specific disabled colors instead */
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* Icon styling */
|
|
112
|
+
nr-icon {
|
|
113
|
+
flex-shrink: 0;
|
|
114
|
+
width: var(--nuraly-button-icon-size, 1rem);
|
|
115
|
+
height: var(--nuraly-button-icon-size, 1rem);
|
|
116
|
+
display: inline-flex;
|
|
117
|
+
align-items: center;
|
|
118
|
+
justify-content: center;
|
|
119
|
+
/* Better text alignment */
|
|
120
|
+
vertical-align: middle;
|
|
121
|
+
line-height: 1;
|
|
122
|
+
/* Ensure icon inherits text color */
|
|
123
|
+
color: inherit;
|
|
124
|
+
/* Override any size attribute with CSS variable */
|
|
125
|
+
font-size: var(--nuraly-button-icon-size, 1rem) !important;
|
|
126
|
+
transition: all var(--nuraly-transition-fast, 0.15s) ease;
|
|
127
|
+
/* Inherit cursor from button */
|
|
128
|
+
cursor: inherit;
|
|
129
|
+
/* Prevent icon from being focusable */
|
|
130
|
+
pointer-events: none;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Icon focus state */
|
|
134
|
+
&:focus:not(:disabled) nr-icon {
|
|
135
|
+
opacity: 1;
|
|
136
|
+
filter: brightness(1.1);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Icon active state */
|
|
140
|
+
&:active:not(:disabled) nr-icon {
|
|
141
|
+
opacity: 0.9;
|
|
142
|
+
transform: scale(0.95);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* Icon hover state */
|
|
146
|
+
&:hover:not(:disabled) nr-icon {
|
|
147
|
+
opacity: 1;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* Icon spacing - use gap for cleaner spacing */
|
|
151
|
+
gap: 0.5rem;
|
|
152
|
+
|
|
153
|
+
/* Ensure proper alignment of content */
|
|
154
|
+
#container, [part="container"] {
|
|
155
|
+
display: flex;
|
|
156
|
+
align-items: center;
|
|
157
|
+
justify-content: center;
|
|
158
|
+
gap: inherit;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* Primary Button - Carbon Design System compliant */
|
|
163
|
+
:host([type="primary"]) button {
|
|
164
|
+
background-color: var(--nuraly-color-button-primary);
|
|
165
|
+
border-color: var(--nuraly-color-button-primary);
|
|
166
|
+
color: var(--nuraly-color-button-primary-text, var(--nuraly-color-text-on-color));
|
|
167
|
+
|
|
168
|
+
&:hover:not(:disabled) {
|
|
169
|
+
background-color: var(--nuraly-color-button-primary-hover);
|
|
170
|
+
border-color: var(--nuraly-color-button-primary-hover);
|
|
171
|
+
color: var(--nuraly-color-button-primary-text-hover, var(--nuraly-color-text-on-color));
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&:active:not(:disabled) {
|
|
175
|
+
background-color: var(--nuraly-color-button-primary-active);
|
|
176
|
+
border-color: var(--nuraly-color-button-primary-active);
|
|
177
|
+
color: var(--nuraly-color-button-primary-text-active, var(--nuraly-color-text-on-color));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&:focus:not(:disabled) {
|
|
181
|
+
outline: 2px solid var(--nuraly-color-button-focus-outline, var(--nuraly-focus-color));
|
|
182
|
+
outline-offset: 2px;
|
|
183
|
+
box-shadow: var(--nuraly-shadow-button-focus, 0 0 0 2px var(--nuraly-color-button-focus-ring));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&:disabled {
|
|
187
|
+
background-color: var(--nuraly-color-button-disabled);
|
|
188
|
+
border-color: var(--nuraly-color-button-disabled-border, var(--nuraly-color-button-disabled));
|
|
189
|
+
color: var(--nuraly-color-button-disabled-text);
|
|
190
|
+
cursor: not-allowed;
|
|
191
|
+
opacity: 1; /* Reset opacity for proper disabled state */
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* Secondary Button - Carbon Design System compliant */
|
|
196
|
+
:host([type="secondary"]) button {
|
|
197
|
+
background-color: var(--nuraly-color-button-secondary);
|
|
198
|
+
border-color: var(--nuraly-color-button-secondary);
|
|
199
|
+
color: var(--nuraly-color-button-secondary-text, var(--nuraly-color-text-on-color));
|
|
200
|
+
|
|
201
|
+
&:hover:not(:disabled) {
|
|
202
|
+
background-color: var(--nuraly-color-button-secondary-hover);
|
|
203
|
+
border-color: var(--nuraly-color-button-secondary-hover);
|
|
204
|
+
color: var(--nuraly-color-button-secondary-text-hover, var(--nuraly-color-text-on-color));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
&:active:not(:disabled) {
|
|
208
|
+
background-color: var(--nuraly-color-button-secondary-active);
|
|
209
|
+
border-color: var(--nuraly-color-button-secondary-active);
|
|
210
|
+
color: var(--nuraly-color-button-secondary-text-active, var(--nuraly-color-text-on-color));
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
&:focus:not(:disabled) {
|
|
214
|
+
outline: 2px solid var(--nuraly-color-button-focus-outline, var(--nuraly-focus-color));
|
|
215
|
+
outline-offset: 2px;
|
|
216
|
+
box-shadow: var(--nuraly-shadow-button-focus, 0 0 0 2px var(--nuraly-color-button-focus-ring));
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
&:disabled {
|
|
220
|
+
background-color: var(--nuraly-color-button-disabled);
|
|
221
|
+
border-color: var(--nuraly-color-button-disabled-border, var(--nuraly-color-button-disabled));
|
|
222
|
+
color: var(--nuraly-color-button-disabled-text);
|
|
223
|
+
cursor: not-allowed;
|
|
224
|
+
opacity: 1; /* Reset opacity for proper disabled state */
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* Default Button - Clean white/light style with defined border */
|
|
229
|
+
:host([type="default"]) button {
|
|
230
|
+
background-color: var(--nuraly-color-background, #ffffff);
|
|
231
|
+
border-color: var(--nuraly-color-border, #d0d0d0);
|
|
232
|
+
color: var(--nuraly-color-text, #161616);
|
|
233
|
+
|
|
234
|
+
&:hover:not(:disabled) {
|
|
235
|
+
background-color: var(--nuraly-color-background-hover, #f4f4f4);
|
|
236
|
+
border-color: var(--nuraly-color-border-hover, #a8a8a8);
|
|
237
|
+
color: var(--nuraly-color-text, #161616);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
&:active:not(:disabled) {
|
|
241
|
+
background-color: var(--nuraly-color-background-active, #e0e0e0);
|
|
242
|
+
border-color: var(--nuraly-color-border-active, #8d8d8d);
|
|
243
|
+
color: var(--nuraly-color-text, #161616);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
&:focus:not(:disabled) {
|
|
247
|
+
outline: 2px solid var(--nuraly-color-button-focus-outline, var(--nuraly-focus-color));
|
|
248
|
+
outline-offset: 2px;
|
|
249
|
+
box-shadow: var(--nuraly-shadow-button-focus, 0 0 0 2px var(--nuraly-color-button-focus-ring));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
&:disabled {
|
|
253
|
+
background-color: var(--nuraly-color-button-disabled, #f4f4f4);
|
|
254
|
+
border-color: var(--nuraly-color-button-disabled-border, #c6c6c6);
|
|
255
|
+
color: var(--nuraly-color-button-disabled-text, #c6c6c6);
|
|
256
|
+
cursor: not-allowed;
|
|
257
|
+
opacity: 1; /* Reset opacity for proper disabled state */
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/* Tertiary/Ghost Button - Carbon Design System compliant */
|
|
262
|
+
:host([type="tertiary"]), :host([type="ghost"]) button {
|
|
263
|
+
background-color: var(--nuraly-color-button-outline, transparent);
|
|
264
|
+
border-color: var(--nuraly-color-button-outline-border, var(--nuraly-color-border));
|
|
265
|
+
color: var(--nuraly-color-button-outline-text, var(--nuraly-color-button-tertiary, var(--nuraly-color-button-primary)));
|
|
266
|
+
|
|
267
|
+
&:hover:not(:disabled) {
|
|
268
|
+
background-color: var(--nuraly-color-button-outline-hover, var(--nuraly-color-background-hover));
|
|
269
|
+
border-color: var(--nuraly-color-button-outline-border-hover, var(--nuraly-color-button-tertiary-hover, var(--nuraly-color-button-primary)));
|
|
270
|
+
color: var(--nuraly-color-button-outline-text-hover, var(--nuraly-color-button-tertiary-hover, var(--nuraly-color-button-primary-hover)));
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
&:active:not(:disabled) {
|
|
274
|
+
background-color: var(--nuraly-color-button-outline-active, var(--nuraly-color-background-active));
|
|
275
|
+
border-color: var(--nuraly-color-button-outline-border-active, var(--nuraly-color-button-tertiary-active, var(--nuraly-color-button-primary-active)));
|
|
276
|
+
color: var(--nuraly-color-button-outline-text-active, var(--nuraly-color-button-tertiary-active, var(--nuraly-color-button-primary-active)));
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
&:focus:not(:disabled) {
|
|
280
|
+
outline: 2px solid var(--nuraly-color-button-focus-outline, var(--nuraly-focus-color));
|
|
281
|
+
outline-offset: 2px;
|
|
282
|
+
box-shadow: var(--nuraly-shadow-button-focus, 0 0 0 2px var(--nuraly-color-button-focus-ring));
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
&:disabled {
|
|
286
|
+
background-color: transparent;
|
|
287
|
+
border-color: var(--nuraly-color-button-disabled-border, var(--nuraly-color-button-disabled));
|
|
288
|
+
color: var(--nuraly-color-button-disabled-text);
|
|
289
|
+
cursor: not-allowed;
|
|
290
|
+
opacity: 1; /* Reset opacity for proper disabled state */
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/* Danger Button - Carbon Design System compliant */
|
|
295
|
+
:host([type="danger"]) button {
|
|
296
|
+
background-color: var(--nuraly-color-button-danger);
|
|
297
|
+
border-color: var(--nuraly-color-button-danger);
|
|
298
|
+
color: var(--nuraly-color-button-danger-text, var(--nuraly-color-text-on-color));
|
|
299
|
+
|
|
300
|
+
&:hover:not(:disabled) {
|
|
301
|
+
background-color: var(--nuraly-color-button-danger-hover);
|
|
302
|
+
border-color: var(--nuraly-color-button-danger-hover);
|
|
303
|
+
color: var(--nuraly-color-button-danger-text-hover, var(--nuraly-color-text-on-color));
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
&:active:not(:disabled) {
|
|
307
|
+
background-color: var(--nuraly-color-button-danger-active);
|
|
308
|
+
border-color: var(--nuraly-color-button-danger-active);
|
|
309
|
+
color: var(--nuraly-color-button-danger-text-active, var(--nuraly-color-text-on-color));
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
&:focus:not(:disabled) {
|
|
313
|
+
outline: 2px solid var(--nuraly-color-button-focus-outline, var(--nuraly-focus-color));
|
|
314
|
+
outline-offset: 2px;
|
|
315
|
+
box-shadow: var(--nuraly-shadow-button-focus, 0 0 0 2px var(--nuraly-color-button-focus-ring));
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
&:disabled {
|
|
319
|
+
background-color: var(--nuraly-color-button-disabled);
|
|
320
|
+
border-color: var(--nuraly-color-button-disabled-border, var(--nuraly-color-button-disabled));
|
|
321
|
+
color: var(--nuraly-color-button-disabled-text);
|
|
322
|
+
cursor: not-allowed;
|
|
323
|
+
opacity: 1; /* Reset opacity for proper disabled state */
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/* Default size when no size attribute is provided (medium) */
|
|
328
|
+
:host(:not([size])) button {
|
|
329
|
+
height: var(--nuraly-size-md);
|
|
330
|
+
padding: var(--nuraly-spacing-2) var(--nuraly-spacing-4);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/* Size variants */
|
|
334
|
+
:host([size="small"]) button {
|
|
335
|
+
height: var(--nuraly-size-sm);
|
|
336
|
+
padding: var(--nuraly-spacing-01) var(--nuraly-spacing-03);
|
|
337
|
+
font-size: 0.75rem;
|
|
338
|
+
min-width: 4rem;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
:host([size="medium"]) button {
|
|
342
|
+
height: var(--nuraly-size-md);
|
|
343
|
+
padding: var(--nuraly-spacing-2) var(--nuraly-spacing-4);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
:host([size="large"]) button {
|
|
347
|
+
height: var(--nuraly-size-lg);
|
|
348
|
+
padding: var(--nuraly-spacing-05) var(--nuraly-spacing-06);
|
|
349
|
+
font-size: 1rem;
|
|
350
|
+
min-width: 6rem;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/* Full width */
|
|
354
|
+
:host([full-width]) {
|
|
355
|
+
width: 100%;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
:host([full-width]) button {
|
|
359
|
+
width: 100%;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/* Loading state */
|
|
363
|
+
:host([loading]) button {
|
|
364
|
+
cursor: not-allowed;
|
|
365
|
+
opacity: 0.7;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/* Shape variants */
|
|
369
|
+
:host([shape="round"]) button {
|
|
370
|
+
border-radius: 50%;
|
|
371
|
+
min-width: auto;
|
|
372
|
+
width: var(--nuraly-size-md);
|
|
373
|
+
aspect-ratio: 1;
|
|
374
|
+
padding: 0;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
:host([shape="round"][size="small"]) button {
|
|
378
|
+
width: var(--nuraly-size-sm);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
:host([shape="round"][size="medium"]) button {
|
|
382
|
+
width: var(--nuraly-size-md);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
:host([shape="round"][size="large"]) button {
|
|
386
|
+
width: var(--nuraly-size-lg);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/* Enhanced Ripple Effect Animation - Theme-aware */
|
|
390
|
+
.ripple {
|
|
391
|
+
position: absolute;
|
|
392
|
+
border-radius: 50%;
|
|
393
|
+
background: rgba(255, 255, 255, 0.6);
|
|
394
|
+
transform: scale(0);
|
|
395
|
+
animation: ripple-animation 0.6s linear;
|
|
396
|
+
pointer-events: none;
|
|
397
|
+
z-index: 1;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
@keyframes ripple-animation {
|
|
401
|
+
0% {
|
|
402
|
+
transform: scale(0);
|
|
403
|
+
opacity: 1;
|
|
404
|
+
}
|
|
405
|
+
70% {
|
|
406
|
+
transform: scale(3);
|
|
407
|
+
opacity: 0.5;
|
|
408
|
+
}
|
|
409
|
+
100% {
|
|
410
|
+
transform: scale(4);
|
|
411
|
+
opacity: 0;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/* Ripple effect for different button types - Carbon Design System compliant */
|
|
416
|
+
:host([type="primary"]) .ripple {
|
|
417
|
+
background: rgba(255, 255, 255, 0.4);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
:host([type="secondary"]) .ripple {
|
|
421
|
+
background: rgba(255, 255, 255, 0.3);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
:host([type="default"]) .ripple {
|
|
425
|
+
background: var(--nuraly-color-text, #161616);
|
|
426
|
+
opacity: 0.1;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
:host([type="ghost"]) .ripple,
|
|
430
|
+
:host([type="tertiary"]) .ripple {
|
|
431
|
+
background: var(--nuraly-color-button-tertiary, #0f62fe);
|
|
432
|
+
opacity: 0.2;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
:host([type="danger"]) .ripple {
|
|
436
|
+
background: rgba(255, 255, 255, 0.4);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/* Theme-specific ripple adjustments for dark theme */
|
|
440
|
+
[data-theme="carbon-dark"] :host([type="default"]) .ripple {
|
|
441
|
+
background: var(--nuraly-color-text, #f4f4f4);
|
|
442
|
+
opacity: 0.1;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
[data-theme="carbon-dark"] :host([type="ghost"]) .ripple,
|
|
446
|
+
[data-theme="carbon-dark"] :host([type="tertiary"]) .ripple {
|
|
447
|
+
background: var(--nuraly-color-button-tertiary, #78a9ff);
|
|
448
|
+
opacity: 0.2;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
[data-theme="carbon-dark"] :host([type="primary"]) .ripple {
|
|
452
|
+
background: rgba(22, 22, 22, 0.4); /* Dark ripple for light buttons */
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
[data-theme="carbon-dark"] :host([type="secondary"]) .ripple {
|
|
456
|
+
background: rgba(22, 22, 22, 0.3); /* Dark ripple for light buttons */
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
[data-theme="carbon-dark"] :host([type="danger"]) .ripple {
|
|
460
|
+
background: rgba(22, 22, 22, 0.4); /* Dark ripple for light buttons */
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/* ========================================
|
|
464
|
+
* CARBON THEME SPECIFIC STYLING
|
|
465
|
+
* Enhanced padding and icon centering for Carbon Design System
|
|
466
|
+
* ======================================== */
|
|
467
|
+
|
|
468
|
+
/* Carbon theme button styling - apply to all carbon themes */
|
|
469
|
+
:host([data-theme*="carbon"]) button,
|
|
470
|
+
[data-theme*="carbon"] :host button {
|
|
471
|
+
/* Better baseline alignment for icon and text */
|
|
472
|
+
align-items: center;
|
|
473
|
+
|
|
474
|
+
/* Enhanced icon alignment and spacing for Carbon */
|
|
475
|
+
nr-icon {
|
|
476
|
+
width: var(--nuraly-button-icon-size, 1rem);
|
|
477
|
+
height: var(--nuraly-button-icon-size, 1rem);
|
|
478
|
+
display: inline-flex;
|
|
479
|
+
align-items: center;
|
|
480
|
+
justify-content: center;
|
|
481
|
+
flex-shrink: 0;
|
|
482
|
+
/* Perfect vertical alignment with text baseline */
|
|
483
|
+
vertical-align: middle;
|
|
484
|
+
line-height: 1;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/* Icon spacing for Carbon theme - improved approach */
|
|
488
|
+
gap: var(--nuraly-button-icon-spacing, var(--nuraly-spacing-03, 0.5rem));
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/* Specific Carbon theme selectors for better targeting */
|
|
492
|
+
[data-theme="carbon-light"] nr-button button,
|
|
493
|
+
[data-theme="carbon-dark"] nr-button button,
|
|
494
|
+
[data-theme="carbon"] nr-button button {
|
|
495
|
+
/* Better baseline alignment for icon and text */
|
|
496
|
+
align-items: center;
|
|
497
|
+
|
|
498
|
+
/* Enhanced icon alignment and spacing for Carbon */
|
|
499
|
+
nr-icon {
|
|
500
|
+
width: var(--nuraly-button-icon-size, 1rem);
|
|
501
|
+
height: var(--nuraly-button-icon-size, 1rem);
|
|
502
|
+
display: inline-flex;
|
|
503
|
+
align-items: center;
|
|
504
|
+
justify-content: center;
|
|
505
|
+
flex-shrink: 0;
|
|
506
|
+
/* Perfect vertical alignment with text baseline */
|
|
507
|
+
vertical-align: middle;
|
|
508
|
+
line-height: 1;
|
|
509
|
+
/* Slight adjustment for perfect optical centering */
|
|
510
|
+
margin-top: -1px;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/* Target the SVG inside nr-icon for better alignment */
|
|
514
|
+
nr-icon svg {
|
|
515
|
+
display: block;
|
|
516
|
+
margin: 0 auto;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
/* Icon spacing for Carbon theme */
|
|
520
|
+
gap: var(--nuraly-button-icon-spacing, var(--nuraly-spacing-03, 0.5rem));
|
|
521
|
+
|
|
522
|
+
/* Ensure text is also properly centered */
|
|
523
|
+
span#container {
|
|
524
|
+
display: flex;
|
|
525
|
+
align-items: center;
|
|
526
|
+
justify-content: center;
|
|
527
|
+
width: 100%;
|
|
528
|
+
height: 100%;
|
|
529
|
+
line-height: 1;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/* Ensure slot content aligns properly */
|
|
533
|
+
slot#slot {
|
|
534
|
+
display: inline-block;
|
|
535
|
+
line-height: inherit;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
`,Vt=Ht,Wt=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,o,e;super.disconnectedCallback(),null===(t=this.themeObserver)||void 0===t||t.disconnect(),null===(o=this.designSystemObserver)||void 0===o||o.disconnect(),null===(e=this.mediaQuery)||void 0===e||e.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var t,o;const e=(null===(t=this.closest("[data-theme]"))||void 0===t?void 0:t.getAttribute("data-theme"))||document.documentElement.getAttribute("data-theme");return e||((null===(o=window.matchMedia)||void 0===o?void 0:o.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light")}get currentDesignSystem(){var t;const o=(null===(t=this.closest("[design-system]"))||void 0===t?void 0:t.getAttribute("design-system"))||document.documentElement.getAttribute("design-system");return"carbon"===o?o:"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))}},Zt=()=>{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)},Gt=t=>class extends t{constructor(){super(...arguments),this.requiredComponents=[]}validateDependencies(){if(Zt())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(!Zt())return!0;let o=!0;for(const e of this.requiredComponents)if(!this.isComponentAvailable(e)){o=!1;const i=new Error(`Required component "${e}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}.`);t?t(e,i):console.error(i.message)}return o}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 o=this.requiredComponents.indexOf(t);o>-1&&this.requiredComponents.splice(o,1)}},Jt=t=>class extends t{dispatchCustomEvent(t,o){this.dispatchEvent(new CustomEvent(t,{detail:o,bubbles:!0,composed:!0}))}dispatchEventWithMetadata(t,o){var e;const i=Object.assign(Object.assign({},o),{timestamp:Date.now(),componentName:(null===(e=this.tagName)||void 0===e?void 0:e.toLowerCase())||"unknown"});this.dispatchCustomEvent(t,i)}dispatchInputEvent(t,o){const e=Object.assign({target:o.target||this,value:o.value,originalEvent:o.originalEvent},o);this.dispatchCustomEvent(t,e)}dispatchFocusEvent(t,o){const e=Object.assign({target:o.target||this,value:o.value,focused:o.focused,cursorPosition:o.cursorPosition,selectedText:o.selectedText},o);this.dispatchCustomEvent(t,e)}dispatchValidationEvent(t,o){var e;const i=Object.assign({target:o.target||this,value:o.value,isValid:null!==(e=o.isValid)&&void 0!==e&&e,error:o.error},o);this.dispatchCustomEvent(t,i)}dispatchActionEvent(t,o){const e=Object.assign({target:o.target||this,action:o.action,previousValue:o.previousValue,newValue:o.newValue},o);this.dispatchCustomEvent(t,e)}isReadonlyKeyAllowed(t){if(t.ctrlKey||t.metaKey){return["KeyA","KeyC"].includes(t.code)}return["Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key)}isActivationKey(t){return"Enter"===t.key||" "===t.key}};
|
|
539
|
+
/**
|
|
540
|
+
* @license
|
|
541
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
542
|
+
* SPDX-License-Identifier: MIT
|
|
543
|
+
*/
|
|
544
|
+
class Yt{constructor(t){this._host=t,this._host.addController(this)}get host(){return this._host}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}handleError(t,o){console.error(`[ButtonController:${this.constructor.name}] Error in ${o}:`,t),this._host.dispatchEvent(new CustomEvent("nr-button-error",{detail:{error:t.message,context:o,controller:this.constructor.name},bubbles:!0,composed:!0}))}requestUpdate(){try{this._host.requestUpdate()}catch(t){this.handleError(t,"requestUpdate")}}dispatchEvent(t){try{return this._host.dispatchEvent(t)}catch(t){return this.handleError(t,"dispatchEvent"),!1}}}
|
|
545
|
+
/**
|
|
546
|
+
* @license
|
|
547
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
548
|
+
* SPDX-License-Identifier: MIT
|
|
549
|
+
*/class Qt extends Yt{createRipple(t){try{if(!this.host.ripple||this.host.disabled)return;const o=t.currentTarget,e=o.getBoundingClientRect(),i=2*Math.max(e.width,e.height),r=t.clientX-e.left-i/2,n=t.clientY-e.top-i/2,s=document.createElement("span");s.className="ripple",s.style.width=s.style.height=i+"px",s.style.left=r+"px",s.style.top=n+"px";o.querySelectorAll(".ripple").forEach((t=>t.remove())),o.appendChild(s),setTimeout((()=>{s.remove()}),600)}catch(t){this.handleError(t,"createRipple")}}handleRippleClick(t){try{this.createRipple(t),this.dispatchEvent(new CustomEvent("button-click",{detail:{disabled:this.host.disabled,timestamp:Date.now(),coordinates:{x:t.clientX,y:t.clientY}},bubbles:!0,composed:!0}))}catch(t){this.handleError(t,"handleRippleClick")}}}
|
|
550
|
+
/**
|
|
551
|
+
* @license
|
|
552
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
553
|
+
* SPDX-License-Identifier: MIT
|
|
554
|
+
*/class Xt extends Yt{handleKeyboardActivation(t){try{if(this.host.disabled)return;this.isActivationKey(t)&&(t.preventDefault(),this.host.click(),this.dispatchEvent(new CustomEvent("keyboard-activation",{detail:{key:t.key,timestamp:Date.now(),target:this.host},bubbles:!0,composed:!0})))}catch(t){this.handleError(t,"handleKeyboardActivation")}}handleKeydown(t){try{if(this.host.disabled){if(!this.isReadonlyKeyAllowed(t))return void t.preventDefault()}this.handleKeyboardActivation(t)}catch(t){this.handleError(t,"handleKeydown")}}isActivationKey(t){return"Enter"===t.key||" "===t.key}isReadonlyKeyAllowed(t){return["Tab","Shift","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"].includes(t.key)}}
|
|
555
|
+
/**
|
|
556
|
+
* @license
|
|
557
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
558
|
+
* SPDX-License-Identifier: MIT
|
|
559
|
+
*/class to extends Yt{isLinkType(){return"link"===this.host.type&&!!this.host.href}getElementTag(){return this.isLinkType()?"a":"button"}getLinkAttributes(){try{const t={};return this.isLinkType()?(t.href=this.host.href,this.host.target&&(t.target=this.host.target,"_blank"===this.host.target&&(t.rel="noopener noreferrer")),t.role="link"):t.role="button",t}catch(t){return this.handleError(t,"getLinkAttributes"),{role:"button"}}}handleLinkNavigation(t){try{this.isLinkType()&&this.dispatchEvent(new CustomEvent("link-navigation",{detail:{href:this.host.href,target:this.host.target,timestamp:Date.now(),originalEvent:t},bubbles:!0,composed:!0}))}catch(t){this.handleError(t,"handleLinkNavigation")}}}
|
|
560
|
+
/**
|
|
561
|
+
* @license
|
|
562
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
563
|
+
* SPDX-License-Identifier: MIT
|
|
564
|
+
*/var oo=function(t,o,e,i){for(var r,n=arguments.length,s=n<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,e):i,a=t.length-1;a>=0;a--)(r=t[a])&&(s=(n<3?r(s):n>3?r(o,e,s):r(o,e))||s);return n>3&&s&&Object.defineProperty(o,e,s),s};let eo=class extends((t=>Gt(Wt(Jt(t))))(Nt)){constructor(){super(...arguments),this.disabled=!1,this.loading=!1,this.size=Ft,this.type="default",this.shape="default",this.block=!1,this.dashed=!1,this.icon=[],this.iconPosition="left",this.href=Ft,this.target=Ft,this.ripple=!0,this.buttonAriaLabel=Ft,this.ariaDescribedBy=Ft,this.htmlType=Ft,this.requiredComponents=["nr-icon"],this.rippleController=new Qt(this),this.keyboardController=new Xt(this),this.linkController=new to(this)}connectedCallback(){super.connectedCallback(),this.validateDependencies()}getCommonAttributes(){return{"data-type":this.type,"data-shape":this.shape,"data-size":this.size||wt,"data-state":this.loading?"loading":wt,"data-theme":this.currentTheme,"data-block":this.block?"true":wt,class:this.dashed?"button-dashed":"","aria-disabled":this.disabled?"true":"false","aria-label":this.buttonAriaLabel||wt,"aria-describedby":this.ariaDescribedBy||wt,tabindex:this.disabled?"-1":"0"}}renderIcon(t){if(!this.isComponentAvailable("nr-icon")){const o="string"==typeof t?t:t.name;return console.warn(`[nr-button] Icon component 'nr-icon' not available. Icon "${o}" will not render. Ensure the icon component is imported and registered.`),wt}const o=()=>{switch(this.size){case"small":return"small";case"medium":default:return"medium";case"large":return"large"}};if("string"==typeof t){const e=o();return gt`<nr-icon name=${t} size=${qt(e)}></nr-icon>`}const{name:e,type:i="solid",size:r,color:n,alt:s}=t,a=r||o();return gt`<nr-icon
|
|
565
|
+
name=${e}
|
|
566
|
+
type=${i}
|
|
567
|
+
alt=${s||""}
|
|
568
|
+
size=${qt(a)}
|
|
569
|
+
color=${n||""}
|
|
570
|
+
></nr-icon>`}handleClick(t){this.disabled?t.preventDefault():(this.rippleController.handleRippleClick(t),this.linkController.isLinkType()&&this.linkController.handleLinkNavigation(t),this.dispatchEventWithMetadata("button-clicked",{type:this.type,disabled:this.disabled,loading:this.loading,href:this.href||null}))}handleKeydown(t){this.keyboardController.handleKeydown(t)}getResolvedLeftIcon(){var t,o;return this.iconLeft?this.iconLeft:(null===(t=this.icons)||void 0===t?void 0:t.left)?this.icons.left:(null===(o=this.icon)||void 0===o?void 0:o.length)>0?this.icon[0]:void 0}getResolvedRightIcon(){var t,o;return this.iconRight?this.iconRight:(null===(t=this.icons)||void 0===t?void 0:t.right)?this.icons.right:2===(null===(o=this.icon)||void 0===o?void 0:o.length)?this.icon[1]:void 0}render(){const t=this.linkController.getElementTag(),o=this.getCommonAttributes(),e=this.linkController.getLinkAttributes(),i=this.getResolvedLeftIcon(),r=this.getResolvedRightIcon(),n=gt`
|
|
571
|
+
<span id="container" part="container">
|
|
572
|
+
${i?this.renderIcon(i):wt}
|
|
573
|
+
<slot id="slot"></slot>
|
|
574
|
+
${r?this.renderIcon(r):wt}
|
|
575
|
+
</span>
|
|
576
|
+
`;return"a"===t?gt`
|
|
577
|
+
<a
|
|
578
|
+
href="${e.href}"
|
|
579
|
+
target="${e.target||wt}"
|
|
580
|
+
rel="${e.rel||wt}"
|
|
581
|
+
role="${e.role}"
|
|
582
|
+
data-type="${o["data-type"]}"
|
|
583
|
+
data-shape="${o["data-shape"]}"
|
|
584
|
+
data-size="${o["data-size"]}"
|
|
585
|
+
data-state="${o["data-state"]}"
|
|
586
|
+
data-theme="${o["data-theme"]}"
|
|
587
|
+
data-block="${o["data-block"]}"
|
|
588
|
+
class="${o.class}"
|
|
589
|
+
aria-disabled="${this.disabled}"
|
|
590
|
+
aria-label="${this.buttonAriaLabel||wt}"
|
|
591
|
+
aria-describedby="${this.ariaDescribedBy||wt}"
|
|
592
|
+
tabindex="${this.disabled?-1:0}"
|
|
593
|
+
@click="${this.handleClick}"
|
|
594
|
+
@keydown="${this.handleKeydown}"
|
|
595
|
+
>
|
|
596
|
+
${n}
|
|
597
|
+
</a>
|
|
598
|
+
`:gt`
|
|
599
|
+
<button
|
|
600
|
+
?disabled="${this.disabled}"
|
|
601
|
+
type="${this.htmlType||"button"}"
|
|
602
|
+
role="${e.role}"
|
|
603
|
+
data-type="${o["data-type"]}"
|
|
604
|
+
data-shape="${o["data-shape"]}"
|
|
605
|
+
data-size="${o["data-size"]}"
|
|
606
|
+
data-state="${o["data-state"]}"
|
|
607
|
+
data-theme="${o["data-theme"]}"
|
|
608
|
+
data-block="${o["data-block"]}"
|
|
609
|
+
class="${o.class}"
|
|
610
|
+
aria-disabled="${this.disabled}"
|
|
611
|
+
aria-label="${this.buttonAriaLabel||wt}"
|
|
612
|
+
aria-describedby="${this.ariaDescribedBy||wt}"
|
|
613
|
+
tabindex="${this.disabled?-1:0}"
|
|
614
|
+
@click="${this.handleClick}"
|
|
615
|
+
@keydown="${this.handleKeydown}"
|
|
616
|
+
>
|
|
617
|
+
${n}
|
|
618
|
+
</button>
|
|
619
|
+
`}};eo.styles=Vt,oo([Pt({type:Boolean})],eo.prototype,"disabled",void 0),oo([Pt({type:Boolean})],eo.prototype,"loading",void 0),oo([Pt({type:String})],eo.prototype,"size",void 0),oo([Pt({type:String})],eo.prototype,"type",void 0),oo([Pt({type:String})],eo.prototype,"shape",void 0),oo([Pt({type:Boolean})],eo.prototype,"block",void 0),oo([Pt({type:Boolean})],eo.prototype,"dashed",void 0),oo([Pt({type:Array})],eo.prototype,"icon",void 0),oo([Pt({type:Object})],eo.prototype,"iconLeft",void 0),oo([Pt({type:Object})],eo.prototype,"iconRight",void 0),oo([Pt({type:Object})],eo.prototype,"icons",void 0),oo([Pt({reflect:!0})],eo.prototype,"iconPosition",void 0),oo([Pt({type:String})],eo.prototype,"href",void 0),oo([Pt({type:String})],eo.prototype,"target",void 0),oo([Pt({type:Boolean})],eo.prototype,"ripple",void 0),oo([Pt({type:String})],eo.prototype,"buttonAriaLabel",void 0),oo([Pt({type:String})],eo.prototype,"ariaDescribedBy",void 0),oo([Pt({type:String})],eo.prototype,"htmlType",void 0),eo=oo([(t=>o=>"function"==typeof o?((t,o)=>(customElements.define(t,o),o))(t,o):((t,o)=>{const{kind:e,elements:i}=o;return{kind:e,elements:i,finisher(o){customElements.define(t,o)}}})(t,o))("nr-button")],eo);export{eo as NrButtonElement};
|