@kodaris/krubble-components 1.0.3 → 1.0.5
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/custom-elements.json +174 -66
- package/dist/button/button.d.ts +34 -3
- package/dist/button/button.d.ts.map +1 -1
- package/dist/button/button.js +193 -38
- package/dist/button/button.js.map +1 -1
- package/dist/krubble.bundled.js +244 -49
- package/dist/krubble.bundled.js.map +1 -1
- package/dist/krubble.bundled.min.js +165 -78
- package/dist/krubble.bundled.min.js.map +1 -1
- package/dist/krubble.umd.js +244 -49
- package/dist/krubble.umd.js.map +1 -1
- package/dist/krubble.umd.min.js +166 -79
- package/dist/krubble.umd.min.js.map +1 -1
- package/dist/snackbar/snackbar.d.ts +16 -6
- package/dist/snackbar/snackbar.d.ts.map +1 -1
- package/dist/snackbar/snackbar.js +52 -12
- package/dist/snackbar/snackbar.js.map +1 -1
- package/package.json +1 -1
package/dist/krubble.umd.min.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
!function(e
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).kr={})}(this,function(t){"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2019 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
-
*/const
|
|
6
|
+
*/const e=globalThis,i=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),s=new WeakMap;let r=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==o)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(i&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=s.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&s.set(e,t))}return t}toString(){return this.cssText}};const n=(t,...e)=>{const i=1===t.length?t[0]:e.reduce((e,i,o)=>e+(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.")})(i)+t[o+1],t[0]);return new r(i,t,o)},a=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new r("string"==typeof t?t:t+"",void 0,o))(e)})(t):t,{is:l,defineProperty:d,getOwnPropertyDescriptor:c,getOwnPropertyNames:h,getOwnPropertySymbols:p,getPrototypeOf:u}=Object,f=globalThis,b=f.trustedTypes,g=b?b.emptyScript:"",m=f.reactiveElementPolyfillSupport,v=(t,e)=>t,y={toAttribute(t,e){switch(e){case Boolean:t=t?g:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},x=(t,e)=>!l(t,e),_={attribute:!0,type:String,converter:y,reflect:!1,useDefault:!1,hasChanged:x};
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;let
|
|
11
|
+
*/Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;let k=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=_){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 i=Symbol(),o=this.getPropertyDescriptor(t,i,e);void 0!==o&&d(this.prototype,t,o)}}static getPropertyDescriptor(t,e,i){const{get:o,set:s}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:o,set(e){const r=o?.call(this);s?.call(this,e),this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??_}static _$Ei(){if(this.hasOwnProperty(v("elementProperties")))return;const t=u(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(v("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(v("properties"))){const t=this.properties,e=[...h(t),...p(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"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 i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,o)=>{if(i)t.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of o){const o=document.createElement("style"),s=e.litNonce;void 0!==s&&o.setAttribute("nonce",s),o.textContent=i.cssText,t.appendChild(o)}})(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,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,i);if(void 0!==o&&!0===i.reflect){const s=(void 0!==i.converter?.toAttribute?i.converter:y).toAttribute(e,i.type);this._$Em=t,null==s?this.removeAttribute(o):this.setAttribute(o,s),this._$Em=null}}_$AK(t,e){const i=this.constructor,o=i._$Eh.get(t);if(void 0!==o&&this._$Em!==o){const t=i.getPropertyOptions(o),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:y;this._$Em=o;const r=s.fromAttribute(e,t.type);this[o]=r??this._$Ej?.get(o)??r,this._$Em=null}}requestUpdate(t,e,i,o=!1,s){if(void 0!==t){const r=this.constructor;if(!1===o&&(s=this[t]),i??=r.getPropertyOptions(t),!((i.hasChanged??x)(s,e)||i.useDefault&&i.reflect&&s===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:o,wrapped:s},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??e??this[t]),!0!==s||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===o&&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,i]of t){const{wrapped:t}=i,o=this[e];!0!==t||this._$AL.has(e)||void 0===o||this.C(e,void 0,i,o)}}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){}};k.elementStyles=[],k.shadowRootOptions={mode:"open"},k[v("elementProperties")]=new Map,k[v("finalized")]=new Map,m?.({ReactiveElement:k}),(f.reactiveElementVersions??=[]).push("2.1.2");
|
|
12
12
|
/**
|
|
13
13
|
* @license
|
|
14
14
|
* Copyright 2017 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
const
|
|
17
|
+
const $=globalThis,w=t=>t,A=$.trustedTypes,R=A?A.createPolicy("lit-html",{createHTML:t=>t}):void 0,S="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,C="?"+E,T=`<${C}>`,P=document,K=()=>P.createComment(""),O=t=>null===t||"object"!=typeof t&&"function"!=typeof t,M=Array.isArray,z="[ \t\n\f\r]",H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,j=/>/g,D=RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),U=/'/g,B=/"/g,N=/^(?:script|style|textarea|title)$/i,F=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),V=Symbol.for("lit-noChange"),I=Symbol.for("lit-nothing"),q=new WeakMap,W=P.createTreeWalker(P,129);function X(t,e){if(!M(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==R?R.createHTML(e):e}const J=(t,e)=>{const i=t.length-1,o=[];let s,r=2===e?"<svg>":3===e?"<math>":"",n=H;for(let e=0;e<i;e++){const i=t[e];let a,l,d=-1,c=0;for(;c<i.length&&(n.lastIndex=c,l=n.exec(i),null!==l);)c=n.lastIndex,n===H?"!--"===l[1]?n=L:void 0!==l[1]?n=j:void 0!==l[2]?(N.test(l[2])&&(s=RegExp("</"+l[2],"g")),n=D):void 0!==l[3]&&(n=D):n===D?">"===l[0]?(n=s??H,d=-1):void 0===l[1]?d=-2:(d=n.lastIndex-l[2].length,a=l[1],n=void 0===l[3]?D:'"'===l[3]?B:U):n===B||n===U?n=D:n===L||n===j?n=H:(n=D,s=void 0);const h=n===D&&t[e+1].startsWith("/>")?" ":"";r+=n===H?i+T:d>=0?(o.push(a),i.slice(0,d)+S+i.slice(d)+E+h):i+E+(-2===d?e:h)}return[X(t,r+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),o]};class Z{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let s=0,r=0;const n=t.length-1,a=this.parts,[l,d]=J(t,e);if(this.el=Z.createElement(l,i),W.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(o=W.nextNode())&&a.length<n;){if(1===o.nodeType){if(o.hasAttributes())for(const t of o.getAttributeNames())if(t.endsWith(S)){const e=d[r++],i=o.getAttribute(t).split(E),n=/([.?@])?(.*)/.exec(e);a.push({type:1,index:s,name:n[2],strings:i,ctor:"."===n[1]?et:"?"===n[1]?it:"@"===n[1]?ot:tt}),o.removeAttribute(t)}else t.startsWith(E)&&(a.push({type:6,index:s}),o.removeAttribute(t));if(N.test(o.tagName)){const t=o.textContent.split(E),e=t.length-1;if(e>0){o.textContent=A?A.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],K()),W.nextNode(),a.push({type:2,index:++s});o.append(t[e],K())}}}else if(8===o.nodeType)if(o.data===C)a.push({type:2,index:s});else{let t=-1;for(;-1!==(t=o.data.indexOf(E,t+1));)a.push({type:7,index:s}),t+=E.length-1}s++}}static createElement(t,e){const i=P.createElement("template");return i.innerHTML=t,i}}function G(t,e,i=t,o){if(e===V)return e;let s=void 0!==o?i._$Co?.[o]:i._$Cl;const r=O(e)?void 0:e._$litDirective$;return s?.constructor!==r&&(s?._$AO?.(!1),void 0===r?s=void 0:(s=new r(t),s._$AT(t,i,o)),void 0!==o?(i._$Co??=[])[o]=s:i._$Cl=s),void 0!==s&&(e=G(t,s._$AS(t,e.values),s,o)),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:i}=this._$AD,o=(t?.creationScope??P).importNode(e,!0);W.currentNode=o;let s=W.nextNode(),r=0,n=0,a=i[0];for(;void 0!==a;){if(r===a.index){let e;2===a.type?e=new Y(s,s.nextSibling,this,t):1===a.type?e=new a.ctor(s,a.name,a.strings,this,t):6===a.type&&(e=new st(s,this,t)),this._$AV.push(e),a=i[++n]}r!==a?.index&&(s=W.nextNode(),r++)}return W.currentNode=P,o}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class Y{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,o){this.type=2,this._$AH=I,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$Cv=o?.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),O(t)?t===I||null==t||""===t?(this._$AH!==I&&this._$AR(),this._$AH=I):t!==this._$AH&&t!==V&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>M(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!==I&&O(this._$AH)?this._$AA.nextSibling.data=t:this.T(P.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,o="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=Z.createElement(X(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===o)this._$AH.p(e);else{const t=new Q(o,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=q.get(t.strings);return void 0===e&&q.set(t.strings,e=new Z(t)),e}k(t){M(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const s of t)o===e.length?e.push(i=new Y(this.O(K()),this.O(K()),this,this.options)):i=e[o],i._$AI(s),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=w(t).nextSibling;w(t).remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class tt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,o,s){this.type=1,this._$AH=I,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=s,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=I}_$AI(t,e=this,i,o){const s=this.strings;let r=!1;if(void 0===s)t=G(this,t,e,0),r=!O(t)||t!==this._$AH&&t!==V,r&&(this._$AH=t);else{const o=t;let n,a;for(t=s[0],n=0;n<s.length-1;n++)a=G(this,o[i+n],e,n),a===V&&(a=this._$AH[n]),r||=!O(a)||a!==this._$AH[n],a===I?t=I:t!==I&&(t+=(a??"")+s[n+1]),this._$AH[n]=a}r&&!o&&this.j(t)}j(t){t===I?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class et extends tt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===I?void 0:t}}class it extends tt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==I)}}class ot extends tt{constructor(t,e,i,o,s){super(t,e,i,o,s),this.type=5}_$AI(t,e=this){if((t=G(this,t,e,0)??I)===V)return;const i=this._$AH,o=t===I&&i!==I||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,s=t!==I&&(i===I||o);o&&this.element.removeEventListener(this.name,this,i),s&&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 st{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){G(this,t)}}const rt=$.litHtmlPolyfillSupport;rt?.(Z,Y),($.litHtmlVersions??=[]).push("3.3.2");const nt=globalThis;
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/let
|
|
22
|
+
*/let at=class extends k{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,i)=>{const o=i?.renderBefore??e;let s=o._$litPart$;if(void 0===s){const t=i?.renderBefore??null;o._$litPart$=s=new Y(e.insertBefore(K(),t),t,void 0,i??{})}return s._$AI(t),s})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}};at._$litElement$=!0,at.finalized=!0,nt.litElementHydrateSupport?.({LitElement:at});const lt=nt.litElementPolyfillSupport;lt?.({LitElement:at}),(nt.litElementVersions??=[]).push("4.2.2");
|
|
23
23
|
/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
27
|
*/
|
|
28
|
-
const
|
|
28
|
+
const dt=t=>(e,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},ct={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},ht=(t=ct,e,i)=>{const{kind:o,metadata:s}=i;let r=globalThis.litPropertyMetadata.get(s);if(void 0===r&&globalThis.litPropertyMetadata.set(s,r=new Map),"setter"===o&&((t=Object.create(t)).wrapped=!0),r.set(i.name,t),"accessor"===o){const{name:o}=i;return{set(i){const s=e.get.call(this);e.set.call(this,i),this.requestUpdate(o,s,t,!0,i)},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===o){const{name:o}=i;return function(i){const s=this[o];e.call(this,i),this.requestUpdate(o,s,t,!0,i)}}throw Error("Unsupported decorator location: "+o)};
|
|
29
29
|
/**
|
|
30
30
|
* @license
|
|
31
31
|
* Copyright 2017 Google LLC
|
|
32
32
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
|
-
*/function
|
|
33
|
+
*/function pt(t){return(e,i)=>"object"==typeof i?ht(t,e,i):((t,e,i)=>{const o=e.hasOwnProperty(i);return e.constructor.createProperty(i,t),o?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)}
|
|
34
34
|
/**
|
|
35
35
|
* @license
|
|
36
36
|
* Copyright 2017 Google LLC
|
|
37
37
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
38
|
-
*/function
|
|
38
|
+
*/function ut(t){return pt({...t,state:!0,attribute:!1})}
|
|
39
39
|
/**
|
|
40
40
|
* @license
|
|
41
41
|
* Copyright 2017 Google LLC
|
|
42
42
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
43
|
-
*/var
|
|
43
|
+
*/var ft=function(t,e,i,o){var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};t.KRAccordion=class extends at{constructor(){super(...arguments),this.header="",this.expanded=!1}toggle(){this.expanded=!this.expanded}render(){return F`
|
|
44
44
|
<div class="header" @click=${this.toggle}>
|
|
45
45
|
<span class="header__title">${this.header}</span>
|
|
46
46
|
<svg class="header__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
@@ -54,7 +54,7 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(e,t)}
|
|
|
54
54
|
</div>
|
|
55
55
|
</div>
|
|
56
56
|
</div>
|
|
57
|
-
`}},
|
|
57
|
+
`}},t.KRAccordion.styles=n`
|
|
58
58
|
:host {
|
|
59
59
|
display: block;
|
|
60
60
|
margin-bottom: 16px;
|
|
@@ -106,23 +106,23 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(e,t)}
|
|
|
106
106
|
.content__body {
|
|
107
107
|
padding: 16px 16px 8px 16px;
|
|
108
108
|
}
|
|
109
|
-
`,
|
|
109
|
+
`,ft([pt({type:String})],t.KRAccordion.prototype,"header",void 0),ft([pt({type:Boolean,reflect:!0})],t.KRAccordion.prototype,"expanded",void 0),t.KRAccordion=ft([dt("kr-accordion")],t.KRAccordion);
|
|
110
110
|
/**
|
|
111
111
|
* @license
|
|
112
112
|
* Copyright 2017 Google LLC
|
|
113
113
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
114
114
|
*/
|
|
115
|
-
const
|
|
115
|
+
const bt=1,gt=2,mt=3,vt=4,yt=t=>(...e)=>({_$litDirective$:t,values:e});class xt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
|
|
116
116
|
/**
|
|
117
117
|
* @license
|
|
118
118
|
* Copyright 2018 Google LLC
|
|
119
119
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
120
|
-
*/const
|
|
120
|
+
*/const _t=yt(class extends xt{constructor(t){if(super(t),t.type!==bt||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in e)e[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(e)}const i=t.element.classList;for(const t of this.st)t in e||(i.remove(t),this.st.delete(t));for(const t in e){const o=!!e[t];o===this.st.has(t)||this.nt?.has(t)||(o?(i.add(t),this.st.add(t)):(i.remove(t),this.st.delete(t)))}return V}});var kt=function(t,e,i,o){var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};t.KRAlert=class extends at{constructor(){super(...arguments),this.type="info",this.dismissible=!1,this.visible=!0}_handleDismiss(){this.visible=!1,this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0}))}render(){const t={info:F`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/></svg>`,success:F`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/></svg>`,warning:F`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/></svg>`,error:F`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/></svg>`};return F`
|
|
121
121
|
<div
|
|
122
|
-
class=${
|
|
122
|
+
class=${_t({alert:!0,["alert--"+this.type]:!0,"alert--hidden":!this.visible})}
|
|
123
123
|
role="alert"
|
|
124
124
|
>
|
|
125
|
-
${
|
|
125
|
+
${t[this.type]}
|
|
126
126
|
<div class="content">
|
|
127
127
|
${this.header?F`<h4 class="header">${this.header}</h4>`:I}
|
|
128
128
|
<div class="message">
|
|
@@ -142,7 +142,7 @@ const be=1,ge=2,ve=3,me=4,ye=e=>(...t)=>({_$litDirective$:e,values:t});class xe{
|
|
|
142
142
|
</button>
|
|
143
143
|
`:I}
|
|
144
144
|
</div>
|
|
145
|
-
`}},
|
|
145
|
+
`}},t.KRAlert.styles=n`
|
|
146
146
|
:host {
|
|
147
147
|
display: block;
|
|
148
148
|
}
|
|
@@ -249,125 +249,193 @@ const be=1,ge=2,ve=3,me=4,ye=e=>(...t)=>({_$litDirective$:e,values:t});class xe{
|
|
|
249
249
|
outline: 2px solid #3b82f6;
|
|
250
250
|
outline-offset: 2px;
|
|
251
251
|
}
|
|
252
|
-
|
|
253
|
-
<
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
<slot></slot>
|
|
259
|
-
</button>
|
|
260
|
-
`}},e.KRButton.styles=n`
|
|
252
|
+
`,kt([pt({type:String})],t.KRAlert.prototype,"type",void 0),kt([pt({type:String})],t.KRAlert.prototype,"header",void 0),kt([pt({type:Boolean})],t.KRAlert.prototype,"dismissible",void 0),kt([pt({type:Boolean})],t.KRAlert.prototype,"visible",void 0),t.KRAlert=kt([dt("kr-alert")],t.KRAlert);var $t=function(t,e,i,o){var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};t.KRButton=class extends at{constructor(){super(...arguments),this.variant="flat",this.color="primary",this.size="medium",this.disabled=!1,this._state="idle",this._stateText="",this._handleKeydown=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.click())}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._handleKeydown)}showLoading(){this._clearStateTimeout(),this._state="loading",this._stateText=""}showSuccess(t="Success",e=2e3){this._clearStateTimeout(),this._state="success",this._stateText=t,this._stateTimeout=window.setTimeout(()=>this.reset(),e)}showError(t="Error",e=2e3){this._clearStateTimeout(),this._state="error",this._stateText=t,this._stateTimeout=window.setTimeout(()=>this.reset(),e)}reset(){this._clearStateTimeout(),this._state="idle",this._stateText=""}_clearStateTimeout(){this._stateTimeout&&(clearTimeout(this._stateTimeout),this._stateTimeout=void 0)}updated(t){this.classList.toggle("kr-button--loading","loading"===this._state),this.classList.toggle("kr-button--success","success"===this._state),this.classList.toggle("kr-button--error","error"===this._state),this.classList.toggle(`kr-button--${this.variant}`,!0),this.classList.toggle(`kr-button--${this.color}`,!0),this.classList.toggle("kr-button--small","small"===this.size),this.classList.toggle("kr-button--large","large"===this.size)}render(){return F`
|
|
253
|
+
<slot></slot>
|
|
254
|
+
${"idle"!==this._state?F`<span class="state-overlay">
|
|
255
|
+
${"loading"===this._state?F`<span class="spinner"></span>`:this._stateText}
|
|
256
|
+
</span>`:""}
|
|
257
|
+
`}},t.KRButton.styles=n`
|
|
261
258
|
:host {
|
|
262
|
-
display: inline-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
259
|
+
display: inline-flex;
|
|
260
|
+
position: relative;
|
|
261
|
+
align-items: center;
|
|
262
|
+
justify-content: center;
|
|
266
263
|
font-family: inherit;
|
|
267
264
|
font-size: 14px;
|
|
268
265
|
font-weight: 400;
|
|
269
266
|
letter-spacing: 0.01em;
|
|
270
267
|
padding: 0 22px;
|
|
271
268
|
height: 36px;
|
|
272
|
-
line-height: 36px;
|
|
273
269
|
border: none;
|
|
274
270
|
border-radius: 20px;
|
|
275
271
|
cursor: pointer;
|
|
276
272
|
transition: background 0.15s ease;
|
|
273
|
+
user-select: none;
|
|
274
|
+
box-sizing: border-box;
|
|
277
275
|
}
|
|
278
276
|
|
|
279
|
-
|
|
280
|
-
|
|
277
|
+
:host([disabled]),
|
|
278
|
+
:host(.kr-button--loading),
|
|
279
|
+
:host(.kr-button--success),
|
|
280
|
+
:host(.kr-button--error) {
|
|
281
|
+
cursor: not-allowed;
|
|
282
|
+
pointer-events: none;
|
|
281
283
|
}
|
|
282
284
|
|
|
283
|
-
button:
|
|
285
|
+
:host([disabled]:not(.kr-button--loading):not(.kr-button--success):not(.kr-button--error)) {
|
|
284
286
|
opacity: 0.5;
|
|
285
|
-
cursor: not-allowed;
|
|
286
287
|
}
|
|
287
288
|
|
|
288
|
-
/*
|
|
289
|
-
|
|
289
|
+
/* Flat + Primary (default) */
|
|
290
|
+
:host,
|
|
291
|
+
:host(.kr-button--flat.kr-button--primary) {
|
|
290
292
|
background: #163052;
|
|
291
293
|
color: white;
|
|
292
294
|
}
|
|
293
295
|
|
|
294
|
-
|
|
296
|
+
:host(:hover:not([disabled])),
|
|
297
|
+
:host(.kr-button--flat.kr-button--primary:hover:not([disabled])) {
|
|
295
298
|
background: #0e1f35;
|
|
296
299
|
}
|
|
297
300
|
|
|
298
|
-
|
|
301
|
+
/* Flat + Secondary */
|
|
302
|
+
:host(.kr-button--flat.kr-button--secondary) {
|
|
299
303
|
background: #f3f4f6;
|
|
300
304
|
color: #374151;
|
|
301
305
|
}
|
|
302
306
|
|
|
303
|
-
button.secondary:hover:not(
|
|
307
|
+
:host(.kr-button--flat.kr-button--secondary:hover:not([disabled])) {
|
|
304
308
|
background: #e5e7eb;
|
|
305
309
|
}
|
|
306
310
|
|
|
307
|
-
|
|
311
|
+
/* Outline + Primary */
|
|
312
|
+
:host(.kr-button--outline.kr-button--primary) {
|
|
313
|
+
background: transparent;
|
|
314
|
+
border: 1px solid #163052;
|
|
315
|
+
color: #163052;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
:host(.kr-button--outline.kr-button--primary:hover:not([disabled])) {
|
|
319
|
+
background: rgba(22, 48, 82, 0.05);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/* Outline + Secondary */
|
|
323
|
+
:host(.kr-button--outline.kr-button--secondary) {
|
|
308
324
|
background: transparent;
|
|
309
325
|
border: 1px solid #d1d5db;
|
|
310
326
|
color: #374151;
|
|
311
|
-
box-shadow: none;
|
|
312
327
|
}
|
|
313
328
|
|
|
314
|
-
button.
|
|
329
|
+
:host(.kr-button--outline.kr-button--secondary:hover:not([disabled])) {
|
|
315
330
|
background: #f9fafb;
|
|
316
331
|
border-color: #9ca3af;
|
|
317
|
-
box-shadow: none;
|
|
318
332
|
}
|
|
319
333
|
|
|
320
334
|
/* Sizes */
|
|
321
|
-
button
|
|
335
|
+
:host(.kr-button--small) {
|
|
322
336
|
font-size: 13px;
|
|
323
337
|
height: 28px;
|
|
324
|
-
line-height: 28px;
|
|
325
338
|
padding: 0 16px;
|
|
326
339
|
}
|
|
327
340
|
|
|
328
|
-
button
|
|
329
|
-
font-size:
|
|
341
|
+
:host(.kr-button--large) {
|
|
342
|
+
font-size: 16px;
|
|
330
343
|
height: 44px;
|
|
331
|
-
line-height: 44px;
|
|
332
344
|
padding: 0 24px;
|
|
345
|
+
border-radius: 30px;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/* State colors */
|
|
349
|
+
:host(.kr-button--success) {
|
|
350
|
+
background: #198754 !important;
|
|
351
|
+
color: white !important;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
:host(.kr-button--error) {
|
|
355
|
+
background: rgb(220, 53, 69) !important;
|
|
356
|
+
color: white !important;
|
|
333
357
|
}
|
|
334
|
-
|
|
358
|
+
|
|
359
|
+
/* Content */
|
|
360
|
+
:host(.kr-button--loading) slot,
|
|
361
|
+
:host(.kr-button--success) slot,
|
|
362
|
+
:host(.kr-button--error) slot {
|
|
363
|
+
visibility: hidden;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/* State overlay */
|
|
367
|
+
.state-overlay {
|
|
368
|
+
position: absolute;
|
|
369
|
+
inset: 0;
|
|
370
|
+
display: flex;
|
|
371
|
+
align-items: center;
|
|
372
|
+
justify-content: center;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/* Spinner */
|
|
376
|
+
@keyframes kr-spin {
|
|
377
|
+
to {
|
|
378
|
+
transform: rotate(360deg);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.spinner {
|
|
383
|
+
width: 12px;
|
|
384
|
+
height: 12px;
|
|
385
|
+
border: 2.5px solid currentColor;
|
|
386
|
+
border-top-color: transparent;
|
|
387
|
+
border-radius: 50%;
|
|
388
|
+
animation: kr-spin 0.6s linear infinite;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
:host(.kr-button--small) .spinner {
|
|
392
|
+
width: 10px;
|
|
393
|
+
height: 10px;
|
|
394
|
+
border-width: 2px;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
:host(.kr-button--large) .spinner {
|
|
398
|
+
width: 16px;
|
|
399
|
+
height: 16px;
|
|
400
|
+
border-width: 3px;
|
|
401
|
+
}
|
|
402
|
+
`,$t([pt({type:String,reflect:!0})],t.KRButton.prototype,"variant",void 0),$t([pt({type:String,reflect:!0})],t.KRButton.prototype,"color",void 0),$t([pt({type:String,reflect:!0})],t.KRButton.prototype,"size",void 0),$t([pt({type:Boolean,reflect:!0})],t.KRButton.prototype,"disabled",void 0),$t([ut()],t.KRButton.prototype,"_state",void 0),$t([ut()],t.KRButton.prototype,"_stateText",void 0),t.KRButton=$t([dt("kr-button")],t.KRButton);
|
|
335
403
|
/**
|
|
336
404
|
* @license
|
|
337
405
|
* Copyright 2017 Google LLC
|
|
338
406
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
339
407
|
*/
|
|
340
|
-
class
|
|
408
|
+
class wt extends xt{constructor(t){if(super(t),this.it=I,t.type!==gt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===I||null==t)return this._t=void 0,this.it=t;if(t===V)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}wt.directiveName="unsafeHTML",wt.resultType=1;const At=yt(wt);var Rt=function(t,e,i,o){var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};t.KRCodeDemo=class extends at{constructor(){super(...arguments),this.language="html",this.code="",this.activeTab="preview",this.copied=!1}setTab(t){this.activeTab=t}getHighlightedCode(){return this.code?window.Prism&&window.Prism.languages[this.language]?window.Prism.highlight(this.code,window.Prism.languages[this.language],this.language):this.escapeHtml(this.code):""}escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}async copyCode(){if(this.code)try{await navigator.clipboard.writeText(this.code),this.copied=!0,setTimeout(()=>{this.copied=!1},2e3)}catch(t){console.error("Failed to copy code:",t)}}render(){return F`
|
|
341
409
|
<div class="tabs">
|
|
342
410
|
<button
|
|
343
|
-
class=${
|
|
411
|
+
class=${_t({tab:!0,"tab--active":"preview"===this.activeTab})}
|
|
344
412
|
@click=${()=>this.setTab("preview")}
|
|
345
413
|
>
|
|
346
414
|
Preview
|
|
347
415
|
</button>
|
|
348
416
|
<button
|
|
349
|
-
class=${
|
|
417
|
+
class=${_t({tab:!0,"tab--active":"code"===this.activeTab})}
|
|
350
418
|
@click=${()=>this.setTab("code")}
|
|
351
419
|
>
|
|
352
420
|
Code
|
|
353
421
|
</button>
|
|
354
422
|
</div>
|
|
355
423
|
|
|
356
|
-
<div class=${
|
|
424
|
+
<div class=${_t({panel:!0,"panel--active":"preview"===this.activeTab,preview:!0})}>
|
|
357
425
|
<slot name="preview"></slot>
|
|
358
426
|
</div>
|
|
359
427
|
|
|
360
|
-
<div class=${
|
|
428
|
+
<div class=${_t({panel:!0,"panel--active":"code"===this.activeTab,"code-container":!0})}>
|
|
361
429
|
<button
|
|
362
|
-
class=${
|
|
430
|
+
class=${_t({"copy-btn":!0,"copy-btn--copied":this.copied})}
|
|
363
431
|
@click=${this.copyCode}
|
|
364
432
|
>
|
|
365
433
|
${this.copied?"Copied!":"Copy"}
|
|
366
434
|
</button>
|
|
367
|
-
<pre class="code"><code>${
|
|
435
|
+
<pre class="code"><code>${At(this.getHighlightedCode())}</code></pre>
|
|
368
436
|
</div>
|
|
369
437
|
|
|
370
|
-
`}},
|
|
438
|
+
`}},t.KRCodeDemo.styles=n`
|
|
371
439
|
:host {
|
|
372
440
|
display: block;
|
|
373
441
|
border: 1px solid #e9ecef;
|
|
@@ -526,20 +594,20 @@ class we extends xe{constructor(e){if(super(e),this.it=I,e.type!==ge)throw Error
|
|
|
526
594
|
.code .token.variable {
|
|
527
595
|
color: #fab387;
|
|
528
596
|
}
|
|
529
|
-
`,
|
|
597
|
+
`,Rt([pt({type:String})],t.KRCodeDemo.prototype,"language",void 0),Rt([pt({type:String})],t.KRCodeDemo.prototype,"code",void 0),Rt([ut()],t.KRCodeDemo.prototype,"activeTab",void 0),Rt([ut()],t.KRCodeDemo.prototype,"copied",void 0),t.KRCodeDemo=Rt([dt("kr-code-demo")],t.KRCodeDemo);var St=function(t,e,i,o){var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};t.KRContextMenu=class extends at{constructor(){super(...arguments),this.items=[],this.resolvePromise=null,this.boundHandleOutsideClick=this.handleOutsideClick.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this)}static async open(t){const e=document.querySelector("kr-context-menu");e&&e.remove();const i=document.createElement("kr-context-menu");return document.body.appendChild(i),i.show(t)}async show(t){this.items=t.items,this.style.left=`${t.x}px`,this.style.top=`${t.y}px`,await this.updateComplete;const e=this.getBoundingClientRect();return e.right>window.innerWidth&&(this.style.left=t.x-e.width+"px"),e.bottom>window.innerHeight&&(this.style.top=t.y-e.height+"px"),requestAnimationFrame(()=>{document.addEventListener("click",this.boundHandleOutsideClick),document.addEventListener("contextmenu",this.boundHandleOutsideClick),document.addEventListener("keydown",this.boundHandleKeyDown)}),new Promise(t=>{this.resolvePromise=t})}handleOutsideClick(t){this.contains(t.target)||this.close(null)}handleKeyDown(t){"Escape"===t.key&&this.close(null)}handleItemClick(t){t.disabled||t.divider||this.close(t)}close(t){document.removeEventListener("click",this.boundHandleOutsideClick),document.removeEventListener("contextmenu",this.boundHandleOutsideClick),document.removeEventListener("keydown",this.boundHandleKeyDown),this.resolvePromise&&(this.resolvePromise(t),this.resolvePromise=null),this.remove()}render(){return F`
|
|
530
598
|
<div class="menu">
|
|
531
|
-
${this.items.map(
|
|
599
|
+
${this.items.map(t=>t.divider?F`<div class="menu__divider"></div>`:F`
|
|
532
600
|
<button
|
|
533
601
|
class="menu__item"
|
|
534
|
-
?disabled=${
|
|
535
|
-
@click=${()=>this.handleItemClick(
|
|
602
|
+
?disabled=${t.disabled}
|
|
603
|
+
@click=${()=>this.handleItemClick(t)}
|
|
536
604
|
>
|
|
537
|
-
${
|
|
538
|
-
${
|
|
605
|
+
${t.icon?F`<span class="menu__item-icon">${t.icon}</span>`:null}
|
|
606
|
+
${t.label}
|
|
539
607
|
</button>
|
|
540
608
|
`)}
|
|
541
609
|
</div>
|
|
542
|
-
`}},
|
|
610
|
+
`}},t.KRContextMenu.styles=n`
|
|
543
611
|
:host {
|
|
544
612
|
position: fixed;
|
|
545
613
|
z-index: 10000;
|
|
@@ -594,12 +662,12 @@ class we extends xe{constructor(e){if(super(e),this.it=I,e.type!==ge)throw Error
|
|
|
594
662
|
background: rgba(255, 255, 255, 0.1);
|
|
595
663
|
margin: 4px 0;
|
|
596
664
|
}
|
|
597
|
-
`,
|
|
665
|
+
`,St([ut()],t.KRContextMenu.prototype,"items",void 0),t.KRContextMenu=St([dt("kr-context-menu")],t.KRContextMenu);var Et=function(t,e,i,o){var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};class Ct{constructor(){this.resolvePromise=null,this.dialogElement=null,this.promise=new Promise(t=>{this.resolvePromise=t})}setDialogElement(t){this.dialogElement=t}close(t){this.resolvePromise&&(this.resolvePromise(t),this.resolvePromise=null),this.dialogElement?.remove()}afterClosed(){return this.promise}}t.KRDialog=class extends at{constructor(){super(...arguments),this.contentElement=null,this.dialogRef=null,this.boundHandleKeyDown=this.handleKeyDown.bind(this)}static open(t,e){const i=document.querySelector("kr-dialog");i&&i.remove();const o=new Ct,s=document.createElement("kr-dialog");o.setDialogElement(s),s.dialogRef=o;const r=new t;return r.dialogRef=o,e?.data&&(r.data=e.data),s.contentElement=r,document.body.appendChild(s),document.addEventListener("keydown",s.boundHandleKeyDown),o}handleKeyDown(t){"Escape"===t.key&&this.dialogRef?.close(void 0)}handleBackdropClick(t){t.target.classList.contains("backdrop")&&this.dialogRef?.close(void 0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.boundHandleKeyDown)}render(){return F`
|
|
598
666
|
<div class="backdrop" @click=${this.handleBackdropClick}></div>
|
|
599
667
|
<div class="dialog">
|
|
600
668
|
${this.contentElement}
|
|
601
669
|
</div>
|
|
602
|
-
`}},
|
|
670
|
+
`}},t.KRDialog.styles=n`
|
|
603
671
|
:host {
|
|
604
672
|
position: fixed;
|
|
605
673
|
inset: 0;
|
|
@@ -624,9 +692,12 @@ class we extends xe{constructor(e){if(super(e),this.it=I,e.type!==ge)throw Error
|
|
|
624
692
|
max-height: 90vh;
|
|
625
693
|
overflow: auto;
|
|
626
694
|
}
|
|
627
|
-
`,
|
|
628
|
-
${
|
|
629
|
-
<div class="
|
|
695
|
+
`,Et([ut()],t.KRDialog.prototype,"contentElement",void 0),t.KRDialog=Et([dt("kr-dialog")],t.KRDialog);var Tt,Pt=function(t,e,i,o){var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};t.KRSnackbar=Tt=class extends at{constructor(){super(...arguments),this.dismissTimeout=null,this.type="info",this.title="",this.message="",this.duration=5e3}static show(t){const e=document.createElement("kr-snackbar");return e.message=t.message,e.title=t.title??"",e.type=t.type??"info",void 0!==t.duration?e.duration=t.duration:"error"===e.type?e.duration=0:e.duration=5e3,document.body.appendChild(e),e}connectedCallback(){super.connectedCallback(),this.setAttribute("role","alert"),this.classList.add(`kr-snackbar--${this.type}`),this.title&&this.classList.add("kr-snackbar--has-title"),Tt.activeSnackbars.push(this),this.updatePositions(),this.duration>0&&(this.dismissTimeout=window.setTimeout(()=>{this.dismiss()},this.duration))}disconnectedCallback(){super.disconnectedCallback();const t=Tt.activeSnackbars.indexOf(this);t>-1&&Tt.activeSnackbars.splice(t,1),this.updatePositions(),this.dismissTimeout&&clearTimeout(this.dismissTimeout)}updatePositions(){let t=24;for(const e of Tt.activeSnackbars)e.style.bottom=`${t}px`,t+=e.offsetHeight+8}dismiss(){this.dismissTimeout&&(clearTimeout(this.dismissTimeout),this.dismissTimeout=null),this.classList.add("kr-snackbar--closing"),this.addEventListener("animationend",()=>{this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0})),this.remove()},{once:!0})}render(){const t={info:F`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/></svg>`,success:F`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/></svg>`,warning:F`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/></svg>`,error:F`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/></svg>`};return F`
|
|
696
|
+
${t[this.type]}
|
|
697
|
+
<div class="content">
|
|
698
|
+
${this.title?F`<div class="title">${this.title}</div>`:""}
|
|
699
|
+
<div class="message">${this.message}</div>
|
|
700
|
+
</div>
|
|
630
701
|
<button
|
|
631
702
|
class="dismiss"
|
|
632
703
|
type="button"
|
|
@@ -637,7 +708,7 @@ class we extends xe{constructor(e){if(super(e),this.it=I,e.type!==ge)throw Error
|
|
|
637
708
|
<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/>
|
|
638
709
|
</svg>
|
|
639
710
|
</button>
|
|
640
|
-
`}},
|
|
711
|
+
`}},t.KRSnackbar.styles=n`
|
|
641
712
|
:host,
|
|
642
713
|
*,
|
|
643
714
|
*::before,
|
|
@@ -663,6 +734,10 @@ class we extends xe{constructor(e){if(super(e),this.it=I,e.type!==ge)throw Error
|
|
|
663
734
|
animation: slideIn 0.2s ease-out;
|
|
664
735
|
}
|
|
665
736
|
|
|
737
|
+
:host(.kr-snackbar--has-title) {
|
|
738
|
+
align-items: flex-start;
|
|
739
|
+
}
|
|
740
|
+
|
|
666
741
|
@keyframes slideIn {
|
|
667
742
|
from {
|
|
668
743
|
opacity: 0;
|
|
@@ -734,10 +809,22 @@ class we extends xe{constructor(e){if(super(e),this.it=I,e.type!==ge)throw Error
|
|
|
734
809
|
flex-shrink: 0;
|
|
735
810
|
width: 20px;
|
|
736
811
|
height: 20px;
|
|
812
|
+
margin-top: 1px;
|
|
737
813
|
}
|
|
738
814
|
|
|
739
|
-
.
|
|
815
|
+
.content {
|
|
740
816
|
flex: 1;
|
|
817
|
+
min-width: 0;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
.title {
|
|
821
|
+
font-size: 14px;
|
|
822
|
+
font-weight: 600;
|
|
823
|
+
color: #000000;
|
|
824
|
+
margin: 0 0 2px 0;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
.message {
|
|
741
828
|
font-size: 14px;
|
|
742
829
|
color: #000000;
|
|
743
830
|
margin: 0;
|
|
@@ -768,18 +855,18 @@ class we extends xe{constructor(e){if(super(e),this.it=I,e.type!==ge)throw Error
|
|
|
768
855
|
outline: 2px solid #3b82f6;
|
|
769
856
|
outline-offset: 2px;
|
|
770
857
|
}
|
|
771
|
-
`,
|
|
858
|
+
`,t.KRSnackbar.activeSnackbars=[],Pt([pt({type:String})],t.KRSnackbar.prototype,"type",void 0),Pt([pt({type:String})],t.KRSnackbar.prototype,"title",void 0),Pt([pt({type:String})],t.KRSnackbar.prototype,"message",void 0),Pt([pt({type:Number})],t.KRSnackbar.prototype,"duration",void 0),t.KRSnackbar=Tt=Pt([dt("kr-snackbar")],t.KRSnackbar);
|
|
772
859
|
/**
|
|
773
860
|
* @license
|
|
774
861
|
* Copyright 2020 Google LLC
|
|
775
862
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
776
863
|
*/
|
|
777
|
-
const
|
|
864
|
+
const Kt={},Ot=yt(class extends xt{constructor(t){if(super(t),t.type!==mt&&t.type!==bt&&t.type!==vt)throw Error("The `live` directive is not allowed on child or event bindings");if(!(t=>void 0===t.strings)(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===V||e===I)return e;const i=t.element,o=t.name;if(t.type===mt){if(e===i[o])return V}else if(t.type===vt){if(!!e===i.hasAttribute(o))return V}else if(t.type===bt&&i.getAttribute(o)===e+"")return V;return((t,e=Kt)=>{t._$AH=e;
|
|
778
865
|
/**
|
|
779
866
|
* @license
|
|
780
867
|
* Copyright 2020 Google LLC
|
|
781
868
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
782
|
-
*/})(
|
|
869
|
+
*/})(t),e}});var Mt=function(t,e,i,o){var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};t.KRTextField=class extends at{constructor(){super(),this.label="",this.name="",this.value="",this.placeholder="",this.type="text",this.required=!1,this.disabled=!1,this.readonly=!1,this.autocomplete="",this.hint="",this._touched=!1,this._dirty=!1,this._internals=this.attachInternals()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._touched=!1,this._dirty=!1,this._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(t){this.value=t}_handleInput(t){this.value=t.target.value,this._dirty=!0,this._internals.setFormValue(this.value),this._internals.setValidity(this._input.validity,this._input.validationMessage,this._input)}_handleChange(t){this.value=t.target.value,this._internals.setFormValue(this.value)}_handleBlur(){this._touched=!0,this._internals.setValidity(this._input.validity,this._input.validationMessage,this._input)}render(){let t="";return this._touched&&this._input&&!this._input.validity.valid&&(t=this._input.validationMessage),F`
|
|
783
870
|
<div class="wrapper">
|
|
784
871
|
${this.label?F`
|
|
785
872
|
<label for="input">
|
|
@@ -791,7 +878,7 @@ const Ke={},Oe=ye(class extends xe{constructor(e){if(super(e),e.type!==ve&&e.typ
|
|
|
791
878
|
id="input"
|
|
792
879
|
type=${this.type}
|
|
793
880
|
name=${this.name}
|
|
794
|
-
.value=${
|
|
881
|
+
.value=${Ot(this.value)}
|
|
795
882
|
placeholder=${this.placeholder}
|
|
796
883
|
?required=${this.required}
|
|
797
884
|
?disabled=${this.disabled}
|
|
@@ -804,9 +891,9 @@ const Ke={},Oe=ye(class extends xe{constructor(e){if(super(e),e.type!==ve&&e.typ
|
|
|
804
891
|
@change=${this._handleChange}
|
|
805
892
|
@blur=${this._handleBlur}
|
|
806
893
|
/>
|
|
807
|
-
${
|
|
894
|
+
${t?F`<div class="validation-message">${t}</div>`:this.hint?F`<div class="hint">${this.hint}</div>`:""}
|
|
808
895
|
</div>
|
|
809
|
-
`}focus(){this._input?.focus()}blur(){this._input?.blur()}select(){this._input?.select()}},
|
|
896
|
+
`}focus(){this._input?.focus()}blur(){this._input?.blur()}select(){this._input?.select()}},t.KRTextField.styles=n`
|
|
810
897
|
:host {
|
|
811
898
|
display: block;
|
|
812
899
|
font-family: inherit;
|
|
@@ -873,11 +960,11 @@ const Ke={},Oe=ye(class extends xe{constructor(e){if(super(e),e.type!==ve&&e.typ
|
|
|
873
960
|
font-size: 0.75rem;
|
|
874
961
|
color: var(--kr-text-field-helper-color, #6b7280);
|
|
875
962
|
}
|
|
876
|
-
`,
|
|
963
|
+
`,t.KRTextField.formAssociated=!0,Mt([pt({type:String})],t.KRTextField.prototype,"label",void 0),Mt([pt({type:String})],t.KRTextField.prototype,"name",void 0),Mt([pt({type:String})],t.KRTextField.prototype,"value",void 0),Mt([pt({type:String})],t.KRTextField.prototype,"placeholder",void 0),Mt([pt({type:String})],t.KRTextField.prototype,"type",void 0),Mt([pt({type:Boolean})],t.KRTextField.prototype,"required",void 0),Mt([pt({type:Boolean})],t.KRTextField.prototype,"disabled",void 0),Mt([pt({type:Boolean})],t.KRTextField.prototype,"readonly",void 0),Mt([pt({type:Number})],t.KRTextField.prototype,"minlength",void 0),Mt([pt({type:Number})],t.KRTextField.prototype,"maxlength",void 0),Mt([pt({type:String})],t.KRTextField.prototype,"pattern",void 0),Mt([pt({type:String})],t.KRTextField.prototype,"autocomplete",void 0),Mt([pt({type:String})],t.KRTextField.prototype,"hint",void 0),Mt([
|
|
877
964
|
/**
|
|
878
965
|
* @license
|
|
879
966
|
* Copyright 2017 Google LLC
|
|
880
967
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
881
968
|
*/
|
|
882
|
-
function(
|
|
969
|
+
function(t){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i))(e,i,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}("input")],t.KRTextField.prototype,"_input",void 0),Mt([ut()],t.KRTextField.prototype,"_touched",void 0),Mt([ut()],t.KRTextField.prototype,"_dirty",void 0),t.KRTextField=Mt([dt("kr-text-field")],t.KRTextField),t.DialogRef=Ct}),function(t){Object.keys(t).forEach(function(e){e.startsWith("KR")&&"function"==typeof t[e]&&(t[e.slice(2)]=t[e],delete t[e])})}(kr);
|
|
883
970
|
//# sourceMappingURL=krubble.umd.min.js.map
|