@kodaris/krubble-components 1.0.12 → 1.0.13
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 +396 -410
- package/dist/form/index.d.ts +2 -2
- package/dist/form/index.d.ts.map +1 -1
- package/dist/form/index.js +2 -2
- package/dist/form/index.js.map +1 -1
- package/dist/form/{select/select-option.d.ts → select-field/select-field-option.d.ts} +5 -5
- package/dist/form/select-field/select-field-option.d.ts.map +1 -0
- package/dist/form/{select/select-option.js → select-field/select-field-option.js} +11 -11
- package/dist/form/select-field/select-field-option.js.map +1 -0
- package/dist/form/{select/select.d.ts → select-field/select-field.d.ts} +5 -5
- package/dist/form/select-field/select-field.d.ts.map +1 -0
- package/dist/form/{select/select.js → select-field/select-field.js} +32 -32
- package/dist/form/select-field/select-field.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/krubble.bundled.js +53 -63
- package/dist/krubble.bundled.js.map +1 -1
- package/dist/krubble.bundled.min.js +12 -12
- package/dist/krubble.bundled.min.js.map +1 -1
- package/dist/krubble.umd.js +52 -62
- package/dist/krubble.umd.js.map +1 -1
- package/dist/krubble.umd.min.js +64 -64
- package/dist/krubble.umd.min.js.map +1 -1
- package/dist/table/table.d.ts +1 -3
- package/dist/table/table.d.ts.map +1 -1
- package/dist/table/table.js +13 -23
- package/dist/table/table.js.map +1 -1
- package/package.json +1 -1
- package/dist/form/select/select-option.d.ts.map +0 -1
- package/dist/form/select/select-option.js.map +0 -1
- package/dist/form/select/select.d.ts.map +0 -1
- package/dist/form/select/select.js.map +0 -1
package/dist/krubble.umd.min.js
CHANGED
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2019 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
-
*/const t=globalThis,i=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),s=new WeakMap;let r=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(i&&void 0===e){const i=void 0!==t&&1===t.length;i&&(e=s.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&s.set(t,e))}return e}toString(){return this.cssText}};const n=(e,...t)=>{const i=1===e.length?e[0]:t.reduce((t,i,o)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[o+1],e[0]);return new r(i,e,o)},l=i?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new r("string"==typeof e?e:e+"",void 0,o))(t)})(e):e,{is:a,defineProperty:d,getOwnPropertyDescriptor:c,getOwnPropertyNames:h,getOwnPropertySymbols:p,getPrototypeOf:u}=Object,g=globalThis,f=g.trustedTypes,b=f?f.emptyScript:"",v=g.reactiveElementPolyfillSupport,y=(e,t)=>e,m={toAttribute(e,t){switch(t){case Boolean:e=e?b:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},_=(e,t)=>!a(e,t),
|
|
6
|
+
*/const t=globalThis,i=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),s=new WeakMap;let r=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(i&&void 0===e){const i=void 0!==t&&1===t.length;i&&(e=s.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&s.set(t,e))}return e}toString(){return this.cssText}};const n=(e,...t)=>{const i=1===e.length?e[0]:t.reduce((t,i,o)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[o+1],e[0]);return new r(i,e,o)},l=i?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new r("string"==typeof e?e:e+"",void 0,o))(t)})(e):e,{is:a,defineProperty:d,getOwnPropertyDescriptor:c,getOwnPropertyNames:h,getOwnPropertySymbols:p,getPrototypeOf:u}=Object,g=globalThis,f=g.trustedTypes,b=f?f.emptyScript:"",v=g.reactiveElementPolyfillSupport,y=(e,t)=>e,m={toAttribute(e,t){switch(t){case Boolean:e=e?b:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},_=(e,t)=>!a(e,t),x={attribute:!0,type:String,converter:m,reflect:!1,useDefault:!1,hasChanged:_};
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/Symbol.metadata??=Symbol("metadata"),g.litPropertyMetadata??=new WeakMap;let
|
|
11
|
+
*/Symbol.metadata??=Symbol("metadata"),g.litPropertyMetadata??=new WeakMap;let k=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=x){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),o=this.getPropertyDescriptor(e,i,t);void 0!==o&&d(this.prototype,e,o)}}static getPropertyDescriptor(e,t,i){const{get:o,set:s}=c(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:o,set(t){const r=o?.call(this);s?.call(this,t),this.requestUpdate(e,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??x}static _$Ei(){if(this.hasOwnProperty(y("elementProperties")))return;const e=u(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(y("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(y("properties"))){const e=this.properties,t=[...h(e),...p(e)];for(const i of t)this.createProperty(i,e[i])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,i]of t)this.elementProperties.set(e,i)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const i=this._$Eu(e,t);void 0!==i&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.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(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,o)=>{if(i)e.adoptedStyleSheets=o.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const i of o){const o=document.createElement("style"),s=t.litNonce;void 0!==s&&o.setAttribute("nonce",s),o.textContent=i.cssText,e.appendChild(o)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,i);if(void 0!==o&&!0===i.reflect){const s=(void 0!==i.converter?.toAttribute?i.converter:m).toAttribute(t,i.type);this._$Em=e,null==s?this.removeAttribute(o):this.setAttribute(o,s),this._$Em=null}}_$AK(e,t){const i=this.constructor,o=i._$Eh.get(e);if(void 0!==o&&this._$Em!==o){const e=i.getPropertyOptions(o),s="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:m;this._$Em=o;const r=s.fromAttribute(t,e.type);this[o]=r??this._$Ej?.get(o)??r,this._$Em=null}}requestUpdate(e,t,i,o=!1,s){if(void 0!==e){const r=this.constructor;if(!1===o&&(s=this[e]),i??=r.getPropertyOptions(e),!((i.hasChanged??_)(s,t)||i.useDefault&&i.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:o,wrapped:s},r){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,r??t??this[e]),!0!==s||void 0!==r)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===o&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,i]of e){const{wrapped:e}=i,o=this[t];!0!==e||this._$AL.has(t)||void 0===o||this.C(t,void 0,i,o)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};k.elementStyles=[],k.shadowRootOptions={mode:"open"},k[y("elementProperties")]=new Map,k[y("finalized")]=new Map,v?.({ReactiveElement:k}),(g.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 w=globalThis,$=e=>e,S=w.trustedTypes,R=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,C="$lit$",T=`lit$${Math.random().toFixed(9).slice(2)}$`,A="?"+T,E=`<${A}>`,O=document,K=()=>O.createComment(""),P=e=>null===e||"object"!=typeof e&&"function"!=typeof e,z=Array.isArray,L="[ \t\n\f\r]",D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,M=/-->/g,j=/>/g,B=RegExp(`>|${L}(?:([^\\s"'>=/]+)(${L}*=${L}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,I=/"/g,q=/^(?:script|style|textarea|title)$/i,
|
|
17
|
+
const w=globalThis,$=e=>e,S=w.trustedTypes,R=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,C="$lit$",T=`lit$${Math.random().toFixed(9).slice(2)}$`,A="?"+T,E=`<${A}>`,O=document,K=()=>O.createComment(""),P=e=>null===e||"object"!=typeof e&&"function"!=typeof e,z=Array.isArray,L="[ \t\n\f\r]",D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,M=/-->/g,j=/>/g,B=RegExp(`>|${L}(?:([^\\s"'>=/]+)(${L}*=${L}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,I=/"/g,q=/^(?:script|style|textarea|title)$/i,F=(e=>(t,...i)=>({_$litType$:e,strings:t,values:i}))(1),U=Symbol.for("lit-noChange"),N=Symbol.for("lit-nothing"),V=new WeakMap,W=O.createTreeWalker(O,129);function Z(e,t){if(!z(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==R?R.createHTML(t):t}const G=(e,t)=>{const i=e.length-1,o=[];let s,r=2===t?"<svg>":3===t?"<math>":"",n=D;for(let t=0;t<i;t++){const i=e[t];let l,a,d=-1,c=0;for(;c<i.length&&(n.lastIndex=c,a=n.exec(i),null!==a);)c=n.lastIndex,n===D?"!--"===a[1]?n=M:void 0!==a[1]?n=j:void 0!==a[2]?(q.test(a[2])&&(s=RegExp("</"+a[2],"g")),n=B):void 0!==a[3]&&(n=B):n===B?">"===a[0]?(n=s??D,d=-1):void 0===a[1]?d=-2:(d=n.lastIndex-a[2].length,l=a[1],n=void 0===a[3]?B:'"'===a[3]?I:H):n===I||n===H?n=B:n===M||n===j?n=D:(n=B,s=void 0);const h=n===B&&e[t+1].startsWith("/>")?" ":"";r+=n===D?i+E:d>=0?(o.push(l),i.slice(0,d)+C+i.slice(d)+T+h):i+T+(-2===d?t:h)}return[Z(e,r+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),o]};class X{constructor({strings:e,_$litType$:t},i){let o;this.parts=[];let s=0,r=0;const n=e.length-1,l=this.parts,[a,d]=G(e,t);if(this.el=X.createElement(a,i),W.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(o=W.nextNode())&&l.length<n;){if(1===o.nodeType){if(o.hasAttributes())for(const e of o.getAttributeNames())if(e.endsWith(C)){const t=d[r++],i=o.getAttribute(e).split(T),n=/([.?@])?(.*)/.exec(t);l.push({type:1,index:s,name:n[2],strings:i,ctor:"."===n[1]?te:"?"===n[1]?ie:"@"===n[1]?oe:ee}),o.removeAttribute(e)}else e.startsWith(T)&&(l.push({type:6,index:s}),o.removeAttribute(e));if(q.test(o.tagName)){const e=o.textContent.split(T),t=e.length-1;if(t>0){o.textContent=S?S.emptyScript:"";for(let i=0;i<t;i++)o.append(e[i],K()),W.nextNode(),l.push({type:2,index:++s});o.append(e[t],K())}}}else if(8===o.nodeType)if(o.data===A)l.push({type:2,index:s});else{let e=-1;for(;-1!==(e=o.data.indexOf(T,e+1));)l.push({type:7,index:s}),e+=T.length-1}s++}}static createElement(e,t){const i=O.createElement("template");return i.innerHTML=e,i}}function Q(e,t,i=e,o){if(t===U)return t;let s=void 0!==o?i._$Co?.[o]:i._$Cl;const r=P(t)?void 0:t._$litDirective$;return s?.constructor!==r&&(s?._$AO?.(!1),void 0===r?s=void 0:(s=new r(e),s._$AT(e,i,o)),void 0!==o?(i._$Co??=[])[o]=s:i._$Cl=s),void 0!==s&&(t=Q(e,s._$AS(e,t.values),s,o)),t}class Y{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,o=(e?.creationScope??O).importNode(t,!0);W.currentNode=o;let s=W.nextNode(),r=0,n=0,l=i[0];for(;void 0!==l;){if(r===l.index){let t;2===l.type?t=new J(s,s.nextSibling,this,e):1===l.type?t=new l.ctor(s,l.name,l.strings,this,e):6===l.type&&(t=new se(s,this,e)),this._$AV.push(t),l=i[++n]}r!==l?.index&&(s=W.nextNode(),r++)}return W.currentNode=O,o}p(e){let t=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class J{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,o){this.type=2,this._$AH=N,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Q(this,e,t),P(e)?e===N||null==e||""===e?(this._$AH!==N&&this._$AR(),this._$AH=N):e!==this._$AH&&e!==U&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>z(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==N&&P(this._$AH)?this._$AA.nextSibling.data=e:this.T(O.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,o="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=X.createElement(Z(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===o)this._$AH.p(t);else{const e=new Y(o,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=V.get(e.strings);return void 0===t&&V.set(e.strings,t=new X(e)),t}k(e){z(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,o=0;for(const s of e)o===t.length?t.push(i=new J(this.O(K()),this.O(K()),this,this.options)):i=t[o],i._$AI(s),o++;o<t.length&&(this._$AR(i&&i._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=$(e).nextSibling;$(e).remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class ee{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,o,s){this.type=1,this._$AH=N,this._$AN=void 0,this.element=e,this.name=t,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=N}_$AI(e,t=this,i,o){const s=this.strings;let r=!1;if(void 0===s)e=Q(this,e,t,0),r=!P(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const o=e;let n,l;for(e=s[0],n=0;n<s.length-1;n++)l=Q(this,o[i+n],t,n),l===U&&(l=this._$AH[n]),r||=!P(l)||l!==this._$AH[n],l===N?e=N:e!==N&&(e+=(l??"")+s[n+1]),this._$AH[n]=l}r&&!o&&this.j(e)}j(e){e===N?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class te extends ee{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===N?void 0:e}}class ie extends ee{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==N)}}class oe extends ee{constructor(e,t,i,o,s){super(e,t,i,o,s),this.type=5}_$AI(e,t=this){if((e=Q(this,e,t,0)??N)===U)return;const i=this._$AH,o=e===N&&i!==N||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,s=e!==N&&(i===N||o);o&&this.element.removeEventListener(this.name,this,i),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class se{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Q(this,e)}}const re=w.litHtmlPolyfillSupport;re?.(X,J),(w.litHtmlVersions??=[]).push("3.3.2");const ne=globalThis;
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/let le=class extends
|
|
22
|
+
*/let le=class extends k{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,i)=>{const o=i?.renderBefore??t;let s=o._$litPart$;if(void 0===s){const e=i?.renderBefore??null;o._$litPart$=s=new J(t.insertBefore(K(),e),e,void 0,i??{})}return s._$AI(e),s})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};le._$litElement$=!0,le.finalized=!0,ne.litElementHydrateSupport?.({LitElement:le});const ae=ne.litElementPolyfillSupport;ae?.({LitElement:le}),(ne.litElementVersions??=[]).push("4.2.2");const de=n`
|
|
23
23
|
:host,
|
|
24
24
|
*,
|
|
25
25
|
*::before,
|
|
@@ -67,7 +67,7 @@ const w=globalThis,$=e=>e,S=w.trustedTypes,R=S?S.createPolicy("lit-html",{create
|
|
|
67
67
|
* Copyright 2017 Google LLC
|
|
68
68
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
69
69
|
*/
|
|
70
|
-
function fe(e,t){return(t,i,o)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i))(t,i,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}var be=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRAccordion=class extends le{constructor(){super(...arguments),this.header="",this.expanded=!1}toggle(){this.expanded=!this.expanded}render(){return
|
|
70
|
+
function fe(e,t){return(t,i,o)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i))(t,i,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}var be=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRAccordion=class extends le{constructor(){super(...arguments),this.header="",this.expanded=!1}toggle(){this.expanded=!this.expanded}render(){return F`
|
|
71
71
|
<div class="header" @click=${this.toggle}>
|
|
72
72
|
<span class="header__title">${this.header}</span>
|
|
73
73
|
<svg class="header__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
@@ -139,24 +139,24 @@ function fe(e,t){return(t,i,o)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
139
139
|
* Copyright 2017 Google LLC
|
|
140
140
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
141
141
|
*/
|
|
142
|
-
const ve=1,ye=2,me=3,_e=4,
|
|
142
|
+
const ve=1,ye=2,me=3,_e=4,xe=e=>(...t)=>({_$litDirective$:e,values:t});let ke=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};
|
|
143
143
|
/**
|
|
144
144
|
* @license
|
|
145
145
|
* Copyright 2018 Google LLC
|
|
146
146
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
147
|
-
*/const we=
|
|
147
|
+
*/const we=xe(class extends ke{constructor(e){if(super(e),e.type!==ve||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter(t=>e[t]).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter(e=>""!==e)));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const i=e.element.classList;for(const e of this.st)e in t||(i.remove(e),this.st.delete(e));for(const e in t){const o=!!t[e];o===this.st.has(e)||this.nt?.has(e)||(o?(i.add(e),this.st.add(e)):(i.remove(e),this.st.delete(e)))}return U}});var $e=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRAlert=class extends le{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 e={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`
|
|
148
148
|
<div
|
|
149
149
|
class=${we({alert:!0,["alert--"+this.type]:!0,"alert--hidden":!this.visible})}
|
|
150
150
|
role="alert"
|
|
151
151
|
>
|
|
152
152
|
${e[this.type]}
|
|
153
153
|
<div class="content">
|
|
154
|
-
${this.header?
|
|
154
|
+
${this.header?F`<h4 class="header">${this.header}</h4>`:N}
|
|
155
155
|
<div class="message">
|
|
156
156
|
<slot></slot>
|
|
157
157
|
</div>
|
|
158
158
|
</div>
|
|
159
|
-
${this.dismissible?
|
|
159
|
+
${this.dismissible?F`
|
|
160
160
|
<button
|
|
161
161
|
class="dismiss"
|
|
162
162
|
type="button"
|
|
@@ -276,15 +276,15 @@ const ve=1,ye=2,me=3,_e=4,ke=e=>(...t)=>({_$litDirective$:e,values:t});let xe=cl
|
|
|
276
276
|
outline: 2px solid #3b82f6;
|
|
277
277
|
outline-offset: 2px;
|
|
278
278
|
}
|
|
279
|
-
`,$e([ue({type:String})],e.KRAlert.prototype,"type",void 0),$e([ue({type:String})],e.KRAlert.prototype,"header",void 0),$e([ue({type:Boolean})],e.KRAlert.prototype,"dismissible",void 0),$e([ue({type:Boolean})],e.KRAlert.prototype,"visible",void 0),e.KRAlert=$e([ce("kr-alert")],e.KRAlert);var Se=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRButton=class extends le{constructor(){super(...arguments),this.variant="flat",this.color="primary",this.size="medium",this.disabled=!1,this.options=[],this._state="idle",this._stateText="",this._dropdownOpened=!1,this._dropdownAlignRight=!1,this._handleHostClick=e=>{this.options.length&&(e.stopPropagation(),this._toggleDropdown())},this._handleKeydown=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.options.length?this._toggleDropdown():this.click()),"Escape"===e.key&&this._dropdownOpened&&(this._dropdownOpened=!1)},this._handleClickOutside=e=>{this._dropdownOpened&&!this.contains(e.target)&&(this._dropdownOpened=!1)}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._handleKeydown),this.addEventListener("click",this._handleHostClick),document.addEventListener("click",this._handleClickOutside)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._handleKeydown),this.removeEventListener("click",this._handleHostClick),document.removeEventListener("click",this._handleClickOutside)}_toggleDropdown(){this._dropdownOpened=!this._dropdownOpened,this._dropdownOpened&&requestAnimationFrame(()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(e){const t=e.getBoundingClientRect();this._dropdownAlignRight=t.right>window.innerWidth}})}_handleOptionClick(e,t){t.stopPropagation(),this._dropdownOpened=!1,this.dispatchEvent(new CustomEvent("option-select",{detail:{id:e.id,label:e.label},bubbles:!0,composed:!0}))}showLoading(){this._clearStateTimeout(),this._state="loading",this._stateText=""}showSuccess(e="Success",t=2e3){this._clearStateTimeout(),this._state="success",this._stateText=e,this._stateTimeout=window.setTimeout(()=>this.reset(),t)}showError(e="Error",t=2e3){this._clearStateTimeout(),this._state="error",this._stateText=e,this._stateTimeout=window.setTimeout(()=>this.reset(),t)}reset(){this._clearStateTimeout(),this._state="idle",this._stateText=""}_clearStateTimeout(){this._stateTimeout&&(clearTimeout(this._stateTimeout),this._stateTimeout=void 0)}updated(e){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
|
|
279
|
+
`,$e([ue({type:String})],e.KRAlert.prototype,"type",void 0),$e([ue({type:String})],e.KRAlert.prototype,"header",void 0),$e([ue({type:Boolean})],e.KRAlert.prototype,"dismissible",void 0),$e([ue({type:Boolean})],e.KRAlert.prototype,"visible",void 0),e.KRAlert=$e([ce("kr-alert")],e.KRAlert);var Se=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRButton=class extends le{constructor(){super(...arguments),this.variant="flat",this.color="primary",this.size="medium",this.disabled=!1,this.options=[],this._state="idle",this._stateText="",this._dropdownOpened=!1,this._dropdownAlignRight=!1,this._handleHostClick=e=>{this.options.length&&(e.stopPropagation(),this._toggleDropdown())},this._handleKeydown=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.options.length?this._toggleDropdown():this.click()),"Escape"===e.key&&this._dropdownOpened&&(this._dropdownOpened=!1)},this._handleClickOutside=e=>{this._dropdownOpened&&!this.contains(e.target)&&(this._dropdownOpened=!1)}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._handleKeydown),this.addEventListener("click",this._handleHostClick),document.addEventListener("click",this._handleClickOutside)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._handleKeydown),this.removeEventListener("click",this._handleHostClick),document.removeEventListener("click",this._handleClickOutside)}_toggleDropdown(){this._dropdownOpened=!this._dropdownOpened,this._dropdownOpened&&requestAnimationFrame(()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(e){const t=e.getBoundingClientRect();this._dropdownAlignRight=t.right>window.innerWidth}})}_handleOptionClick(e,t){t.stopPropagation(),this._dropdownOpened=!1,this.dispatchEvent(new CustomEvent("option-select",{detail:{id:e.id,label:e.label},bubbles:!0,composed:!0}))}showLoading(){this._clearStateTimeout(),this._state="loading",this._stateText=""}showSuccess(e="Success",t=2e3){this._clearStateTimeout(),this._state="success",this._stateText=e,this._stateTimeout=window.setTimeout(()=>this.reset(),t)}showError(e="Error",t=2e3){this._clearStateTimeout(),this._state="error",this._stateText=e,this._stateTimeout=window.setTimeout(()=>this.reset(),t)}reset(){this._clearStateTimeout(),this._state="idle",this._stateText=""}_clearStateTimeout(){this._stateTimeout&&(clearTimeout(this._stateTimeout),this._stateTimeout=void 0)}updated(e){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`
|
|
280
280
|
<slot></slot>
|
|
281
|
-
${this.options.length?
|
|
282
|
-
${"idle"!==this._state?
|
|
283
|
-
${"loading"===this._state?
|
|
281
|
+
${this.options.length?F`<svg class="caret" xmlns="http://www.w3.org/2000/svg" height="20" width="20" viewBox="0 0 24 24" fill="currentColor"><path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/></svg>`:N}
|
|
282
|
+
${"idle"!==this._state?F`<span class="state-overlay">
|
|
283
|
+
${"loading"===this._state?F`<span class="spinner"></span>`:this._stateText}
|
|
284
284
|
</span>`:N}
|
|
285
|
-
${this.options.length?
|
|
285
|
+
${this.options.length?F`
|
|
286
286
|
<div class="dropdown ${this._dropdownOpened?"dropdown--opened":""} ${this._dropdownAlignRight?"dropdown--align-right":""}">
|
|
287
|
-
${this.options.map(e=>
|
|
287
|
+
${this.options.map(e=>F`
|
|
288
288
|
<button
|
|
289
289
|
class="dropdown-item"
|
|
290
290
|
@click=${t=>this._handleOptionClick(e,t)}
|
|
@@ -527,7 +527,7 @@ const ve=1,ye=2,me=3,_e=4,ke=e=>(...t)=>({_$litDirective$:e,values:t});let xe=cl
|
|
|
527
527
|
* Copyright 2017 Google LLC
|
|
528
528
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
529
529
|
*/
|
|
530
|
-
class Re extends
|
|
530
|
+
class Re extends ke{constructor(e){if(super(e),this.it=N,e.type!==ye)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===N||null==e)return this._t=void 0,this.it=e;if(e===U)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}Re.directiveName="unsafeHTML",Re.resultType=1;const Ce=xe(Re);var Te=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRCodeDemo=class extends le{constructor(){super(...arguments),this.language="html",this.code="",this.activeTab="preview",this.copied=!1}setTab(e){this.activeTab=e}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(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}async copyCode(){if(this.code)try{await navigator.clipboard.writeText(this.code),this.copied=!0,setTimeout(()=>{this.copied=!1},2e3)}catch(e){console.error("Failed to copy code:",e)}}render(){return F`
|
|
531
531
|
<div class="tabs">
|
|
532
532
|
<button
|
|
533
533
|
class=${we({tab:!0,"tab--active":"preview"===this.activeTab})}
|
|
@@ -717,15 +717,15 @@ class Re extends xe{constructor(e){if(super(e),this.it=N,e.type!==ye)throw Error
|
|
|
717
717
|
.code .token.variable {
|
|
718
718
|
color: #fab387;
|
|
719
719
|
}
|
|
720
|
-
`,Te([ue({type:String})],e.KRCodeDemo.prototype,"language",void 0),Te([ue({type:String})],e.KRCodeDemo.prototype,"code",void 0),Te([ge()],e.KRCodeDemo.prototype,"activeTab",void 0),Te([ge()],e.KRCodeDemo.prototype,"copied",void 0),e.KRCodeDemo=Te([ce("kr-code-demo")],e.KRCodeDemo);var Ae=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRContextMenu=class extends le{constructor(){super(...arguments),this.items=[],this.resolvePromise=null,this.boundHandleOutsideClick=this.handleOutsideClick.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this)}static async open(e){const t=document.querySelector("kr-context-menu");t&&t.remove();const i=document.createElement("kr-context-menu");return document.body.appendChild(i),i.show(e)}async show(e){this.items=e.items,this.style.left=`${e.x}px`,this.style.top=`${e.y}px`,await this.updateComplete;const t=this.getBoundingClientRect();return t.right>window.innerWidth&&(this.style.left=e.x-t.width+"px"),t.bottom>window.innerHeight&&(this.style.top=e.y-t.height+"px"),requestAnimationFrame(()=>{document.addEventListener("click",this.boundHandleOutsideClick),document.addEventListener("contextmenu",this.boundHandleOutsideClick),document.addEventListener("keydown",this.boundHandleKeyDown)}),new Promise(e=>{this.resolvePromise=e})}handleOutsideClick(e){this.contains(e.target)||this.close(null)}handleKeyDown(e){"Escape"===e.key&&this.close(null)}handleItemClick(e){e.disabled||e.divider||this.close(e)}close(e){document.removeEventListener("click",this.boundHandleOutsideClick),document.removeEventListener("contextmenu",this.boundHandleOutsideClick),document.removeEventListener("keydown",this.boundHandleKeyDown),this.resolvePromise&&(this.resolvePromise(e),this.resolvePromise=null),this.remove()}render(){return
|
|
720
|
+
`,Te([ue({type:String})],e.KRCodeDemo.prototype,"language",void 0),Te([ue({type:String})],e.KRCodeDemo.prototype,"code",void 0),Te([ge()],e.KRCodeDemo.prototype,"activeTab",void 0),Te([ge()],e.KRCodeDemo.prototype,"copied",void 0),e.KRCodeDemo=Te([ce("kr-code-demo")],e.KRCodeDemo);var Ae=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRContextMenu=class extends le{constructor(){super(...arguments),this.items=[],this.resolvePromise=null,this.boundHandleOutsideClick=this.handleOutsideClick.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this)}static async open(e){const t=document.querySelector("kr-context-menu");t&&t.remove();const i=document.createElement("kr-context-menu");return document.body.appendChild(i),i.show(e)}async show(e){this.items=e.items,this.style.left=`${e.x}px`,this.style.top=`${e.y}px`,await this.updateComplete;const t=this.getBoundingClientRect();return t.right>window.innerWidth&&(this.style.left=e.x-t.width+"px"),t.bottom>window.innerHeight&&(this.style.top=e.y-t.height+"px"),requestAnimationFrame(()=>{document.addEventListener("click",this.boundHandleOutsideClick),document.addEventListener("contextmenu",this.boundHandleOutsideClick),document.addEventListener("keydown",this.boundHandleKeyDown)}),new Promise(e=>{this.resolvePromise=e})}handleOutsideClick(e){this.contains(e.target)||this.close(null)}handleKeyDown(e){"Escape"===e.key&&this.close(null)}handleItemClick(e){e.disabled||e.divider||this.close(e)}close(e){document.removeEventListener("click",this.boundHandleOutsideClick),document.removeEventListener("contextmenu",this.boundHandleOutsideClick),document.removeEventListener("keydown",this.boundHandleKeyDown),this.resolvePromise&&(this.resolvePromise(e),this.resolvePromise=null),this.remove()}render(){return F`
|
|
721
721
|
<div class="menu">
|
|
722
|
-
${this.items.map(e=>e.divider?
|
|
722
|
+
${this.items.map(e=>e.divider?F`<div class="menu__divider"></div>`:F`
|
|
723
723
|
<button
|
|
724
724
|
class="menu__item"
|
|
725
725
|
?disabled=${e.disabled}
|
|
726
726
|
@click=${()=>this.handleItemClick(e)}
|
|
727
727
|
>
|
|
728
|
-
${e.icon?
|
|
728
|
+
${e.icon?F`<span class="menu__item-icon">${e.icon}</span>`:null}
|
|
729
729
|
${e.label}
|
|
730
730
|
</button>
|
|
731
731
|
`)}
|
|
@@ -785,7 +785,7 @@ class Re extends xe{constructor(e){if(super(e),this.it=N,e.type!==ye)throw Error
|
|
|
785
785
|
background: rgba(255, 255, 255, 0.1);
|
|
786
786
|
margin: 4px 0;
|
|
787
787
|
}
|
|
788
|
-
`,Ae([ge()],e.KRContextMenu.prototype,"items",void 0),e.KRContextMenu=Ae([ce("kr-context-menu")],e.KRContextMenu);var Ee=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class Oe{constructor(){this.resolvePromise=null,this.dialogElement=null,this.promise=new Promise(e=>{this.resolvePromise=e})}setDialogElement(e){this.dialogElement=e}close(e){this.resolvePromise&&(this.resolvePromise(e),this.resolvePromise=null),this.dialogElement?.remove()}afterClosed(){return this.promise}}e.KRDialog=class extends le{constructor(){super(...arguments),this.contentElement=null,this.dialogRef=null,this.boundHandleKeyDown=this.handleKeyDown.bind(this)}static open(e,t){const i=document.querySelector("kr-dialog");i&&i.remove();const o=new Oe,s=document.createElement("kr-dialog");o.setDialogElement(s),s.dialogRef=o;const r=new e;return r.dialogRef=o,t?.data&&(r.data=t.data),s.contentElement=r,document.body.appendChild(s),document.addEventListener("keydown",s.boundHandleKeyDown),o}handleKeyDown(e){"Escape"===e.key&&this.dialogRef?.close(void 0)}handleBackdropClick(e){e.target.classList.contains("backdrop")&&this.dialogRef?.close(void 0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.boundHandleKeyDown)}render(){return
|
|
788
|
+
`,Ae([ge()],e.KRContextMenu.prototype,"items",void 0),e.KRContextMenu=Ae([ce("kr-context-menu")],e.KRContextMenu);var Ee=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class Oe{constructor(){this.resolvePromise=null,this.dialogElement=null,this.promise=new Promise(e=>{this.resolvePromise=e})}setDialogElement(e){this.dialogElement=e}close(e){this.resolvePromise&&(this.resolvePromise(e),this.resolvePromise=null),this.dialogElement?.remove()}afterClosed(){return this.promise}}e.KRDialog=class extends le{constructor(){super(...arguments),this.contentElement=null,this.dialogRef=null,this.boundHandleKeyDown=this.handleKeyDown.bind(this)}static open(e,t){const i=document.querySelector("kr-dialog");i&&i.remove();const o=new Oe,s=document.createElement("kr-dialog");o.setDialogElement(s),s.dialogRef=o;const r=new e;return r.dialogRef=o,t?.data&&(r.data=t.data),s.contentElement=r,document.body.appendChild(s),document.addEventListener("keydown",s.boundHandleKeyDown),o}handleKeyDown(e){"Escape"===e.key&&this.dialogRef?.close(void 0)}handleBackdropClick(e){e.target.classList.contains("backdrop")&&this.dialogRef?.close(void 0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.boundHandleKeyDown)}render(){return F`
|
|
789
789
|
<div class="backdrop" @click=${this.handleBackdropClick}></div>
|
|
790
790
|
<div class="dialog">
|
|
791
791
|
${this.contentElement}
|
|
@@ -815,10 +815,10 @@ class Re extends xe{constructor(e){if(super(e),this.it=N,e.type!==ye)throw Error
|
|
|
815
815
|
max-height: 90vh;
|
|
816
816
|
overflow: auto;
|
|
817
817
|
}
|
|
818
|
-
`,Ee([ge()],e.KRDialog.prototype,"contentElement",void 0),e.KRDialog=Ee([ce("kr-dialog")],e.KRDialog);var Ke,Pe=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRSnackbar=Ke=class extends le{constructor(){super(...arguments),this.dismissTimeout=null,this.type="info",this.title="",this.message="",this.duration=5e3}static show(e){const t=document.createElement("kr-snackbar");return t.message=e.message,t.title=e.title??"",t.type=e.type??"info",void 0!==e.duration?t.duration=e.duration:"error"===t.type?t.duration=0:t.duration=5e3,document.body.appendChild(t),t}connectedCallback(){super.connectedCallback(),this.setAttribute("role","alert"),this.classList.add(`kr-snackbar--${this.type}`),this.title&&this.classList.add("kr-snackbar--has-title"),Ke.activeSnackbars.push(this),this.updatePositions(),this.duration>0&&(this.dismissTimeout=window.setTimeout(()=>{this.dismiss()},this.duration))}disconnectedCallback(){super.disconnectedCallback();const e=Ke.activeSnackbars.indexOf(this);e>-1&&Ke.activeSnackbars.splice(e,1),this.updatePositions(),this.dismissTimeout&&clearTimeout(this.dismissTimeout)}updatePositions(){let e=24;for(const t of Ke.activeSnackbars)t.style.bottom=`${e}px`,e+=t.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 e={info:
|
|
818
|
+
`,Ee([ge()],e.KRDialog.prototype,"contentElement",void 0),e.KRDialog=Ee([ce("kr-dialog")],e.KRDialog);var Ke,Pe=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRSnackbar=Ke=class extends le{constructor(){super(...arguments),this.dismissTimeout=null,this.type="info",this.title="",this.message="",this.duration=5e3}static show(e){const t=document.createElement("kr-snackbar");return t.message=e.message,t.title=e.title??"",t.type=e.type??"info",void 0!==e.duration?t.duration=e.duration:"error"===t.type?t.duration=0:t.duration=5e3,document.body.appendChild(t),t}connectedCallback(){super.connectedCallback(),this.setAttribute("role","alert"),this.classList.add(`kr-snackbar--${this.type}`),this.title&&this.classList.add("kr-snackbar--has-title"),Ke.activeSnackbars.push(this),this.updatePositions(),this.duration>0&&(this.dismissTimeout=window.setTimeout(()=>{this.dismiss()},this.duration))}disconnectedCallback(){super.disconnectedCallback();const e=Ke.activeSnackbars.indexOf(this);e>-1&&Ke.activeSnackbars.splice(e,1),this.updatePositions(),this.dismissTimeout&&clearTimeout(this.dismissTimeout)}updatePositions(){let e=24;for(const t of Ke.activeSnackbars)t.style.bottom=`${e}px`,e+=t.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 e={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`
|
|
819
819
|
${e[this.type]}
|
|
820
820
|
<div class="content">
|
|
821
|
-
${this.title?
|
|
821
|
+
${this.title?F`<div class="title">${this.title}</div>`:""}
|
|
822
822
|
<div class="message">${this.message}</div>
|
|
823
823
|
</div>
|
|
824
824
|
<button
|
|
@@ -984,9 +984,9 @@ class Re extends xe{constructor(e){if(super(e),this.it=N,e.type!==ye)throw Error
|
|
|
984
984
|
* Copyright 2018 Google LLC
|
|
985
985
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
986
986
|
*/
|
|
987
|
-
const ze="important",Le=" !"+ze,De=
|
|
987
|
+
const ze="important",Le=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e),e.type!==ve||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,i)=>{const o=e[i];return null==o?t:t+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${o};`},"")}update(e,[t]){const{style:i}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?i.removeProperty(e):i[e]=null);for(const e in t){const o=t[e];if(null!=o){this.ft.add(e);const t="string"==typeof o&&o.endsWith(Le);e.includes("-")||t?i.setProperty(e,t?o.slice(0,-11):o,t?ze:""):i[e]=o}}return U}});var Me=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRTabGroup=class extends le{constructor(){super(...arguments),this.justified=!1,this.size="medium"}updated(e){e.has("activeTabId")&&this._updateActiveTab()}firstUpdated(){this._updateActiveTab()}_getTabs(){return Array.from(this.querySelectorAll("kr-tab"))}_updateActiveTab(){const e=this._getTabs();0!==e.length&&(this.activeTabId||(this.activeTabId=e[0]?.id),e.forEach(e=>{e.active=e.id===this.activeTabId}),this.requestUpdate())}_handleTabClick(e){e.disabled||(this.activeTabId=e.id,this.dispatchEvent(new CustomEvent("tab-change",{detail:{activeTabId:e.id},bubbles:!0,composed:!0})))}_handleTabDismiss(e,t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("tab-dismiss",{detail:{tabId:e.id},bubbles:!0,composed:!0}))}_handleKeyDown(e){const t=this._getTabs().filter(e=>!e.disabled),i=t.findIndex(e=>e.id===this.activeTabId);let o=-1;switch(e.key){case"ArrowLeft":o=i>0?i-1:t.length-1;break;case"ArrowRight":o=i<t.length-1?i+1:0;break;case"Home":o=0;break;case"End":o=t.length-1}if(o>=0){e.preventDefault();const i=t[o];this.activeTabId=i.id,this.dispatchEvent(new CustomEvent("tab-change",{detail:{activeTabId:i.id},bubbles:!0,composed:!0}));const s=this.shadowRoot?.querySelectorAll(".label"),r=Array.from(s||[]).find(e=>e.getAttribute("data-tab-id")===i.id);r?.focus()}}_renderTabIcon(e){const t=e.getIconElement();if(!t)return N;const i=t.cloneNode(!0);return i.removeAttribute("slot"),F`<span class="label-icon">${i}</span>`}render(){return F`
|
|
988
988
|
<div class="header" role="tablist" @keydown=${this._handleKeyDown}>
|
|
989
|
-
${this._getTabs().map(e=>
|
|
989
|
+
${this._getTabs().map(e=>F`
|
|
990
990
|
<button
|
|
991
991
|
class=${we({label:!0,"label--active":e.id===this.activeTabId,"label--justified":this.justified})}
|
|
992
992
|
role="tab"
|
|
@@ -999,8 +999,8 @@ const ze="important",Le=" !"+ze,De=ke(class extends xe{constructor(e){if(super(e
|
|
|
999
999
|
>
|
|
1000
1000
|
${this._renderTabIcon(e)}
|
|
1001
1001
|
<span>${e.title}</span>
|
|
1002
|
-
${e.badge?
|
|
1003
|
-
${e.dismissible?
|
|
1002
|
+
${e.badge?F`<span class="label-badge" style=${De({backgroundColor:e.badgeBackground,color:e.badgeColor})}>${e.badge}</span>`:N}
|
|
1003
|
+
${e.dismissible?F`
|
|
1004
1004
|
<button
|
|
1005
1005
|
class="label-dismiss"
|
|
1006
1006
|
type="button"
|
|
@@ -1148,7 +1148,7 @@ const ze="important",Le=" !"+ze,De=ke(class extends xe{constructor(e){if(super(e
|
|
|
1148
1148
|
::slotted(kr-tab[active]) {
|
|
1149
1149
|
display: block;
|
|
1150
1150
|
}
|
|
1151
|
-
`],Me([ue({type:String,attribute:"active-tab-id"})],e.KRTabGroup.prototype,"activeTabId",void 0),Me([ue({type:Boolean})],e.KRTabGroup.prototype,"justified",void 0),Me([ue({type:String,reflect:!0})],e.KRTabGroup.prototype,"size",void 0),e.KRTabGroup=Me([ce("kr-tab-group")],e.KRTabGroup);var je=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRTab=class extends le{constructor(){super(...arguments),this.id="",this.title="",this.badge="",this.badgeBackground="",this.badgeColor="",this.disabled=!1,this.dismissible=!1,this.active=!1}getIconElement(){return this.querySelector('[slot="icon"]')}render(){return
|
|
1151
|
+
`],Me([ue({type:String,attribute:"active-tab-id"})],e.KRTabGroup.prototype,"activeTabId",void 0),Me([ue({type:Boolean})],e.KRTabGroup.prototype,"justified",void 0),Me([ue({type:String,reflect:!0})],e.KRTabGroup.prototype,"size",void 0),e.KRTabGroup=Me([ce("kr-tab-group")],e.KRTabGroup);var je=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRTab=class extends le{constructor(){super(...arguments),this.id="",this.title="",this.badge="",this.badgeBackground="",this.badgeColor="",this.disabled=!1,this.dismissible=!1,this.active=!1}getIconElement(){return this.querySelector('[slot="icon"]')}render(){return F`<slot></slot>`}},e.KRTab.styles=[de,n`
|
|
1152
1152
|
:host {
|
|
1153
1153
|
display: none;
|
|
1154
1154
|
}
|
|
@@ -1156,7 +1156,7 @@ const ze="important",Le=" !"+ze,De=ke(class extends xe{constructor(e){if(super(e
|
|
|
1156
1156
|
:host([active]) {
|
|
1157
1157
|
display: block;
|
|
1158
1158
|
}
|
|
1159
|
-
`],je([ue({type:String,reflect:!0})],e.KRTab.prototype,"id",void 0),je([ue({type:String})],e.KRTab.prototype,"title",void 0),je([ue({type:String})],e.KRTab.prototype,"badge",void 0),je([ue({type:String,attribute:"badge-background"})],e.KRTab.prototype,"badgeBackground",void 0),je([ue({type:String,attribute:"badge-color"})],e.KRTab.prototype,"badgeColor",void 0),je([ue({type:Boolean})],e.KRTab.prototype,"disabled",void 0),je([ue({type:Boolean})],e.KRTab.prototype,"dismissible",void 0),je([ue({type:Boolean,reflect:!0})],e.KRTab.prototype,"active",void 0),e.KRTab=je([ce("kr-tab")],e.KRTab);var Be=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};const He=['"',"+","-","&&","||","!","(",")","{","}","[","]","^","~","*","?",":"],Ie=['\\"',"\\+","\\-","\\&\\&","\\|\\|","\\!","\\(","\\)","\\{","\\}","\\[","\\]","\\^","\\~","\\*","\\?","\\:"];function qe(e){let t=e;for(let e=0;e<He.length;e++)t=t.split(He[e]).join(Ie[e]);return t}e.KRTable=class extends le{constructor(){super(...arguments),this._scrollStyle="overlay",this._data=[],this._dataState="idle",this._page=1,this._pageSize=50,this._totalItems=0,this._totalPages=0,this._searchQuery="",this._canScrollLeft=!1,this._canScrollRight=!1,this._canScrollHorizontal=!1,this._columnPickerOpen=!1,this._displayedColumns=[],this.
|
|
1159
|
+
`],je([ue({type:String,reflect:!0})],e.KRTab.prototype,"id",void 0),je([ue({type:String})],e.KRTab.prototype,"title",void 0),je([ue({type:String})],e.KRTab.prototype,"badge",void 0),je([ue({type:String,attribute:"badge-background"})],e.KRTab.prototype,"badgeBackground",void 0),je([ue({type:String,attribute:"badge-color"})],e.KRTab.prototype,"badgeColor",void 0),je([ue({type:Boolean})],e.KRTab.prototype,"disabled",void 0),je([ue({type:Boolean})],e.KRTab.prototype,"dismissible",void 0),je([ue({type:Boolean,reflect:!0})],e.KRTab.prototype,"active",void 0),e.KRTab=je([ce("kr-tab")],e.KRTab);var Be=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};const He=['"',"+","-","&&","||","!","(",")","{","}","[","]","^","~","*","?",":"],Ie=['\\"',"\\+","\\-","\\&\\&","\\|\\|","\\!","\\(","\\)","\\{","\\}","\\[","\\]","\\^","\\~","\\*","\\?","\\:"];function qe(e){let t=e;for(let e=0;e<He.length;e++)t=t.split(He[e]).join(Ie[e]);return t}e.KRTable=class extends le{constructor(){super(...arguments),this._scrollStyle="overlay",this._data=[],this._dataState="idle",this._page=1,this._pageSize=50,this._totalItems=0,this._totalPages=0,this._searchQuery="",this._canScrollLeft=!1,this._canScrollRight=!1,this._canScrollHorizontal=!1,this._columnPickerOpen=!1,this._displayedColumns=[],this._resizing=null,this._resizeObserver=null,this._searchPositionLocked=!1,this._def={columns:[]},this.def={columns:[]},this._handleClickOutsideColumnPicker=e=>{if(!this._columnPickerOpen)return;const t=e.composedPath(),i=this.shadowRoot?.querySelector(".column-picker-wrapper");i&&!t.includes(i)&&(this._columnPickerOpen=!1)},this._handleResizeMove=e=>{if(!this._resizing)return;const t=this._def.columns.find(e=>e.id===this._resizing.columnId);if(t){const i=this._resizing.startWidth+(e.clientX-this._resizing.startX);t.width=`${Math.min(900,Math.max(50,i))}px`,this.requestUpdate()}},this._handleResizeEnd=()=>{this._resizing=null,document.removeEventListener("mousemove",this._handleResizeMove),document.removeEventListener("mouseup",this._handleResizeEnd)}}connectedCallback(){super.connectedCallback(),this.classList.toggle("kr-table--scroll-overlay","overlay"===this._scrollStyle),this.classList.toggle("kr-table--scroll-edge","edge"===this._scrollStyle),this._fetch(),this._initRefresh(),document.addEventListener("click",this._handleClickOutsideColumnPicker),this._resizeObserver=new ResizeObserver(()=>{this._searchPositionLocked=!1,this._updateSearchPosition()}),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this._refreshTimer),document.removeEventListener("click",this._handleClickOutsideColumnPicker),this._resizeObserver?.disconnect()}willUpdate(e){e.has("def")&&(this._def={...this.def,columns:this.def.columns.map(e=>"actions"===e.type?{...e,sticky:"right",resizable:!1}:{...e})},this._displayedColumns=this._def.displayedColumns||this._def.columns.map(e=>e.id),this._fetch(),this._initRefresh())}updated(e){this._updateScrollFlags()}refresh(){this._fetch()}goToPrevPage(){this._page>1&&(this._page--,this._fetch())}goToNextPage(){this._page<this._totalPages&&(this._page++,this._fetch())}goToPage(e){e>=1&&e<=this._totalPages&&(this._page=e,this._fetch())}_fetch(){if(!this._def.dataSource)return;let t;switch(this._dataState="loading",this._def.dataSource.mode){case"opensearch":throw Error("Opensearch not supported yet");case"db":throw Error("DB not supported yet");default:t={page:this._page-1,size:this._pageSize,sorts:[],filterFields:[],queryFields:[],facetFields:[]},this._searchQuery?.trim().length&&t.queryFields.push({name:"_text_",operation:"IS",value:qe(this._searchQuery)})}this._def.dataSource.fetch(t).then(e=>{switch(this._def.dataSource?.mode){case"opensearch":throw Error("Opensearch not supported yet");case"db":throw Error("DB not supported yet");default:{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size}}this._dataState="success",this._updateSearchPosition()}).catch(t=>{this._dataState="error",e.KRSnackbar.show({message:t instanceof Error?t.message:"Failed to load data",type:"error"})})}_initRefresh(){clearInterval(this._refreshTimer),this._def.refreshInterval&&this._def.refreshInterval>0&&(this._refreshTimer=window.setInterval(()=>{this._fetch()},this._def.refreshInterval))}_handleSearch(e){const t=e.target;this._searchQuery=t.value,this._page=1,this._fetch()}_getGridTemplateColumns(){return this.getDisplayedColumns().map(e=>e.width?e.width:"actions"===e.type?"max-content":"minmax(80px, auto)").join(" ")}_updateSearchPosition(){if(this._searchPositionLocked)return;const e=this.shadowRoot?.querySelector(".search"),t=e?.querySelector(".search-field");e&&t&&(e.style.justifyContent="center",t.style.marginLeft="",requestAnimationFrame(()=>{const i=e.getBoundingClientRect(),o=t.getBoundingClientRect().left-i.left;e.style.justifyContent="flex-start",t.style.marginLeft=`${o}px`,this._searchPositionLocked=!0}))}_toggleColumnPicker(){this._columnPickerOpen=!this._columnPickerOpen}_toggleColumn(e){this._displayedColumns.includes(e)?this._displayedColumns=this._displayedColumns.filter(t=>t!==e):this._displayedColumns=[...this._displayedColumns,e]}getDisplayedColumns(){return this._displayedColumns.map(e=>this._def.columns.find(t=>t.id===e)).sort((e,t)=>"actions"===e.type&&"actions"!==t.type?1:"actions"!==e.type&&"actions"===t.type?-1:0)}_handleScroll(e){const t=e.target;this._canScrollLeft=t.scrollLeft>0,this._canScrollRight=t.scrollLeft<t.scrollWidth-t.clientWidth-1}_updateScrollFlags(){const e=this.shadowRoot?.querySelector(".content");e&&(this._canScrollLeft=e.scrollLeft>0,this._canScrollRight=e.scrollWidth>e.clientWidth&&e.scrollLeft<e.scrollWidth-e.clientWidth-1,this._canScrollHorizontal=e.scrollWidth>e.clientWidth),this.classList.toggle("kr-table--scroll-left-available",this._canScrollLeft),this.classList.toggle("kr-table--scroll-right-available",this._canScrollRight),this.classList.toggle("kr-table--scroll-horizontal-available",this._canScrollHorizontal),this.classList.toggle("kr-table--sticky-left",this.getDisplayedColumns().some(e=>"left"===e.sticky)),this.classList.toggle("kr-table--sticky-right",this.getDisplayedColumns().some(e=>"right"===e.sticky))}_handleResizeStart(e,t){e.preventDefault();const i=this.shadowRoot?.querySelector(`.header-cell[data-column-id="${t}"]`);this._resizing={columnId:t,startX:e.clientX,startWidth:i?.offsetWidth||200},document.addEventListener("mousemove",this._handleResizeMove),document.addEventListener("mouseup",this._handleResizeEnd)}_handleAction(e){this.dispatchEvent(new CustomEvent("action",{detail:{action:e.id},bubbles:!0,composed:!0}))}_renderCellContent(e,t){const i=t[e.id];if(e.render){const i=e.render(t);return"string"==typeof i?Ce(i):i}if(null==i)return"";switch(e.type){case"number":return"number"==typeof i?i.toLocaleString():String(i);case"currency":return"number"==typeof i?i.toLocaleString("en-US",{style:"currency",currency:"USD"}):String(i);case"date":return i instanceof Date?i.toLocaleDateString():new Date(i).toLocaleDateString();case"boolean":return!0===i?"Yes":!1===i?"No":"";default:return String(i)}}_getHeaderCellClasses(e,t){return{"header-cell":!0,"header-cell--align-center":"center"===e.align,"header-cell--align-right":"right"===e.align,"header-cell--sticky-left":"left"===e.sticky,"header-cell--sticky-left-last":"left"===e.sticky&&!this.getDisplayedColumns().slice(t+1).some(e=>"left"===e.sticky),"header-cell--sticky-right":"right"===e.sticky,"header-cell--sticky-right-first":"right"===e.sticky&&!this.getDisplayedColumns().slice(0,t).some(e=>"right"===e.sticky)}}_getCellClasses(e,t){return{cell:!0,"cell--actions":"actions"===e.type,"cell--align-center":"center"===e.align,"cell--align-right":"right"===e.align,"cell--sticky-left":"left"===e.sticky,"cell--sticky-left-last":"left"===e.sticky&&!this.getDisplayedColumns().slice(t+1).some(e=>"left"===e.sticky),"cell--sticky-right":"right"===e.sticky,"cell--sticky-right-first":"right"===e.sticky&&!this.getDisplayedColumns().slice(0,t).some(e=>"right"===e.sticky)}}_getCellStyle(e,t){const i={};if("left"===e.sticky){let e=0;for(let i=0;i<t;i++){const t=this.getDisplayedColumns()[i];"left"===t.sticky&&(e+=parseInt(t.width||"0",10))}i.left=`${e}px`}if("right"===e.sticky){let e=0;for(let i=t+1;i<this.getDisplayedColumns().length;i++){const t=this.getDisplayedColumns()[i];"right"===t.sticky&&(e+=parseInt(t.width||"0",10))}i.right=`${e}px`}return i}_renderPagination(){const e=(this._page-1)*this._pageSize+1,t=Math.min(this._page*this._pageSize,this._totalItems);return F`
|
|
1160
1160
|
<div class="pagination">
|
|
1161
1161
|
<span
|
|
1162
1162
|
class="pagination-icon ${1===this._page?"pagination-icon--disabled":""}"
|
|
@@ -1172,7 +1172,7 @@ const ze="important",Le=" !"+ze,De=ke(class extends xe{constructor(e){if(super(e
|
|
|
1172
1172
|
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
|
|
1173
1173
|
</span>
|
|
1174
1174
|
</div>
|
|
1175
|
-
`}_renderHeader(){return!this._def.title&&!this._def.actions?.length&&this._totalPages<=1?N:
|
|
1175
|
+
`}_renderHeader(){return!this._def.title&&!this._def.actions?.length&&this._totalPages<=1?N:F`
|
|
1176
1176
|
<div class="header">
|
|
1177
1177
|
<div class="title">${this._def.title??""}</div>
|
|
1178
1178
|
<div class="search">
|
|
@@ -1203,7 +1203,7 @@ const ze="important",Le=" !"+ze,De=ke(class extends xe{constructor(e){if(super(e
|
|
|
1203
1203
|
<svg viewBox="0 -960 960 960" fill="currentColor"><path d="M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"/></svg>
|
|
1204
1204
|
</span>
|
|
1205
1205
|
<div class="column-picker ${this._columnPickerOpen?"open":""}">
|
|
1206
|
-
${[...this._def.columns].filter(e=>"actions"!==e.type).sort((e,t)=>(e.label??e.id).localeCompare(t.label??t.id)).map(e=>
|
|
1206
|
+
${[...this._def.columns].filter(e=>"actions"!==e.type).sort((e,t)=>(e.label??e.id).localeCompare(t.label??t.id)).map(e=>F`
|
|
1207
1207
|
<div class="column-picker-item" @click=${()=>this._toggleColumn(e.id)}>
|
|
1208
1208
|
<div class="column-picker-checkbox ${this._displayedColumns.includes(e.id)?"checked":""}">
|
|
1209
1209
|
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>
|
|
@@ -1213,14 +1213,14 @@ const ze="important",Le=" !"+ze,De=ke(class extends xe{constructor(e){if(super(e
|
|
|
1213
1213
|
`)}
|
|
1214
1214
|
</div>
|
|
1215
1215
|
</div>
|
|
1216
|
-
${1===this._def.actions?.length?
|
|
1216
|
+
${1===this._def.actions?.length?F`
|
|
1217
1217
|
<kr-button
|
|
1218
1218
|
class="actions"
|
|
1219
1219
|
@click=${()=>this._handleAction(this._def.actions[0])}
|
|
1220
1220
|
>
|
|
1221
1221
|
${this._def.actions[0].label}
|
|
1222
1222
|
</kr-button>
|
|
1223
|
-
`:this._def.actions?.length?
|
|
1223
|
+
`:this._def.actions?.length?F`
|
|
1224
1224
|
<kr-button
|
|
1225
1225
|
class="actions"
|
|
1226
1226
|
.options=${this._def.actions.map(e=>({id:e.id,label:e.label}))}
|
|
@@ -1231,7 +1231,7 @@ const ze="important",Le=" !"+ze,De=ke(class extends xe{constructor(e){if(super(e
|
|
|
1231
1231
|
`:N}
|
|
1232
1232
|
</div>
|
|
1233
1233
|
</div>
|
|
1234
|
-
`}_renderStatus(){return"loading"===this._dataState&&0===this._data.length?
|
|
1234
|
+
`}_renderStatus(){return"loading"===this._dataState&&0===this._data.length?F`<div class="status">Loading...</div>`:"error"===this._dataState&&0===this._data.length?F`<div class="status status--error">Error loading data</div>`:0===this._data.length?F`<div class="status">No data available</div>`:N}_renderTable(){return F`
|
|
1235
1235
|
<div class="wrapper">
|
|
1236
1236
|
<div class="overlay-left"></div>
|
|
1237
1237
|
<div class="overlay-right"></div>
|
|
@@ -1239,20 +1239,20 @@ const ze="important",Le=" !"+ze,De=ke(class extends xe{constructor(e){if(super(e
|
|
|
1239
1239
|
<div class="content" @scroll=${this._handleScroll}>
|
|
1240
1240
|
<div class="table" style="grid-template-columns: ${this._getGridTemplateColumns()}">
|
|
1241
1241
|
<div class="header-row">
|
|
1242
|
-
${this.getDisplayedColumns().map((e,t)=>
|
|
1242
|
+
${this.getDisplayedColumns().map((e,t)=>F`
|
|
1243
1243
|
<div
|
|
1244
1244
|
class=${we(this._getHeaderCellClasses(e,t))}
|
|
1245
1245
|
style=${De(this._getCellStyle(e,t))}
|
|
1246
1246
|
data-column-id=${e.id}
|
|
1247
|
-
>${e.label??e.id}${!1!==e.resizable?
|
|
1247
|
+
>${e.label??e.id}${!1!==e.resizable?F`<div
|
|
1248
1248
|
class="header-cell__resize"
|
|
1249
1249
|
@mousedown=${t=>this._handleResizeStart(t,e.id)}
|
|
1250
1250
|
></div>`:N}</div>
|
|
1251
1251
|
`)}
|
|
1252
1252
|
</div>
|
|
1253
|
-
${this._data.map(e=>
|
|
1253
|
+
${this._data.map(e=>F`
|
|
1254
1254
|
<div class="row">
|
|
1255
|
-
${this.getDisplayedColumns().map((t,i)=>
|
|
1255
|
+
${this.getDisplayedColumns().map((t,i)=>F`
|
|
1256
1256
|
<div
|
|
1257
1257
|
class=${we(this._getCellClasses(t,i))}
|
|
1258
1258
|
style=${De(this._getCellStyle(t,i))}
|
|
@@ -1266,10 +1266,10 @@ const ze="important",Le=" !"+ze,De=ke(class extends xe{constructor(e){if(super(e
|
|
|
1266
1266
|
</div>
|
|
1267
1267
|
</div>
|
|
1268
1268
|
</div>
|
|
1269
|
-
`}render(){return this._def.columns.length?
|
|
1269
|
+
`}render(){return this._def.columns.length?F`
|
|
1270
1270
|
${this._renderHeader()}
|
|
1271
1271
|
${this._renderTable()}
|
|
1272
|
-
`:
|
|
1272
|
+
`:F`<slot></slot>`}},e.KRTable.styles=[de,n`
|
|
1273
1273
|
/* -------------------------------------------------------------------------
|
|
1274
1274
|
* Host
|
|
1275
1275
|
* ----------------------------------------------------------------------- */
|
|
@@ -1784,7 +1784,7 @@ const ze="important",Le=" !"+ze,De=ke(class extends xe{constructor(e){if(super(e
|
|
|
1784
1784
|
* Copyright 2018 Google LLC
|
|
1785
1785
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1786
1786
|
*/
|
|
1787
|
-
const
|
|
1787
|
+
const Fe=e=>e??N,Ue={},Ne=xe(class extends ke{constructor(e){if(super(e),e.type!==me&&e.type!==ve&&e.type!==_e)throw Error("The `live` directive is not allowed on child or event bindings");if(!(e=>void 0===e.strings)(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===U||t===N)return t;const i=e.element,o=e.name;if(e.type===me){if(t===i[o])return U}else if(e.type===_e){if(!!t===i.hasAttribute(o))return U}else if(e.type===ve&&i.getAttribute(o)===t+"")return U;return((e,t=Ue)=>{e._$AH=t;
|
|
1788
1788
|
/**
|
|
1789
1789
|
* @license
|
|
1790
1790
|
* Copyright 2020 Google LLC
|
|
@@ -1794,12 +1794,12 @@ const Ue=e=>e??N,Fe={},Ne=ke(class extends xe{constructor(e){if(super(e),e.type!
|
|
|
1794
1794
|
* @license
|
|
1795
1795
|
* Copyright 2020 Google LLC
|
|
1796
1796
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1797
|
-
*/var Ve=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRTextField=class extends le{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._handleInvalid=e=>{e.preventDefault(),this._touched=!0},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(e){this.value=e}connectedCallback(){super.connectedCallback(),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity()}_updateValidity(){this._input&&this._internals.setValidity(this._input.validity,this._input.validationMessage)}_handleInput(e){this.value=e.target.value,this._dirty=!0,this._internals.setFormValue(this.value),this._internals.setValidity(this._input.validity,this._input.validationMessage)}_handleChange(e){this.value=e.target.value,this._internals.setFormValue(this.value)}_handleBlur(){this._touched=!0,this._internals.setValidity(this._input.validity,this._input.validationMessage)}render(){let e="";return this._touched&&this._input&&!this._input.validity.valid&&(e=this._input.validationMessage),
|
|
1797
|
+
*/var Ve=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRTextField=class extends le{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._handleInvalid=e=>{e.preventDefault(),this._touched=!0},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(e){this.value=e}connectedCallback(){super.connectedCallback(),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity()}_updateValidity(){this._input&&this._internals.setValidity(this._input.validity,this._input.validationMessage)}_handleInput(e){this.value=e.target.value,this._dirty=!0,this._internals.setFormValue(this.value),this._internals.setValidity(this._input.validity,this._input.validationMessage)}_handleChange(e){this.value=e.target.value,this._internals.setFormValue(this.value)}_handleBlur(){this._touched=!0,this._internals.setValidity(this._input.validity,this._input.validationMessage)}render(){let e="";return this._touched&&this._input&&!this._input.validity.valid&&(e=this._input.validationMessage),F`
|
|
1798
1798
|
<div class="wrapper">
|
|
1799
|
-
${this.label?
|
|
1799
|
+
${this.label?F`
|
|
1800
1800
|
<label for="input">
|
|
1801
1801
|
${this.label}
|
|
1802
|
-
${this.required?
|
|
1802
|
+
${this.required?F`<span class="required" aria-hidden="true">*</span>`:""}
|
|
1803
1803
|
</label>
|
|
1804
1804
|
`:""}
|
|
1805
1805
|
<input
|
|
@@ -1812,15 +1812,15 @@ const Ue=e=>e??N,Fe={},Ne=ke(class extends xe{constructor(e){if(super(e),e.type!
|
|
|
1812
1812
|
?required=${this.required}
|
|
1813
1813
|
?disabled=${this.disabled}
|
|
1814
1814
|
?readonly=${this.readonly}
|
|
1815
|
-
minlength=${
|
|
1816
|
-
maxlength=${
|
|
1817
|
-
pattern=${
|
|
1818
|
-
autocomplete=${
|
|
1815
|
+
minlength=${Fe(this.minlength)}
|
|
1816
|
+
maxlength=${Fe(this.maxlength)}
|
|
1817
|
+
pattern=${Fe(this.pattern)}
|
|
1818
|
+
autocomplete=${Fe(this.autocomplete||void 0)}
|
|
1819
1819
|
@input=${this._handleInput}
|
|
1820
1820
|
@change=${this._handleChange}
|
|
1821
1821
|
@blur=${this._handleBlur}
|
|
1822
1822
|
/>
|
|
1823
|
-
${e?
|
|
1823
|
+
${e?F`<div class="validation-message">${e}</div>`:this.hint?F`<div class="hint">${this.hint}</div>`:""}
|
|
1824
1824
|
</div>
|
|
1825
1825
|
`}focus(){this._input?.focus()}blur(){this._input?.blur()}select(){this._input?.select()}},e.KRTextField.styles=n`
|
|
1826
1826
|
:host {
|
|
@@ -1889,12 +1889,12 @@ const Ue=e=>e??N,Fe={},Ne=ke(class extends xe{constructor(e){if(super(e),e.type!
|
|
|
1889
1889
|
font-size: 0.75rem;
|
|
1890
1890
|
color: var(--kr-text-field-helper-color, #6b7280);
|
|
1891
1891
|
}
|
|
1892
|
-
`,e.KRTextField.formAssociated=!0,Ve([ue({type:String})],e.KRTextField.prototype,"label",void 0),Ve([ue({type:String})],e.KRTextField.prototype,"name",void 0),Ve([ue({type:String})],e.KRTextField.prototype,"value",void 0),Ve([ue({type:String})],e.KRTextField.prototype,"placeholder",void 0),Ve([ue({type:String})],e.KRTextField.prototype,"type",void 0),Ve([ue({type:Boolean})],e.KRTextField.prototype,"required",void 0),Ve([ue({type:Boolean})],e.KRTextField.prototype,"disabled",void 0),Ve([ue({type:Boolean})],e.KRTextField.prototype,"readonly",void 0),Ve([ue({type:Number})],e.KRTextField.prototype,"minlength",void 0),Ve([ue({type:Number})],e.KRTextField.prototype,"maxlength",void 0),Ve([ue({type:String})],e.KRTextField.prototype,"pattern",void 0),Ve([ue({type:String})],e.KRTextField.prototype,"autocomplete",void 0),Ve([ue({type:String})],e.KRTextField.prototype,"hint",void 0),Ve([fe("input")],e.KRTextField.prototype,"_input",void 0),Ve([ge()],e.KRTextField.prototype,"_touched",void 0),Ve([ge()],e.KRTextField.prototype,"_dirty",void 0),e.KRTextField=Ve([ce("kr-text-field")],e.KRTextField);var We=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.
|
|
1892
|
+
`,e.KRTextField.formAssociated=!0,Ve([ue({type:String})],e.KRTextField.prototype,"label",void 0),Ve([ue({type:String})],e.KRTextField.prototype,"name",void 0),Ve([ue({type:String})],e.KRTextField.prototype,"value",void 0),Ve([ue({type:String})],e.KRTextField.prototype,"placeholder",void 0),Ve([ue({type:String})],e.KRTextField.prototype,"type",void 0),Ve([ue({type:Boolean})],e.KRTextField.prototype,"required",void 0),Ve([ue({type:Boolean})],e.KRTextField.prototype,"disabled",void 0),Ve([ue({type:Boolean})],e.KRTextField.prototype,"readonly",void 0),Ve([ue({type:Number})],e.KRTextField.prototype,"minlength",void 0),Ve([ue({type:Number})],e.KRTextField.prototype,"maxlength",void 0),Ve([ue({type:String})],e.KRTextField.prototype,"pattern",void 0),Ve([ue({type:String})],e.KRTextField.prototype,"autocomplete",void 0),Ve([ue({type:String})],e.KRTextField.prototype,"hint",void 0),Ve([fe("input")],e.KRTextField.prototype,"_input",void 0),Ve([ge()],e.KRTextField.prototype,"_touched",void 0),Ve([ge()],e.KRTextField.prototype,"_dirty",void 0),e.KRTextField=Ve([ce("kr-text-field")],e.KRTextField);var We=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRSelectField=class extends le{constructor(){super(),this.label="",this.name="",this.value="",this.placeholder="Select an option",this.disabled=!1,this.required=!1,this.readonly=!1,this.hint="",this._isOpen=!1,this._highlightedIndex=-1,this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._handleOutsideClick=e=>{e.composedPath().includes(this)||this._close()},this._handleKeyDown=e=>{if(!this._isOpen)return;const t=Array.from(this.querySelectorAll("kr-select-field-option"));switch(e.key){case"Escape":this._close(),this._triggerElement?.focus();break;case"ArrowDown":if(e.preventDefault(),t.some(e=>!e.disabled)){let e=this._highlightedIndex+1;for(;e<t.length&&t[e]?.disabled;)e++;e<t.length&&(this._highlightedIndex=e)}break;case"ArrowUp":e.preventDefault();{let e=this._highlightedIndex-1;for(;e>=0&&t[e]?.disabled;)e--;e>=0&&(this._highlightedIndex=e)}break;case"Enter":e.preventDefault(),this._highlightedIndex>=0&&this._highlightedIndex<t.length&&this._selectOption(t[this._highlightedIndex])}},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._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(e){this.value=e}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick),document.addEventListener("keydown",this._handleKeyDown),this.addEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick),document.removeEventListener("keydown",this._handleKeyDown),this.removeEventListener("invalid",this._handleInvalid)}_toggle(){if(!this.disabled&&!this.readonly)if(this._isOpen)this._close();else{this._isOpen=!0;const e=Array.from(this.querySelectorAll("kr-select-field-option"));this._highlightedIndex=e.findIndex(e=>e.value===this.value)}}_close(){this._isOpen=!1,this._highlightedIndex=-1}_selectOption(e){e.disabled||(this.value=e.value,this._internals.setFormValue(this.value),this._updateValidity(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._close(),this._triggerElement?.focus())}_handleBlur(){this._touched=!0,this._updateValidity()}_updateValidity(){this.required&&!this.value?this._internals.setValidity({valueMissing:!0},"Please select an option",this._triggerElement):this._internals.setValidity({})}render(){const e=Array.from(this.querySelectorAll("kr-select-field-option")),t=e.find(e=>e.value===this.value)?.label;return F`
|
|
1893
1893
|
<div class="wrapper">
|
|
1894
|
-
${this.label?
|
|
1894
|
+
${this.label?F`
|
|
1895
1895
|
<label>
|
|
1896
1896
|
${this.label}
|
|
1897
|
-
${this.required?
|
|
1897
|
+
${this.required?F`<span class="required" aria-hidden="true">*</span>`:""}
|
|
1898
1898
|
</label>
|
|
1899
1899
|
`:N}
|
|
1900
1900
|
<div class="select-wrapper">
|
|
@@ -1921,7 +1921,7 @@ const Ue=e=>e??N,Fe={},Ne=ke(class extends xe{constructor(e){if(super(e),e.type!
|
|
|
1921
1921
|
|
|
1922
1922
|
<div class=${we({"select-dropdown":!0,hidden:!this._isOpen})} role="listbox">
|
|
1923
1923
|
<div class="select-options">
|
|
1924
|
-
${0===e.length?
|
|
1924
|
+
${0===e.length?F`<div class="select-empty">No options available</div>`:e.map((e,t)=>{const i=e.value===this.value;return F`
|
|
1925
1925
|
<div
|
|
1926
1926
|
class=${we({"select-option":!0,"select-option--selected":i,"select-option--disabled":e.disabled,"select-option--highlighted":t===this._highlightedIndex})}
|
|
1927
1927
|
role="option"
|
|
@@ -1930,7 +1930,7 @@ const Ue=e=>e??N,Fe={},Ne=ke(class extends xe{constructor(e){if(super(e),e.type!
|
|
|
1930
1930
|
@mouseenter=${()=>this._highlightedIndex=t}
|
|
1931
1931
|
>
|
|
1932
1932
|
${e.label}
|
|
1933
|
-
${i?
|
|
1933
|
+
${i?F`<svg class="chevron-icon select-check" viewBox="0 0 20 20" fill="currentColor">
|
|
1934
1934
|
<path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd" />
|
|
1935
1935
|
</svg>`:N}
|
|
1936
1936
|
</div>
|
|
@@ -1938,12 +1938,12 @@ const Ue=e=>e??N,Fe={},Ne=ke(class extends xe{constructor(e){if(super(e),e.type!
|
|
|
1938
1938
|
</div>
|
|
1939
1939
|
</div>
|
|
1940
1940
|
</div>
|
|
1941
|
-
${this._touched&&this.required&&!this.value?
|
|
1941
|
+
${this._touched&&this.required&&!this.value?F`<div class="validation-message">Please select an option</div>`:this.hint?F`<div class="hint">${this.hint}</div>`:""}
|
|
1942
1942
|
</div>
|
|
1943
1943
|
<div class="options-slot">
|
|
1944
1944
|
<slot @slotchange=${()=>this.requestUpdate()}></slot>
|
|
1945
1945
|
</div>
|
|
1946
|
-
`}focus(){this._triggerElement?.focus()}blur(){this._triggerElement?.blur()}},e.
|
|
1946
|
+
`}focus(){this._triggerElement?.focus()}blur(){this._triggerElement?.blur()}},e.KRSelectField.styles=n`
|
|
1947
1947
|
:host {
|
|
1948
1948
|
display: block;
|
|
1949
1949
|
font-family: inherit;
|
|
@@ -2065,32 +2065,32 @@ const Ue=e=>e??N,Fe={},Ne=ke(class extends xe{constructor(e){if(super(e),e.type!
|
|
|
2065
2065
|
gap: 0.5rem;
|
|
2066
2066
|
padding: 0.5rem 0.75rem;
|
|
2067
2067
|
font-size: 14px;
|
|
2068
|
-
color: var(--kr-select-option-color, #111827);
|
|
2068
|
+
color: var(--kr-select-field-option-color, #111827);
|
|
2069
2069
|
cursor: pointer;
|
|
2070
2070
|
border-radius: 4px;
|
|
2071
2071
|
transition: background-color 0.15s;
|
|
2072
2072
|
}
|
|
2073
2073
|
|
|
2074
2074
|
.select-option:hover:not(.select-option--disabled) {
|
|
2075
|
-
background-color: var(--kr-select-option-hover-bg, #f3f4f6);
|
|
2075
|
+
background-color: var(--kr-select-field-option-hover-bg, #f3f4f6);
|
|
2076
2076
|
}
|
|
2077
2077
|
|
|
2078
2078
|
.select-option--selected {
|
|
2079
|
-
background-color: var(--kr-select-option-selected-bg, #eff6ff);
|
|
2080
|
-
color: var(--kr-select-option-selected-color, #1d4ed8);
|
|
2079
|
+
background-color: var(--kr-select-field-option-selected-bg, #eff6ff);
|
|
2080
|
+
color: var(--kr-select-field-option-selected-color, #1d4ed8);
|
|
2081
2081
|
}
|
|
2082
2082
|
|
|
2083
2083
|
.select-option--selected:hover {
|
|
2084
|
-
background-color: var(--kr-select-option-selected-hover-bg, #dbeafe);
|
|
2084
|
+
background-color: var(--kr-select-field-option-selected-hover-bg, #dbeafe);
|
|
2085
2085
|
}
|
|
2086
2086
|
|
|
2087
2087
|
.select-option--disabled {
|
|
2088
|
-
color: var(--kr-select-option-disabled-color, #9ca3af);
|
|
2088
|
+
color: var(--kr-select-field-option-disabled-color, #9ca3af);
|
|
2089
2089
|
cursor: not-allowed;
|
|
2090
2090
|
}
|
|
2091
2091
|
|
|
2092
2092
|
.select-option--highlighted {
|
|
2093
|
-
background-color: var(--kr-select-option-hover-bg, #f3f4f6);
|
|
2093
|
+
background-color: var(--kr-select-field-option-hover-bg, #f3f4f6);
|
|
2094
2094
|
}
|
|
2095
2095
|
|
|
2096
2096
|
.select-empty {
|
|
@@ -2129,9 +2129,9 @@ const Ue=e=>e??N,Fe={},Ne=ke(class extends xe{constructor(e){if(super(e),e.type!
|
|
|
2129
2129
|
.options-slot {
|
|
2130
2130
|
display: none;
|
|
2131
2131
|
}
|
|
2132
|
-
`,e.
|
|
2132
|
+
`,e.KRSelectField.formAssociated=!0,We([ue({type:String})],e.KRSelectField.prototype,"label",void 0),We([ue({type:String})],e.KRSelectField.prototype,"name",void 0),We([ue({type:String})],e.KRSelectField.prototype,"value",void 0),We([ue({type:String})],e.KRSelectField.prototype,"placeholder",void 0),We([ue({type:Boolean})],e.KRSelectField.prototype,"disabled",void 0),We([ue({type:Boolean})],e.KRSelectField.prototype,"required",void 0),We([ue({type:Boolean})],e.KRSelectField.prototype,"readonly",void 0),We([ue({type:String})],e.KRSelectField.prototype,"hint",void 0),We([ge()],e.KRSelectField.prototype,"_isOpen",void 0),We([ge()],e.KRSelectField.prototype,"_highlightedIndex",void 0),We([ge()],e.KRSelectField.prototype,"_touched",void 0),We([fe(".select-trigger")],e.KRSelectField.prototype,"_triggerElement",void 0),e.KRSelectField=We([ce("kr-select-field")],e.KRSelectField);var Ze=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};e.KRSelectFieldOption=class extends le{constructor(){super(...arguments),this.value="",this.disabled=!1}get label(){return this.textContent?.trim()||""}render(){return F`<slot></slot>`}},e.KRSelectFieldOption.styles=n`
|
|
2133
2133
|
:host {
|
|
2134
2134
|
display: none;
|
|
2135
2135
|
}
|
|
2136
|
-
`,Ze([ue({type:String})],e.
|
|
2136
|
+
`,Ze([ue({type:String})],e.KRSelectFieldOption.prototype,"value",void 0),Ze([ue({type:Boolean})],e.KRSelectFieldOption.prototype,"disabled",void 0),e.KRSelectFieldOption=Ze([ce("kr-select-field-option")],e.KRSelectFieldOption),e.DialogRef=Oe,e.krBaseCSS=de}),function(e){Object.keys(e).forEach(function(t){t.startsWith("KR")&&"function"==typeof e[t]&&(e[t.slice(2)]=e[t],delete e[t])})}(kr);
|
|
2137
2137
|
//# sourceMappingURL=krubble.umd.min.js.map
|