@kodaris/krubble-components 1.0.73 → 1.0.74
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 +3 -3
- package/dist/button/button.d.ts.map +1 -1
- package/dist/button/button.js +14 -2
- package/dist/button/button.js.map +1 -1
- package/dist/krubble-components.bundled.js +14 -2
- package/dist/krubble-components.bundled.js.map +1 -1
- package/dist/krubble-components.bundled.min.js +2 -1
- package/dist/krubble-components.bundled.min.js.map +1 -1
- package/dist/krubble-components.umd.js +14 -2
- package/dist/krubble-components.umd.js.map +1 -1
- package/dist/krubble-components.umd.min.js +133 -132
- package/dist/krubble-components.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
* Copyright 2017 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
const w=globalThis,$=w.trustedTypes,C=$?$.createPolicy("lit-html",{createHTML:e=>e}):void 0,R="$lit$",S=`lit$${Math.random().toFixed(9).slice(2)}$`,T="?"+S,E=`<${T}>`,z=document,O=()=>z.createComment(""),D=e=>null===e||"object"!=typeof e&&"function"!=typeof e,K=Array.isArray,A="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,I=/-->/g,q=/>/g,L=RegExp(`>|${A}(?:([^\\s"'>=/]+)(${A}*=${A}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),M=/'/g,B=/"/g,V=/^(?:script|style|textarea|title)$/i,
|
|
17
|
+
const w=globalThis,$=w.trustedTypes,C=$?$.createPolicy("lit-html",{createHTML:e=>e}):void 0,R="$lit$",S=`lit$${Math.random().toFixed(9).slice(2)}$`,T="?"+S,E=`<${T}>`,z=document,O=()=>z.createComment(""),D=e=>null===e||"object"!=typeof e&&"function"!=typeof e,K=Array.isArray,A="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,I=/-->/g,q=/>/g,L=RegExp(`>|${A}(?:([^\\s"'>=/]+)(${A}*=${A}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),M=/'/g,B=/"/g,V=/^(?:script|style|textarea|title)$/i,H=(e=>(t,...i)=>({_$litType$:e,strings:t,values:i}))(1),F=Symbol.for("lit-noChange"),j=Symbol.for("lit-nothing"),U=new WeakMap,N=z.createTreeWalker(z,129);function W(e,t){if(!K(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==C?C.createHTML(t):t}const X=(e,t)=>{const i=e.length-1,o=[];let s,r=2===t?"<svg>":3===t?"<math>":"",a=P;for(let t=0;t<i;t++){const i=e[t];let l,n,d=-1,h=0;for(;h<i.length&&(a.lastIndex=h,n=a.exec(i),null!==n);)h=a.lastIndex,a===P?"!--"===n[1]?a=I:void 0!==n[1]?a=q:void 0!==n[2]?(V.test(n[2])&&(s=RegExp("</"+n[2],"g")),a=L):void 0!==n[3]&&(a=L):a===L?">"===n[0]?(a=s??P,d=-1):void 0===n[1]?d=-2:(d=a.lastIndex-n[2].length,l=n[1],a=void 0===n[3]?L:'"'===n[3]?B:M):a===B||a===M?a=L:a===I||a===q?a=P:(a=L,s=void 0);const c=a===L&&e[t+1].startsWith("/>")?" ":"";r+=a===P?i+E:d>=0?(o.push(l),i.slice(0,d)+R+i.slice(d)+S+c):i+S+(-2===d?t:c)}return[W(e,r+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),o]};class Y{constructor({strings:e,_$litType$:t},i){let o;this.parts=[];let s=0,r=0;const a=e.length-1,l=this.parts,[n,d]=X(e,t);if(this.el=Y.createElement(n,i),N.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(o=N.nextNode())&&l.length<a;){if(1===o.nodeType){if(o.hasAttributes())for(const e of o.getAttributeNames())if(e.endsWith(R)){const t=d[r++],i=o.getAttribute(e).split(S),a=/([.?@])?(.*)/.exec(t);l.push({type:1,index:s,name:a[2],strings:i,ctor:"."===a[1]?ee:"?"===a[1]?te:"@"===a[1]?ie:J}),o.removeAttribute(e)}else e.startsWith(S)&&(l.push({type:6,index:s}),o.removeAttribute(e));if(V.test(o.tagName)){const e=o.textContent.split(S),t=e.length-1;if(t>0){o.textContent=$?$.emptyScript:"";for(let i=0;i<t;i++)o.append(e[i],O()),N.nextNode(),l.push({type:2,index:++s});o.append(e[t],O())}}}else if(8===o.nodeType)if(o.data===T)l.push({type:2,index:s});else{let e=-1;for(;-1!==(e=o.data.indexOf(S,e+1));)l.push({type:7,index:s}),e+=S.length-1}s++}}static createElement(e,t){const i=z.createElement("template");return i.innerHTML=e,i}}function Z(e,t,i=e,o){if(t===F)return t;let s=void 0!==o?i._$Co?.[o]:i._$Cl;const r=D(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=Z(e,s._$AS(e,t.values),s,o)),t}class Q{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??z).importNode(t,!0);N.currentNode=o;let s=N.nextNode(),r=0,a=0,l=i[0];for(;void 0!==l;){if(r===l.index){let t;2===l.type?t=new G(s,s.nextSibling,this,e):1===l.type?t=new l.ctor(s,l.name,l.strings,this,e):6===l.type&&(t=new oe(s,this,e)),this._$AV.push(t),l=i[++a]}r!==l?.index&&(s=N.nextNode(),r++)}return N.currentNode=z,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 G{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,o){this.type=2,this._$AH=j,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=Z(this,e,t),D(e)?e===j||null==e||""===e?(this._$AH!==j&&this._$AR(),this._$AH=j):e!==this._$AH&&e!==F&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>K(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!==j&&D(this._$AH)?this._$AA.nextSibling.data=e:this.T(z.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=Y.createElement(W(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===o)this._$AH.p(t);else{const e=new Q(o,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=U.get(e.strings);return void 0===t&&U.set(e.strings,t=new Y(e)),t}k(e){K(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 G(this.O(O()),this.O(O()),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 J{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,o,s){this.type=1,this._$AH=j,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=j}_$AI(e,t=this,i,o){const s=this.strings;let r=!1;if(void 0===s)e=Z(this,e,t,0),r=!D(e)||e!==this._$AH&&e!==F,r&&(this._$AH=e);else{const o=e;let a,l;for(e=s[0],a=0;a<s.length-1;a++)l=Z(this,o[i+a],t,a),l===F&&(l=this._$AH[a]),r||=!D(l)||l!==this._$AH[a],l===j?e=j:e!==j&&(e+=(l??"")+s[a+1]),this._$AH[a]=l}r&&!o&&this.j(e)}j(e){e===j?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ee extends J{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===j?void 0:e}}class te extends J{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==j)}}class ie extends J{constructor(e,t,i,o,s){super(e,t,i,o,s),this.type=5}_$AI(e,t=this){if((e=Z(this,e,t,0)??j)===F)return;const i=this._$AH,o=e===j&&i!==j||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,s=e!==j&&(i===j||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 oe{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){Z(this,e)}}const se=w.litHtmlPolyfillSupport;se?.(Y,G),(w.litHtmlVersions??=[]).push("3.3.2");const re=(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 G(t.insertBefore(O(),e),e,void 0,i??{})}return s._$AI(e),s
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/},ae=globalThis;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=re(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return
|
|
22
|
+
*/},ae=globalThis;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=re(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return F}};le._$litElement$=!0,le.finalized=!0,ae.litElementHydrateSupport?.({LitElement:le});const ne=ae.litElementPolyfillSupport;ne?.({LitElement:le}),(ae.litElementVersions??=[]).push("4.2.2");const de=a`
|
|
23
23
|
:host,
|
|
24
24
|
*,
|
|
25
25
|
*::before,
|
|
@@ -72,7 +72,7 @@ const w=globalThis,$=w.trustedTypes,C=$?$.createPolicy("lit-html",{createHTML:e=
|
|
|
72
72
|
* Copyright 2017 Google LLC
|
|
73
73
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
74
74
|
*/
|
|
75
|
-
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,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRAccordion=class extends le{constructor(){super(...arguments),this.header="",this.expanded=!1}toggle(){this.expanded=!this.expanded}render(){return
|
|
75
|
+
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,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRAccordion=class extends le{constructor(){super(...arguments),this.header="",this.expanded=!1}toggle(){this.expanded=!this.expanded}render(){return H`
|
|
76
76
|
<div class="header" @click=${this.toggle}>
|
|
77
77
|
<span class="header__title">${this.header}</span>
|
|
78
78
|
<svg class="header__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
@@ -149,19 +149,19 @@ const ve=1,_e=2,me=3,ye=4,xe=e=>(...t)=>({_$litDirective$:e,values:t});let ke=cl
|
|
|
149
149
|
* @license
|
|
150
150
|
* Copyright 2018 Google LLC
|
|
151
151
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
152
|
-
*/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
|
|
152
|
+
*/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 F}});var $e=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRAlert=class extends le{constructor(){super(...arguments),this.type="info",this.title="",this.dismissible=!1,this.visible=!0}_handleDismiss(){this.visible=!1,this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0}))}render(){const e={info:H`<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:H`<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:H`<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:H`<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 H`
|
|
153
153
|
<div
|
|
154
154
|
class=${we({alert:!0,["alert--"+this.type]:!0,"alert--has-header":!!this.title,"alert--hidden":!this.visible})}
|
|
155
155
|
role="alert"
|
|
156
156
|
>
|
|
157
157
|
${e[this.type]}
|
|
158
158
|
<div class="content">
|
|
159
|
-
${this.title?
|
|
159
|
+
${this.title?H`<h4 class="header">${this.title}</h4>`:j}
|
|
160
160
|
<div class="message">
|
|
161
161
|
<slot></slot>
|
|
162
162
|
</div>
|
|
163
163
|
</div>
|
|
164
|
-
${this.dismissible?
|
|
164
|
+
${this.dismissible?H`
|
|
165
165
|
<button
|
|
166
166
|
class="dismiss"
|
|
167
167
|
type="button"
|
|
@@ -290,14 +290,14 @@ const ve=1,_e=2,me=3,ye=4,xe=e=>(...t)=>({_$litDirective$:e,values:t});let ke=cl
|
|
|
290
290
|
outline: 2px solid #3b82f6;
|
|
291
291
|
outline-offset: 2px;
|
|
292
292
|
}
|
|
293
|
-
`,$e([ue({type:String})],e.KRAlert.prototype,"type",void 0),$e([ue({type:String})],e.KRAlert.prototype,"title",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([he("kr-alert")],e.KRAlert);var Ce=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRButton=class extends le{constructor(){super(...arguments),this.variant="flat",this.color="primary",this.size="medium",this.disabled=!1,this.options=[],this.iconPosition="left",this.split=!1,this._state="idle",this._stateText="",this._dropdownOpened=!1,this._handleHostClick=e=>{this.split&&this.options.length||this.options.length&&(e.stopPropagation(),this._toggleDropdown())},this._handleKeydown=e=>{if("Escape"===e.key&&this._dropdownOpened)this._dropdownOpened=!1;else{if("Enter"===e.key||" "===e.key){if(e.preventDefault(),this.split&&this.options.length)return void this.dispatchEvent(new MouseEvent("click",{bubbles:!0,composed:!0}));this.options.length?this._toggleDropdown():this.click()}this.split&&this.options.length&&"ArrowDown"===e.key&&(e.preventDefault(),this._dropdownOpened||this._toggleDropdown())}},this._handleClickOutside=e=>{this._dropdownOpened&&!this.contains(e.target)&&(this._dropdownOpened=!1)}}connectedCallback(){super.connectedCallback(),this.setAttribute("role",this.href?"link":"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)}_handleSplitPrimaryClick(e){e.stopPropagation(),this._dropdownOpened&&(this._dropdownOpened=!1),this.dispatchEvent(new MouseEvent("click",{bubbles:!0,composed:!0}))}_handleSplitTriggerClick(e){e.stopPropagation(),this._toggleDropdown()}_toggleDropdown(){this._dropdownOpened=!this._dropdownOpened,this._dropdownOpened&&requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(e){const t=this.getBoundingClientRect();e.style.top=t.bottom+4+"px",e.style.bottom="",e.style.left=t.left+"px",e.style.right="",e.style.minWidth=t.width+"px",e.style.transformOrigin="top left";const i=e.getBoundingClientRect();i.bottom>window.innerHeight?(e.style.top="",e.style.bottom=window.innerHeight-t.top+4+"px",e.style.transformOrigin="bottom left",e.classList.add("dropdown--above")):e.classList.remove("dropdown--above"),i.right>window.innerWidth&&(e.style.left="",e.style.right=window.innerWidth-t.right+"px",i.bottom>window.innerHeight?e.style.transformOrigin="bottom right":e.style.transformOrigin="top right")}}))}_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,t>0&&(this._stateTimeout=window.setTimeout((()=>this.reset()),t))}showError(e="Error",t=2e3){this._clearStateTimeout(),this._state="error",this._stateText=e,t>0&&(this._stateTimeout=window.setTimeout((()=>this.reset()),t))}isLoading(){return"loading"===this._state}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),this.classList.toggle("kr-button--split",this.split&&!!this.options.length)}render(){if(this.split&&this.options.length)return
|
|
293
|
+
`,$e([ue({type:String})],e.KRAlert.prototype,"type",void 0),$e([ue({type:String})],e.KRAlert.prototype,"title",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([he("kr-alert")],e.KRAlert);var Ce=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRButton=class extends le{constructor(){super(...arguments),this.variant="flat",this.color="primary",this.size="medium",this.disabled=!1,this.options=[],this.iconPosition="left",this.split=!1,this._state="idle",this._stateText="",this._dropdownOpened=!1,this._handleHostClick=e=>{this.split&&this.options.length||this.options.length&&(e.stopPropagation(),this._toggleDropdown())},this._handleKeydown=e=>{if("Escape"===e.key&&this._dropdownOpened)this._dropdownOpened=!1;else{if("Enter"===e.key||" "===e.key){if(e.preventDefault(),this.split&&this.options.length)return void this.dispatchEvent(new MouseEvent("click",{bubbles:!0,composed:!0}));this.options.length?this._toggleDropdown():this.click()}this.split&&this.options.length&&"ArrowDown"===e.key&&(e.preventDefault(),this._dropdownOpened||this._toggleDropdown())}},this._handleClickOutside=e=>{this._dropdownOpened&&!this.contains(e.target)&&(this._dropdownOpened=!1)}}connectedCallback(){super.connectedCallback(),this.setAttribute("role",this.href?"link":"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)}_handleSplitPrimaryClick(e){e.stopPropagation(),this._dropdownOpened&&(this._dropdownOpened=!1),this.dispatchEvent(new MouseEvent("click",{bubbles:!0,composed:!0}))}_handleSplitTriggerClick(e){e.stopPropagation(),this._toggleDropdown()}_toggleDropdown(){this._dropdownOpened=!this._dropdownOpened,this._dropdownOpened&&requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(e){const t=this.getBoundingClientRect();e.style.top=t.bottom+4+"px",e.style.bottom="",e.style.left=t.left+"px",e.style.right="",e.style.minWidth=t.width+"px",e.style.transformOrigin="top left",e.style.maxHeight="",e.style.overflowY="";const i=e.getBoundingClientRect();i.height>window.innerHeight-t.bottom-8&&t.top>window.innerHeight-t.bottom?(e.style.top="",e.style.bottom=window.innerHeight-t.top+4+"px",e.style.transformOrigin="bottom left",e.classList.add("dropdown--above"),i.height>t.top-8&&(e.style.maxHeight=t.top-8+"px",e.style.overflowY="auto")):(e.classList.remove("dropdown--above"),i.height>window.innerHeight-t.bottom-8&&(e.style.maxHeight=window.innerHeight-t.bottom-8+"px",e.style.overflowY="auto")),i.right>window.innerWidth&&(e.style.left="",e.style.right=window.innerWidth-t.right+"px",i.bottom>window.innerHeight?e.style.transformOrigin="bottom right":e.style.transformOrigin="top right")}}))}_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,t>0&&(this._stateTimeout=window.setTimeout((()=>this.reset()),t))}showError(e="Error",t=2e3){this._clearStateTimeout(),this._state="error",this._stateText=e,t>0&&(this._stateTimeout=window.setTimeout((()=>this.reset()),t))}isLoading(){return"loading"===this._state}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),this.classList.toggle("kr-button--split",this.split&&!!this.options.length)}render(){if(this.split&&this.options.length)return H`
|
|
294
294
|
<div class="split-primary" @click=${e=>this._handleSplitPrimaryClick(e)}>
|
|
295
295
|
<span class="content">
|
|
296
296
|
<slot name="icon"></slot>
|
|
297
297
|
<slot></slot>
|
|
298
298
|
</span>
|
|
299
|
-
${"idle"!==this._state?
|
|
300
|
-
${"loading"===this._state?
|
|
299
|
+
${"idle"!==this._state?H`<span class="state-overlay">
|
|
300
|
+
${"loading"===this._state?H`<span class="spinner"></span>`:this._stateText}
|
|
301
301
|
</span>`:j}
|
|
302
302
|
</div>
|
|
303
303
|
<div class="split-divider"></div>
|
|
@@ -305,25 +305,25 @@ const ve=1,_e=2,me=3,ye=4,xe=e=>(...t)=>({_$litDirective$:e,values:t});let ke=cl
|
|
|
305
305
|
<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>
|
|
306
306
|
</div>
|
|
307
307
|
<div class="dropdown ${this._dropdownOpened?"dropdown--opened":""}">
|
|
308
|
-
${this.options.map((e=>
|
|
308
|
+
${this.options.map((e=>H`
|
|
309
309
|
<button
|
|
310
310
|
class="dropdown-item"
|
|
311
311
|
@click=${t=>this._handleOptionClick(e,t)}
|
|
312
312
|
>${e.label}</button>
|
|
313
313
|
`))}
|
|
314
314
|
</div>
|
|
315
|
-
`;const e=
|
|
315
|
+
`;const e=H`
|
|
316
316
|
<span class="content">
|
|
317
317
|
<slot name="icon"></slot>
|
|
318
318
|
<slot></slot>
|
|
319
319
|
</span>
|
|
320
|
-
${this.options.length?
|
|
321
|
-
${"idle"!==this._state?
|
|
322
|
-
${"loading"===this._state?
|
|
320
|
+
${this.options.length?H`<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>`:j}
|
|
321
|
+
${"idle"!==this._state?H`<span class="state-overlay">
|
|
322
|
+
${"loading"===this._state?H`<span class="spinner"></span>`:this._stateText}
|
|
323
323
|
</span>`:j}
|
|
324
|
-
${this.options.length?
|
|
324
|
+
${this.options.length?H`
|
|
325
325
|
<div class="dropdown ${this._dropdownOpened?"dropdown--opened":""}">
|
|
326
|
-
${this.options.map((e=>
|
|
326
|
+
${this.options.map((e=>H`
|
|
327
327
|
<button
|
|
328
328
|
class="dropdown-item"
|
|
329
329
|
@click=${t=>this._handleOptionClick(e,t)}
|
|
@@ -331,7 +331,7 @@ const ve=1,_e=2,me=3,ye=4,xe=e=>(...t)=>({_$litDirective$:e,values:t});let ke=cl
|
|
|
331
331
|
`))}
|
|
332
332
|
</div>
|
|
333
333
|
`:j}
|
|
334
|
-
`;return this.href?
|
|
334
|
+
`;return this.href?H`<a class="link" href=${this.href} target=${this.target||j}>${e}</a>`:e}},e.KRButton.styles=a`
|
|
335
335
|
:host {
|
|
336
336
|
display: inline-flex;
|
|
337
337
|
position: relative;
|
|
@@ -502,6 +502,7 @@ const ve=1,_e=2,me=3,ye=4,xe=e=>(...t)=>({_$litDirective$:e,values:t});let ke=cl
|
|
|
502
502
|
.dropdown {
|
|
503
503
|
position: fixed;
|
|
504
504
|
min-width: 100%;
|
|
505
|
+
box-sizing: border-box;
|
|
505
506
|
background: white;
|
|
506
507
|
border: 1px solid #9ba7b6;
|
|
507
508
|
border-radius: 8px;
|
|
@@ -755,7 +756,7 @@ const ve=1,_e=2,me=3,ye=4,xe=e=>(...t)=>({_$litDirective$:e,values:t});let ke=cl
|
|
|
755
756
|
* Copyright 2017 Google LLC
|
|
756
757
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
757
758
|
*/
|
|
758
|
-
class Re extends ke{constructor(e){if(super(e),this.it=j,e.type!==_e)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===j||null==e)return this._t=void 0,this.it=e;if(e===
|
|
759
|
+
class Re extends ke{constructor(e){if(super(e),this.it=j,e.type!==_e)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===j||null==e)return this._t=void 0,this.it=e;if(e===F)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 Se=xe(Re);var Te=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRCodeDemo=class extends le{constructor(){super(...arguments),this.language="html",this.code="",this.activeTab="preview",this.copied=!1,this.highlightedCode=""}connectedCallback(){super.connectedCallback(),requestAnimationFrame((()=>{this.code||(this.code=this.innerHTML.trim().replace(/=""(?=[\s>])/g,"")),this.querySelectorAll("script").forEach((e=>{const t=document.createElement("script");t.textContent=e.textContent,e.replaceWith(t)})),this.code&&window.hljs&&window.hljs.getLanguage(this.language)?this.highlightedCode=window.hljs.highlight(this.code,{language:this.language}).value:this.highlightedCode=this.code.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}))}activateTab(e){this.activeTab=e}copyCode(){this.code&&navigator.clipboard.writeText(this.code).then((()=>{this.copied=!0,setTimeout((()=>{this.copied=!1}),2e3)}))}render(){return H`
|
|
759
760
|
<div class="tabs">
|
|
760
761
|
<button
|
|
761
762
|
class=${we({tab:!0,"tab--active":"preview"===this.activeTab})}
|
|
@@ -774,7 +775,7 @@ class Re extends ke{constructor(e){if(super(e),this.it=j,e.type!==_e)throw Error
|
|
|
774
775
|
@click=${this.copyCode}
|
|
775
776
|
title=${this.copied?"Copied!":"Copy code"}
|
|
776
777
|
>
|
|
777
|
-
${this.copied?
|
|
778
|
+
${this.copied?H`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>`:H`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>`}
|
|
778
779
|
</button>
|
|
779
780
|
</div>
|
|
780
781
|
|
|
@@ -908,15 +909,15 @@ class Re extends ke{constructor(e){if(super(e),this.it=j,e.type!==_e)throw Error
|
|
|
908
909
|
.hljs-attribute { color: #005cc5; }
|
|
909
910
|
.hljs-property { color: #005cc5; }
|
|
910
911
|
|
|
911
|
-
`],Te([ue({type:String})],e.KRCodeDemo.prototype,"language",void 0),Te([ge()],e.KRCodeDemo.prototype,"code",void 0),Te([ge()],e.KRCodeDemo.prototype,"activeTab",void 0),Te([ge()],e.KRCodeDemo.prototype,"copied",void 0),Te([ge()],e.KRCodeDemo.prototype,"highlightedCode",void 0),e.KRCodeDemo=Te([he("kr-code-demo")],e.KRCodeDemo);var Ee=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};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
|
|
912
|
+
`],Te([ue({type:String})],e.KRCodeDemo.prototype,"language",void 0),Te([ge()],e.KRCodeDemo.prototype,"code",void 0),Te([ge()],e.KRCodeDemo.prototype,"activeTab",void 0),Te([ge()],e.KRCodeDemo.prototype,"copied",void 0),Te([ge()],e.KRCodeDemo.prototype,"highlightedCode",void 0),e.KRCodeDemo=Te([he("kr-code-demo")],e.KRCodeDemo);var Ee=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};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 H`
|
|
912
913
|
<div class="menu">
|
|
913
|
-
${this.items.map((e=>e.divider?
|
|
914
|
+
${this.items.map((e=>e.divider?H`<div class="menu__divider"></div>`:H`
|
|
914
915
|
<button
|
|
915
916
|
class="menu__item"
|
|
916
917
|
?disabled=${e.disabled}
|
|
917
918
|
@click=${()=>this.handleItemClick(e)}
|
|
918
919
|
>
|
|
919
|
-
${e.icon?
|
|
920
|
+
${e.icon?H`<span class="menu__item-icon">${e.icon}</span>`:null}
|
|
920
921
|
${e.label}
|
|
921
922
|
</button>
|
|
922
923
|
`))}
|
|
@@ -982,7 +983,7 @@ class Re extends ke{constructor(e){if(super(e),this.it=j,e.type!==_e)throw Error
|
|
|
982
983
|
* Copyright 2018 Google LLC
|
|
983
984
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
984
985
|
*/
|
|
985
|
-
const ze="important",Oe=" !"+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(Oe);e.includes("-")||t?i.setProperty(e,t?o.slice(0,-11):o,t?ze:""):i[e]=o}}return
|
|
986
|
+
const ze="important",Oe=" !"+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(Oe);e.includes("-")||t?i.setProperty(e,t?o.slice(0,-11):o,t?ze:""):i[e]=o}}return F}});var Ke=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let Ae=class extends le{render(){return H`<slot></slot>`}};Ae.styles=a`
|
|
986
987
|
:host {
|
|
987
988
|
display: flex;
|
|
988
989
|
padding: 0 24px;
|
|
@@ -997,14 +998,14 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
997
998
|
font-size: 18px;
|
|
998
999
|
font-weight: 600;
|
|
999
1000
|
}
|
|
1000
|
-
`,Ae=Ke([he("kr-dialog-header")],Ae);let Pe=class extends le{render(){return
|
|
1001
|
+
`,Ae=Ke([he("kr-dialog-header")],Ae);let Pe=class extends le{render(){return H`<slot></slot>`}};Pe.styles=a`
|
|
1001
1002
|
:host {
|
|
1002
1003
|
display: block;
|
|
1003
1004
|
padding: 24px;
|
|
1004
1005
|
overflow: auto;
|
|
1005
1006
|
flex: 1 1 auto;
|
|
1006
1007
|
}
|
|
1007
|
-
`,Pe=Ke([he("kr-dialog-content")],Pe);let Ie=class extends le{render(){return
|
|
1008
|
+
`,Pe=Ke([he("kr-dialog-content")],Pe);let Ie=class extends le{render(){return H`<slot></slot>`}};Ie.styles=a`
|
|
1008
1009
|
:host {
|
|
1009
1010
|
display: flex;
|
|
1010
1011
|
padding: 0 24px;
|
|
@@ -1015,11 +1016,11 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
1015
1016
|
gap: 12px;
|
|
1016
1017
|
justify-content: flex-end;
|
|
1017
1018
|
}
|
|
1018
|
-
`,Ie=Ke([he("kr-dialog-footer")],Ie);class qe{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._dialogRef=null,this._contentElement=null,this.opened=!1,this.label="",this.width="560px",this._handleDocumentKeyDown=e=>{"Escape"===e.key&&this.close()}}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this._handleDocumentKeyDown)}updated(e){super.updated(e),e.has("opened")&&(this.opened?document.addEventListener("keydown",this._handleDocumentKeyDown):document.removeEventListener("keydown",this._handleDocumentKeyDown))}open(){this.opened=!0}close(){this._dialogRef?this._dialogRef.close(void 0):(this.opened=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}static open(e,t){document.querySelectorAll("kr-dialog").forEach((e=>{e._dialogRef&&e.remove()}));const i=new qe,o=document.createElement("kr-dialog");i.setDialogElement(o),o._dialogRef=i;const s=new e;return s.dialogRef=i,t?.data&&(s.data=t.data),t?.label&&(o.label=t.label),t?.width&&(o.width=t.width),o._contentElement=s,o.opened=!0,document.body.appendChild(o),i}_handleBackdropClick(e){e.target.classList.contains("backdrop")&&this.close()}render(){return
|
|
1019
|
+
`,Ie=Ke([he("kr-dialog-footer")],Ie);class qe{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._dialogRef=null,this._contentElement=null,this.opened=!1,this.label="",this.width="560px",this._handleDocumentKeyDown=e=>{"Escape"===e.key&&this.close()}}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this._handleDocumentKeyDown)}updated(e){super.updated(e),e.has("opened")&&(this.opened?document.addEventListener("keydown",this._handleDocumentKeyDown):document.removeEventListener("keydown",this._handleDocumentKeyDown))}open(){this.opened=!0}close(){this._dialogRef?this._dialogRef.close(void 0):(this.opened=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}static open(e,t){document.querySelectorAll("kr-dialog").forEach((e=>{e._dialogRef&&e.remove()}));const i=new qe,o=document.createElement("kr-dialog");i.setDialogElement(o),o._dialogRef=i;const s=new e;return s.dialogRef=i,t?.data&&(s.data=t.data),t?.label&&(o.label=t.label),t?.width&&(o.width=t.width),o._contentElement=s,o.opened=!0,document.body.appendChild(o),i}_handleBackdropClick(e){e.target.classList.contains("backdrop")&&this.close()}render(){return H`
|
|
1019
1020
|
<div class="backdrop" @click=${this._handleBackdropClick}></div>
|
|
1020
1021
|
<div class="dialog" style=${De({width:this.width})}>
|
|
1021
|
-
${this.label?
|
|
1022
|
-
<div class="dialog__body">${this._contentElement?this._contentElement:
|
|
1022
|
+
${this.label?H`<div class="dialog__header"><div class="dialog__header-label">${this.label}</div></div>`:""}
|
|
1023
|
+
<div class="dialog__body">${this._contentElement?this._contentElement:H`<slot></slot>`}</div>
|
|
1023
1024
|
</div>
|
|
1024
1025
|
`}},e.KRDialog.styles=a`
|
|
1025
1026
|
:host {
|
|
@@ -1087,9 +1088,9 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
1087
1088
|
display: flex;
|
|
1088
1089
|
flex-direction: column;
|
|
1089
1090
|
}
|
|
1090
|
-
`,Ke([ge()],e.KRDialog.prototype,"_contentElement",void 0),Ke([ue({type:Boolean,reflect:!0})],e.KRDialog.prototype,"opened",void 0),Ke([ue({type:String})],e.KRDialog.prototype,"label",void 0),Ke([ue({type:String})],e.KRDialog.prototype,"width",void 0),e.KRDialog=Ke([he("kr-dialog")],e.KRDialog);var Le=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRDateRangePicker=class extends le{constructor(){super(...arguments),this.relativeOptions=[{key:"last-5-minutes",amount:5,unit:"minute",type:"relative"},{key:"last-30-minutes",amount:30,unit:"minute",type:"relative"},{key:"last-1-hour",amount:1,unit:"hour",type:"relative"},{key:"last-6-hours",amount:6,unit:"hour",type:"relative"},{key:"last-1-day",amount:1,unit:"day",type:"relative"},{key:"last-7-days",amount:7,unit:"day",type:"relative"},{key:"last-30-days",amount:30,unit:"day",type:"relative"}],this.disabled=!1,this.invalid=!1,this.placeholder="Select a date range",this.startDate="",this.endDate="",this._isOpen=!1,this._activeTab="relative",this._tempStartDate="",this._tempEndDate="",this._handleClickOutside=e=>{e.composedPath().includes(this)||(this._isOpen=!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleClickOutside),this.startDate&&(this._tempStartDate=this.startDate),this.endDate&&(this._tempEndDate=this.endDate),"relative"===this.mode?this._activeTab="relative":"absolute"===this.mode&&(this._activeTab="absolute")}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleClickOutside)}_handleTriggerClick(){this.disabled||(this._isOpen=!this._isOpen)}_handleTabClick(e){this._activeTab=e}_handleRelativeSelect(e){this.value={type:"relative",amount:e.amount,unit:e.unit},this._isOpen=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))}_handleApplyAbsolute(){this._tempStartDate&&this._tempEndDate&&(this._tempStartDate>=this._tempEndDate||(this.value={type:"absolute",startDate:this._tempStartDate,endDate:this._tempEndDate},this.startDate=this._tempStartDate,this.endDate=this._tempEndDate,this._isOpen=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))))}_handleCancel(){this._isOpen=!1,this._tempStartDate=this.startDate,this._tempEndDate=this.endDate}_formatRelativeOption(e){if(0===e.amount)return"day"===e.unit?"Today":`This ${e.unit}`;const t={second:1===e.amount?"second":"seconds",minute:1===e.amount?"minute":"minutes",hour:1===e.amount?"hour":"hours",day:1===e.amount?"day":"days",week:1===e.amount?"week":"weeks",month:1===e.amount?"month":"months",year:1===e.amount?"year":"years"};return`Last ${e.amount} ${t[e.unit]}`}_getDisplayValue(){return this.value?"relative"===this.value.type&&void 0!==this.value.amount&&this.value.unit?this._formatRelativeOption({key:"",amount:this.value.amount,unit:this.value.unit,type:"relative"}):"absolute"===this.value.type&&this.value.startDate&&this.value.endDate?`${this.value.startDate} - ${this.value.endDate}`:"":""}_renderTriggerText(){const e=this._getDisplayValue();return e?
|
|
1091
|
+
`,Ke([ge()],e.KRDialog.prototype,"_contentElement",void 0),Ke([ue({type:Boolean,reflect:!0})],e.KRDialog.prototype,"opened",void 0),Ke([ue({type:String})],e.KRDialog.prototype,"label",void 0),Ke([ue({type:String})],e.KRDialog.prototype,"width",void 0),e.KRDialog=Ke([he("kr-dialog")],e.KRDialog);var Le=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRDateRangePicker=class extends le{constructor(){super(...arguments),this.relativeOptions=[{key:"last-5-minutes",amount:5,unit:"minute",type:"relative"},{key:"last-30-minutes",amount:30,unit:"minute",type:"relative"},{key:"last-1-hour",amount:1,unit:"hour",type:"relative"},{key:"last-6-hours",amount:6,unit:"hour",type:"relative"},{key:"last-1-day",amount:1,unit:"day",type:"relative"},{key:"last-7-days",amount:7,unit:"day",type:"relative"},{key:"last-30-days",amount:30,unit:"day",type:"relative"}],this.disabled=!1,this.invalid=!1,this.placeholder="Select a date range",this.startDate="",this.endDate="",this._isOpen=!1,this._activeTab="relative",this._tempStartDate="",this._tempEndDate="",this._handleClickOutside=e=>{e.composedPath().includes(this)||(this._isOpen=!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleClickOutside),this.startDate&&(this._tempStartDate=this.startDate),this.endDate&&(this._tempEndDate=this.endDate),"relative"===this.mode?this._activeTab="relative":"absolute"===this.mode&&(this._activeTab="absolute")}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleClickOutside)}_handleTriggerClick(){this.disabled||(this._isOpen=!this._isOpen)}_handleTabClick(e){this._activeTab=e}_handleRelativeSelect(e){this.value={type:"relative",amount:e.amount,unit:e.unit},this._isOpen=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))}_handleApplyAbsolute(){this._tempStartDate&&this._tempEndDate&&(this._tempStartDate>=this._tempEndDate||(this.value={type:"absolute",startDate:this._tempStartDate,endDate:this._tempEndDate},this.startDate=this._tempStartDate,this.endDate=this._tempEndDate,this._isOpen=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))))}_handleCancel(){this._isOpen=!1,this._tempStartDate=this.startDate,this._tempEndDate=this.endDate}_formatRelativeOption(e){if(0===e.amount)return"day"===e.unit?"Today":`This ${e.unit}`;const t={second:1===e.amount?"second":"seconds",minute:1===e.amount?"minute":"minutes",hour:1===e.amount?"hour":"hours",day:1===e.amount?"day":"days",week:1===e.amount?"week":"weeks",month:1===e.amount?"month":"months",year:1===e.amount?"year":"years"};return`Last ${e.amount} ${t[e.unit]}`}_getDisplayValue(){return this.value?"relative"===this.value.type&&void 0!==this.value.amount&&this.value.unit?this._formatRelativeOption({key:"",amount:this.value.amount,unit:this.value.unit,type:"relative"}):"absolute"===this.value.type&&this.value.startDate&&this.value.endDate?`${this.value.startDate} - ${this.value.endDate}`:"":""}_renderTriggerText(){const e=this._getDisplayValue();return e?H`${e}`:H`<span class="trigger-placeholder">${this.placeholder}</span>`}_renderContent(){return"relative"===this.mode?this._renderRelativeContent():"absolute"===this.mode?this._renderAbsoluteContent():"relative"===this._activeTab?this._renderRelativeContent():this._renderAbsoluteContent()}_renderRelativeContent(){return H`
|
|
1091
1092
|
<div class="relative-options">
|
|
1092
|
-
${this.relativeOptions.map((e=>
|
|
1093
|
+
${this.relativeOptions.map((e=>H`
|
|
1093
1094
|
<button
|
|
1094
1095
|
class=${we({"relative-option":!0,"relative-option--selected":"relative"===this.value?.type&&this.value?.amount===e.amount&&this.value?.unit===e.unit})}
|
|
1095
1096
|
type="button"
|
|
@@ -1099,7 +1100,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
1099
1100
|
</button>
|
|
1100
1101
|
`))}
|
|
1101
1102
|
</div>
|
|
1102
|
-
`}_renderAbsoluteContent(){return
|
|
1103
|
+
`}_renderAbsoluteContent(){return H`
|
|
1103
1104
|
<div class="absolute">
|
|
1104
1105
|
<div class="date-row">
|
|
1105
1106
|
<span class="date-label">Start</span>
|
|
@@ -1120,7 +1121,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
1120
1121
|
/>
|
|
1121
1122
|
</div>
|
|
1122
1123
|
</div>
|
|
1123
|
-
`}_renderFooter(){return"absolute"===this.mode?
|
|
1124
|
+
`}_renderFooter(){return"absolute"===this.mode?H`
|
|
1124
1125
|
<div class="footer">
|
|
1125
1126
|
<kr-button variant="outline" size="small" @click=${this._handleCancel}>
|
|
1126
1127
|
Cancel
|
|
@@ -1134,7 +1135,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
1134
1135
|
Apply
|
|
1135
1136
|
</kr-button>
|
|
1136
1137
|
</div>
|
|
1137
|
-
`:"relative"===this.mode?j:"absolute"===this._activeTab?
|
|
1138
|
+
`:"relative"===this.mode?j:"absolute"===this._activeTab?H`
|
|
1138
1139
|
<div class="footer">
|
|
1139
1140
|
<kr-button variant="outline" size="small" @click=${this._handleCancel}>
|
|
1140
1141
|
Cancel
|
|
@@ -1148,7 +1149,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
1148
1149
|
Apply
|
|
1149
1150
|
</kr-button>
|
|
1150
1151
|
</div>
|
|
1151
|
-
`:j}_handleStartDateChange(e){this._tempStartDate=e.target.value}_handleEndDateChange(e){this._tempEndDate=e.target.value}render(){return
|
|
1152
|
+
`:j}_handleStartDateChange(e){this._tempStartDate=e.target.value}_handleEndDateChange(e){this._tempEndDate=e.target.value}render(){return H`
|
|
1152
1153
|
<button
|
|
1153
1154
|
part="trigger"
|
|
1154
1155
|
class=${we({trigger:!0,"trigger--invalid":this.invalid})}
|
|
@@ -1178,7 +1179,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
1178
1179
|
</button>
|
|
1179
1180
|
|
|
1180
1181
|
<div part="dropdown" class=${we({dropdown:!0,"dropdown--open":this._isOpen})}>
|
|
1181
|
-
${this.mode?j:
|
|
1182
|
+
${this.mode?j:H`
|
|
1182
1183
|
<div class="tabs">
|
|
1183
1184
|
<button
|
|
1184
1185
|
class=${we({tab:!0,"tab--active":"relative"===this._activeTab})}
|
|
@@ -1381,10 +1382,10 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
1381
1382
|
padding: 0.75rem 1rem;
|
|
1382
1383
|
border-top: 1px solid #e5e7eb;
|
|
1383
1384
|
}
|
|
1384
|
-
`,Le([ue({type:Object})],e.KRDateRangePicker.prototype,"value",void 0),Le([ue({type:Array})],e.KRDateRangePicker.prototype,"relativeOptions",void 0),Le([ue({type:Boolean})],e.KRDateRangePicker.prototype,"disabled",void 0),Le([ue({type:Boolean})],e.KRDateRangePicker.prototype,"invalid",void 0),Le([ue({type:String})],e.KRDateRangePicker.prototype,"placeholder",void 0),Le([ue({type:String})],e.KRDateRangePicker.prototype,"startDate",void 0),Le([ue({type:String})],e.KRDateRangePicker.prototype,"endDate",void 0),Le([ue({type:String})],e.KRDateRangePicker.prototype,"mode",void 0),Le([ge()],e.KRDateRangePicker.prototype,"_isOpen",void 0),Le([ge()],e.KRDateRangePicker.prototype,"_activeTab",void 0),Le([ge()],e.KRDateRangePicker.prototype,"_tempStartDate",void 0),Le([ge()],e.KRDateRangePicker.prototype,"_tempEndDate",void 0),e.KRDateRangePicker=Le([he("kr-date-range-picker")],e.KRDateRangePicker);var Me,Be=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRSnackbar=Me=class extends le{constructor(){super(...arguments),this.dismissTimeout=null,this.type="info",this.title="",this.message="",this.duration=5e3}static show(e){for(const e of this.activeSnackbars)e.dismiss();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"),Me.activeSnackbars.push(this),this.duration>0&&(this.dismissTimeout=window.setTimeout((()=>{this.dismiss()}),this.duration))}disconnectedCallback(){super.disconnectedCallback();const e=Me.activeSnackbars.indexOf(this);e>-1&&Me.activeSnackbars.splice(e,1),this.dismissTimeout&&clearTimeout(this.dismissTimeout)}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:
|
|
1385
|
+
`,Le([ue({type:Object})],e.KRDateRangePicker.prototype,"value",void 0),Le([ue({type:Array})],e.KRDateRangePicker.prototype,"relativeOptions",void 0),Le([ue({type:Boolean})],e.KRDateRangePicker.prototype,"disabled",void 0),Le([ue({type:Boolean})],e.KRDateRangePicker.prototype,"invalid",void 0),Le([ue({type:String})],e.KRDateRangePicker.prototype,"placeholder",void 0),Le([ue({type:String})],e.KRDateRangePicker.prototype,"startDate",void 0),Le([ue({type:String})],e.KRDateRangePicker.prototype,"endDate",void 0),Le([ue({type:String})],e.KRDateRangePicker.prototype,"mode",void 0),Le([ge()],e.KRDateRangePicker.prototype,"_isOpen",void 0),Le([ge()],e.KRDateRangePicker.prototype,"_activeTab",void 0),Le([ge()],e.KRDateRangePicker.prototype,"_tempStartDate",void 0),Le([ge()],e.KRDateRangePicker.prototype,"_tempEndDate",void 0),e.KRDateRangePicker=Le([he("kr-date-range-picker")],e.KRDateRangePicker);var Me,Be=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRSnackbar=Me=class extends le{constructor(){super(...arguments),this.dismissTimeout=null,this.type="info",this.title="",this.message="",this.duration=5e3}static show(e){for(const e of this.activeSnackbars)e.dismiss();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"),Me.activeSnackbars.push(this),this.duration>0&&(this.dismissTimeout=window.setTimeout((()=>{this.dismiss()}),this.duration))}disconnectedCallback(){super.disconnectedCallback();const e=Me.activeSnackbars.indexOf(this);e>-1&&Me.activeSnackbars.splice(e,1),this.dismissTimeout&&clearTimeout(this.dismissTimeout)}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:H`<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:H`<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:H`<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:H`<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 H`
|
|
1385
1386
|
${e[this.type]}
|
|
1386
1387
|
<div class="content">
|
|
1387
|
-
${this.title?
|
|
1388
|
+
${this.title?H`<div class="title">${this.title}</div>`:""}
|
|
1388
1389
|
<div class="message">${this.message}</div>
|
|
1389
1390
|
</div>
|
|
1390
1391
|
<button
|
|
@@ -1545,9 +1546,9 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
1545
1546
|
outline: 2px solid #3b82f6;
|
|
1546
1547
|
outline-offset: 2px;
|
|
1547
1548
|
}
|
|
1548
|
-
`,e.KRSnackbar.activeSnackbars=[],Be([ue({type:String})],e.KRSnackbar.prototype,"type",void 0),Be([ue({type:String})],e.KRSnackbar.prototype,"title",void 0),Be([ue({type:String})],e.KRSnackbar.prototype,"message",void 0),Be([ue({type:Number})],e.KRSnackbar.prototype,"duration",void 0),e.KRSnackbar=Me=Be([he("kr-snackbar")],e.KRSnackbar);var Ve=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};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 j;const i=t.cloneNode(!0);return i.removeAttribute("slot"),
|
|
1549
|
+
`,e.KRSnackbar.activeSnackbars=[],Be([ue({type:String})],e.KRSnackbar.prototype,"type",void 0),Be([ue({type:String})],e.KRSnackbar.prototype,"title",void 0),Be([ue({type:String})],e.KRSnackbar.prototype,"message",void 0),Be([ue({type:Number})],e.KRSnackbar.prototype,"duration",void 0),e.KRSnackbar=Me=Be([he("kr-snackbar")],e.KRSnackbar);var Ve=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};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 j;const i=t.cloneNode(!0);return i.removeAttribute("slot"),H`<span class="label-icon">${i}</span>`}render(){return H`
|
|
1549
1550
|
<div class="header" role="tablist" @keydown=${this._handleKeyDown}>
|
|
1550
|
-
${this._getTabs().map((e=>
|
|
1551
|
+
${this._getTabs().map((e=>H`
|
|
1551
1552
|
<button
|
|
1552
1553
|
class=${we({label:!0,"label--active":e.id===this.activeTabId,"label--justified":this.justified})}
|
|
1553
1554
|
role="tab"
|
|
@@ -1560,8 +1561,8 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
1560
1561
|
>
|
|
1561
1562
|
${this._renderTabIcon(e)}
|
|
1562
1563
|
<span>${e.label}</span>
|
|
1563
|
-
${e.badge?
|
|
1564
|
-
${e.dismissible?
|
|
1564
|
+
${e.badge?H`<span class="label-badge" style=${De({backgroundColor:e.badgeBackground,color:e.badgeColor})}>${e.badge}</span>`:j}
|
|
1565
|
+
${e.dismissible?H`
|
|
1565
1566
|
<button
|
|
1566
1567
|
class="label-dismiss"
|
|
1567
1568
|
type="button"
|
|
@@ -1710,7 +1711,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
1710
1711
|
::slotted(kr-tab[active]) {
|
|
1711
1712
|
display: block;
|
|
1712
1713
|
}
|
|
1713
|
-
`],Ve([ue({type:String,attribute:"active-tab-id"})],e.KRTabGroup.prototype,"activeTabId",void 0),Ve([ue({type:Boolean})],e.KRTabGroup.prototype,"justified",void 0),Ve([ue({type:String,reflect:!0})],e.KRTabGroup.prototype,"size",void 0),e.KRTabGroup=Ve([he("kr-tab-group")],e.KRTabGroup);var
|
|
1714
|
+
`],Ve([ue({type:String,attribute:"active-tab-id"})],e.KRTabGroup.prototype,"activeTabId",void 0),Ve([ue({type:Boolean})],e.KRTabGroup.prototype,"justified",void 0),Ve([ue({type:String,reflect:!0})],e.KRTabGroup.prototype,"size",void 0),e.KRTabGroup=Ve([he("kr-tab-group")],e.KRTabGroup);var He=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRTab=class extends le{constructor(){super(...arguments),this.id="",this.label="",this.badge="",this.badgeBackground="",this.badgeColor="",this.disabled=!1,this.dismissible=!1,this.active=!1}getIconElement(){return this.querySelector('[slot="icon"]')}updated(){const e=this.closest("kr-tab-group");e&&e.requestUpdate()}render(){return H`<slot></slot>`}},e.KRTab.styles=[de,a`
|
|
1714
1715
|
:host {
|
|
1715
1716
|
display: none;
|
|
1716
1717
|
}
|
|
@@ -1720,12 +1721,12 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
1720
1721
|
width: 100%;
|
|
1721
1722
|
height: 100%;
|
|
1722
1723
|
}
|
|
1723
|
-
`],
|
|
1724
|
+
`],He([ue({type:String,reflect:!0})],e.KRTab.prototype,"id",void 0),He([ue({type:String})],e.KRTab.prototype,"label",void 0),He([ue({type:String})],e.KRTab.prototype,"badge",void 0),He([ue({type:String,attribute:"badge-background"})],e.KRTab.prototype,"badgeBackground",void 0),He([ue({type:String,attribute:"badge-color"})],e.KRTab.prototype,"badgeColor",void 0),He([ue({type:Boolean})],e.KRTab.prototype,"disabled",void 0),He([ue({type:Boolean})],e.KRTab.prototype,"dismissible",void 0),He([ue({type:Boolean,reflect:!0})],e.KRTab.prototype,"active",void 0),e.KRTab=He([he("kr-tab")],e.KRTab);var Fe=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};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-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-option"));this._highlightedIndex=e.findIndex((e=>e.value===this.value)),requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".select-dropdown");if(e){const t=this._triggerElement.getBoundingClientRect(),i=window.innerHeight-t.bottom-4-8;e.style.top=t.bottom+4+"px",e.style.left=t.left+"px",e.style.width=t.width+"px",e.style.maxHeight=i+"px"}}))}}_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-option")),t=e.find((e=>e.value===this.value))?.label;return H`
|
|
1724
1725
|
<div class="wrapper">
|
|
1725
|
-
${this.label?
|
|
1726
|
+
${this.label?H`
|
|
1726
1727
|
<label>
|
|
1727
1728
|
${this.label}
|
|
1728
|
-
${this.required?
|
|
1729
|
+
${this.required?H`<span class="required" aria-hidden="true">*</span>`:""}
|
|
1729
1730
|
</label>
|
|
1730
1731
|
`:j}
|
|
1731
1732
|
<div class="select-wrapper">
|
|
@@ -1752,7 +1753,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
1752
1753
|
|
|
1753
1754
|
<div class=${we({"select-dropdown":!0,hidden:!this._isOpen})} role="listbox">
|
|
1754
1755
|
<div class="select-options">
|
|
1755
|
-
${0===e.length?
|
|
1756
|
+
${0===e.length?H`<div class="select-empty">No options available</div>`:e.map(((e,t)=>{const i=e.value===this.value;return H`
|
|
1756
1757
|
<div
|
|
1757
1758
|
class=${we({"select-option":!0,"select-option--selected":i,"select-option--disabled":e.disabled,"select-option--highlighted":t===this._highlightedIndex})}
|
|
1758
1759
|
role="option"
|
|
@@ -1766,7 +1767,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
1766
1767
|
</div>
|
|
1767
1768
|
</div>
|
|
1768
1769
|
</div>
|
|
1769
|
-
${this._touched&&this.required&&!this.value?
|
|
1770
|
+
${this._touched&&this.required&&!this.value?H`<div class="validation-message">Please select an option</div>`:this.hint?H`<div class="hint">${this.hint}</div>`:""}
|
|
1770
1771
|
</div>
|
|
1771
1772
|
<div class="options-slot">
|
|
1772
1773
|
<slot @slotchange=${()=>this.requestUpdate()}></slot>
|
|
@@ -1947,26 +1948,26 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
1947
1948
|
.options-slot {
|
|
1948
1949
|
display: none;
|
|
1949
1950
|
}
|
|
1950
|
-
`],e.KRSelectField.formAssociated=!0,
|
|
1951
|
+
`],e.KRSelectField.formAssociated=!0,Fe([ue({type:String})],e.KRSelectField.prototype,"label",void 0),Fe([ue({type:String})],e.KRSelectField.prototype,"name",void 0),Fe([ue({type:String})],e.KRSelectField.prototype,"value",void 0),Fe([ue({type:String})],e.KRSelectField.prototype,"placeholder",void 0),Fe([ue({type:Boolean})],e.KRSelectField.prototype,"disabled",void 0),Fe([ue({type:Boolean})],e.KRSelectField.prototype,"required",void 0),Fe([ue({type:Boolean})],e.KRSelectField.prototype,"readonly",void 0),Fe([ue({type:String})],e.KRSelectField.prototype,"hint",void 0),Fe([ge()],e.KRSelectField.prototype,"_isOpen",void 0),Fe([ge()],e.KRSelectField.prototype,"_highlightedIndex",void 0),Fe([ge()],e.KRSelectField.prototype,"_touched",void 0),Fe([fe(".select-trigger")],e.KRSelectField.prototype,"_triggerElement",void 0),e.KRSelectField=Fe([he("kr-select-field")],e.KRSelectField);var je=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRSelectOption=class extends le{constructor(){super(...arguments),this.value="",this.disabled=!1}get label(){return this.textContent?.trim()||""}render(){return H`<slot></slot>`}},e.KRSelectOption.styles=a`
|
|
1951
1952
|
:host {
|
|
1952
1953
|
display: none;
|
|
1953
1954
|
}
|
|
1954
|
-
`,je([ue({type:String})],e.KRSelectOption.prototype,"value",void 0),je([ue({type:Boolean})],e.KRSelectOption.prototype,"disabled",void 0),e.KRSelectOption=je([he("kr-select-option")],e.KRSelectOption);const Ue={equals:{key:"equals",type:"comparison",dataTypes:["string","number","date","boolean"],label:"Equals"},n_equals:{key:"n_equals",type:"comparison",dataTypes:["string","number","date","boolean"],label:"Doesn't equal"},contains:{key:"contains",type:"comparison",dataTypes:["string"],label:"Contains"},n_contains:{key:"n_contains",type:"comparison",dataTypes:["string"],label:"Doesn't contain"},starts_with:{key:"starts_with",type:"comparison",dataTypes:["string"],label:"Starts with"},ends_with:{key:"ends_with",type:"comparison",dataTypes:["string"],label:"Ends with"},less_than:{key:"less_than",type:"comparison",dataTypes:["number","date"],label:"Less than"},less_than_equal:{key:"less_than_equal",type:"comparison",dataTypes:["number","date"],label:"Less than or equal"},greater_than:{key:"greater_than",type:"comparison",dataTypes:["number","date"],label:"Greater than"},greater_than_equal:{key:"greater_than_equal",type:"comparison",dataTypes:["number","date"],label:"Greater than or equal"},between:{key:"between",type:"range",dataTypes:["number","date"],label:"Between"},in:{key:"in",type:"list",dataTypes:["string","number"],label:"In"},n_in:{key:"n_in",type:"list",dataTypes:["string","number","date","boolean"],label:"Not In"},empty:{key:"empty",type:"nil",dataTypes:["string","number","date","boolean"],label:"Empty"},n_empty:{key:"n_empty",type:"nil",dataTypes:["string","number","date","boolean"],label:"Not empty"}};function Ne(e){const t=[];for(const i of Object.values(Ue))i.dataTypes.includes(e)&&t.push({key:i.key,label:i.label});return t}const We=['"',"+","-","&&","||","!","(",")","{","}","[","]","^","~","*","?",":"],Xe=['\\"',"\\+","\\-","\\&\\&","\\|\\|","\\!","\\(","\\)","\\{","\\}","\\[","\\]","\\^","\\~","\\*","\\?","\\:"];function Ye(e,t=!0){return!0===e||!1===e?e.toString():null===e?"(*:* NOT *)":"number"==typeof e?e.toString():"string"==typeof e?(We.forEach(((t,i)=>{var o;e=e.replace(new RegExp(`${o=t,"string"!=typeof o?o:o.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}`,"g"),Xe[i])})),t?`"${e}"`:e.replace(/ /g,"\\ ")):e}function Ze(e,t=!1){const i=new Date(e);return i.setMinutes(i.getMinutes()-i.getTimezoneOffset()),t&&(i.setUTCHours(23),i.setUTCMinutes(59),i.setUTCSeconds(59),i.setUTCMilliseconds(999)),i.toISOString().replace(/:/g,"\\:")}function Qe(e,t){let i,o,s,r;if(e&&"start"in e&&"end"in e)i=new Date(e.start),o=new Date(e.end),s=t[0],r=t[1];else{if(!(e instanceof Date))return"[* TO *]";i=new Date(e),o=new Date(e),s=t[0],r=t[0]}return"year"===s?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0)):"month"===s?(i.setUTCDate(1),i.setUTCHours(0,0,0,0)):"day"===s?i.setUTCHours(0,0,0,0):"time"===s&&i.setUTCSeconds(0,0),"year"===r?(o.setUTCMonth(11,31),o.setUTCHours(23,59,59,999)):"month"===r?(o.setUTCMonth(o.getUTCMonth()+1),o.setUTCDate(0),o.setUTCHours(23,59,59,999)):"day"===r?o.setUTCHours(23,59,59,999):"time"===r&&o.setUTCSeconds(59,999),`[${i.toISOString().replace(/:/g,"\\:")} TO ${o.toISOString().replace(/:/g,"\\:")}]`}function Ge(e,t){let i,o,s,r,a,l;return e&&"start"in e&&"end"in e?(i=new Date(e.start),o=new Date(e.end),s=t[0],r=t[1]):(i=new Date(e),o=new Date(e),s=t[0],r=t[0]),"year"===s?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0),a=i):"month"===s?(i.setUTCDate(1),i.setUTCHours(0,0,0,0),a=i):"day"===s?(i.setUTCHours(0,0,0,0),a=i):"time"===s?(i.setUTCSeconds(0,0),a=i):a=i,"year"===r?(o.setUTCMonth(11,31),o.setUTCHours(23,59,59,999),l=o):"month"===r?(o.setUTCMonth(o.getUTCMonth()+1),o.setUTCDate(0),o.setUTCHours(23,59,59,999),l=o):"day"===r?(o.setUTCHours(23,59,59,999),l=o):"time"===r?(o.setUTCSeconds(59,999),l=o):l=o,[a.toISOString().replace(/\..+/,"").replace("T"," "),l.toISOString().replace(/\..+/,"").replace("T"," ")]}function Je(e){return e=e.trim(),/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/.test(e)||/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.test(e)?"day":/^(\d{1,2})\/(\d{1,2})\/(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i.test(e)||/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i.test(e)?"time":/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/.test(e)?"day":/^(\d{2})$/.test(e)||/^(\d{4})$/.test(e)?"year":/^([A-Za-z]+)\s+(\d{4})$/.test(e)?"month":null}class et{constructor(){this.field="",this.operator="equals",this.value=null,this.kql="",this.text="",this.type="",this.specificity=[]}setKql(e){if(this.kql=e.trim(),this.text="",this.specificity=[],this.value=null,this.kql)if(e.startsWith("="))this.operator="equals",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.startsWith("!="))this.operator="n_equals",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.startsWith("~")&&"string"===this.type)this.operator="contains",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.startsWith("!~")&&"string"===this.type)this.operator="n_contains",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.endsWith("*")&&"string"===this.type)this.operator="starts_with",this.text=e.substring(0,e.length-1),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.startsWith("*")&&"string"===this.type)this.operator="ends_with",this.text=e.substring(1),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if("EMPTY"===e)this.operator="empty",this.value=null,this.specificity=[];else if("NOT EMPTY"===e)this.operator="n_empty",this.value=null,this.specificity=[];else if(e.startsWith("<="))this.operator="less_than_equal",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.startsWith("<"))this.operator="less_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.startsWith(">="))this.operator="greater_than_equal",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.startsWith(">"))this.operator="greater_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.startsWith("[")&&e.endsWith("]")&&e.indexOf(" TO ")>-1){this.operator="between";const t=e.indexOf(" TO "),i=e.substring(1,t).trim(),o=e.substring(t+4,e.length-1).trim();this.text=`${i} - ${o}`,this.value={start:this._parse(i),end:this._parse(o)},this.specificity=[Je(i),Je(o)]}else e.startsWith("!(")&&e.endsWith(")")?(this.operator="n_in",this.text=e.substring(2,e.length-1).trim(),this.value=this.text.split(",").map((e=>e.trim())).map((e=>this._parse(e))),this.specificity=[Je(this.text)]):e.startsWith("(")&&e.endsWith(")")?(this.operator="in",this.text=e.substring(1,e.length-1).trim(),this.value=this.text.split(",").map((e=>e.trim())).map((e=>this._parse(e))),this.specificity=[Je(this.text)]):"date"===this.type||"boolean"===this.type||"number"===this.type?(this.operator="equals",this.text=this.kql,this.value=this._parse(this.text),this.specificity=[Je(this.text)]):(this.operator="contains",this.text=e,this.value=this._parse(this.text),this.specificity=[Je(this.text)]);else"string"===this.type?this.operator="contains":this.operator="equals"}setOperator(e){"empty"===this.operator||"n_empty"===this.operator||"between"===this.operator?(this.value=null,this.text=""):"in"!==this.operator&&"n_in"!==this.operator||(this.value=[],this.text=""),this.operator=e,"empty"===this.operator?(this.value="EMPTY",this.text="EMPTY"):"n_empty"===this.operator?(this.value="NOT EMPTY",this.text="NOT EMPTY"):"between"===this.operator?(this.value=null,this.text=""):"in"!==this.operator&&"n_in"!==this.operator||(this.value=[],this.text=""),this._buildKql()}setValue(e,t){this.value=e,t?this.specificity=[t]:e instanceof Date?this.specificity=["time"]:this.specificity=[],this._buildText(),this._buildKql()}setStart(e,t){void 0===this.value?.start&&(this.value={start:null,end:null}),this.value.start=e,t?this.specificity[0]=t:e instanceof Date&&(this.specificity[0]="time"),this._buildText(),this._buildKql()}setEnd(e,t){void 0===this.value?.end&&(this.value={start:null,end:null}),this.value.end=e,t?this.specificity[1]=t:e instanceof Date&&(this.specificity[1]="time"),this._buildText(),this._buildKql()}clear(){"string"===this.type?this.operator="contains":this.operator="equals",this.value=null,this.kql="",this.text="",this.specificity=[]}isEmpty(){return"empty"===this.operator||"n_empty"===this.operator?!this.text:"between"===this.operator?!this.value?.start&&!this.value?.end:"in"===this.operator||"n_in"===this.operator?!this.value?.length:void 0===this.value||null===this.value||""===this.value}has(e){return!("in"!==this.operator&&"n_in"!==this.operator||!Array.isArray(this.value))&&("boolean"===this.type&&"string"==typeof e&&("true"===e?e=!0:"false"===e&&(e=!1)),this.value.indexOf(e)>=0)}toggle(e){"in"!==this.operator&&"n_in"!==this.operator&&this.setOperator("in"),"boolean"===this.type&&"string"==typeof e&&("true"===e?e=!0:"false"===e&&(e=!1));const t=this.value.indexOf(e);t>=0?this.value.splice(t,1):this.value.push(e),this._buildText(),this._buildKql()}isValid(){return!this.kql||!!this.field&&(!!this.operator&&("empty"===this.operator||("n_empty"===this.operator||("in"===this.operator||"n_in"===this.operator?Array.isArray(this.value)&&this.value.length>0:"date"===this.type?"between"===this.operator?this.value?.start instanceof Date&&this.value?.end instanceof Date&&!isNaN(this.value.start.getTime())&&!isNaN(this.value.end.getTime()):this.value instanceof Date&&!isNaN(this.value.getTime()):"number"===this.type?"between"===this.operator?"number"==typeof this.value?.start&&"number"==typeof this.value?.end:"number"==typeof this.value:"boolean"===this.type?"boolean"==typeof this.value:"string"==typeof this.value&&!!this.value.trim().length))))}toSolrData(){const e={boost:null,fuzzy:null,not:!1,name:null,operation:null,tagged:!1,value:null};switch(e.name=this.field,this.operator){case"equals":this.value instanceof Date?(e.operation="EXPRESSION",e.value=Qe(this.value,this.specificity)):(e.operation="IS",e.value=this.value);break;case"n_equals":this.value instanceof Date?(e.operation="EXPRESSION",e.not=!0,e.value=Qe(this.value,this.specificity)):(e.operation="IS",e.not=!0,e.value=this.value);break;case"contains":e.operation="EXPRESSION",e.value=`*${Ye(this.value,!1)}*`;break;case"n_contains":e.operation="EXPRESSION",e.not=!0,e.value=`*${Ye(this.value,!1)}*`;break;case"starts_with":e.operation="EXPRESSION",e.value=`${Ye(this.value,!1)}*`;break;case"ends_with":e.operation="EXPRESSION",e.value=`*${Ye(this.value,!1)}`;break;case"empty":e.operation="EXPRESSION",e.not=!0,e.value="[* TO *]";break;case"n_empty":e.operation="EXPRESSION",e.value="[* TO *]";break;case"less_than":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[* TO ${Ze(this.value)}}`):(e.operation="EXPRESSION",e.value=`[* TO ${Ye(this.value,!0)}}`);break;case"less_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[* TO ${Ze(this.value,!0)}]`):(e.operation="EXPRESSION",e.value=`[* TO ${Ye(this.value,!0)}]`);break;case"greater_than":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`{${Ze(this.value,!0)} TO *]`):(e.operation="EXPRESSION",e.value=`{${Ye(this.value,!0)} TO *]`);break;case"greater_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[${Ze(this.value)} TO *]`):(e.operation="EXPRESSION",e.value=`[${Ye(this.value,!0)} TO *]`);break;case"between":this.value?.start instanceof Date&&this.value?.end instanceof Date?(e.operation="EXPRESSION",e.value=Qe(this.value,this.specificity)):(e.operation="EXPRESSION",e.value=`[${this.value.start} TO ${this.value.end}]`);break;case"in":Array.isArray(this.value)&&this.value.length>0?(e.operation="EXPRESSION",e.value=`(${this.value.map((e=>Ye(e,!0))).join(" OR ")})`):(e.operation="EXPRESSION",e.value=Ye(this.value,!0));break;case"n_in":Array.isArray(this.value)&&this.value.length>0?(e.operation="EXPRESSION",e.not=!0,e.value=`(${this.value.map((e=>Ye(e,!0))).join(" OR ")})`):(e.operation="EXPRESSION",e.not=!0,e.value=Ye(this.value,!0));break;default:e.operation="EXPRESSION",e.value=Ye(this.value,!0)}return e}toDbParams(){const e={boost:null,fuzzy:null,not:!1,name:null,operation:null,tagged:!1,value:null,values:null};switch(e.name=this.field,this.operator){case"equals":"date"===this.type?(e.operation="BETWEEN",e.values=Ge(this.value,this.specificity)):(e.operation="IS",e.value=this.value);break;case"n_equals":"date"===this.type?(e.operation="BETWEEN",e.not=!0,e.values=Ge(this.value,this.specificity)):(e.operation="IS",e.value=this.value,e.not=!0);break;case"contains":e.operation="CONTAINS",e.value=this.value;break;case"n_contains":e.operation="CONTAINS",e.value=this.value,e.not=!0;break;case"starts_with":e.operation="STARTS_WITH",e.value=this.value;break;case"ends_with":e.operation="ENDS_WITH",e.value=this.value;break;case"empty":e.operation="IS_BLANK";break;case"n_empty":e.operation="IS_NOT_BLANK";break;case"less_than":e.operation="LESS_THAN",e.value=this.value;break;case"less_than_equal":e.operation="LESS_THAN_EQUAL",e.value=this.value;break;case"greater_than":e.operation="GREATER_THAN",e.value=this.value;break;case"greater_than_equal":e.operation="GREATER_THAN_EQUAL",e.value=this.value;break;case"between":e.operation="BETWEEN","date"===this.type?e.values=Ge(this.value,this.specificity):e.values=[this.value.start,this.value.end];break;case"in":e.operation="IN",e.values=this.value??[];break;case"n_in":e.operation="IN",e.not=!0,e.values=this.value??[];break;default:throw Error(`${this.operator} operator not supported by db params.`)}return e}_buildText(){this.isEmpty()?this.text="":"between"===this.operator?this.text=`${this._format(this.value?.start)} - ${this._format(this.value?.end)}`:"in"===this.operator||"n_in"===this.operator?this.text=this.value.map((e=>this._format(e))).join(","):this.text=this._format(this.value)}_format(e){if(e instanceof Date&&!isNaN(e.getTime())){return`${String(e.getUTCMonth()+1).padStart(2,"0")}/${String(e.getUTCDate()).padStart(2,"0")}/${e.getUTCFullYear()}`}return"boolean"==typeof e?e?"Yes":"No":String(e??"")}_parse(e){if(null==e||""===e)return null;if(this.type)switch(this.type){case"boolean":{const t=e.toString().toLowerCase();return!0===e||!1!==e&&("yes"===t||"no"!==t&&("1"===t||"0"!==t&&null))}case"date":return this._parseDate(e);case"number":{const t=Number(e.toString().replace(/[$,]+/g,""));return isNaN(t)?null:t}default:return e.toString()}return e}_parseDate(e){if(null==e||""===e)return null;const t={jan:0,january:0,feb:1,february:1,mar:2,march:2,apr:3,april:3,may:4,jun:5,june:5,jul:6,july:6,aug:7,august:7,sep:8,september:8,oct:9,october:9,nov:10,november:10,dec:11,december:11};let i;if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/),i)return new Date(Date.UTC(2e3+parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2])));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/),i)return new Date(Date.UTC(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2])));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i),i){let e=parseInt(i[4]);return i[6]&&("PM"===i[6].toUpperCase()&&12!==e&&(e+=12),"AM"===i[6].toUpperCase()&&12===e&&(e=0)),new Date(Date.UTC(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2]),e,parseInt(i[5])))}if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i),i){const e=t[i[1].toLowerCase()];if(void 0!==e){let t=parseInt(i[4]);return i[6]&&("PM"===i[6].toUpperCase()&&12!==t&&(t+=12),"AM"===i[6].toUpperCase()&&12===t&&(t=0)),new Date(Date.UTC(parseInt(i[3]),e,parseInt(i[2]),t,parseInt(i[5])))}}if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(Date.UTC(parseInt(i[3]),e,parseInt(i[2])))}if(i=e.match(/^(\d{2})$/),i)return new Date(Date.UTC(2e3+parseInt(i[1]),0,1));if(i=e.match(/^(\d{4})$/),i)return new Date(Date.UTC(parseInt(i[1]),0,1));if(i=e.match(/^([A-Za-z]+)\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(Date.UTC(parseInt(i[2]),e,1))}return null}_buildKql(){if(this.isEmpty())this.kql="";else switch(this.operator){case"equals":this.kql=`= ${this.text}`;break;case"n_equals":this.kql=`!= ${this.text}`;break;case"contains":this.kql=`~ ${this.text}`;break;case"n_contains":this.kql=`!~ ${this.text}`;break;case"starts_with":this.kql=`${this.text}*`;break;case"ends_with":this.kql=`*${this.text}`;break;case"empty":this.kql="EMPTY";break;case"n_empty":this.kql="NOT EMPTY";break;case"less_than":this.kql=`< ${this.text}`;break;case"less_than_equal":this.kql=`<= ${this.text}`;break;case"greater_than":this.kql=`> ${this.text}`;break;case"greater_than_equal":this.kql=`>= ${this.text}`;break;case"between":this.kql=`[${this._format(this.value?.start??"")} TO ${this._format(this.value?.end??"")}]`;break;case"in":this.kql=`(${this.value.map((e=>this._format(e))).join(",")})`;break;case"n_in":this.kql=`!(${this.value.map((e=>this._format(e))).join(",")})`;break;default:throw Error(`Unknown operator ${this.operator}`)}}}var tt=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class it{constructor(){this.title="",this.description="",this.actions=[],this.columns=[],this.displayedColumns=[],this.data=null,this.dataSource=null,this.refreshInterval=0,this.pageSize=0,this.rowClickable=!1,this.rowHref=null}}e.KRTable=class extends le{constructor(){super(...arguments),this._scrollStyle="edge",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._filterPanelOpened=null,this._filterPanelTab="filter",this._buckets=new Map,this._filterPanelPos={top:0,left:0},this._sorts=[],this._resizing=null,this._resizeObserver=null,this._searchPositionLocked=!1,this._columnWidthsLocked=!1,this._model=new it,this.def={columns:[]},this.variant="default",this._handleClickOutside=e=>{const t=e.composedPath();if(this._columnPickerOpen){const e=this.shadowRoot?.querySelector(".column-picker-wrapper");e&&!t.includes(e)&&(this._columnPickerOpen=!1)}this._filterPanelOpened&&(t.some((e=>e.classList?.contains("filter-panel")))||this._handleFilterApply())},this._handleResizeMove=e=>{if(!this._resizing)return;const t=this._model.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._handleClickOutside),this._resizeObserver=new ResizeObserver((()=>{this._searchPositionLocked=!1,this._updateSearchPosition()})),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this._refreshTimer),document.removeEventListener("click",this._handleClickOutside),this._resizeObserver?.disconnect()}willUpdate(e){e.has("def")&&(this._columnWidthsLocked=!1,this._model=new it,this.def.title&&(this._model.title=this.def.title),this.def.description&&(this._model.description=this.def.description),this.def.actions&&(this._model.actions=this.def.actions),this.def.data&&(this._model.data=this.def.data),this.def.dataSource&&(this._model.dataSource=this.def.dataSource),"number"==typeof this.def.refreshInterval&&(this._model.refreshInterval=this.def.refreshInterval),"number"==typeof this.def.pageSize&&(this._model.pageSize=this.def.pageSize,this._pageSize=this.def.pageSize),this.def.rowClickable&&(this._model.rowClickable=this.def.rowClickable),this.def.rowHref&&(this._model.rowHref=this.def.rowHref),this._sorts=[],this._model.columns=this.def.columns.map((e=>{const t={...e,filter:null};return t.type||(t.type="string"),e.sort&&this._sorts.push({sortBy:e.id,sortDirection:e.sort}),"actions"===t.type?(t.label=e.label??"",t.sticky="right",t.resizable=!1,t):((e.filterable||e.facetable)&&(t.filter=new et,t.filter.field=e.id,t.filter.type=t.type,e.filter?(t.filter.setOperator(e.filter.operator),t.filter.setValue(e.filter.value)):e.facetable&&!e.filterable?(t.filter.operator="in",t.filter.value=[]):"string"===t.filter.type&&(t.filter.operator="contains")),t)})),this.def.displayedColumns?this._model.displayedColumns=this.def.displayedColumns:this._model.displayedColumns=this._model.columns.map((e=>e.id)),this._fetch(),this._initRefresh())}updated(e){this.classList.toggle("kr-table--card","card"===this.variant),this._updateScrollFlags(),this._syncSlottedContent(),this._lockColumnWidths()}_lockColumnWidths(){if(this._columnWidthsLocked||0===this._data.length)return;const e=this.shadowRoot?.querySelectorAll(".header-row > .header-cell");if(!e)return;const t=this.getDisplayedColumns();e.forEach(((e,i)=>{const o=e.offsetWidth;i<t.length&&!t[i].width&&"actions"!==t[i].type&&o>0&&(t[i].width=`${o}px`,this._columnWidthsLocked=!0)}))}_syncSlottedContent(){const e=this.getDisplayedColumns().filter((e=>e.render));e.length&&(this.querySelectorAll('[slot^="cell-"]').forEach((e=>e.remove())),this._data.forEach(((t,i)=>{e.forEach((e=>{const o=e.render(t);if(!o)return;const s=document.createElement("span");s.slot=`cell-${i}-${e.id}`,"actions"===e.type&&(s.style.display="flex",s.style.gap="8px"),"string"==typeof o?s.innerHTML=o:re(o,s),this.appendChild(s)}))})))}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())}_toSolrData(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns){if(!t.filter||t.filter.isEmpty()||!t.filter.isValid())continue;const i=t.filter.toSolrData();!t.facetable||"in"!==t.filter.operator&&"n_in"!==t.filter.operator||(i.tagged=!0),e.filterFields.push(i)}for(const t of this._model.columns)t.facetable&&e.facetFields.push({name:t.id,type:"FIELD",limit:100,sort:"count",minimumCount:1});return this._searchQuery?.trim().length&&e.queryFields.push({name:"_text_",operation:"IS",value:Ye(this._searchQuery,!1)}),e}_toDbParams(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns)t.filter&&!t.filter.isEmpty()&&t.filter.isValid()&&e.filterFields.push(t.filter.toDbParams());return this._searchQuery?.trim().length&&this._model.columns.filter((e=>e.searchable)).forEach((t=>{e.queryFields.push({name:t.id,operation:"CONTAINS",value:this._searchQuery,and:!1})})),e}_fetch(){if(this._model.data)return this._data=this._model.data,this._totalItems=this._model.data.length,this._totalPages=Math.ceil(this._model.data.length/this._pageSize),void(this._dataState="success");if(!this._model.dataSource)return;let t;this._dataState="loading",t="db"===this._model.dataSource.mode?this._toDbParams():this._toSolrData(),this._model.dataSource.fetch(t).then((e=>{switch(this._model.dataSource?.mode){case"opensearch":throw Error("Opensearch not supported yet");case"db":{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size;break}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._parseFacetResults(t)}}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"})}))}_parseFacetResults(e){if(e.data.facetFields){for(const t of this._model.columns){if(!t.facetable)continue;const i=e.data.facetFields[t.id];if(!i){this._buckets.set(t.id,[]);continue}const o=[];for(const e of i){let i=e.name;"boolean"===t.type&&"string"==typeof e.name&&("true"===e.name?i=!0:"false"===e.name&&(i=!1)),null===e.name&&e.count>0&&o.unshift({val:null,count:e.count}),null!==e.name&&o.push({val:i,count:e.count})}if(t.filter&&("in"===t.filter.operator||"n_in"===t.filter.operator)&&Array.isArray(t.filter.value))for(const e of t.filter.value)o.some((t=>t.val===e))||o.push({val:e,count:0});this._buckets.set(t.id,o)}this._buckets=new Map(this._buckets)}}_initRefresh(){clearInterval(this._refreshTimer),this._model.refreshInterval&&this._model.refreshInterval>0&&(this._refreshTimer=window.setInterval((()=>{this._fetch()}),this._model.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;if("card"===this.variant)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._model.displayedColumns.includes(e)?this._model.displayedColumns=this._model.displayedColumns.filter((t=>t!==e)):this._model.displayedColumns=[...this._model.displayedColumns,e],this.requestUpdate()}_handleRowMouseDown(){(this._model.rowClickable||this._model.rowHref)&&window.getSelection()?.removeAllRanges()}_handleRowClick(e,t,i){if(!this._model.rowClickable&&!this._model.rowHref)return;const o=window.getSelection();o&&o.toString().length>0?e.preventDefault():this.dispatchEvent(new CustomEvent("row-click",{detail:{row:t,rowIndex:i},bubbles:!0,composed:!0}))}getDisplayedColumns(){return this._model.displayedColumns.map((e=>this._model.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)}_handleSortClick(e,t){if(e.shiftKey){const e=this._sorts.findIndex((e=>e.sortBy===t.id));if(-1===e)this._sorts.push({sortBy:t.id,sortDirection:"asc"});else{const t=this._sorts[e];"asc"===t.sortDirection?t.sortDirection="desc":this._sorts.splice(e,1)}this.requestUpdate()}else{let e=null;1===this._sorts.length&&(e=this._sorts.find((e=>e.sortBy===t.id))),e?"asc"===e.sortDirection?this._sorts=[{sortBy:t.id,sortDirection:"desc"}]:this._sorts=[]:this._sorts=[{sortBy:t.id,sortDirection:"asc"}]}this._page=1,this._fetch()}_renderSortIndicator(e){if(!e.sortable)return j;const t=this._sorts.findIndex((t=>t.sortBy===e.id));if(-1===t)return F`
|
|
1955
|
+
`,je([ue({type:String})],e.KRSelectOption.prototype,"value",void 0),je([ue({type:Boolean})],e.KRSelectOption.prototype,"disabled",void 0),e.KRSelectOption=je([he("kr-select-option")],e.KRSelectOption);const Ue={equals:{key:"equals",type:"comparison",dataTypes:["string","number","date","boolean"],label:"Equals"},n_equals:{key:"n_equals",type:"comparison",dataTypes:["string","number","date","boolean"],label:"Doesn't equal"},contains:{key:"contains",type:"comparison",dataTypes:["string"],label:"Contains"},n_contains:{key:"n_contains",type:"comparison",dataTypes:["string"],label:"Doesn't contain"},starts_with:{key:"starts_with",type:"comparison",dataTypes:["string"],label:"Starts with"},ends_with:{key:"ends_with",type:"comparison",dataTypes:["string"],label:"Ends with"},less_than:{key:"less_than",type:"comparison",dataTypes:["number","date"],label:"Less than"},less_than_equal:{key:"less_than_equal",type:"comparison",dataTypes:["number","date"],label:"Less than or equal"},greater_than:{key:"greater_than",type:"comparison",dataTypes:["number","date"],label:"Greater than"},greater_than_equal:{key:"greater_than_equal",type:"comparison",dataTypes:["number","date"],label:"Greater than or equal"},between:{key:"between",type:"range",dataTypes:["number","date"],label:"Between"},in:{key:"in",type:"list",dataTypes:["string","number"],label:"In"},n_in:{key:"n_in",type:"list",dataTypes:["string","number","date","boolean"],label:"Not In"},empty:{key:"empty",type:"nil",dataTypes:["string","number","date","boolean"],label:"Empty"},n_empty:{key:"n_empty",type:"nil",dataTypes:["string","number","date","boolean"],label:"Not empty"}};function Ne(e){const t=[];for(const i of Object.values(Ue))i.dataTypes.includes(e)&&t.push({key:i.key,label:i.label});return t}const We=['"',"+","-","&&","||","!","(",")","{","}","[","]","^","~","*","?",":"],Xe=['\\"',"\\+","\\-","\\&\\&","\\|\\|","\\!","\\(","\\)","\\{","\\}","\\[","\\]","\\^","\\~","\\*","\\?","\\:"];function Ye(e,t=!0){return!0===e||!1===e?e.toString():null===e?"(*:* NOT *)":"number"==typeof e?e.toString():"string"==typeof e?(We.forEach(((t,i)=>{var o;e=e.replace(new RegExp(`${o=t,"string"!=typeof o?o:o.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}`,"g"),Xe[i])})),t?`"${e}"`:e.replace(/ /g,"\\ ")):e}function Ze(e,t=!1){const i=new Date(e);return i.setMinutes(i.getMinutes()-i.getTimezoneOffset()),t&&(i.setUTCHours(23),i.setUTCMinutes(59),i.setUTCSeconds(59),i.setUTCMilliseconds(999)),i.toISOString().replace(/:/g,"\\:")}function Qe(e,t){let i,o,s,r;if(e&&"start"in e&&"end"in e)i=new Date(e.start),o=new Date(e.end),s=t[0],r=t[1];else{if(!(e instanceof Date))return"[* TO *]";i=new Date(e),o=new Date(e),s=t[0],r=t[0]}return"year"===s?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0)):"month"===s?(i.setUTCDate(1),i.setUTCHours(0,0,0,0)):"day"===s?i.setUTCHours(0,0,0,0):"time"===s&&i.setUTCSeconds(0,0),"year"===r?(o.setUTCMonth(11,31),o.setUTCHours(23,59,59,999)):"month"===r?(o.setUTCMonth(o.getUTCMonth()+1),o.setUTCDate(0),o.setUTCHours(23,59,59,999)):"day"===r?o.setUTCHours(23,59,59,999):"time"===r&&o.setUTCSeconds(59,999),`[${i.toISOString().replace(/:/g,"\\:")} TO ${o.toISOString().replace(/:/g,"\\:")}]`}function Ge(e,t){let i,o,s,r,a,l;return e&&"start"in e&&"end"in e?(i=new Date(e.start),o=new Date(e.end),s=t[0],r=t[1]):(i=new Date(e),o=new Date(e),s=t[0],r=t[0]),"year"===s?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0),a=i):"month"===s?(i.setUTCDate(1),i.setUTCHours(0,0,0,0),a=i):"day"===s?(i.setUTCHours(0,0,0,0),a=i):"time"===s?(i.setUTCSeconds(0,0),a=i):a=i,"year"===r?(o.setUTCMonth(11,31),o.setUTCHours(23,59,59,999),l=o):"month"===r?(o.setUTCMonth(o.getUTCMonth()+1),o.setUTCDate(0),o.setUTCHours(23,59,59,999),l=o):"day"===r?(o.setUTCHours(23,59,59,999),l=o):"time"===r?(o.setUTCSeconds(59,999),l=o):l=o,[a.toISOString().replace(/\..+/,"").replace("T"," "),l.toISOString().replace(/\..+/,"").replace("T"," ")]}function Je(e){return e=e.trim(),/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/.test(e)||/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.test(e)?"day":/^(\d{1,2})\/(\d{1,2})\/(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i.test(e)||/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i.test(e)?"time":/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/.test(e)?"day":/^(\d{2})$/.test(e)||/^(\d{4})$/.test(e)?"year":/^([A-Za-z]+)\s+(\d{4})$/.test(e)?"month":null}class et{constructor(){this.field="",this.operator="equals",this.value=null,this.kql="",this.text="",this.type="",this.specificity=[]}setKql(e){if(this.kql=e.trim(),this.text="",this.specificity=[],this.value=null,this.kql)if(e.startsWith("="))this.operator="equals",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.startsWith("!="))this.operator="n_equals",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.startsWith("~")&&"string"===this.type)this.operator="contains",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.startsWith("!~")&&"string"===this.type)this.operator="n_contains",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.endsWith("*")&&"string"===this.type)this.operator="starts_with",this.text=e.substring(0,e.length-1),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.startsWith("*")&&"string"===this.type)this.operator="ends_with",this.text=e.substring(1),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if("EMPTY"===e)this.operator="empty",this.value=null,this.specificity=[];else if("NOT EMPTY"===e)this.operator="n_empty",this.value=null,this.specificity=[];else if(e.startsWith("<="))this.operator="less_than_equal",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.startsWith("<"))this.operator="less_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.startsWith(">="))this.operator="greater_than_equal",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.startsWith(">"))this.operator="greater_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Je(this.text)];else if(e.startsWith("[")&&e.endsWith("]")&&e.indexOf(" TO ")>-1){this.operator="between";const t=e.indexOf(" TO "),i=e.substring(1,t).trim(),o=e.substring(t+4,e.length-1).trim();this.text=`${i} - ${o}`,this.value={start:this._parse(i),end:this._parse(o)},this.specificity=[Je(i),Je(o)]}else e.startsWith("!(")&&e.endsWith(")")?(this.operator="n_in",this.text=e.substring(2,e.length-1).trim(),this.value=this.text.split(",").map((e=>e.trim())).map((e=>this._parse(e))),this.specificity=[Je(this.text)]):e.startsWith("(")&&e.endsWith(")")?(this.operator="in",this.text=e.substring(1,e.length-1).trim(),this.value=this.text.split(",").map((e=>e.trim())).map((e=>this._parse(e))),this.specificity=[Je(this.text)]):"date"===this.type||"boolean"===this.type||"number"===this.type?(this.operator="equals",this.text=this.kql,this.value=this._parse(this.text),this.specificity=[Je(this.text)]):(this.operator="contains",this.text=e,this.value=this._parse(this.text),this.specificity=[Je(this.text)]);else"string"===this.type?this.operator="contains":this.operator="equals"}setOperator(e){"empty"===this.operator||"n_empty"===this.operator||"between"===this.operator?(this.value=null,this.text=""):"in"!==this.operator&&"n_in"!==this.operator||(this.value=[],this.text=""),this.operator=e,"empty"===this.operator?(this.value="EMPTY",this.text="EMPTY"):"n_empty"===this.operator?(this.value="NOT EMPTY",this.text="NOT EMPTY"):"between"===this.operator?(this.value=null,this.text=""):"in"!==this.operator&&"n_in"!==this.operator||(this.value=[],this.text=""),this._buildKql()}setValue(e,t){this.value=e,t?this.specificity=[t]:e instanceof Date?this.specificity=["time"]:this.specificity=[],this._buildText(),this._buildKql()}setStart(e,t){void 0===this.value?.start&&(this.value={start:null,end:null}),this.value.start=e,t?this.specificity[0]=t:e instanceof Date&&(this.specificity[0]="time"),this._buildText(),this._buildKql()}setEnd(e,t){void 0===this.value?.end&&(this.value={start:null,end:null}),this.value.end=e,t?this.specificity[1]=t:e instanceof Date&&(this.specificity[1]="time"),this._buildText(),this._buildKql()}clear(){"string"===this.type?this.operator="contains":this.operator="equals",this.value=null,this.kql="",this.text="",this.specificity=[]}isEmpty(){return"empty"===this.operator||"n_empty"===this.operator?!this.text:"between"===this.operator?!this.value?.start&&!this.value?.end:"in"===this.operator||"n_in"===this.operator?!this.value?.length:void 0===this.value||null===this.value||""===this.value}has(e){return!("in"!==this.operator&&"n_in"!==this.operator||!Array.isArray(this.value))&&("boolean"===this.type&&"string"==typeof e&&("true"===e?e=!0:"false"===e&&(e=!1)),this.value.indexOf(e)>=0)}toggle(e){"in"!==this.operator&&"n_in"!==this.operator&&this.setOperator("in"),"boolean"===this.type&&"string"==typeof e&&("true"===e?e=!0:"false"===e&&(e=!1));const t=this.value.indexOf(e);t>=0?this.value.splice(t,1):this.value.push(e),this._buildText(),this._buildKql()}isValid(){return!this.kql||!!this.field&&(!!this.operator&&("empty"===this.operator||("n_empty"===this.operator||("in"===this.operator||"n_in"===this.operator?Array.isArray(this.value)&&this.value.length>0:"date"===this.type?"between"===this.operator?this.value?.start instanceof Date&&this.value?.end instanceof Date&&!isNaN(this.value.start.getTime())&&!isNaN(this.value.end.getTime()):this.value instanceof Date&&!isNaN(this.value.getTime()):"number"===this.type?"between"===this.operator?"number"==typeof this.value?.start&&"number"==typeof this.value?.end:"number"==typeof this.value:"boolean"===this.type?"boolean"==typeof this.value:"string"==typeof this.value&&!!this.value.trim().length))))}toSolrData(){const e={boost:null,fuzzy:null,not:!1,name:null,operation:null,tagged:!1,value:null};switch(e.name=this.field,this.operator){case"equals":this.value instanceof Date?(e.operation="EXPRESSION",e.value=Qe(this.value,this.specificity)):(e.operation="IS",e.value=this.value);break;case"n_equals":this.value instanceof Date?(e.operation="EXPRESSION",e.not=!0,e.value=Qe(this.value,this.specificity)):(e.operation="IS",e.not=!0,e.value=this.value);break;case"contains":e.operation="EXPRESSION",e.value=`*${Ye(this.value,!1)}*`;break;case"n_contains":e.operation="EXPRESSION",e.not=!0,e.value=`*${Ye(this.value,!1)}*`;break;case"starts_with":e.operation="EXPRESSION",e.value=`${Ye(this.value,!1)}*`;break;case"ends_with":e.operation="EXPRESSION",e.value=`*${Ye(this.value,!1)}`;break;case"empty":e.operation="EXPRESSION",e.not=!0,e.value="[* TO *]";break;case"n_empty":e.operation="EXPRESSION",e.value="[* TO *]";break;case"less_than":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[* TO ${Ze(this.value)}}`):(e.operation="EXPRESSION",e.value=`[* TO ${Ye(this.value,!0)}}`);break;case"less_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[* TO ${Ze(this.value,!0)}]`):(e.operation="EXPRESSION",e.value=`[* TO ${Ye(this.value,!0)}]`);break;case"greater_than":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`{${Ze(this.value,!0)} TO *]`):(e.operation="EXPRESSION",e.value=`{${Ye(this.value,!0)} TO *]`);break;case"greater_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[${Ze(this.value)} TO *]`):(e.operation="EXPRESSION",e.value=`[${Ye(this.value,!0)} TO *]`);break;case"between":this.value?.start instanceof Date&&this.value?.end instanceof Date?(e.operation="EXPRESSION",e.value=Qe(this.value,this.specificity)):(e.operation="EXPRESSION",e.value=`[${this.value.start} TO ${this.value.end}]`);break;case"in":Array.isArray(this.value)&&this.value.length>0?(e.operation="EXPRESSION",e.value=`(${this.value.map((e=>Ye(e,!0))).join(" OR ")})`):(e.operation="EXPRESSION",e.value=Ye(this.value,!0));break;case"n_in":Array.isArray(this.value)&&this.value.length>0?(e.operation="EXPRESSION",e.not=!0,e.value=`(${this.value.map((e=>Ye(e,!0))).join(" OR ")})`):(e.operation="EXPRESSION",e.not=!0,e.value=Ye(this.value,!0));break;default:e.operation="EXPRESSION",e.value=Ye(this.value,!0)}return e}toDbParams(){const e={boost:null,fuzzy:null,not:!1,name:null,operation:null,tagged:!1,value:null,values:null};switch(e.name=this.field,this.operator){case"equals":"date"===this.type?(e.operation="BETWEEN",e.values=Ge(this.value,this.specificity)):(e.operation="IS",e.value=this.value);break;case"n_equals":"date"===this.type?(e.operation="BETWEEN",e.not=!0,e.values=Ge(this.value,this.specificity)):(e.operation="IS",e.value=this.value,e.not=!0);break;case"contains":e.operation="CONTAINS",e.value=this.value;break;case"n_contains":e.operation="CONTAINS",e.value=this.value,e.not=!0;break;case"starts_with":e.operation="STARTS_WITH",e.value=this.value;break;case"ends_with":e.operation="ENDS_WITH",e.value=this.value;break;case"empty":e.operation="IS_BLANK";break;case"n_empty":e.operation="IS_NOT_BLANK";break;case"less_than":e.operation="LESS_THAN",e.value=this.value;break;case"less_than_equal":e.operation="LESS_THAN_EQUAL",e.value=this.value;break;case"greater_than":e.operation="GREATER_THAN",e.value=this.value;break;case"greater_than_equal":e.operation="GREATER_THAN_EQUAL",e.value=this.value;break;case"between":e.operation="BETWEEN","date"===this.type?e.values=Ge(this.value,this.specificity):e.values=[this.value.start,this.value.end];break;case"in":e.operation="IN",e.values=this.value??[];break;case"n_in":e.operation="IN",e.not=!0,e.values=this.value??[];break;default:throw Error(`${this.operator} operator not supported by db params.`)}return e}_buildText(){this.isEmpty()?this.text="":"between"===this.operator?this.text=`${this._format(this.value?.start)} - ${this._format(this.value?.end)}`:"in"===this.operator||"n_in"===this.operator?this.text=this.value.map((e=>this._format(e))).join(","):this.text=this._format(this.value)}_format(e){if(e instanceof Date&&!isNaN(e.getTime())){return`${String(e.getUTCMonth()+1).padStart(2,"0")}/${String(e.getUTCDate()).padStart(2,"0")}/${e.getUTCFullYear()}`}return"boolean"==typeof e?e?"Yes":"No":String(e??"")}_parse(e){if(null==e||""===e)return null;if(this.type)switch(this.type){case"boolean":{const t=e.toString().toLowerCase();return!0===e||!1!==e&&("yes"===t||"no"!==t&&("1"===t||"0"!==t&&null))}case"date":return this._parseDate(e);case"number":{const t=Number(e.toString().replace(/[$,]+/g,""));return isNaN(t)?null:t}default:return e.toString()}return e}_parseDate(e){if(null==e||""===e)return null;const t={jan:0,january:0,feb:1,february:1,mar:2,march:2,apr:3,april:3,may:4,jun:5,june:5,jul:6,july:6,aug:7,august:7,sep:8,september:8,oct:9,october:9,nov:10,november:10,dec:11,december:11};let i;if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/),i)return new Date(Date.UTC(2e3+parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2])));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/),i)return new Date(Date.UTC(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2])));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i),i){let e=parseInt(i[4]);return i[6]&&("PM"===i[6].toUpperCase()&&12!==e&&(e+=12),"AM"===i[6].toUpperCase()&&12===e&&(e=0)),new Date(Date.UTC(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2]),e,parseInt(i[5])))}if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i),i){const e=t[i[1].toLowerCase()];if(void 0!==e){let t=parseInt(i[4]);return i[6]&&("PM"===i[6].toUpperCase()&&12!==t&&(t+=12),"AM"===i[6].toUpperCase()&&12===t&&(t=0)),new Date(Date.UTC(parseInt(i[3]),e,parseInt(i[2]),t,parseInt(i[5])))}}if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(Date.UTC(parseInt(i[3]),e,parseInt(i[2])))}if(i=e.match(/^(\d{2})$/),i)return new Date(Date.UTC(2e3+parseInt(i[1]),0,1));if(i=e.match(/^(\d{4})$/),i)return new Date(Date.UTC(parseInt(i[1]),0,1));if(i=e.match(/^([A-Za-z]+)\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(Date.UTC(parseInt(i[2]),e,1))}return null}_buildKql(){if(this.isEmpty())this.kql="";else switch(this.operator){case"equals":this.kql=`= ${this.text}`;break;case"n_equals":this.kql=`!= ${this.text}`;break;case"contains":this.kql=`~ ${this.text}`;break;case"n_contains":this.kql=`!~ ${this.text}`;break;case"starts_with":this.kql=`${this.text}*`;break;case"ends_with":this.kql=`*${this.text}`;break;case"empty":this.kql="EMPTY";break;case"n_empty":this.kql="NOT EMPTY";break;case"less_than":this.kql=`< ${this.text}`;break;case"less_than_equal":this.kql=`<= ${this.text}`;break;case"greater_than":this.kql=`> ${this.text}`;break;case"greater_than_equal":this.kql=`>= ${this.text}`;break;case"between":this.kql=`[${this._format(this.value?.start??"")} TO ${this._format(this.value?.end??"")}]`;break;case"in":this.kql=`(${this.value.map((e=>this._format(e))).join(",")})`;break;case"n_in":this.kql=`!(${this.value.map((e=>this._format(e))).join(",")})`;break;default:throw Error(`Unknown operator ${this.operator}`)}}}var tt=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class it{constructor(){this.title="",this.description="",this.actions=[],this.columns=[],this.displayedColumns=[],this.data=null,this.dataSource=null,this.refreshInterval=0,this.pageSize=0,this.rowClickable=!1,this.rowHref=null}}e.KRTable=class extends le{constructor(){super(...arguments),this._scrollStyle="edge",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._filterPanelOpened=null,this._filterPanelTab="filter",this._buckets=new Map,this._filterPanelPos={top:0,left:0},this._sorts=[],this._resizing=null,this._resizeObserver=null,this._searchPositionLocked=!1,this._columnWidthsLocked=!1,this._model=new it,this.def={columns:[]},this.variant="default",this._handleClickOutside=e=>{const t=e.composedPath();if(this._columnPickerOpen){const e=this.shadowRoot?.querySelector(".column-picker-wrapper");e&&!t.includes(e)&&(this._columnPickerOpen=!1)}this._filterPanelOpened&&(t.some((e=>e.classList?.contains("filter-panel")))||this._handleFilterApply())},this._handleResizeMove=e=>{if(!this._resizing)return;const t=this._model.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._handleClickOutside),this._resizeObserver=new ResizeObserver((()=>{this._searchPositionLocked=!1,this._updateSearchPosition()})),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this._refreshTimer),document.removeEventListener("click",this._handleClickOutside),this._resizeObserver?.disconnect()}willUpdate(e){e.has("def")&&(this._columnWidthsLocked=!1,this._model=new it,this.def.title&&(this._model.title=this.def.title),this.def.description&&(this._model.description=this.def.description),this.def.actions&&(this._model.actions=this.def.actions),this.def.data&&(this._model.data=this.def.data),this.def.dataSource&&(this._model.dataSource=this.def.dataSource),"number"==typeof this.def.refreshInterval&&(this._model.refreshInterval=this.def.refreshInterval),"number"==typeof this.def.pageSize&&(this._model.pageSize=this.def.pageSize,this._pageSize=this.def.pageSize),this.def.rowClickable&&(this._model.rowClickable=this.def.rowClickable),this.def.rowHref&&(this._model.rowHref=this.def.rowHref),this._sorts=[],this._model.columns=this.def.columns.map((e=>{const t={...e,filter:null};return t.type||(t.type="string"),e.sort&&this._sorts.push({sortBy:e.id,sortDirection:e.sort}),"actions"===t.type?(t.label=e.label??"",t.sticky="right",t.resizable=!1,t):((e.filterable||e.facetable)&&(t.filter=new et,t.filter.field=e.id,t.filter.type=t.type,e.filter?(t.filter.setOperator(e.filter.operator),t.filter.setValue(e.filter.value)):e.facetable&&!e.filterable?(t.filter.operator="in",t.filter.value=[]):"string"===t.filter.type&&(t.filter.operator="contains")),t)})),this.def.displayedColumns?this._model.displayedColumns=this.def.displayedColumns:this._model.displayedColumns=this._model.columns.map((e=>e.id)),this._fetch(),this._initRefresh())}updated(e){this.classList.toggle("kr-table--card","card"===this.variant),this._updateScrollFlags(),this._syncSlottedContent(),this._lockColumnWidths()}_lockColumnWidths(){if(this._columnWidthsLocked||0===this._data.length)return;const e=this.shadowRoot?.querySelectorAll(".header-row > .header-cell");if(!e)return;const t=this.getDisplayedColumns();e.forEach(((e,i)=>{const o=e.offsetWidth;i<t.length&&!t[i].width&&"actions"!==t[i].type&&o>0&&(t[i].width=`${o}px`,this._columnWidthsLocked=!0)}))}_syncSlottedContent(){const e=this.getDisplayedColumns().filter((e=>e.render));e.length&&(this.querySelectorAll('[slot^="cell-"]').forEach((e=>e.remove())),this._data.forEach(((t,i)=>{e.forEach((e=>{const o=e.render(t);if(!o)return;const s=document.createElement("span");s.slot=`cell-${i}-${e.id}`,"actions"===e.type&&(s.style.display="flex",s.style.gap="8px"),"string"==typeof o?s.innerHTML=o:re(o,s),this.appendChild(s)}))})))}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())}_toSolrData(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns){if(!t.filter||t.filter.isEmpty()||!t.filter.isValid())continue;const i=t.filter.toSolrData();!t.facetable||"in"!==t.filter.operator&&"n_in"!==t.filter.operator||(i.tagged=!0),e.filterFields.push(i)}for(const t of this._model.columns)t.facetable&&e.facetFields.push({name:t.id,type:"FIELD",limit:100,sort:"count",minimumCount:1});return this._searchQuery?.trim().length&&e.queryFields.push({name:"_text_",operation:"IS",value:Ye(this._searchQuery,!1)}),e}_toDbParams(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns)t.filter&&!t.filter.isEmpty()&&t.filter.isValid()&&e.filterFields.push(t.filter.toDbParams());return this._searchQuery?.trim().length&&this._model.columns.filter((e=>e.searchable)).forEach((t=>{e.queryFields.push({name:t.id,operation:"CONTAINS",value:this._searchQuery,and:!1})})),e}_fetch(){if(this._model.data)return this._data=this._model.data,this._totalItems=this._model.data.length,this._totalPages=Math.ceil(this._model.data.length/this._pageSize),void(this._dataState="success");if(!this._model.dataSource)return;let t;this._dataState="loading",t="db"===this._model.dataSource.mode?this._toDbParams():this._toSolrData(),this._model.dataSource.fetch(t).then((e=>{switch(this._model.dataSource?.mode){case"opensearch":throw Error("Opensearch not supported yet");case"db":{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size;break}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._parseFacetResults(t)}}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"})}))}_parseFacetResults(e){if(e.data.facetFields){for(const t of this._model.columns){if(!t.facetable)continue;const i=e.data.facetFields[t.id];if(!i){this._buckets.set(t.id,[]);continue}const o=[];for(const e of i){let i=e.name;"boolean"===t.type&&"string"==typeof e.name&&("true"===e.name?i=!0:"false"===e.name&&(i=!1)),null===e.name&&e.count>0&&o.unshift({val:null,count:e.count}),null!==e.name&&o.push({val:i,count:e.count})}if(t.filter&&("in"===t.filter.operator||"n_in"===t.filter.operator)&&Array.isArray(t.filter.value))for(const e of t.filter.value)o.some((t=>t.val===e))||o.push({val:e,count:0});this._buckets.set(t.id,o)}this._buckets=new Map(this._buckets)}}_initRefresh(){clearInterval(this._refreshTimer),this._model.refreshInterval&&this._model.refreshInterval>0&&(this._refreshTimer=window.setInterval((()=>{this._fetch()}),this._model.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;if("card"===this.variant)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._model.displayedColumns.includes(e)?this._model.displayedColumns=this._model.displayedColumns.filter((t=>t!==e)):this._model.displayedColumns=[...this._model.displayedColumns,e],this.requestUpdate()}_handleRowMouseDown(){(this._model.rowClickable||this._model.rowHref)&&window.getSelection()?.removeAllRanges()}_handleRowClick(e,t,i){if(!this._model.rowClickable&&!this._model.rowHref)return;const o=window.getSelection();o&&o.toString().length>0?e.preventDefault():this.dispatchEvent(new CustomEvent("row-click",{detail:{row:t,rowIndex:i},bubbles:!0,composed:!0}))}getDisplayedColumns(){return this._model.displayedColumns.map((e=>this._model.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)}_handleSortClick(e,t){if(e.shiftKey){const e=this._sorts.findIndex((e=>e.sortBy===t.id));if(-1===e)this._sorts.push({sortBy:t.id,sortDirection:"asc"});else{const t=this._sorts[e];"asc"===t.sortDirection?t.sortDirection="desc":this._sorts.splice(e,1)}this.requestUpdate()}else{let e=null;1===this._sorts.length&&(e=this._sorts.find((e=>e.sortBy===t.id))),e?"asc"===e.sortDirection?this._sorts=[{sortBy:t.id,sortDirection:"desc"}]:this._sorts=[]:this._sorts=[{sortBy:t.id,sortDirection:"asc"}]}this._page=1,this._fetch()}_renderSortIndicator(e){if(!e.sortable)return j;const t=this._sorts.findIndex((t=>t.sortBy===e.id));if(-1===t)return H`
|
|
1955
1956
|
<span class="header-cell__sort" @click=${t=>this._handleSortClick(t,e)}>
|
|
1956
1957
|
<svg class="header-cell__sort-arrow header-cell__sort-arrow--ghost" viewBox="0 0 24 24" fill="currentColor">
|
|
1957
1958
|
<path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"/>
|
|
1958
1959
|
</svg>
|
|
1959
1960
|
</span>
|
|
1960
|
-
`;let i={};return"desc"===this._sorts[t].sortDirection&&(i={transform:"rotate(180deg)"}),
|
|
1961
|
+
`;let i={};return"desc"===this._sorts[t].sortDirection&&(i={transform:"rotate(180deg)"}),H`
|
|
1961
1962
|
<span class="header-cell__sort" @click=${t=>this._handleSortClick(t,e)}>
|
|
1962
1963
|
<svg class="header-cell__sort-arrow" viewBox="0 0 24 24" fill="currentColor" style=${De(i)}>
|
|
1963
1964
|
<path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"/>
|
|
1964
1965
|
</svg>
|
|
1965
|
-
${this._sorts.length>1?
|
|
1966
|
+
${this._sorts.length>1?H`
|
|
1966
1967
|
<span class="header-cell__sort-priority">${t+1}</span>
|
|
1967
1968
|
`:j}
|
|
1968
1969
|
</span>
|
|
1969
|
-
`}_handleAction(e){e.href||this.dispatchEvent(new CustomEvent("action",{detail:{action:e.id},bubbles:!0,composed:!0}))}_handleKqlChange(e,t){const i=e.target.value.trim();if(i){if(t.filter.setKql(i),this.requestUpdate(),!t.filter.isValid())return}else t.filter.clear(),this.requestUpdate();this._page=1,this._fetch()}_handleFilterPanelToggle(e,t){if(e.stopPropagation(),this._filterPanelOpened===t.id)this._filterPanelOpened=null;else{const i=e.currentTarget.getBoundingClientRect();let o=i.left;o+328>window.innerWidth&&(o=window.innerWidth-328),this._filterPanelPos={top:i.bottom+4,left:o},this._filterPanelOpened=t.id,t.facetable?this._filterPanelTab="counts":this._filterPanelTab="filter"}}_handleKqlClear(e){e.filter.clear(),this._page=1,this._fetch()}_handleFilterClear(){const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));e&&(e.filter.clear(),e.facetable&&!e.filterable&&(e.filter.operator="in",e.filter.value=[])),this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterTextKeydown(e,t){"Enter"===e.key&&(e.preventDefault(),this._handleFilterApply())}_handleOperatorChange(e,t){t.filter.setOperator(e.target.value),this.requestUpdate()}_handleFilterStringChange(e,t){t.filter.setValue(e.target.value),this.requestUpdate()}_handleFilterNumberChange(e,t){t.filter.setValue(Number(e.target.value)),this.requestUpdate()}_handleFilterDateChange(e,t){t.filter.setValue(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterBooleanChange(e,t){t.filter.setValue("true"===e.target.value),this.requestUpdate()}_handleFilterDateStartChange(e,t){t.filter.setStart(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterDateEndChange(e,t){t.filter.setEnd(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterNumberStartChange(e,t){t.filter.setStart(Number(e.target.value)),this.requestUpdate()}_handleFilterNumberEndChange(e,t){t.filter.setEnd(Number(e.target.value)),this.requestUpdate()}_handleFilterListChange(e,t){const i=e.target.value.split(",").map((e=>e.trim())).filter((e=>""!==e));"number"===t.type?t.filter.setValue(i.map((e=>Number(e)))):t.filter.setValue(i),this.requestUpdate()}_handleFilterApply(){this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterPanelTabChange(e){this._filterPanelTab=e.detail.activeTabId}_handleBucketToggle(e,t,i){t.filter.toggle(i.val),this._page=1,this._fetch()}_renderCellContent(e,t,i){const o=t[e.id];if(e.render)return
|
|
1970
|
+
`}_handleAction(e){e.href||this.dispatchEvent(new CustomEvent("action",{detail:{action:e.id},bubbles:!0,composed:!0}))}_handleKqlChange(e,t){const i=e.target.value.trim();if(i){if(t.filter.setKql(i),this.requestUpdate(),!t.filter.isValid())return}else t.filter.clear(),this.requestUpdate();this._page=1,this._fetch()}_handleFilterPanelToggle(e,t){if(e.stopPropagation(),this._filterPanelOpened===t.id)this._filterPanelOpened=null;else{const i=e.currentTarget.getBoundingClientRect();let o=i.left;o+328>window.innerWidth&&(o=window.innerWidth-328),this._filterPanelPos={top:i.bottom+4,left:o},this._filterPanelOpened=t.id,t.facetable?this._filterPanelTab="counts":this._filterPanelTab="filter"}}_handleKqlClear(e){e.filter.clear(),this._page=1,this._fetch()}_handleFilterClear(){const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));e&&(e.filter.clear(),e.facetable&&!e.filterable&&(e.filter.operator="in",e.filter.value=[])),this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterTextKeydown(e,t){"Enter"===e.key&&(e.preventDefault(),this._handleFilterApply())}_handleOperatorChange(e,t){t.filter.setOperator(e.target.value),this.requestUpdate()}_handleFilterStringChange(e,t){t.filter.setValue(e.target.value),this.requestUpdate()}_handleFilterNumberChange(e,t){t.filter.setValue(Number(e.target.value)),this.requestUpdate()}_handleFilterDateChange(e,t){t.filter.setValue(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterBooleanChange(e,t){t.filter.setValue("true"===e.target.value),this.requestUpdate()}_handleFilterDateStartChange(e,t){t.filter.setStart(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterDateEndChange(e,t){t.filter.setEnd(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterNumberStartChange(e,t){t.filter.setStart(Number(e.target.value)),this.requestUpdate()}_handleFilterNumberEndChange(e,t){t.filter.setEnd(Number(e.target.value)),this.requestUpdate()}_handleFilterListChange(e,t){const i=e.target.value.split(",").map((e=>e.trim())).filter((e=>""!==e));"number"===t.type?t.filter.setValue(i.map((e=>Number(e)))):t.filter.setValue(i),this.requestUpdate()}_handleFilterApply(){this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterPanelTabChange(e){this._filterPanelTab=e.detail.activeTabId}_handleBucketToggle(e,t,i){t.filter.toggle(i.val),this._page=1,this._fetch()}_renderCellContent(e,t,i){const o=t[e.id];if(e.render)return H`<slot name="cell-${i}-${e.id}"></slot>`;if(null==o)return"";switch(e.type){case"number":return"currency"===e.format&&"number"==typeof o?o.toLocaleString("en-US",{style:"currency",currency:"USD"}):String(o);case"date":{let e;if(o instanceof Date)e=o;else if("string"==typeof o&&/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/.test(o)){const t=o.replace(/(\d{2}:\d{2}:\d{2}):(\d+)$/,"$1.$2").replace(" ","T")+"Z";e=new Date(t)}else e=new Date(o);return e.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZone:"UTC"})}case"boolean":return!0===o?"Yes":!1===o?"No":"";default:return String(o)}}_getHeaderCellClasses(e,t){return{"header-cell":!0,"header-cell--sortable":!!e.sortable,"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 H`
|
|
1970
1971
|
<div class="pagination">
|
|
1971
1972
|
<span
|
|
1972
1973
|
class="pagination-icon ${1===this._page?"pagination-icon--disabled":""}"
|
|
@@ -1982,15 +1983,15 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
1982
1983
|
<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>
|
|
1983
1984
|
</span>
|
|
1984
1985
|
</div>
|
|
1985
|
-
`}_renderCardHeader(){return"card"!==this.variant?j:this._model.title||this._model.description?
|
|
1986
|
+
`}_renderCardHeader(){return"card"!==this.variant?j:this._model.title||this._model.description?H`
|
|
1986
1987
|
<div class="card-header">
|
|
1987
|
-
${this._model.title?
|
|
1988
|
-
${this._model.description?
|
|
1988
|
+
${this._model.title?H`<h2 class="card-header__title">${this._model.title}</h2>`:j}
|
|
1989
|
+
${this._model.description?H`<p class="card-header__description">${this._model.description}</p>`:j}
|
|
1989
1990
|
</div>
|
|
1990
|
-
`:j}_renderHeader(){return!this._model.title&&!this._model.actions?.length&&this._totalPages<=1?j:
|
|
1991
|
+
`:j}_renderHeader(){return!this._model.title&&!this._model.actions?.length&&this._totalPages<=1?j:H`
|
|
1991
1992
|
<div class="header">
|
|
1992
|
-
${this._model.title&&"card"!==this.variant?
|
|
1993
|
-
${"db"!==this._model.dataSource?.mode||this._model.columns.some((e=>e.searchable))?
|
|
1993
|
+
${this._model.title&&"card"!==this.variant?H`<div class="title">${this._model.title}</div>`:j}
|
|
1994
|
+
${"db"!==this._model.dataSource?.mode||this._model.columns.some((e=>e.searchable))?H`
|
|
1994
1995
|
<div class="search">
|
|
1995
1996
|
<!-- TODO: Saved views dropdown
|
|
1996
1997
|
<div class="views">
|
|
@@ -2009,7 +2010,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2009
2010
|
/>
|
|
2010
2011
|
</div>
|
|
2011
2012
|
</div>
|
|
2012
|
-
`:
|
|
2013
|
+
`:H`<div class="search"></div>`}
|
|
2013
2014
|
<div class="tools">
|
|
2014
2015
|
${this._renderPagination()}
|
|
2015
2016
|
<span class="refresh" title="Refresh" @click=${()=>this.refresh()}>
|
|
@@ -2020,7 +2021,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2020
2021
|
<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>
|
|
2021
2022
|
</span>
|
|
2022
2023
|
<div class="column-picker ${this._columnPickerOpen?"open":""}">
|
|
2023
|
-
${[...this._model.columns].filter((e=>"actions"!==e.type)).sort(((e,t)=>(e.label??e.id).localeCompare(t.label??t.id))).map((e=>
|
|
2024
|
+
${[...this._model.columns].filter((e=>"actions"!==e.type)).sort(((e,t)=>(e.label??e.id).localeCompare(t.label??t.id))).map((e=>H`
|
|
2024
2025
|
<div class="column-picker-item" @click=${()=>this._toggleColumn(e.id)}>
|
|
2025
2026
|
<div class="column-picker-checkbox ${this._model.displayedColumns.includes(e.id)?"checked":""}">
|
|
2026
2027
|
<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>
|
|
@@ -2030,7 +2031,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2030
2031
|
`))}
|
|
2031
2032
|
</div>
|
|
2032
2033
|
</div>
|
|
2033
|
-
${1===this._model.actions?.length?
|
|
2034
|
+
${1===this._model.actions?.length?H`
|
|
2034
2035
|
<kr-button
|
|
2035
2036
|
class="actions"
|
|
2036
2037
|
.href=${this._model.actions[0].href}
|
|
@@ -2039,7 +2040,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2039
2040
|
>
|
|
2040
2041
|
${this._model.actions[0].label}
|
|
2041
2042
|
</kr-button>
|
|
2042
|
-
`:this._model.actions?.length?
|
|
2043
|
+
`:this._model.actions?.length?H`
|
|
2043
2044
|
<kr-button
|
|
2044
2045
|
class="actions"
|
|
2045
2046
|
.options=${this._model.actions.map((e=>({id:e.id,label:e.label})))}
|
|
@@ -2050,14 +2051,14 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2050
2051
|
`:j}
|
|
2051
2052
|
</div>
|
|
2052
2053
|
</div>
|
|
2053
|
-
`}_renderStatus(){return"loading"===this._dataState&&0===this._data.length?
|
|
2054
|
+
`}_renderStatus(){return"loading"===this._dataState&&0===this._data.length?H`<div class="status">Loading...</div>`:"error"===this._dataState&&0===this._data.length?H`<div class="status status--error">Error loading data</div>`:0===this._data.length?H`<div class="status">No data available</div>`:j}_renderFilterPanel(){if(!this._filterPanelOpened)return j;const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));let t=H``;t="empty"===e.filter.operator||"n_empty"===e.filter.operator?H`
|
|
2054
2055
|
<input
|
|
2055
2056
|
type="text"
|
|
2056
2057
|
class="filter-panel__input"
|
|
2057
2058
|
disabled
|
|
2058
2059
|
.value=${e.filter.text}
|
|
2059
2060
|
/>
|
|
2060
|
-
`:"between"===e.filter.operator&&"date"===e.type?
|
|
2061
|
+
`:"between"===e.filter.operator&&"date"===e.type?H`
|
|
2061
2062
|
<input
|
|
2062
2063
|
type="date"
|
|
2063
2064
|
class="filter-panel__input"
|
|
@@ -2070,7 +2071,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2070
2071
|
.valueAsDate=${e.filter.value?.end??null}
|
|
2071
2072
|
@change=${t=>this._handleFilterDateEndChange(t,e)}
|
|
2072
2073
|
/>
|
|
2073
|
-
`:"between"===e.filter.operator&&"number"===e.type?
|
|
2074
|
+
`:"between"===e.filter.operator&&"number"===e.type?H`
|
|
2074
2075
|
<input
|
|
2075
2076
|
type="number"
|
|
2076
2077
|
class="filter-panel__input"
|
|
@@ -2087,7 +2088,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2087
2088
|
@input=${t=>this._handleFilterNumberEndChange(t,e)}
|
|
2088
2089
|
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
2089
2090
|
/>
|
|
2090
|
-
`:"in"===e.filter.operator||"n_in"===e.filter.operator?
|
|
2091
|
+
`:"in"===e.filter.operator||"n_in"===e.filter.operator?H`
|
|
2091
2092
|
<textarea
|
|
2092
2093
|
class="filter-panel__textarea"
|
|
2093
2094
|
rows="3"
|
|
@@ -2096,7 +2097,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2096
2097
|
@input=${t=>this._handleFilterListChange(t,e)}
|
|
2097
2098
|
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
2098
2099
|
></textarea>
|
|
2099
|
-
`:"boolean"===e.type?
|
|
2100
|
+
`:"boolean"===e.type?H`
|
|
2100
2101
|
<kr-select-field
|
|
2101
2102
|
placeholder="Value"
|
|
2102
2103
|
.value=${String(e.filter.value??"")}
|
|
@@ -2105,14 +2106,14 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2105
2106
|
<kr-select-option value="true">Yes</kr-select-option>
|
|
2106
2107
|
<kr-select-option value="false">No</kr-select-option>
|
|
2107
2108
|
</kr-select-field>
|
|
2108
|
-
`:"date"===e.type?
|
|
2109
|
+
`:"date"===e.type?H`
|
|
2109
2110
|
<input
|
|
2110
2111
|
type="date"
|
|
2111
2112
|
class="filter-panel__input"
|
|
2112
2113
|
.valueAsDate=${e.filter.value}
|
|
2113
2114
|
@change=${t=>this._handleFilterDateChange(t,e)}
|
|
2114
2115
|
/>
|
|
2115
|
-
`:"number"===e.type?
|
|
2116
|
+
`:"number"===e.type?H`
|
|
2116
2117
|
<input
|
|
2117
2118
|
type="number"
|
|
2118
2119
|
class="filter-panel__input"
|
|
@@ -2122,7 +2123,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2122
2123
|
@input=${t=>this._handleFilterNumberChange(t,e)}
|
|
2123
2124
|
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
2124
2125
|
/>
|
|
2125
|
-
`:
|
|
2126
|
+
`:H`
|
|
2126
2127
|
<input
|
|
2127
2128
|
type="text"
|
|
2128
2129
|
class="filter-panel__input"
|
|
@@ -2131,25 +2132,25 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2131
2132
|
@input=${t=>this._handleFilterStringChange(t,e)}
|
|
2132
2133
|
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
2133
2134
|
/>
|
|
2134
|
-
`;const i=
|
|
2135
|
+
`;const i=H`
|
|
2135
2136
|
<div class="filter-panel__content">
|
|
2136
2137
|
<kr-select-field
|
|
2137
2138
|
.value=${e.filter.operator}
|
|
2138
2139
|
@change=${t=>this._handleOperatorChange(t,e)}
|
|
2139
2140
|
>
|
|
2140
|
-
${Ne(e.type).map((e=>
|
|
2141
|
+
${Ne(e.type).map((e=>H`
|
|
2141
2142
|
<kr-select-option value=${e.key}>${e.label}</kr-select-option>
|
|
2142
2143
|
`))}
|
|
2143
2144
|
</kr-select-field>
|
|
2144
2145
|
${t}
|
|
2145
2146
|
</div>
|
|
2146
|
-
`,o=this._buckets.get(e.id)||[];let s,r;return s=o.length?
|
|
2147
|
+
`,o=this._buckets.get(e.id)||[];let s,r;return s=o.length?H`
|
|
2147
2148
|
<div class="buckets">
|
|
2148
|
-
${o.map((t=>{let i="(Empty)";null!==t.val&&void 0!==t.val&&(i="boolean"===e.type?!0===t.val||"true"===t.val?"Yes":"No":String(t.val));let o=e.filter.has(t.val);"n_in"===e.filter.operator&&(o=!o);let s=j;return o&&(s=
|
|
2149
|
+
${o.map((t=>{let i="(Empty)";null!==t.val&&void 0!==t.val&&(i="boolean"===e.type?!0===t.val||"true"===t.val?"Yes":"No":String(t.val));let o=e.filter.has(t.val);"n_in"===e.filter.operator&&(o=!o);let s=j;return o&&(s=H`
|
|
2149
2150
|
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
2150
2151
|
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>
|
|
2151
2152
|
</svg>
|
|
2152
|
-
`),
|
|
2153
|
+
`),H`
|
|
2153
2154
|
<div
|
|
2154
2155
|
class="bucket"
|
|
2155
2156
|
@click=${i=>this._handleBucketToggle(i,e,t)}
|
|
@@ -2162,7 +2163,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2162
2163
|
</div>
|
|
2163
2164
|
`}))}
|
|
2164
2165
|
</div>
|
|
2165
|
-
`:
|
|
2166
|
+
`:H`<div class="bucket-empty">No data</div>`,r=e.facetable&&e.filterable?H`
|
|
2166
2167
|
<kr-tab-group
|
|
2167
2168
|
size="small"
|
|
2168
2169
|
active-tab-id=${this._filterPanelTab}
|
|
@@ -2175,7 +2176,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2175
2176
|
${s}
|
|
2176
2177
|
</kr-tab>
|
|
2177
2178
|
</kr-tab-group>
|
|
2178
|
-
`:e.facetable?s:i,
|
|
2179
|
+
`:e.facetable?s:i,H`
|
|
2179
2180
|
<div
|
|
2180
2181
|
class="filter-panel"
|
|
2181
2182
|
style=${De({top:this._filterPanelPos.top+"px",left:this._filterPanelPos.left+"px"})}
|
|
@@ -2190,9 +2191,9 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2190
2191
|
</kr-button>
|
|
2191
2192
|
</div>
|
|
2192
2193
|
</div>
|
|
2193
|
-
`}_renderFilterRow(){const e=this.getDisplayedColumns();return e.some((e=>e.filterable||e.facetable))?
|
|
2194
|
+
`}_renderFilterRow(){const e=this.getDisplayedColumns();return e.some((e=>e.filterable||e.facetable))?H`
|
|
2194
2195
|
<div class="filter-row">
|
|
2195
|
-
${e.map(((t,i)=>t.filterable||t.facetable?
|
|
2196
|
+
${e.map(((t,i)=>t.filterable||t.facetable?H`
|
|
2196
2197
|
<div
|
|
2197
2198
|
class=${we({"filter-cell":!0,"filter-cell--sticky-left":"left"===t.sticky,"filter-cell--sticky-right":"right"===t.sticky,"filter-cell--sticky-right-first":"right"===t.sticky&&!e.slice(0,i).some((e=>"right"===e.sticky))})}
|
|
2198
2199
|
style=${De(this._getCellStyle(t,i))}
|
|
@@ -2204,7 +2205,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2204
2205
|
.value=${t.filter.kql}
|
|
2205
2206
|
@change=${e=>this._handleKqlChange(e,t)}
|
|
2206
2207
|
/>
|
|
2207
|
-
${t.filter?.kql?.length>0?
|
|
2208
|
+
${t.filter?.kql?.length>0?H`
|
|
2208
2209
|
<button
|
|
2209
2210
|
class="filter-cell__clear"
|
|
2210
2211
|
@click=${()=>this._handleKqlClear(t)}
|
|
@@ -2224,12 +2225,12 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2224
2225
|
</button>
|
|
2225
2226
|
</div>
|
|
2226
2227
|
</div>
|
|
2227
|
-
`:
|
|
2228
|
+
`:H`<div
|
|
2228
2229
|
class=${we({"filter-cell":!0,"filter-cell--sticky-left":"left"===t.sticky,"filter-cell--sticky-right":"right"===t.sticky,"filter-cell--sticky-right-first":"right"===t.sticky&&!e.slice(0,i).some((e=>"right"===e.sticky))})}
|
|
2229
2230
|
style=${De(this._getCellStyle(t,i))}
|
|
2230
2231
|
></div>`))}
|
|
2231
2232
|
</div>
|
|
2232
|
-
`:j}_renderTable(){return
|
|
2233
|
+
`:j}_renderTable(){return H`
|
|
2233
2234
|
<div class="wrapper">
|
|
2234
2235
|
<div class="overlay-left"></div>
|
|
2235
2236
|
<div class="overlay-right"></div>
|
|
@@ -2237,7 +2238,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2237
2238
|
<div class="content" @scroll=${this._handleScroll}>
|
|
2238
2239
|
<div class="table" style="grid-template-columns: ${this._getGridTemplateColumns()}">
|
|
2239
2240
|
<div class="header-row">
|
|
2240
|
-
${this.getDisplayedColumns().map(((e,t)=>
|
|
2241
|
+
${this.getDisplayedColumns().map(((e,t)=>H`
|
|
2241
2242
|
<div
|
|
2242
2243
|
class=${we(this._getHeaderCellClasses(e,t))}
|
|
2243
2244
|
style=${De(this._getCellStyle(e,t))}
|
|
@@ -2245,7 +2246,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2245
2246
|
>
|
|
2246
2247
|
<span class="header-cell__label">${e.label??e.id}</span>
|
|
2247
2248
|
${this._renderSortIndicator(e)}
|
|
2248
|
-
${!1!==e.resizable?
|
|
2249
|
+
${!1!==e.resizable?H`<div
|
|
2249
2250
|
class="header-cell__resize"
|
|
2250
2251
|
@mousedown=${t=>this._handleResizeStart(t,e.id)}
|
|
2251
2252
|
></div>`:j}
|
|
@@ -2253,7 +2254,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2253
2254
|
`))}
|
|
2254
2255
|
</div>
|
|
2255
2256
|
${this._renderFilterRow()}
|
|
2256
|
-
${this._data.map(((e,t)=>{const i=this.getDisplayedColumns().map(((i,o)=>
|
|
2257
|
+
${this._data.map(((e,t)=>{const i=this.getDisplayedColumns().map(((i,o)=>H`
|
|
2257
2258
|
<div
|
|
2258
2259
|
class=${we(this._getCellClasses(i,o))}
|
|
2259
2260
|
style=${De(this._getCellStyle(i,o))}
|
|
@@ -2261,7 +2262,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2261
2262
|
>
|
|
2262
2263
|
${this._renderCellContent(i,e,t)}
|
|
2263
2264
|
</div>
|
|
2264
|
-
`));return this._model.rowHref?
|
|
2265
|
+
`));return this._model.rowHref?H`
|
|
2265
2266
|
<a
|
|
2266
2267
|
href=${this._model.rowHref(e)}
|
|
2267
2268
|
draggable="false"
|
|
@@ -2269,7 +2270,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2269
2270
|
@mousedown=${()=>this._handleRowMouseDown()}
|
|
2270
2271
|
@click=${i=>this._handleRowClick(i,e,t)}
|
|
2271
2272
|
>${i}</a>
|
|
2272
|
-
`:
|
|
2273
|
+
`:H`
|
|
2273
2274
|
<div
|
|
2274
2275
|
class=${we({row:!0,"row--clickable":!!this._model.rowClickable})}
|
|
2275
2276
|
@mousedown=${()=>this._handleRowMouseDown()}
|
|
@@ -2279,12 +2280,12 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
2279
2280
|
</div>
|
|
2280
2281
|
</div>
|
|
2281
2282
|
</div>
|
|
2282
|
-
`}render(){return this._model.columns.length?
|
|
2283
|
+
`}render(){return this._model.columns.length?H`
|
|
2283
2284
|
${this._renderCardHeader()}
|
|
2284
2285
|
${this._renderHeader()}
|
|
2285
2286
|
${this._renderTable()}
|
|
2286
2287
|
${this._renderFilterPanel()}
|
|
2287
|
-
`:
|
|
2288
|
+
`:H`<slot></slot>`}},e.KRTable.styles=[de,a`
|
|
2288
2289
|
/* -------------------------------------------------------------------------
|
|
2289
2290
|
* Host
|
|
2290
2291
|
* ----------------------------------------------------------------------- */
|
|
@@ -3188,7 +3189,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
3188
3189
|
height: auto;
|
|
3189
3190
|
}
|
|
3190
3191
|
|
|
3191
|
-
`],tt([ge()],e.KRTable.prototype,"_data",void 0),tt([ge()],e.KRTable.prototype,"_dataState",void 0),tt([ge()],e.KRTable.prototype,"_page",void 0),tt([ge()],e.KRTable.prototype,"_pageSize",void 0),tt([ge()],e.KRTable.prototype,"_totalItems",void 0),tt([ge()],e.KRTable.prototype,"_totalPages",void 0),tt([ge()],e.KRTable.prototype,"_searchQuery",void 0),tt([ge()],e.KRTable.prototype,"_canScrollLeft",void 0),tt([ge()],e.KRTable.prototype,"_canScrollRight",void 0),tt([ge()],e.KRTable.prototype,"_canScrollHorizontal",void 0),tt([ge()],e.KRTable.prototype,"_columnPickerOpen",void 0),tt([ge()],e.KRTable.prototype,"_filterPanelOpened",void 0),tt([ge()],e.KRTable.prototype,"_filterPanelTab",void 0),tt([ge()],e.KRTable.prototype,"_buckets",void 0),tt([ge()],e.KRTable.prototype,"_sorts",void 0),tt([ue({type:Object})],e.KRTable.prototype,"def",void 0),tt([ue({type:String,reflect:!0})],e.KRTable.prototype,"variant",void 0),e.KRTable=tt([he("kr-table")],e.KRTable);var ot=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRSpinner=class extends le{constructor(){super(...arguments),this.size="md",this.color="dark"}render(){var e="",t="";return e="sm"==this.size?"16px":"md"==this.size?"24px":"lg"==this.size?"32px":"xl"==this.size?"48px":this.size,t="dark"==this.color?"#163052":"light"==this.color?"#ffffff":this.color,
|
|
3192
|
+
`],tt([ge()],e.KRTable.prototype,"_data",void 0),tt([ge()],e.KRTable.prototype,"_dataState",void 0),tt([ge()],e.KRTable.prototype,"_page",void 0),tt([ge()],e.KRTable.prototype,"_pageSize",void 0),tt([ge()],e.KRTable.prototype,"_totalItems",void 0),tt([ge()],e.KRTable.prototype,"_totalPages",void 0),tt([ge()],e.KRTable.prototype,"_searchQuery",void 0),tt([ge()],e.KRTable.prototype,"_canScrollLeft",void 0),tt([ge()],e.KRTable.prototype,"_canScrollRight",void 0),tt([ge()],e.KRTable.prototype,"_canScrollHorizontal",void 0),tt([ge()],e.KRTable.prototype,"_columnPickerOpen",void 0),tt([ge()],e.KRTable.prototype,"_filterPanelOpened",void 0),tt([ge()],e.KRTable.prototype,"_filterPanelTab",void 0),tt([ge()],e.KRTable.prototype,"_buckets",void 0),tt([ge()],e.KRTable.prototype,"_sorts",void 0),tt([ue({type:Object})],e.KRTable.prototype,"def",void 0),tt([ue({type:String,reflect:!0})],e.KRTable.prototype,"variant",void 0),e.KRTable=tt([he("kr-table")],e.KRTable);var ot=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRSpinner=class extends le{constructor(){super(...arguments),this.size="md",this.color="dark"}render(){var e="",t="";return e="sm"==this.size?"16px":"md"==this.size?"24px":"lg"==this.size?"32px":"xl"==this.size?"48px":this.size,t="dark"==this.color?"#163052":"light"==this.color?"#ffffff":this.color,H`
|
|
3192
3193
|
<svg
|
|
3193
3194
|
class="spinner"
|
|
3194
3195
|
style=${`width: ${e}; height: ${e}; color: ${t}`}
|
|
@@ -3248,7 +3249,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
3248
3249
|
stroke: currentColor;
|
|
3249
3250
|
stroke-linecap: round;
|
|
3250
3251
|
}
|
|
3251
|
-
`,ot([ue({type:String,reflect:!0})],e.KRSpinner.prototype,"size",void 0),ot([ue({type:String,reflect:!0})],e.KRSpinner.prototype,"color",void 0),e.KRSpinner=ot([he("kr-spinner")],e.KRSpinner);var st=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRProgressBar=class extends le{constructor(){super(...arguments),this.color="dark"}render(){let e="",t="";return e="dark"===this.color?"#163052":"light"===this.color?"#ffffff":this.color,t=this.trackColor?this.trackColor:"light"===this.color?"#ffffff4d":"#0000001a",
|
|
3252
|
+
`,ot([ue({type:String,reflect:!0})],e.KRSpinner.prototype,"size",void 0),ot([ue({type:String,reflect:!0})],e.KRSpinner.prototype,"color",void 0),e.KRSpinner=ot([he("kr-spinner")],e.KRSpinner);var st=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRProgressBar=class extends le{constructor(){super(...arguments),this.color="dark"}render(){let e="",t="";return e="dark"===this.color?"#163052":"light"===this.color?"#ffffff":this.color,t=this.trackColor?this.trackColor:"light"===this.color?"#ffffff4d":"#0000001a",H`
|
|
3252
3253
|
<div
|
|
3253
3254
|
class="progress-bar"
|
|
3254
3255
|
style=${`background: ${t}`}
|
|
@@ -3289,13 +3290,13 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
3289
3290
|
left: 100%;
|
|
3290
3291
|
}
|
|
3291
3292
|
}
|
|
3292
|
-
`,st([ue({type:String,reflect:!0})],e.KRProgressBar.prototype,"color",void 0),st([ue({type:String,reflect:!0})],e.KRProgressBar.prototype,"trackColor",void 0),e.KRProgressBar=st([he("kr-progress-bar")],e.KRProgressBar);var rt,at=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRFilePreview=rt=class extends le{constructor(){super(...arguments),this._zoom=100,this._panX=0,this._panY=0,this._dragging=!1,this._dragStartX=0,this._dragStartY=0,this._panStartX=0,this._panStartY=0,this.src="",this.name="",this._zoomLevel=100,this._textContent=null,this._handleKeydown=e=>{"Escape"===e.key&&this._close()},this._handleDragMove=e=>{this._dragging&&(this._panX=this._panStartX+(e.clientX-this._dragStartX),this._panY=this._panStartY+(e.clientY-this._dragStartY),this.requestUpdate())},this._handleDragEnd=()=>{this._dragging=!1,document.removeEventListener("mousemove",this._handleDragMove),document.removeEventListener("mouseup",this._handleDragEnd)}}static open(e){this._activePreview&&this._activePreview._close();const t=document.createElement("kr-file-preview");return t.src=e.src,t.name=e.name,document.body.appendChild(t),this._activePreview=t,t}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this._handleKeydown),this._isText()&&this._loadTextContent()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this._handleKeydown)}_close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})),rt._activePreview===this&&(rt._activePreview=null),this.remove()}_handleDownload(){this.dispatchEvent(new CustomEvent("download",{bubbles:!0,composed:!0,detail:{src:this.src,name:this.name}}))}_handleZoomIn(){this._zoomLevel=Math.min(this._zoomLevel+25,300),this._zoomLevel<=100&&(this._panX=0,this._panY=0)}_handleZoomOut(){this._zoomLevel=Math.max(this._zoomLevel-25,25),this._zoomLevel<=100&&(this._panX=0,this._panY=0)}_handleZoomReset(){this._zoomLevel=100,this._panX=0,this._panY=0}_handleDragStart(e){this._zoomLevel<=100||(e.preventDefault(),this._dragging=!0,this._dragStartX=e.clientX,this._dragStartY=e.clientY,this._panStartX=this._panX,this._panStartY=this._panY,document.addEventListener("mousemove",this._handleDragMove),document.addEventListener("mouseup",this._handleDragEnd))}_handleBackdropClick(e){e.target===e.currentTarget&&this._close()}_getExtension(){return(this.name||"").split(".").pop()?.toLowerCase()||""}_isImage(){return["jpg","jpeg","png","gif","webp","svg","bmp"].includes(this._getExtension())}_isPdf(){return"pdf"===this._getExtension()}_isText(){return["csv","txt","json","xml","log","md","yml","yaml","ini","cfg","conf","env","sh","bat"].includes(this._getExtension())}_isCsv(){return"csv"===this._getExtension()}_loadTextContent(){fetch(this.src).then((e=>e.text())).then((e=>{this._isCsv()?this._textContent=this._formatCsv(e):this._textContent=e})).catch((()=>{this._textContent="Failed to load file content."}))}_formatCsv(e){const t=e.trim().split("\n");if(!t.length)return e;const i=t.map((e=>e.split(",").map((e=>e.trim())))),o=Math.max(...i.map((e=>e.length))),s=[];for(let e=0;e<o;e++){let t=0;for(const o of i){const i=(o[e]||"").length;i>t&&(t=i)}s.push(t)}return i.map((e=>e.map(((e,t)=>e.padEnd(s[t]||0))).join(" "))).join("\n")}_getFallbackIconClass(e){return["doc","docx","rtf","txt"].includes(e)?"fallback__icon--doc":["xls","xlsx","csv"].includes(e)?"fallback__icon--xls":["zip","rar","7z","gz","tar"].includes(e)?"fallback__icon--zip":"fallback__icon--default"}_getFallbackIcon(e){return["doc","docx","rtf","txt"].includes(e)?
|
|
3293
|
+
`,st([ue({type:String,reflect:!0})],e.KRProgressBar.prototype,"color",void 0),st([ue({type:String,reflect:!0})],e.KRProgressBar.prototype,"trackColor",void 0),e.KRProgressBar=st([he("kr-progress-bar")],e.KRProgressBar);var rt,at=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRFilePreview=rt=class extends le{constructor(){super(...arguments),this._zoom=100,this._panX=0,this._panY=0,this._dragging=!1,this._dragStartX=0,this._dragStartY=0,this._panStartX=0,this._panStartY=0,this.src="",this.name="",this._zoomLevel=100,this._textContent=null,this._handleKeydown=e=>{"Escape"===e.key&&this._close()},this._handleDragMove=e=>{this._dragging&&(this._panX=this._panStartX+(e.clientX-this._dragStartX),this._panY=this._panStartY+(e.clientY-this._dragStartY),this.requestUpdate())},this._handleDragEnd=()=>{this._dragging=!1,document.removeEventListener("mousemove",this._handleDragMove),document.removeEventListener("mouseup",this._handleDragEnd)}}static open(e){this._activePreview&&this._activePreview._close();const t=document.createElement("kr-file-preview");return t.src=e.src,t.name=e.name,document.body.appendChild(t),this._activePreview=t,t}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this._handleKeydown),this._isText()&&this._loadTextContent()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this._handleKeydown)}_close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})),rt._activePreview===this&&(rt._activePreview=null),this.remove()}_handleDownload(){this.dispatchEvent(new CustomEvent("download",{bubbles:!0,composed:!0,detail:{src:this.src,name:this.name}}))}_handleZoomIn(){this._zoomLevel=Math.min(this._zoomLevel+25,300),this._zoomLevel<=100&&(this._panX=0,this._panY=0)}_handleZoomOut(){this._zoomLevel=Math.max(this._zoomLevel-25,25),this._zoomLevel<=100&&(this._panX=0,this._panY=0)}_handleZoomReset(){this._zoomLevel=100,this._panX=0,this._panY=0}_handleDragStart(e){this._zoomLevel<=100||(e.preventDefault(),this._dragging=!0,this._dragStartX=e.clientX,this._dragStartY=e.clientY,this._panStartX=this._panX,this._panStartY=this._panY,document.addEventListener("mousemove",this._handleDragMove),document.addEventListener("mouseup",this._handleDragEnd))}_handleBackdropClick(e){e.target===e.currentTarget&&this._close()}_getExtension(){return(this.name||"").split(".").pop()?.toLowerCase()||""}_isImage(){return["jpg","jpeg","png","gif","webp","svg","bmp"].includes(this._getExtension())}_isPdf(){return"pdf"===this._getExtension()}_isText(){return["csv","txt","json","xml","log","md","yml","yaml","ini","cfg","conf","env","sh","bat"].includes(this._getExtension())}_isCsv(){return"csv"===this._getExtension()}_loadTextContent(){fetch(this.src).then((e=>e.text())).then((e=>{this._isCsv()?this._textContent=this._formatCsv(e):this._textContent=e})).catch((()=>{this._textContent="Failed to load file content."}))}_formatCsv(e){const t=e.trim().split("\n");if(!t.length)return e;const i=t.map((e=>e.split(",").map((e=>e.trim())))),o=Math.max(...i.map((e=>e.length))),s=[];for(let e=0;e<o;e++){let t=0;for(const o of i){const i=(o[e]||"").length;i>t&&(t=i)}s.push(t)}return i.map((e=>e.map(((e,t)=>e.padEnd(s[t]||0))).join(" "))).join("\n")}_getFallbackIconClass(e){return["doc","docx","rtf","txt"].includes(e)?"fallback__icon--doc":["xls","xlsx","csv"].includes(e)?"fallback__icon--xls":["zip","rar","7z","gz","tar"].includes(e)?"fallback__icon--zip":"fallback__icon--default"}_getFallbackIcon(e){return["doc","docx","rtf","txt"].includes(e)?H`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6zm2-6h8v2H8v-2zm0-4h8v2H8v-2zm0 8h5v2H8v-2z"/></svg>`:["xls","xlsx","csv"].includes(e)?H`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 2v3H5V5h14zm0 5v4H5v-4h14zM5 19v-3h14v3H5zm2-8h4v2H7v-2zm0 5h4v2H7v-2z"/></svg>`:["zip","rar","7z","gz","tar"].includes(e)?H`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-8-4h2v2h-2v-2zm0-4h2v2h-2v-2zm-2 2h2v2h-2v-2z"/></svg>`:H`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"/></svg>`}render(){let e;if(this._isImage()){const t=this._zoomLevel/100,i=this._panX/t,o=this._panY/t,s=this._zoomLevel>100?"grab":"default";e=H`<img
|
|
3293
3294
|
class="body__image"
|
|
3294
3295
|
src="${this.src}"
|
|
3295
3296
|
alt="${this.name}"
|
|
3296
3297
|
style="transform: scale(${t}) translate(${i}px, ${o}px); cursor: ${s}"
|
|
3297
3298
|
@mousedown=${this._handleDragStart}
|
|
3298
|
-
/>`}else if(this._isPdf())e=
|
|
3299
|
+
/>`}else if(this._isPdf())e=H`<iframe class="body__iframe" src="${this.src}"></iframe>`;else if(this._isText())e=null===this._textContent?H`<div class="body__text-loading">Loading...</div>`:H`<pre class="body__text">${this._textContent}</pre>`;else{const t=this._getExtension();e=H`
|
|
3299
3300
|
<div class="fallback">
|
|
3300
3301
|
<div class="fallback__icon ${this._getFallbackIconClass(t)}">
|
|
3301
3302
|
${this._getFallbackIcon(t)}
|
|
@@ -3307,11 +3308,11 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
3307
3308
|
Download
|
|
3308
3309
|
</kr-button>
|
|
3309
3310
|
</div>
|
|
3310
|
-
`}return
|
|
3311
|
+
`}return H`
|
|
3311
3312
|
<div class="toolbar">
|
|
3312
3313
|
<div class="toolbar__name">${this.name}</div>
|
|
3313
3314
|
<div class="toolbar__controls">
|
|
3314
|
-
${this._isImage()?
|
|
3315
|
+
${this._isImage()?H`
|
|
3315
3316
|
<button class="toolbar__btn" @click=${this._handleZoomOut} title="Zoom out">
|
|
3316
3317
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7V9z"/></svg>
|
|
3317
3318
|
</button>
|
|
@@ -3512,14 +3513,14 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
3512
3513
|
height: 18px;
|
|
3513
3514
|
fill: currentColor;
|
|
3514
3515
|
}
|
|
3515
|
-
`,e.KRFilePreview._activePreview=null,at([ue({type:String})],e.KRFilePreview.prototype,"src",void 0),at([ue({type:String})],e.KRFilePreview.prototype,"name",void 0),at([ge()],e.KRFilePreview.prototype,"_zoomLevel",void 0),at([ge()],e.KRFilePreview.prototype,"_textContent",void 0),e.KRFilePreview=rt=at([he("kr-file-preview")],e.KRFilePreview);var lt=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRFileList=class extends le{constructor(){super(...arguments),this.files=[],this.emptyMessage="No files"}_handleFileClick(t){if(this.dispatchEvent(new CustomEvent("file-click",{bubbles:!0,composed:!0,detail:{file:t}})),t.url){e.KRFilePreview.open({src:t.url,name:t.name}).addEventListener("download",(()=>{this._handleDownload(t)}))}}_handleDownload(e){this.dispatchEvent(new CustomEvent("download",{bubbles:!0,composed:!0,detail:{file:e}}))}_handleDelete(e){this.dispatchEvent(new CustomEvent("delete",{bubbles:!0,composed:!0,detail:{file:e}}))}_getExtension(e){return e.split(".").pop()?.toLowerCase()||""}_getExtClass(e){return["pdf"].includes(e)?"file-list__ext--pdf":["doc","docx","rtf","txt"].includes(e)?"file-list__ext--doc":["xls","xlsx","csv"].includes(e)?"file-list__ext--xls":["zip","rar","7z","gz","tar"].includes(e)?"file-list__ext--zip":["jpg","jpeg","png","gif","webp","svg","bmp"].includes(e)?"file-list__ext--img":"file-list__ext--default"}_getExtIcon(e){return["jpg","jpeg","png","gif","webp","svg","bmp"].includes(e)?
|
|
3516
|
+
`,e.KRFilePreview._activePreview=null,at([ue({type:String})],e.KRFilePreview.prototype,"src",void 0),at([ue({type:String})],e.KRFilePreview.prototype,"name",void 0),at([ge()],e.KRFilePreview.prototype,"_zoomLevel",void 0),at([ge()],e.KRFilePreview.prototype,"_textContent",void 0),e.KRFilePreview=rt=at([he("kr-file-preview")],e.KRFilePreview);var lt=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRFileList=class extends le{constructor(){super(...arguments),this.files=[],this.emptyMessage="No files"}_handleFileClick(t){if(this.dispatchEvent(new CustomEvent("file-click",{bubbles:!0,composed:!0,detail:{file:t}})),t.url){e.KRFilePreview.open({src:t.url,name:t.name}).addEventListener("download",(()=>{this._handleDownload(t)}))}}_handleDownload(e){this.dispatchEvent(new CustomEvent("download",{bubbles:!0,composed:!0,detail:{file:e}}))}_handleDelete(e){this.dispatchEvent(new CustomEvent("delete",{bubbles:!0,composed:!0,detail:{file:e}}))}_getExtension(e){return e.split(".").pop()?.toLowerCase()||""}_getExtClass(e){return["pdf"].includes(e)?"file-list__ext--pdf":["doc","docx","rtf","txt"].includes(e)?"file-list__ext--doc":["xls","xlsx","csv"].includes(e)?"file-list__ext--xls":["zip","rar","7z","gz","tar"].includes(e)?"file-list__ext--zip":["jpg","jpeg","png","gif","webp","svg","bmp"].includes(e)?"file-list__ext--img":"file-list__ext--default"}_getExtIcon(e){return["jpg","jpeg","png","gif","webp","svg","bmp"].includes(e)?H`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86-3 3.87L9 13.14 6 17h12l-3.86-5.14z"/></svg>`:["pdf"].includes(e)?H`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5v1zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5v3zm4-3H19v1h1.5V11H19v2h-1.5V7h3v1.5zM9 9.5h1v-1H9v1zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm10 5.5h1v-3h-1v3z"/></svg>`:["doc","docx","rtf","txt"].includes(e)?H`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6zm2-6h8v2H8v-2zm0-4h8v2H8v-2zm0 8h5v2H8v-2z"/></svg>`:["xls","xlsx","csv"].includes(e)?H`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 2v3H5V5h14zm0 5v4H5v-4h14zM5 19v-3h14v3H5zm2-8h4v2H7v-2zm0 5h4v2H7v-2z"/></svg>`:["zip","rar","7z","gz","tar"].includes(e)?H`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-8-4h2v2h-2v-2zm0-4h2v2h-2v-2zm-2 2h2v2h-2v-2z"/></svg>`:H`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"/></svg>`}render(){return this.files.length?H`
|
|
3516
3517
|
<div class="file-list">
|
|
3517
|
-
${this.files.map((e=>{const t=this._getExtension(e.name),i=e.meta||e.date||"";return
|
|
3518
|
+
${this.files.map((e=>{const t=this._getExtension(e.name),i=e.meta||e.date||"";return H`
|
|
3518
3519
|
<div class="file-list__item">
|
|
3519
3520
|
<div class="file-list__ext ${this._getExtClass(t)}">${this._getExtIcon(t)}</div>
|
|
3520
3521
|
<div class="file-list__info">
|
|
3521
3522
|
<a class="file-list__name" @click=${()=>this._handleFileClick(e)}>${e.name}</a>
|
|
3522
|
-
${i?
|
|
3523
|
+
${i?H`<div class="file-list__meta">${i}</div>`:""}
|
|
3523
3524
|
</div>
|
|
3524
3525
|
<div class="file-list__actions">
|
|
3525
3526
|
<svg class="file-list__action" @click=${()=>this._handleDownload(e)} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" title="Download"><path d="M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5v-2z"/></svg>
|
|
@@ -3528,7 +3529,7 @@ const ze="important",Oe=" !"+ze,De=xe(class extends ke{constructor(e){if(super(e
|
|
|
3528
3529
|
</div>
|
|
3529
3530
|
`}))}
|
|
3530
3531
|
</div>
|
|
3531
|
-
`:
|
|
3532
|
+
`:H`<div class="file-list__empty">${this.emptyMessage}</div>`}},e.KRFileList.styles=a`
|
|
3532
3533
|
*,
|
|
3533
3534
|
*::after,
|
|
3534
3535
|
*::before,
|
|
@@ -3653,17 +3654,17 @@ const nt=e=>e??j
|
|
|
3653
3654
|
* @license
|
|
3654
3655
|
* Copyright 2020 Google LLC
|
|
3655
3656
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3656
|
-
*/,dt={},ht=xe(class extends ke{constructor(e){if(super(e),e.type!==me&&e.type!==ve&&e.type!==ye)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===
|
|
3657
|
+
*/,dt={},ht=xe(class extends ke{constructor(e){if(super(e),e.type!==me&&e.type!==ve&&e.type!==ye)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===F||t===j)return t;const i=e.element,o=e.name;if(e.type===me){if(t===i[o])return F}else if(e.type===ye){if(!!t===i.hasAttribute(o))return F}else if(e.type===ve&&i.getAttribute(o)===t+"")return F;return((e,t=dt)=>{e._$AH=t;
|
|
3657
3658
|
/**
|
|
3658
3659
|
* @license
|
|
3659
3660
|
* Copyright 2020 Google LLC
|
|
3660
3661
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3661
|
-
*/})(e),t}});var ct=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};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),
|
|
3662
|
+
*/})(e),t}});var ct=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};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),H`
|
|
3662
3663
|
<div class="wrapper">
|
|
3663
|
-
${this.label?
|
|
3664
|
+
${this.label?H`
|
|
3664
3665
|
<label for="input">
|
|
3665
3666
|
${this.label}
|
|
3666
|
-
${this.required?
|
|
3667
|
+
${this.required?H`<span class="required" aria-hidden="true">*</span>`:""}
|
|
3667
3668
|
</label>
|
|
3668
3669
|
`:""}
|
|
3669
3670
|
<input
|
|
@@ -3684,7 +3685,7 @@ const nt=e=>e??j
|
|
|
3684
3685
|
@change=${this._handleChange}
|
|
3685
3686
|
@blur=${this._handleBlur}
|
|
3686
3687
|
/>
|
|
3687
|
-
${e?
|
|
3688
|
+
${e?H`<div class="validation-message">${e}</div>`:this.hint?H`<div class="hint">${this.hint}</div>`:""}
|
|
3688
3689
|
</div>
|
|
3689
3690
|
`}focus(){this._input?.focus()}blur(){this._input?.blur()}select(){this._input?.select()}},e.KRTextField.styles=a`
|
|
3690
3691
|
:host {
|
|
@@ -3753,12 +3754,12 @@ const nt=e=>e??j
|
|
|
3753
3754
|
font-size: 0.75rem;
|
|
3754
3755
|
color: var(--kr-text-field-helper-color, #6b7280);
|
|
3755
3756
|
}
|
|
3756
|
-
`,e.KRTextField.formAssociated=!0,ct([ue({type:String})],e.KRTextField.prototype,"label",void 0),ct([ue({type:String})],e.KRTextField.prototype,"name",void 0),ct([ue({type:String})],e.KRTextField.prototype,"value",void 0),ct([ue({type:String})],e.KRTextField.prototype,"placeholder",void 0),ct([ue({type:String})],e.KRTextField.prototype,"type",void 0),ct([ue({type:Boolean})],e.KRTextField.prototype,"required",void 0),ct([ue({type:Boolean})],e.KRTextField.prototype,"disabled",void 0),ct([ue({type:Boolean})],e.KRTextField.prototype,"readonly",void 0),ct([ue({type:Number})],e.KRTextField.prototype,"minlength",void 0),ct([ue({type:Number})],e.KRTextField.prototype,"maxlength",void 0),ct([ue({type:String})],e.KRTextField.prototype,"pattern",void 0),ct([ue({type:String})],e.KRTextField.prototype,"autocomplete",void 0),ct([ue({type:String})],e.KRTextField.prototype,"hint",void 0),ct([fe("input")],e.KRTextField.prototype,"_input",void 0),ct([ge()],e.KRTextField.prototype,"_touched",void 0),ct([ge()],e.KRTextField.prototype,"_dirty",void 0),e.KRTextField=ct([he("kr-text-field")],e.KRTextField);var pt=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRTextareaField=class extends le{constructor(){super(),this.label="",this.name="",this.value="",this.placeholder="",this.required=!1,this.disabled=!1,this.readonly=!1,this.rows=3,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._textarea&&this._internals.setValidity(this._textarea.validity,this._textarea.validationMessage)}_handleInput(e){this.value=e.target.value,this._dirty=!0,this._internals.setFormValue(this.value),this._internals.setValidity(this._textarea.validity,this._textarea.validationMessage)}_handleChange(e){this.value=e.target.value,this._internals.setFormValue(this.value)}_handleBlur(){this._touched=!0,this._internals.setValidity(this._textarea.validity,this._textarea.validationMessage)}render(){let e="";return this._touched&&this._textarea&&!this._textarea.validity.valid&&(e=this._textarea.validationMessage),
|
|
3757
|
+
`,e.KRTextField.formAssociated=!0,ct([ue({type:String})],e.KRTextField.prototype,"label",void 0),ct([ue({type:String})],e.KRTextField.prototype,"name",void 0),ct([ue({type:String})],e.KRTextField.prototype,"value",void 0),ct([ue({type:String})],e.KRTextField.prototype,"placeholder",void 0),ct([ue({type:String})],e.KRTextField.prototype,"type",void 0),ct([ue({type:Boolean})],e.KRTextField.prototype,"required",void 0),ct([ue({type:Boolean})],e.KRTextField.prototype,"disabled",void 0),ct([ue({type:Boolean})],e.KRTextField.prototype,"readonly",void 0),ct([ue({type:Number})],e.KRTextField.prototype,"minlength",void 0),ct([ue({type:Number})],e.KRTextField.prototype,"maxlength",void 0),ct([ue({type:String})],e.KRTextField.prototype,"pattern",void 0),ct([ue({type:String})],e.KRTextField.prototype,"autocomplete",void 0),ct([ue({type:String})],e.KRTextField.prototype,"hint",void 0),ct([fe("input")],e.KRTextField.prototype,"_input",void 0),ct([ge()],e.KRTextField.prototype,"_touched",void 0),ct([ge()],e.KRTextField.prototype,"_dirty",void 0),e.KRTextField=ct([he("kr-text-field")],e.KRTextField);var pt=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRTextareaField=class extends le{constructor(){super(),this.label="",this.name="",this.value="",this.placeholder="",this.required=!1,this.disabled=!1,this.readonly=!1,this.rows=3,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._textarea&&this._internals.setValidity(this._textarea.validity,this._textarea.validationMessage)}_handleInput(e){this.value=e.target.value,this._dirty=!0,this._internals.setFormValue(this.value),this._internals.setValidity(this._textarea.validity,this._textarea.validationMessage)}_handleChange(e){this.value=e.target.value,this._internals.setFormValue(this.value)}_handleBlur(){this._touched=!0,this._internals.setValidity(this._textarea.validity,this._textarea.validationMessage)}render(){let e="";return this._touched&&this._textarea&&!this._textarea.validity.valid&&(e=this._textarea.validationMessage),H`
|
|
3757
3758
|
<div class="wrapper">
|
|
3758
|
-
${this.label?
|
|
3759
|
+
${this.label?H`
|
|
3759
3760
|
<label for="textarea">
|
|
3760
3761
|
${this.label}
|
|
3761
|
-
${this.required?
|
|
3762
|
+
${this.required?H`<span class="required" aria-hidden="true">*</span>`:j}
|
|
3762
3763
|
</label>
|
|
3763
3764
|
`:j}
|
|
3764
3765
|
<textarea
|
|
@@ -3779,7 +3780,7 @@ const nt=e=>e??j
|
|
|
3779
3780
|
@change=${this._handleChange}
|
|
3780
3781
|
@blur=${this._handleBlur}
|
|
3781
3782
|
></textarea>
|
|
3782
|
-
${e?
|
|
3783
|
+
${e?H`<div class="validation-message">${e}</div>`:this.hint?H`<div class="hint">${this.hint}</div>`:j}
|
|
3783
3784
|
</div>
|
|
3784
3785
|
`}focus(){this._textarea?.focus()}blur(){this._textarea?.blur()}select(){this._textarea?.select()}},e.KRTextareaField.styles=a`
|
|
3785
3786
|
:host {
|
|
@@ -3851,9 +3852,9 @@ const nt=e=>e??j
|
|
|
3851
3852
|
font-size: 0.75rem;
|
|
3852
3853
|
color: var(--kr-textarea-field-helper-color, #6b7280);
|
|
3853
3854
|
}
|
|
3854
|
-
`,e.KRTextareaField.formAssociated=!0,pt([ue({type:String})],e.KRTextareaField.prototype,"label",void 0),pt([ue({type:String})],e.KRTextareaField.prototype,"name",void 0),pt([ue({type:String})],e.KRTextareaField.prototype,"value",void 0),pt([ue({type:String})],e.KRTextareaField.prototype,"placeholder",void 0),pt([ue({type:Boolean})],e.KRTextareaField.prototype,"required",void 0),pt([ue({type:Boolean})],e.KRTextareaField.prototype,"disabled",void 0),pt([ue({type:Boolean})],e.KRTextareaField.prototype,"readonly",void 0),pt([ue({type:Number})],e.KRTextareaField.prototype,"rows",void 0),pt([ue({type:Number})],e.KRTextareaField.prototype,"cols",void 0),pt([ue({type:Number})],e.KRTextareaField.prototype,"minlength",void 0),pt([ue({type:Number})],e.KRTextareaField.prototype,"maxlength",void 0),pt([ue({type:String})],e.KRTextareaField.prototype,"autocomplete",void 0),pt([ue({type:String})],e.KRTextareaField.prototype,"hint",void 0),pt([fe("textarea")],e.KRTextareaField.prototype,"_textarea",void 0),pt([ge()],e.KRTextareaField.prototype,"_touched",void 0),pt([ge()],e.KRTextareaField.prototype,"_dirty",void 0),e.KRTextareaField=pt([he("kr-textarea-field")],e.KRTextareaField);var ut=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let gt=class extends le{constructor(){super(...arguments),this.label="",this.value=""}render(){return
|
|
3855
|
+
`,e.KRTextareaField.formAssociated=!0,pt([ue({type:String})],e.KRTextareaField.prototype,"label",void 0),pt([ue({type:String})],e.KRTextareaField.prototype,"name",void 0),pt([ue({type:String})],e.KRTextareaField.prototype,"value",void 0),pt([ue({type:String})],e.KRTextareaField.prototype,"placeholder",void 0),pt([ue({type:Boolean})],e.KRTextareaField.prototype,"required",void 0),pt([ue({type:Boolean})],e.KRTextareaField.prototype,"disabled",void 0),pt([ue({type:Boolean})],e.KRTextareaField.prototype,"readonly",void 0),pt([ue({type:Number})],e.KRTextareaField.prototype,"rows",void 0),pt([ue({type:Number})],e.KRTextareaField.prototype,"cols",void 0),pt([ue({type:Number})],e.KRTextareaField.prototype,"minlength",void 0),pt([ue({type:Number})],e.KRTextareaField.prototype,"maxlength",void 0),pt([ue({type:String})],e.KRTextareaField.prototype,"autocomplete",void 0),pt([ue({type:String})],e.KRTextareaField.prototype,"hint",void 0),pt([fe("textarea")],e.KRTextareaField.prototype,"_textarea",void 0),pt([ge()],e.KRTextareaField.prototype,"_touched",void 0),pt([ge()],e.KRTextareaField.prototype,"_dirty",void 0),e.KRTextareaField=pt([he("kr-textarea-field")],e.KRTextareaField);var ut=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let gt=class extends le{constructor(){super(...arguments),this.label="",this.value=""}render(){return H`
|
|
3855
3856
|
<div class="wrapper">
|
|
3856
|
-
${this.label?
|
|
3857
|
+
${this.label?H`<label>${this.label}</label>`:j}
|
|
3857
3858
|
<div class="value">${this.value}</div>
|
|
3858
3859
|
</div>
|
|
3859
3860
|
`}};gt.styles=a`
|
|
@@ -3878,7 +3879,7 @@ const nt=e=>e??j
|
|
|
3878
3879
|
font-size: 14px;
|
|
3879
3880
|
color: black;
|
|
3880
3881
|
}
|
|
3881
|
-
`,ut([ue({type:String})],gt.prototype,"label",void 0),ut([ue({type:String})],gt.prototype,"value",void 0),gt=ut([he("kr-detail-field")],gt);var ft=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRAutoSuggest=class extends le{constructor(){super(),this._requestId=0,this._handleDocumentClick=e=>{e.composedPath().includes(this)||(this._isOpen=!1)},this.label="",this.name="",this.value="",this.placeholder="",this.disabled=!1,this.readonly=!1,this.required=!1,this.hint="",this.options=[],this.fetch=null,this._isOpen=!1,this._highlightedIndex=-1,this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleDocumentClick),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity(),e.has("options")&&this._isOpen&&this._positionDropdown()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._touched=!1,this._isOpen=!1,this._highlightedIndex=-1,this._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(e){this.value=e}_updateValidity(){this._input&&this._internals.setValidity(this._input.validity,this._input.validationMessage)}_fetch(){if(!this.fetch)return;this._requestId++;const e=this._requestId;this.fetch(this.value).then((t=>{e===this._requestId&&(this.options=t)})).catch((e=>{console.error("kr-auto-suggest: fetch failed",e)}))}_handleInput(e){this.value=e.target.value,this._isOpen=!0,this._highlightedIndex=-1,this._positionDropdown(),this._internals.setFormValue(this.value),this._internals.setValidity(this._input.validity,this._input.validationMessage),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._fetch()}_positionDropdown(){requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(!e)return;const t=this._input.getBoundingClientRect(),i=window.innerHeight-t.bottom-4-8,o=t.top-4-8;e.style.left=t.left+"px",e.style.width=t.width+"px",o>i?(e.style.top="",e.style.bottom=window.innerHeight-t.top+4+"px",e.style.maxHeight=o+"px"):(e.style.bottom="",e.style.top=t.bottom+4+"px",e.style.maxHeight=i+"px")}))}_handleFocus(){this._isOpen=!0,this._positionDropdown(),this._fetch()}_handleBlur(){this._touched=!0,this._internals.setValidity(this._input.validity,this._input.validationMessage),setTimeout((()=>{this._isOpen=!1,this._highlightedIndex=-1}),200)}_handleKeyDown(e){switch(e.key){case"ArrowDown":e.preventDefault(),this._isOpen=!0,this._highlightedIndex=Math.min(this._highlightedIndex+1,this.options.length-1),this._scrollToHighlighted();break;case"ArrowUp":e.preventDefault(),-1===this._highlightedIndex?(this._isOpen=!0,this._highlightedIndex=this.options.length-1):this._highlightedIndex=Math.max(this._highlightedIndex-1,0),this._scrollToHighlighted();break;case"Enter":this._highlightedIndex>=0&&this.options[this._highlightedIndex]&&(e.preventDefault(),this._selectOption(this.options[this._highlightedIndex]));break;case"Escape":e.preventDefault(),this._isOpen=!1,this._highlightedIndex=-1;break;case"Tab":this._isOpen=!1,this._highlightedIndex=-1}}_scrollToHighlighted(){this.updateComplete.then((()=>{const e=this.shadowRoot?.querySelector(".dropdown"),t=this.shadowRoot?.querySelector(".option--highlighted");if(e&&t){const i=e.getBoundingClientRect(),o=t.getBoundingClientRect();(o.bottom>i.bottom||o.top<i.top)&&t.scrollIntoView({block:"nearest"})}}))}_selectOption(e){e.disabled||(this.value=e.value,this._isOpen=!1,this._highlightedIndex=-1,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("select",{detail:{value:e.value,option:e},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_handleClear(){this.value="",this._internals.setFormValue(this.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._input?.focus()}_handleOptionMouseEnter(e,t){this._highlightedIndex=t}_renderOption(e,t){return
|
|
3882
|
+
`,ut([ue({type:String})],gt.prototype,"label",void 0),ut([ue({type:String})],gt.prototype,"value",void 0),gt=ut([he("kr-detail-field")],gt);var ft=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRAutoSuggest=class extends le{constructor(){super(),this._requestId=0,this._handleDocumentClick=e=>{e.composedPath().includes(this)||(this._isOpen=!1)},this.label="",this.name="",this.value="",this.placeholder="",this.disabled=!1,this.readonly=!1,this.required=!1,this.hint="",this.options=[],this.fetch=null,this._isOpen=!1,this._highlightedIndex=-1,this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleDocumentClick),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity(),e.has("options")&&this._isOpen&&this._positionDropdown()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._touched=!1,this._isOpen=!1,this._highlightedIndex=-1,this._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(e){this.value=e}_updateValidity(){this._input&&this._internals.setValidity(this._input.validity,this._input.validationMessage)}_fetch(){if(!this.fetch)return;this._requestId++;const e=this._requestId;this.fetch(this.value).then((t=>{e===this._requestId&&(this.options=t)})).catch((e=>{console.error("kr-auto-suggest: fetch failed",e)}))}_handleInput(e){this.value=e.target.value,this._isOpen=!0,this._highlightedIndex=-1,this._positionDropdown(),this._internals.setFormValue(this.value),this._internals.setValidity(this._input.validity,this._input.validationMessage),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._fetch()}_positionDropdown(){requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(!e)return;const t=this._input.getBoundingClientRect(),i=window.innerHeight-t.bottom-4-8,o=t.top-4-8;e.style.left=t.left+"px",e.style.width=t.width+"px",o>i?(e.style.top="",e.style.bottom=window.innerHeight-t.top+4+"px",e.style.maxHeight=o+"px"):(e.style.bottom="",e.style.top=t.bottom+4+"px",e.style.maxHeight=i+"px")}))}_handleFocus(){this._isOpen=!0,this._positionDropdown(),this._fetch()}_handleBlur(){this._touched=!0,this._internals.setValidity(this._input.validity,this._input.validationMessage),setTimeout((()=>{this._isOpen=!1,this._highlightedIndex=-1}),200)}_handleKeyDown(e){switch(e.key){case"ArrowDown":e.preventDefault(),this._isOpen=!0,this._highlightedIndex=Math.min(this._highlightedIndex+1,this.options.length-1),this._scrollToHighlighted();break;case"ArrowUp":e.preventDefault(),-1===this._highlightedIndex?(this._isOpen=!0,this._highlightedIndex=this.options.length-1):this._highlightedIndex=Math.max(this._highlightedIndex-1,0),this._scrollToHighlighted();break;case"Enter":this._highlightedIndex>=0&&this.options[this._highlightedIndex]&&(e.preventDefault(),this._selectOption(this.options[this._highlightedIndex]));break;case"Escape":e.preventDefault(),this._isOpen=!1,this._highlightedIndex=-1;break;case"Tab":this._isOpen=!1,this._highlightedIndex=-1}}_scrollToHighlighted(){this.updateComplete.then((()=>{const e=this.shadowRoot?.querySelector(".dropdown"),t=this.shadowRoot?.querySelector(".option--highlighted");if(e&&t){const i=e.getBoundingClientRect(),o=t.getBoundingClientRect();(o.bottom>i.bottom||o.top<i.top)&&t.scrollIntoView({block:"nearest"})}}))}_selectOption(e){e.disabled||(this.value=e.value,this._isOpen=!1,this._highlightedIndex=-1,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("select",{detail:{value:e.value,option:e},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_handleClear(){this.value="",this._internals.setFormValue(this.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._input?.focus()}_handleOptionMouseEnter(e,t){this._highlightedIndex=t}_renderOption(e,t){return H`
|
|
3882
3883
|
<button
|
|
3883
3884
|
class=${we({option:!0,"option--highlighted":t===this._highlightedIndex})}
|
|
3884
3885
|
type="button"
|
|
@@ -3890,12 +3891,12 @@ const nt=e=>e??j
|
|
|
3890
3891
|
>
|
|
3891
3892
|
${e.label||e.value}
|
|
3892
3893
|
</button>
|
|
3893
|
-
`}render(){let e=j;return this._touched&&this._input&&!this._input.validity.valid?e=
|
|
3894
|
+
`}render(){let e=j;return this._touched&&this._input&&!this._input.validity.valid?e=H`<div class="validation-message">${this._input.validationMessage}</div>`:this.hint&&(e=H`<div class="hint">${this.hint}</div>`),H`
|
|
3894
3895
|
<div class="wrapper">
|
|
3895
|
-
${this.label?
|
|
3896
|
+
${this.label?H`
|
|
3896
3897
|
<label>
|
|
3897
3898
|
${this.label}
|
|
3898
|
-
${this.required?
|
|
3899
|
+
${this.required?H`<span class="required">*</span>`:j}
|
|
3899
3900
|
</label>
|
|
3900
3901
|
`:j}
|
|
3901
3902
|
|
|
@@ -3920,12 +3921,12 @@ const nt=e=>e??j
|
|
|
3920
3921
|
@keydown=${this._handleKeyDown}
|
|
3921
3922
|
/>
|
|
3922
3923
|
<div class="icon-wrapper">
|
|
3923
|
-
${!this.value||this.disabled||this.readonly?j:
|
|
3924
|
+
${!this.value||this.disabled||this.readonly?j:H`
|
|
3924
3925
|
<svg class="clear" viewBox="0 0 24 24" fill="currentColor" aria-label="Clear" @click=${this._handleClear}>
|
|
3925
3926
|
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
|
|
3926
3927
|
</svg>
|
|
3927
3928
|
`}
|
|
3928
|
-
${this.value||this.disabled||this.readonly?j:
|
|
3929
|
+
${this.value||this.disabled||this.readonly?j:H`
|
|
3929
3930
|
<svg class="search-icon" viewBox="0 0 24 24" fill="currentColor">
|
|
3930
3931
|
<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
|
|
3931
3932
|
</svg>
|
|
@@ -4100,7 +4101,7 @@ const nt=e=>e??j
|
|
|
4100
4101
|
font-size: 0.75rem;
|
|
4101
4102
|
color: var(--kr-text-field-error-color, #ef4444);
|
|
4102
4103
|
}
|
|
4103
|
-
`,e.KRAutoSuggest.formAssociated=!0,ft([ue({type:String})],e.KRAutoSuggest.prototype,"label",void 0),ft([ue({type:String})],e.KRAutoSuggest.prototype,"name",void 0),ft([ue({type:String})],e.KRAutoSuggest.prototype,"value",void 0),ft([ue({type:String})],e.KRAutoSuggest.prototype,"placeholder",void 0),ft([ue({type:Boolean})],e.KRAutoSuggest.prototype,"disabled",void 0),ft([ue({type:Boolean})],e.KRAutoSuggest.prototype,"readonly",void 0),ft([ue({type:Boolean})],e.KRAutoSuggest.prototype,"required",void 0),ft([ue({type:String})],e.KRAutoSuggest.prototype,"hint",void 0),ft([ue({type:Array})],e.KRAutoSuggest.prototype,"options",void 0),ft([ue({attribute:!1})],e.KRAutoSuggest.prototype,"fetch",void 0),ft([ge()],e.KRAutoSuggest.prototype,"_isOpen",void 0),ft([ge()],e.KRAutoSuggest.prototype,"_highlightedIndex",void 0),ft([ge()],e.KRAutoSuggest.prototype,"_touched",void 0),ft([fe("input")],e.KRAutoSuggest.prototype,"_input",void 0),e.KRAutoSuggest=ft([he("kr-auto-suggest")],e.KRAutoSuggest);var bt=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRComboBox=class extends le{constructor(){super(),this._requestId=0,this._selectedOption=null,this._handleDocumentClick=e=>{e.composedPath().includes(this)||this._close()},this.label="",this.name="",this.value="",this.placeholder="Select an option",this.disabled=!1,this.readonly=!1,this.required=!1,this.hint="",this.optionValue="value",this.optionLabel="label",this.options=[],this.fetch=null,this.fetchSelection=null,this._isOpen=!1,this._highlightedIndex=-1,this._touched=!1,this._searchQuery="",this._loading=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleDocumentClick),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity(),this.value&&this.fetchSelection&&this._resolveSelection()}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity(),e.has("value")&&(this.value?this._selectedOption&&this._getOptionValue(this._selectedOption)===this.value||this._resolveSelection():this._selectedOption=null),e.has("options")&&this._isOpen&&this._positionDropdown()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._selectedOption=null,this._touched=!1,this._isOpen=!1,this._highlightedIndex=-1,this._searchQuery="",this._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(e){this.value=e}focus(){this._isOpen||this._open()}blur(){this._triggerElement?.blur()}_updateValidity(){this.required&&!this.value?this._internals.setValidity({valueMissing:!0},"Please select an option",this._triggerElement):this._internals.setValidity({})}_handleTriggerClick(){this.disabled||this.readonly||(this._isOpen?this._close():this._open())}_open(){this._isOpen=!0,this._searchQuery="",this._highlightedIndex=-1,this._fetch(),this.updateComplete.then((()=>{this._positionDropdown(),this._searchInput&&this._searchInput.focus()}))}_close(){this._isOpen=!1,this._highlightedIndex=-1,this._searchQuery=""}_positionDropdown(){requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(!e)return;const t=this._triggerElement.getBoundingClientRect(),i=window.innerHeight-t.bottom-4-8,o=t.top-4-8;e.style.left=t.left+"px",e.style.width=t.width+"px",i<200&&o>i?(e.style.top="",e.style.bottom=window.innerHeight-t.top+4+"px",e.style.maxHeight=o+"px"):(e.style.bottom="",e.style.top=t.bottom+4+"px",e.style.maxHeight=i+"px")}))}_fetch(){if(!this.fetch)return;this._loading=!0,this._requestId++;const e=this._requestId;this.fetch(this._searchQuery).then((t=>{e===this._requestId&&(this.options=t,this._loading=!1)})).catch((e=>{console.error("kr-combo-box: fetch failed",e),this._loading=!1}))}_handleSearchInput(e){this._searchQuery=e.target.value,this._highlightedIndex=-1,this._fetch()}_handleSearchKeyDown(e){switch(e.key){case"ArrowDown":e.preventDefault(),this._highlightedIndex=Math.min(this._highlightedIndex+1,this.options.length-1),this._scrollToHighlighted();break;case"ArrowUp":e.preventDefault(),-1===this._highlightedIndex?this._highlightedIndex=this.options.length-1:this._highlightedIndex=Math.max(this._highlightedIndex-1,0),this._scrollToHighlighted();break;case"Enter":e.preventDefault(),this._highlightedIndex>=0&&this.options[this._highlightedIndex]&&this._selectOption(this.options[this._highlightedIndex]);break;case"Escape":e.preventDefault(),this._close(),this._triggerElement?.focus();break;case"Tab":this._close()}}_handleTriggerKeyDown(e){"ArrowDown"!==e.key&&"ArrowUp"!==e.key&&"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this._isOpen||this._open())}_handleTriggerBlur(){this._touched=!0,this._updateValidity()}_scrollToHighlighted(){this.updateComplete.then((()=>{const e=this.shadowRoot?.querySelector(".options"),t=this.shadowRoot?.querySelector(".option--highlighted");if(e&&t){const i=e.getBoundingClientRect(),o=t.getBoundingClientRect();(o.bottom>i.bottom||o.top<i.top)&&t.scrollIntoView({block:"nearest"})}}))}_getOptionValue(e){return"function"==typeof this.optionValue?this.optionValue(e):e[this.optionValue]}_getOptionLabel(e){let t;return t="function"==typeof this.optionLabel?this.optionLabel(e):e[this.optionLabel],t||this._getOptionValue(e)}_resolveSelection(){if(!this.fetchSelection)return;const e=this.value;this.fetchSelection(this.value).then((t=>{this.value===e&&t&&(this._selectedOption=t,this.requestUpdate())})).catch((e=>{console.error("kr-combo-box: fetchSelection failed",e)}))}_selectOption(e){e.disabled||(this.value=this._getOptionValue(e),this._selectedOption=e,this._close(),this._internals.setFormValue(this.value),this._updateValidity(),this.dispatchEvent(new CustomEvent("select",{detail:{option:e},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._triggerElement?.focus())}_handleOptionMouseEnter(e,t){this._highlightedIndex=t}_renderOption(e,t){const i=this._getOptionValue(e);return
|
|
4104
|
+
`,e.KRAutoSuggest.formAssociated=!0,ft([ue({type:String})],e.KRAutoSuggest.prototype,"label",void 0),ft([ue({type:String})],e.KRAutoSuggest.prototype,"name",void 0),ft([ue({type:String})],e.KRAutoSuggest.prototype,"value",void 0),ft([ue({type:String})],e.KRAutoSuggest.prototype,"placeholder",void 0),ft([ue({type:Boolean})],e.KRAutoSuggest.prototype,"disabled",void 0),ft([ue({type:Boolean})],e.KRAutoSuggest.prototype,"readonly",void 0),ft([ue({type:Boolean})],e.KRAutoSuggest.prototype,"required",void 0),ft([ue({type:String})],e.KRAutoSuggest.prototype,"hint",void 0),ft([ue({type:Array})],e.KRAutoSuggest.prototype,"options",void 0),ft([ue({attribute:!1})],e.KRAutoSuggest.prototype,"fetch",void 0),ft([ge()],e.KRAutoSuggest.prototype,"_isOpen",void 0),ft([ge()],e.KRAutoSuggest.prototype,"_highlightedIndex",void 0),ft([ge()],e.KRAutoSuggest.prototype,"_touched",void 0),ft([fe("input")],e.KRAutoSuggest.prototype,"_input",void 0),e.KRAutoSuggest=ft([he("kr-auto-suggest")],e.KRAutoSuggest);var bt=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRComboBox=class extends le{constructor(){super(),this._requestId=0,this._selectedOption=null,this._handleDocumentClick=e=>{e.composedPath().includes(this)||this._close()},this.label="",this.name="",this.value="",this.placeholder="Select an option",this.disabled=!1,this.readonly=!1,this.required=!1,this.hint="",this.optionValue="value",this.optionLabel="label",this.options=[],this.fetch=null,this.fetchSelection=null,this._isOpen=!1,this._highlightedIndex=-1,this._touched=!1,this._searchQuery="",this._loading=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleDocumentClick),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity(),this.value&&this.fetchSelection&&this._resolveSelection()}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity(),e.has("value")&&(this.value?this._selectedOption&&this._getOptionValue(this._selectedOption)===this.value||this._resolveSelection():this._selectedOption=null),e.has("options")&&this._isOpen&&this._positionDropdown()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._selectedOption=null,this._touched=!1,this._isOpen=!1,this._highlightedIndex=-1,this._searchQuery="",this._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(e){this.value=e}focus(){this._isOpen||this._open()}blur(){this._triggerElement?.blur()}_updateValidity(){this.required&&!this.value?this._internals.setValidity({valueMissing:!0},"Please select an option",this._triggerElement):this._internals.setValidity({})}_handleTriggerClick(){this.disabled||this.readonly||(this._isOpen?this._close():this._open())}_open(){this._isOpen=!0,this._searchQuery="",this._highlightedIndex=-1,this._fetch(),this.updateComplete.then((()=>{this._positionDropdown(),this._searchInput&&this._searchInput.focus()}))}_close(){this._isOpen=!1,this._highlightedIndex=-1,this._searchQuery=""}_positionDropdown(){requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(!e)return;const t=this._triggerElement.getBoundingClientRect(),i=window.innerHeight-t.bottom-4-8,o=t.top-4-8;e.style.left=t.left+"px",e.style.width=t.width+"px",i<200&&o>i?(e.style.top="",e.style.bottom=window.innerHeight-t.top+4+"px",e.style.maxHeight=o+"px"):(e.style.bottom="",e.style.top=t.bottom+4+"px",e.style.maxHeight=i+"px")}))}_fetch(){if(!this.fetch)return;this._loading=!0,this._requestId++;const e=this._requestId;this.fetch(this._searchQuery).then((t=>{e===this._requestId&&(this.options=t,this._loading=!1)})).catch((e=>{console.error("kr-combo-box: fetch failed",e),this._loading=!1}))}_handleSearchInput(e){this._searchQuery=e.target.value,this._highlightedIndex=-1,this._fetch()}_handleSearchKeyDown(e){switch(e.key){case"ArrowDown":e.preventDefault(),this._highlightedIndex=Math.min(this._highlightedIndex+1,this.options.length-1),this._scrollToHighlighted();break;case"ArrowUp":e.preventDefault(),-1===this._highlightedIndex?this._highlightedIndex=this.options.length-1:this._highlightedIndex=Math.max(this._highlightedIndex-1,0),this._scrollToHighlighted();break;case"Enter":e.preventDefault(),this._highlightedIndex>=0&&this.options[this._highlightedIndex]&&this._selectOption(this.options[this._highlightedIndex]);break;case"Escape":e.preventDefault(),this._close(),this._triggerElement?.focus();break;case"Tab":this._close()}}_handleTriggerKeyDown(e){"ArrowDown"!==e.key&&"ArrowUp"!==e.key&&"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this._isOpen||this._open())}_handleTriggerBlur(){this._touched=!0,this._updateValidity()}_scrollToHighlighted(){this.updateComplete.then((()=>{const e=this.shadowRoot?.querySelector(".options"),t=this.shadowRoot?.querySelector(".option--highlighted");if(e&&t){const i=e.getBoundingClientRect(),o=t.getBoundingClientRect();(o.bottom>i.bottom||o.top<i.top)&&t.scrollIntoView({block:"nearest"})}}))}_getOptionValue(e){return"function"==typeof this.optionValue?this.optionValue(e):e[this.optionValue]}_getOptionLabel(e){let t;return t="function"==typeof this.optionLabel?this.optionLabel(e):e[this.optionLabel],t||this._getOptionValue(e)}_resolveSelection(){if(!this.fetchSelection)return;const e=this.value;this.fetchSelection(this.value).then((t=>{this.value===e&&t&&(this._selectedOption=t,this.requestUpdate())})).catch((e=>{console.error("kr-combo-box: fetchSelection failed",e)}))}_selectOption(e){e.disabled||(this.value=this._getOptionValue(e),this._selectedOption=e,this._close(),this._internals.setFormValue(this.value),this._updateValidity(),this.dispatchEvent(new CustomEvent("select",{detail:{option:e},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._triggerElement?.focus())}_handleOptionMouseEnter(e,t){this._highlightedIndex=t}_renderOption(e,t){const i=this._getOptionValue(e);return H`
|
|
4104
4105
|
<button
|
|
4105
4106
|
class=${we({option:!0,"option--highlighted":t===this._highlightedIndex,"option--selected":i===this.value})}
|
|
4106
4107
|
type="button"
|
|
@@ -4112,12 +4113,12 @@ const nt=e=>e??j
|
|
|
4112
4113
|
>
|
|
4113
4114
|
${this._getOptionLabel(e)}
|
|
4114
4115
|
</button>
|
|
4115
|
-
`}render(){let e=j;return this._touched&&this.required&&!this.value?e=
|
|
4116
|
+
`}render(){let e=j;return this._touched&&this.required&&!this.value?e=H`<div class="validation-message">Please select an option</div>`:this.hint&&(e=H`<div class="hint">${this.hint}</div>`),H`
|
|
4116
4117
|
<div class="wrapper">
|
|
4117
|
-
${this.label?
|
|
4118
|
+
${this.label?H`
|
|
4118
4119
|
<label>
|
|
4119
4120
|
${this.label}
|
|
4120
|
-
${this.required?
|
|
4121
|
+
${this.required?H`<span class="required">*</span>`:j}
|
|
4121
4122
|
</label>
|
|
4122
4123
|
`:j}
|
|
4123
4124
|
|
|
@@ -4164,7 +4165,7 @@ const nt=e=>e??j
|
|
|
4164
4165
|
</div>
|
|
4165
4166
|
|
|
4166
4167
|
<div class="options">
|
|
4167
|
-
${this._loading?
|
|
4168
|
+
${this._loading?H`<div class="empty">Loading...</div>`:0===this.options.length?H`<div class="empty">No options found</div>`:this.options.map(((e,t)=>this._renderOption(e,t)))}
|
|
4168
4169
|
</div>
|
|
4169
4170
|
</div>
|
|
4170
4171
|
|
|
@@ -4382,12 +4383,12 @@ const nt=e=>e??j
|
|
|
4382
4383
|
font-size: 0.75rem;
|
|
4383
4384
|
color: var(--kr-text-field-error-color, #ef4444);
|
|
4384
4385
|
}
|
|
4385
|
-
`,e.KRComboBox.formAssociated=!0,bt([ue({type:String})],e.KRComboBox.prototype,"label",void 0),bt([ue({type:String})],e.KRComboBox.prototype,"name",void 0),bt([ue({type:String})],e.KRComboBox.prototype,"value",void 0),bt([ue({type:String})],e.KRComboBox.prototype,"placeholder",void 0),bt([ue({type:Boolean})],e.KRComboBox.prototype,"disabled",void 0),bt([ue({type:Boolean})],e.KRComboBox.prototype,"readonly",void 0),bt([ue({type:Boolean})],e.KRComboBox.prototype,"required",void 0),bt([ue({type:String})],e.KRComboBox.prototype,"hint",void 0),bt([ue({attribute:"option-value"})],e.KRComboBox.prototype,"optionValue",void 0),bt([ue({attribute:"option-label"})],e.KRComboBox.prototype,"optionLabel",void 0),bt([ue({type:Array})],e.KRComboBox.prototype,"options",void 0),bt([ue({attribute:!1})],e.KRComboBox.prototype,"fetch",void 0),bt([ue({attribute:!1})],e.KRComboBox.prototype,"fetchSelection",void 0),bt([ge()],e.KRComboBox.prototype,"_isOpen",void 0),bt([ge()],e.KRComboBox.prototype,"_highlightedIndex",void 0),bt([ge()],e.KRComboBox.prototype,"_touched",void 0),bt([ge()],e.KRComboBox.prototype,"_searchQuery",void 0),bt([ge()],e.KRComboBox.prototype,"_loading",void 0),bt([fe(".trigger")],e.KRComboBox.prototype,"_triggerElement",void 0),bt([fe(".search__input")],e.KRComboBox.prototype,"_searchInput",void 0),e.KRComboBox=bt([he("kr-combo-box")],e.KRComboBox);var vt=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRRadioCards=class extends le{constructor(){super(),this._focusedIndex=-1,this.label="",this.name="",this.value="",this.options=[],this.disabled=!1,this.required=!1,this.hint="",this.direction="row",this._touched=!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._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.required&&!this.value?this._internals.setValidity({valueMissing:!0},"Please select an option"):this._internals.setValidity({})}_handleCardClick(e,t){this.disabled||t.disabled||(this.value=t.value,this._touched=!0,this._internals.setFormValue(this.value),this._updateValidity(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_handleKeyDown(e,t){if(this.disabled)return;if(" "===e.key||"Enter"===e.key)return e.preventDefault(),void(this.options[t].disabled||this._handleCardClick(e,this.options[t]));let i=-1;if("row"===this.direction?"ArrowRight"===e.key?i=this._findNextEnabledIndex(t,1):"ArrowLeft"===e.key&&(i=this._findNextEnabledIndex(t,-1)):"ArrowDown"===e.key?i=this._findNextEnabledIndex(t,1):"ArrowUp"===e.key&&(i=this._findNextEnabledIndex(t,-1)),i>=0){e.preventDefault(),this._focusedIndex=i;const t=this.shadowRoot?.querySelectorAll(".card");t[i]&&t[i].focus()}}_findNextEnabledIndex(e,t){let i=e+t;for(;i>=0&&i<this.options.length;){if(!this.options[i].disabled)return i;i+=t}return-1}render(){return
|
|
4386
|
+
`,e.KRComboBox.formAssociated=!0,bt([ue({type:String})],e.KRComboBox.prototype,"label",void 0),bt([ue({type:String})],e.KRComboBox.prototype,"name",void 0),bt([ue({type:String})],e.KRComboBox.prototype,"value",void 0),bt([ue({type:String})],e.KRComboBox.prototype,"placeholder",void 0),bt([ue({type:Boolean})],e.KRComboBox.prototype,"disabled",void 0),bt([ue({type:Boolean})],e.KRComboBox.prototype,"readonly",void 0),bt([ue({type:Boolean})],e.KRComboBox.prototype,"required",void 0),bt([ue({type:String})],e.KRComboBox.prototype,"hint",void 0),bt([ue({attribute:"option-value"})],e.KRComboBox.prototype,"optionValue",void 0),bt([ue({attribute:"option-label"})],e.KRComboBox.prototype,"optionLabel",void 0),bt([ue({type:Array})],e.KRComboBox.prototype,"options",void 0),bt([ue({attribute:!1})],e.KRComboBox.prototype,"fetch",void 0),bt([ue({attribute:!1})],e.KRComboBox.prototype,"fetchSelection",void 0),bt([ge()],e.KRComboBox.prototype,"_isOpen",void 0),bt([ge()],e.KRComboBox.prototype,"_highlightedIndex",void 0),bt([ge()],e.KRComboBox.prototype,"_touched",void 0),bt([ge()],e.KRComboBox.prototype,"_searchQuery",void 0),bt([ge()],e.KRComboBox.prototype,"_loading",void 0),bt([fe(".trigger")],e.KRComboBox.prototype,"_triggerElement",void 0),bt([fe(".search__input")],e.KRComboBox.prototype,"_searchInput",void 0),e.KRComboBox=bt([he("kr-combo-box")],e.KRComboBox);var vt=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRRadioCards=class extends le{constructor(){super(),this._focusedIndex=-1,this.label="",this.name="",this.value="",this.options=[],this.disabled=!1,this.required=!1,this.hint="",this.direction="row",this._touched=!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._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.required&&!this.value?this._internals.setValidity({valueMissing:!0},"Please select an option"):this._internals.setValidity({})}_handleCardClick(e,t){this.disabled||t.disabled||(this.value=t.value,this._touched=!0,this._internals.setFormValue(this.value),this._updateValidity(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_handleKeyDown(e,t){if(this.disabled)return;if(" "===e.key||"Enter"===e.key)return e.preventDefault(),void(this.options[t].disabled||this._handleCardClick(e,this.options[t]));let i=-1;if("row"===this.direction?"ArrowRight"===e.key?i=this._findNextEnabledIndex(t,1):"ArrowLeft"===e.key&&(i=this._findNextEnabledIndex(t,-1)):"ArrowDown"===e.key?i=this._findNextEnabledIndex(t,1):"ArrowUp"===e.key&&(i=this._findNextEnabledIndex(t,-1)),i>=0){e.preventDefault(),this._focusedIndex=i;const t=this.shadowRoot?.querySelectorAll(".card");t[i]&&t[i].focus()}}_findNextEnabledIndex(e,t){let i=e+t;for(;i>=0&&i<this.options.length;){if(!this.options[i].disabled)return i;i+=t}return-1}render(){return H`
|
|
4386
4387
|
<div class="wrapper">
|
|
4387
|
-
${this.label?
|
|
4388
|
+
${this.label?H`
|
|
4388
4389
|
<label>
|
|
4389
4390
|
${this.label}
|
|
4390
|
-
${this.required?
|
|
4391
|
+
${this.required?H`<span class="required" aria-hidden="true">*</span>`:j}
|
|
4391
4392
|
</label>
|
|
4392
4393
|
`:j}
|
|
4393
4394
|
<div
|
|
@@ -4395,7 +4396,7 @@ const nt=e=>e??j
|
|
|
4395
4396
|
role="radiogroup"
|
|
4396
4397
|
aria-label=${this.label}
|
|
4397
4398
|
>
|
|
4398
|
-
${this.options.map(((e,t)=>{const i=e.value===this.value,o=this.disabled||!!e.disabled;return
|
|
4399
|
+
${this.options.map(((e,t)=>{const i=e.value===this.value,o=this.disabled||!!e.disabled;return H`
|
|
4399
4400
|
<div
|
|
4400
4401
|
class=${we({card:!0,"card--selected":i,"card--disabled":o})}
|
|
4401
4402
|
role="radio"
|
|
@@ -4406,16 +4407,16 @@ const nt=e=>e??j
|
|
|
4406
4407
|
@keydown=${e=>this._handleKeyDown(e,t)}
|
|
4407
4408
|
>
|
|
4408
4409
|
<div class="card__radio">
|
|
4409
|
-
${i?
|
|
4410
|
+
${i?H`<div class="card__radio-dot"></div>`:j}
|
|
4410
4411
|
</div>
|
|
4411
4412
|
<div class="card__content">
|
|
4412
4413
|
<div class="card__label">${e.label}</div>
|
|
4413
|
-
${e.description?
|
|
4414
|
+
${e.description?H`<div class="card__description">${e.description}</div>`:j}
|
|
4414
4415
|
</div>
|
|
4415
4416
|
</div>
|
|
4416
4417
|
`}))}
|
|
4417
4418
|
</div>
|
|
4418
|
-
${this._touched&&this.required&&!this.value?
|
|
4419
|
+
${this._touched&&this.required&&!this.value?H`<div class="validation-message">Please select an option</div>`:this.hint?H`<div class="hint">${this.hint}</div>`:j}
|
|
4419
4420
|
</div>
|
|
4420
4421
|
`}},e.KRRadioCards.styles=[de,a`
|
|
4421
4422
|
:host {
|
|
@@ -4540,7 +4541,7 @@ const nt=e=>e??j
|
|
|
4540
4541
|
font-size: 0.75rem;
|
|
4541
4542
|
color: var(--kr-radio-cards-error-color, #ef4444);
|
|
4542
4543
|
}
|
|
4543
|
-
`],e.KRRadioCards.formAssociated=!0,vt([ue({type:String})],e.KRRadioCards.prototype,"label",void 0),vt([ue({type:String})],e.KRRadioCards.prototype,"name",void 0),vt([ue({type:String})],e.KRRadioCards.prototype,"value",void 0),vt([ue({attribute:!1})],e.KRRadioCards.prototype,"options",void 0),vt([ue({type:Boolean})],e.KRRadioCards.prototype,"disabled",void 0),vt([ue({type:Boolean})],e.KRRadioCards.prototype,"required",void 0),vt([ue({type:String})],e.KRRadioCards.prototype,"hint",void 0),vt([ue({type:String})],e.KRRadioCards.prototype,"direction",void 0),vt([ge()],e.KRRadioCards.prototype,"_touched",void 0),e.KRRadioCards=vt([he("kr-radio-cards")],e.KRRadioCards);var _t=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRCheckbox=class extends le{constructor(){super(),this.label="",this.name="",this.value="on",this.checked=!1,this.disabled=!1,this.required=!1,this.hint="",this._touched=!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.checked=!1,this._touched=!1,this._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(e){this.checked=e===this.value}connectedCallback(){super.connectedCallback(),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._syncFormValue(),this._updateValidity()}updated(e){(e.has("checked")||e.has("value"))&&this._syncFormValue(),(e.has("required")||e.has("checked"))&&this._updateValidity()}_syncFormValue(){this.checked?this._internals.setFormValue(this.value):this._internals.setFormValue("")}_updateValidity(){this.required&&!this.checked?this._internals.setValidity({valueMissing:!0},"This field is required"):this._internals.setValidity({})}_handleClick(e){this.disabled||(this.checked=!this.checked,this._touched=!0,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_handleKeyDown(e){this.disabled||" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),this._handleClick(e))}render(){return
|
|
4544
|
+
`],e.KRRadioCards.formAssociated=!0,vt([ue({type:String})],e.KRRadioCards.prototype,"label",void 0),vt([ue({type:String})],e.KRRadioCards.prototype,"name",void 0),vt([ue({type:String})],e.KRRadioCards.prototype,"value",void 0),vt([ue({attribute:!1})],e.KRRadioCards.prototype,"options",void 0),vt([ue({type:Boolean})],e.KRRadioCards.prototype,"disabled",void 0),vt([ue({type:Boolean})],e.KRRadioCards.prototype,"required",void 0),vt([ue({type:String})],e.KRRadioCards.prototype,"hint",void 0),vt([ue({type:String})],e.KRRadioCards.prototype,"direction",void 0),vt([ge()],e.KRRadioCards.prototype,"_touched",void 0),e.KRRadioCards=vt([he("kr-radio-cards")],e.KRRadioCards);var _t=function(e,t,i,o){var s,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(r<3?s(a):r>3?s(t,i,a):s(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};e.KRCheckbox=class extends le{constructor(){super(),this.label="",this.name="",this.value="on",this.checked=!1,this.disabled=!1,this.required=!1,this.hint="",this._touched=!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.checked=!1,this._touched=!1,this._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(e){this.checked=e===this.value}connectedCallback(){super.connectedCallback(),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._syncFormValue(),this._updateValidity()}updated(e){(e.has("checked")||e.has("value"))&&this._syncFormValue(),(e.has("required")||e.has("checked"))&&this._updateValidity()}_syncFormValue(){this.checked?this._internals.setFormValue(this.value):this._internals.setFormValue("")}_updateValidity(){this.required&&!this.checked?this._internals.setValidity({valueMissing:!0},"This field is required"):this._internals.setValidity({})}_handleClick(e){this.disabled||(this.checked=!this.checked,this._touched=!0,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_handleKeyDown(e){this.disabled||" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),this._handleClick(e))}render(){return H`
|
|
4544
4545
|
<div class="wrapper">
|
|
4545
4546
|
<div
|
|
4546
4547
|
class=${we({checkbox:!0,"checkbox--disabled":this.disabled})}
|
|
@@ -4557,14 +4558,14 @@ const nt=e=>e??j
|
|
|
4557
4558
|
<polyline points="20 6 9 17 4 12"></polyline>
|
|
4558
4559
|
</svg>
|
|
4559
4560
|
</div>
|
|
4560
|
-
${this.label?
|
|
4561
|
+
${this.label?H`
|
|
4561
4562
|
<span class="checkbox__label">
|
|
4562
4563
|
${this.label}
|
|
4563
|
-
${this.required?
|
|
4564
|
+
${this.required?H`<span class="required" aria-hidden="true">*</span>`:j}
|
|
4564
4565
|
</span>
|
|
4565
4566
|
`:j}
|
|
4566
4567
|
</div>
|
|
4567
|
-
${this._touched&&this.required&&!this.checked?
|
|
4568
|
+
${this._touched&&this.required&&!this.checked?H`<div class="validation-message">This field is required</div>`:this.hint?H`<div class="hint">${this.hint}</div>`:j}
|
|
4568
4569
|
</div>
|
|
4569
4570
|
`}focus(){this.shadowRoot?.querySelector(".checkbox")?.focus()}blur(){this.shadowRoot?.querySelector(".checkbox")?.blur()}},e.KRCheckbox.styles=[de,a`
|
|
4570
4571
|
:host {
|