@kodaris/krubble-components 1.0.9 → 1.0.11

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.
@@ -95,7 +95,7 @@
95
95
  * SPDX-License-Identifier: BSD-3-Clause
96
96
  */function e$3(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;return e$4(n,s,{get(){return o(this)}})}}
97
97
 
98
- var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
98
+ var __decorate$c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
99
99
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
100
100
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
101
101
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -202,13 +202,13 @@
202
202
  padding: 16px 16px 8px 16px;
203
203
  }
204
204
  `;
205
- __decorate$b([
205
+ __decorate$c([
206
206
  n$1({ type: String })
207
207
  ], exports.KRAccordion.prototype, "header", void 0);
208
- __decorate$b([
208
+ __decorate$c([
209
209
  n$1({ type: Boolean, reflect: true })
210
210
  ], exports.KRAccordion.prototype, "expanded", void 0);
211
- exports.KRAccordion = __decorate$b([
211
+ exports.KRAccordion = __decorate$c([
212
212
  t$1('kr-accordion')
213
213
  ], exports.KRAccordion);
214
214
 
@@ -225,7 +225,7 @@
225
225
  * SPDX-License-Identifier: BSD-3-Clause
226
226
  */const e$1=e$2(class extends i$1{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"class"!==t$1.name||t$1.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter(s=>t[s]).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return E}});
227
227
 
228
- var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
228
+ var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
229
229
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
230
230
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
231
231
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -409,23 +409,23 @@
409
409
  outline-offset: 2px;
410
410
  }
411
411
  `;
412
- __decorate$a([
412
+ __decorate$b([
413
413
  n$1({ type: String })
414
414
  ], exports.KRAlert.prototype, "type", void 0);
415
- __decorate$a([
415
+ __decorate$b([
416
416
  n$1({ type: String })
417
417
  ], exports.KRAlert.prototype, "header", void 0);
418
- __decorate$a([
418
+ __decorate$b([
419
419
  n$1({ type: Boolean })
420
420
  ], exports.KRAlert.prototype, "dismissible", void 0);
421
- __decorate$a([
421
+ __decorate$b([
422
422
  n$1({ type: Boolean })
423
423
  ], exports.KRAlert.prototype, "visible", void 0);
424
- exports.KRAlert = __decorate$a([
424
+ exports.KRAlert = __decorate$b([
425
425
  t$1('kr-alert')
426
426
  ], exports.KRAlert);
427
427
 
428
- var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
428
+ var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
429
429
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
430
430
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
431
431
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -436,6 +436,7 @@
436
436
  *
437
437
  * @slot - The button content
438
438
  * @fires click - Fired when the button is clicked
439
+ * @fires option-select - Fired when a dropdown option is selected
439
440
  */
440
441
  exports.KRButton = class KRButton extends i$2 {
441
442
  constructor() {
@@ -456,12 +457,37 @@
456
457
  * Whether the button is disabled
457
458
  */
458
459
  this.disabled = false;
460
+ /**
461
+ * Dropdown options - when provided, button becomes a dropdown
462
+ */
463
+ this.options = [];
459
464
  this._state = 'idle';
460
465
  this._stateText = '';
466
+ this._dropdownOpened = false;
467
+ this._dropdownAlignRight = false;
468
+ this._handleHostClick = (e) => {
469
+ if (this.options.length) {
470
+ e.stopPropagation();
471
+ this._toggleDropdown();
472
+ }
473
+ };
461
474
  this._handleKeydown = (e) => {
462
475
  if (e.key === 'Enter' || e.key === ' ') {
463
476
  e.preventDefault();
464
- this.click();
477
+ if (this.options.length) {
478
+ this._toggleDropdown();
479
+ }
480
+ else {
481
+ this.click();
482
+ }
483
+ }
484
+ if (e.key === 'Escape' && this._dropdownOpened) {
485
+ this._dropdownOpened = false;
486
+ }
487
+ };
488
+ this._handleClickOutside = (e) => {
489
+ if (this._dropdownOpened && !this.contains(e.target)) {
490
+ this._dropdownOpened = false;
465
491
  }
466
492
  };
467
493
  }
@@ -470,10 +496,36 @@
470
496
  this.setAttribute('role', 'button');
471
497
  this.setAttribute('tabindex', '0');
472
498
  this.addEventListener('keydown', this._handleKeydown);
499
+ this.addEventListener('click', this._handleHostClick);
500
+ document.addEventListener('click', this._handleClickOutside);
473
501
  }
474
502
  disconnectedCallback() {
475
503
  super.disconnectedCallback();
476
504
  this.removeEventListener('keydown', this._handleKeydown);
505
+ this.removeEventListener('click', this._handleHostClick);
506
+ document.removeEventListener('click', this._handleClickOutside);
507
+ }
508
+ _toggleDropdown() {
509
+ this._dropdownOpened = !this._dropdownOpened;
510
+ if (this._dropdownOpened) {
511
+ // Check if dropdown would overflow viewport after render
512
+ requestAnimationFrame(() => {
513
+ const dropdown = this.shadowRoot?.querySelector('.dropdown');
514
+ if (dropdown) {
515
+ const rect = dropdown.getBoundingClientRect();
516
+ this._dropdownAlignRight = rect.right > window.innerWidth;
517
+ }
518
+ });
519
+ }
520
+ }
521
+ _handleOptionClick(option, e) {
522
+ e.stopPropagation();
523
+ this._dropdownOpened = false;
524
+ this.dispatchEvent(new CustomEvent('option-select', {
525
+ detail: { id: option.id, label: option.label },
526
+ bubbles: true,
527
+ composed: true
528
+ }));
477
529
  }
478
530
  /**
479
531
  * Shows a loading spinner and disables the button.
@@ -532,13 +584,24 @@
532
584
  render() {
533
585
  return b `
534
586
  <slot></slot>
587
+ ${this.options.length ? b `<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>` : A}
535
588
  ${this._state !== 'idle'
536
589
  ? b `<span class="state-overlay">
537
590
  ${this._state === 'loading'
538
591
  ? b `<span class="spinner"></span>`
539
592
  : this._stateText}
540
593
  </span>`
541
- : ''}
594
+ : A}
595
+ ${this.options.length ? b `
596
+ <div class="dropdown ${this._dropdownOpened ? 'dropdown--opened' : ''} ${this._dropdownAlignRight ? 'dropdown--align-right' : ''}">
597
+ ${this.options.map(option => b `
598
+ <button
599
+ class="dropdown-item"
600
+ @click=${(e) => this._handleOptionClick(option, e)}
601
+ >${option.label}</button>
602
+ `)}
603
+ </div>
604
+ ` : A}
542
605
  `;
543
606
  }
544
607
  };
@@ -622,7 +685,7 @@
622
685
  /* Sizes */
623
686
  :host(.kr-button--small) {
624
687
  font-size: 13px;
625
- height: 28px;
688
+ height: 26px;
626
689
  padding: 0 16px;
627
690
  }
628
691
 
@@ -687,26 +750,98 @@
687
750
  height: 16px;
688
751
  border-width: 3px;
689
752
  }
753
+
754
+ /* Dropdown */
755
+ .dropdown {
756
+ position: absolute;
757
+ top: 100%;
758
+ left: 0;
759
+ margin-top: 4px;
760
+ min-width: 100%;
761
+ background: white;
762
+ border: 1px solid #9ba7b6;
763
+ border-radius: 8px;
764
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
765
+ padding: 8px 0;
766
+ z-index: 100;
767
+ display: none;
768
+ transform-origin: top;
769
+ }
770
+
771
+ .dropdown--opened {
772
+ display: block;
773
+ animation: dropdown-fade-in 150ms ease-out;
774
+ }
775
+
776
+ .dropdown--align-right {
777
+ left: auto;
778
+ right: 0;
779
+ }
780
+
781
+ @keyframes dropdown-fade-in {
782
+ from {
783
+ opacity: 0;
784
+ transform: translateY(-4px);
785
+ }
786
+ to {
787
+ opacity: 1;
788
+ transform: translateY(0);
789
+ }
790
+ }
791
+
792
+ .dropdown-item {
793
+ display: block;
794
+ width: 100%;
795
+ padding: 8px 16px;
796
+ text-align: left;
797
+ background: none;
798
+ border: none;
799
+ font-size: 14px;
800
+ color: #374151;
801
+ cursor: pointer;
802
+ font-family: inherit;
803
+ white-space: nowrap;
804
+ }
805
+
806
+ .dropdown-item:hover {
807
+ background: #f3f4f6;
808
+ }
809
+
810
+ /* Caret for dropdown button */
811
+ .caret {
812
+ margin-left: 4px;
813
+ margin-right: -6px;
814
+ display: flex;
815
+ }
690
816
  `;
691
- __decorate$9([
817
+ __decorate$a([
692
818
  n$1({ type: String, reflect: true })
693
819
  ], exports.KRButton.prototype, "variant", void 0);
694
- __decorate$9([
820
+ __decorate$a([
695
821
  n$1({ type: String, reflect: true })
696
822
  ], exports.KRButton.prototype, "color", void 0);
697
- __decorate$9([
823
+ __decorate$a([
698
824
  n$1({ type: String, reflect: true })
699
825
  ], exports.KRButton.prototype, "size", void 0);
700
- __decorate$9([
826
+ __decorate$a([
701
827
  n$1({ type: Boolean, reflect: true })
702
828
  ], exports.KRButton.prototype, "disabled", void 0);
703
- __decorate$9([
829
+ __decorate$a([
830
+ n$1({ type: Array })
831
+ ], exports.KRButton.prototype, "options", void 0);
832
+ __decorate$a([
704
833
  r$1()
705
834
  ], exports.KRButton.prototype, "_state", void 0);
706
- __decorate$9([
835
+ __decorate$a([
707
836
  r$1()
708
837
  ], exports.KRButton.prototype, "_stateText", void 0);
709
- exports.KRButton = __decorate$9([
838
+ __decorate$a([
839
+ r$1()
840
+ ], exports.KRButton.prototype, "_dropdownOpened", void 0);
841
+ __decorate$a([
842
+ r$1()
843
+ ], exports.KRButton.prototype, "_dropdownAlignRight", void 0);
844
+ exports.KRButton = __decorate$a([
710
845
  t$1('kr-button')
711
846
  ], exports.KRButton);
712
847
 
@@ -716,7 +851,7 @@
716
851
  * SPDX-License-Identifier: BSD-3-Clause
717
852
  */class e extends i$1{constructor(i){if(super(i),this.it=A,i.type!==t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===A||null==r)return this._t=void 0,this.it=r;if(r===E)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e.directiveName="unsafeHTML",e.resultType=1;const o$2=e$2(e);
718
853
 
719
- var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
854
+ var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
720
855
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
721
856
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
722
857
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -973,23 +1108,23 @@
973
1108
  color: #fab387;
974
1109
  }
975
1110
  `;
976
- __decorate$8([
1111
+ __decorate$9([
977
1112
  n$1({ type: String })
978
1113
  ], exports.KRCodeDemo.prototype, "language", void 0);
979
- __decorate$8([
1114
+ __decorate$9([
980
1115
  n$1({ type: String })
981
1116
  ], exports.KRCodeDemo.prototype, "code", void 0);
982
- __decorate$8([
1117
+ __decorate$9([
983
1118
  r$1()
984
1119
  ], exports.KRCodeDemo.prototype, "activeTab", void 0);
985
- __decorate$8([
1120
+ __decorate$9([
986
1121
  r$1()
987
1122
  ], exports.KRCodeDemo.prototype, "copied", void 0);
988
- exports.KRCodeDemo = __decorate$8([
1123
+ exports.KRCodeDemo = __decorate$9([
989
1124
  t$1('kr-code-demo')
990
1125
  ], exports.KRCodeDemo);
991
1126
 
992
- var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1127
+ var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
993
1128
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
994
1129
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
995
1130
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -1158,14 +1293,14 @@
1158
1293
  margin: 4px 0;
1159
1294
  }
1160
1295
  `;
1161
- __decorate$7([
1296
+ __decorate$8([
1162
1297
  r$1()
1163
1298
  ], exports.KRContextMenu.prototype, "items", void 0);
1164
- exports.KRContextMenu = __decorate$7([
1299
+ exports.KRContextMenu = __decorate$8([
1165
1300
  t$1('kr-context-menu')
1166
1301
  ], exports.KRContextMenu);
1167
1302
 
1168
- var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1303
+ var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1169
1304
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1170
1305
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1171
1306
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -1297,14 +1432,14 @@
1297
1432
  overflow: auto;
1298
1433
  }
1299
1434
  `;
1300
- __decorate$6([
1435
+ __decorate$7([
1301
1436
  r$1()
1302
1437
  ], exports.KRDialog.prototype, "contentElement", void 0);
1303
- exports.KRDialog = __decorate$6([
1438
+ exports.KRDialog = __decorate$7([
1304
1439
  t$1('kr-dialog')
1305
1440
  ], exports.KRDialog);
1306
1441
 
1307
- var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1442
+ var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1308
1443
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1309
1444
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1310
1445
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -1601,19 +1736,19 @@
1601
1736
  `;
1602
1737
  /** Track active snackbars for stacking */
1603
1738
  exports.KRSnackbar.activeSnackbars = [];
1604
- __decorate$5([
1739
+ __decorate$6([
1605
1740
  n$1({ type: String })
1606
1741
  ], exports.KRSnackbar.prototype, "type", void 0);
1607
- __decorate$5([
1742
+ __decorate$6([
1608
1743
  n$1({ type: String })
1609
1744
  ], exports.KRSnackbar.prototype, "title", void 0);
1610
- __decorate$5([
1745
+ __decorate$6([
1611
1746
  n$1({ type: String })
1612
1747
  ], exports.KRSnackbar.prototype, "message", void 0);
1613
- __decorate$5([
1748
+ __decorate$6([
1614
1749
  n$1({ type: Number })
1615
1750
  ], exports.KRSnackbar.prototype, "duration", void 0);
1616
- exports.KRSnackbar = KRSnackbar_1 = __decorate$5([
1751
+ exports.KRSnackbar = KRSnackbar_1 = __decorate$6([
1617
1752
  t$1('kr-snackbar')
1618
1753
  ], exports.KRSnackbar);
1619
1754
 
@@ -1623,7 +1758,7 @@
1623
1758
  * SPDX-License-Identifier: BSD-3-Clause
1624
1759
  */const n="important",i=" !"+n,o$1=e$2(class extends i$1{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"style"!==t$1.name||t$1.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(t){return Object.keys(t).reduce((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(e,[r]){const{style:s}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(r)),this.render(r);for(const t of this.ft)null==r[t]&&(this.ft.delete(t),t.includes("-")?s.removeProperty(t):s[t]=null);for(const t in r){const e=r[t];if(null!=e){this.ft.add(t);const r="string"==typeof e&&e.endsWith(i);t.includes("-")||r?s.setProperty(t,r?e.slice(0,-11):e,r?n:""):s[t]=e;}}return E}});
1625
1760
 
1626
- var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1761
+ var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1627
1762
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1628
1763
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1629
1764
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -1798,7 +1933,9 @@
1798
1933
  }
1799
1934
 
1800
1935
  .header {
1936
+ height: 44px;
1801
1937
  display: flex;
1938
+ flex-shrink: 0;
1802
1939
  align-items: stretch;
1803
1940
  border-bottom: 1px solid #e5e7eb;
1804
1941
  overflow-x: auto;
@@ -1923,20 +2060,20 @@
1923
2060
  }
1924
2061
  `,
1925
2062
  ];
1926
- __decorate$4([
2063
+ __decorate$5([
1927
2064
  n$1({ type: String, attribute: 'active-tab-id' })
1928
2065
  ], exports.KRTabGroup.prototype, "activeTabId", void 0);
1929
- __decorate$4([
2066
+ __decorate$5([
1930
2067
  n$1({ type: Boolean })
1931
2068
  ], exports.KRTabGroup.prototype, "justified", void 0);
1932
- __decorate$4([
2069
+ __decorate$5([
1933
2070
  n$1({ type: String, reflect: true })
1934
2071
  ], exports.KRTabGroup.prototype, "size", void 0);
1935
- exports.KRTabGroup = __decorate$4([
2072
+ exports.KRTabGroup = __decorate$5([
1936
2073
  t$1('kr-tab-group')
1937
2074
  ], exports.KRTabGroup);
1938
2075
 
1939
- var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2076
+ var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1940
2077
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1941
2078
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1942
2079
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -2007,34 +2144,1253 @@
2007
2144
  }
2008
2145
  `,
2009
2146
  ];
2010
- __decorate$3([
2147
+ __decorate$4([
2011
2148
  n$1({ type: String, reflect: true })
2012
2149
  ], exports.KRTab.prototype, "id", void 0);
2013
- __decorate$3([
2150
+ __decorate$4([
2014
2151
  n$1({ type: String })
2015
2152
  ], exports.KRTab.prototype, "title", void 0);
2016
- __decorate$3([
2153
+ __decorate$4([
2017
2154
  n$1({ type: String })
2018
2155
  ], exports.KRTab.prototype, "badge", void 0);
2019
- __decorate$3([
2156
+ __decorate$4([
2020
2157
  n$1({ type: String, attribute: 'badge-background' })
2021
2158
  ], exports.KRTab.prototype, "badgeBackground", void 0);
2022
- __decorate$3([
2159
+ __decorate$4([
2023
2160
  n$1({ type: String, attribute: 'badge-color' })
2024
2161
  ], exports.KRTab.prototype, "badgeColor", void 0);
2025
- __decorate$3([
2162
+ __decorate$4([
2026
2163
  n$1({ type: Boolean })
2027
2164
  ], exports.KRTab.prototype, "disabled", void 0);
2028
- __decorate$3([
2165
+ __decorate$4([
2029
2166
  n$1({ type: Boolean })
2030
2167
  ], exports.KRTab.prototype, "dismissible", void 0);
2031
- __decorate$3([
2168
+ __decorate$4([
2032
2169
  n$1({ type: Boolean, reflect: true })
2033
2170
  ], exports.KRTab.prototype, "active", void 0);
2034
- exports.KRTab = __decorate$3([
2171
+ exports.KRTab = __decorate$4([
2035
2172
  t$1('kr-tab')
2036
2173
  ], exports.KRTab);
2037
2174
 
2175
+ var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2176
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2177
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2178
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2179
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2180
+ };
2181
+ // === Solr Utilities ===
2182
+ const SOLR_RESERVED_CHARS = [
2183
+ '"', '+', '-', '&&', '||', '!', '(', ')', '{',
2184
+ '}', '[', ']', '^', '~', '*', '?', ':'
2185
+ ];
2186
+ const SOLR_RESERVED_CHARS_REPLACEMENT = [
2187
+ '\\"', '\\+', '\\-', '\\&\\&', '\\|\\|', '\\!', '\\(', '\\)', '\\{',
2188
+ '\\}', '\\[', '\\]', '\\^', '\\~', '\\*', '\\?', '\\:'
2189
+ ];
2190
+ function escapeSolrQuery(query) {
2191
+ let escaped = query;
2192
+ for (let i = 0; i < SOLR_RESERVED_CHARS.length; i++) {
2193
+ escaped = escaped.split(SOLR_RESERVED_CHARS[i]).join(SOLR_RESERVED_CHARS_REPLACEMENT[i]);
2194
+ }
2195
+ return escaped;
2196
+ }
2197
+ exports.KRTable = class KRTable extends i$2 {
2198
+ constructor() {
2199
+ super(...arguments);
2200
+ /**
2201
+ * Internal flag to switch between scroll edge modes:
2202
+ * - 'overlay': Fixed padding with overlay elements that hide content at edges (scrollbar at viewport edge)
2203
+ * - 'edge': Padding scrolls with content, allowing table to reach edges when scrolling
2204
+ */
2205
+ this._scrollStyle = 'overlay';
2206
+ this._data = [];
2207
+ this._dataState = 'idle';
2208
+ this._page = 1;
2209
+ this._pageSize = 50;
2210
+ this._totalItems = 0;
2211
+ this._totalPages = 0;
2212
+ this._searchQuery = '';
2213
+ this._canScrollLeft = false;
2214
+ this._canScrollRight = false;
2215
+ this._canScrollHorizontal = false;
2216
+ this._columnPickerOpen = false;
2217
+ this._displayedColumns = [];
2218
+ this._widthsLocked = false;
2219
+ this._resizing = null;
2220
+ this._resizeObserver = null;
2221
+ this._searchPositionLocked = false;
2222
+ this._def = { columns: [] };
2223
+ this.def = { columns: [] };
2224
+ this._handleClickOutsideColumnPicker = (e) => {
2225
+ if (!this._columnPickerOpen)
2226
+ return;
2227
+ const path = e.composedPath();
2228
+ const picker = this.shadowRoot?.querySelector('.column-picker-wrapper');
2229
+ if (picker && !path.includes(picker)) {
2230
+ this._columnPickerOpen = false;
2231
+ }
2232
+ };
2233
+ this._handleResizeMove = (e) => {
2234
+ if (!this._resizing)
2235
+ return;
2236
+ const col = this._def.columns.find(c => c.id === this._resizing.columnId);
2237
+ if (col) {
2238
+ const newWidth = this._resizing.startWidth + (e.clientX - this._resizing.startX);
2239
+ col.width = `${Math.min(900, Math.max(50, newWidth))}px`;
2240
+ this.requestUpdate();
2241
+ }
2242
+ };
2243
+ this._handleResizeEnd = () => {
2244
+ this._resizing = null;
2245
+ document.removeEventListener('mousemove', this._handleResizeMove);
2246
+ document.removeEventListener('mouseup', this._handleResizeEnd);
2247
+ };
2248
+ }
2249
+ connectedCallback() {
2250
+ super.connectedCallback();
2251
+ this.classList.toggle('kr-table--scroll-overlay', this._scrollStyle === 'overlay');
2252
+ this.classList.toggle('kr-table--scroll-edge', this._scrollStyle === 'edge');
2253
+ this._fetch();
2254
+ this._initRefresh();
2255
+ document.addEventListener('click', this._handleClickOutsideColumnPicker);
2256
+ this._resizeObserver = new ResizeObserver(() => {
2257
+ // Unlock and recalculate on resize since layout changes
2258
+ this._searchPositionLocked = false;
2259
+ this._updateSearchPosition();
2260
+ });
2261
+ this._resizeObserver.observe(this);
2262
+ }
2263
+ disconnectedCallback() {
2264
+ super.disconnectedCallback();
2265
+ clearInterval(this._refreshTimer);
2266
+ document.removeEventListener('click', this._handleClickOutsideColumnPicker);
2267
+ this._resizeObserver?.disconnect();
2268
+ }
2269
+ willUpdate(changedProperties) {
2270
+ if (changedProperties.has('def')) {
2271
+ // Copy user's def and normalize action columns
2272
+ this._def = {
2273
+ ...this.def,
2274
+ columns: this.def.columns.map(col => {
2275
+ if (col.type === 'actions') {
2276
+ return { ...col, sticky: 'right', resizable: false };
2277
+ }
2278
+ return { ...col };
2279
+ })
2280
+ };
2281
+ this._displayedColumns = this._def.displayedColumns || this._def.columns.map(c => c.id);
2282
+ this._widthsLocked = false;
2283
+ this.classList.remove('kr-table--widths-locked');
2284
+ this._fetch();
2285
+ this._initRefresh();
2286
+ }
2287
+ }
2288
+ updated(changedProperties) {
2289
+ this._updateScrollFlags();
2290
+ }
2291
+ // ----------------------------------------------------------------------------
2292
+ // Public Interface
2293
+ // ----------------------------------------------------------------------------
2294
+ refresh() {
2295
+ this._fetch();
2296
+ }
2297
+ goToPrevPage() {
2298
+ if (this._page > 1) {
2299
+ this._page--;
2300
+ this._fetch();
2301
+ }
2302
+ }
2303
+ goToNextPage() {
2304
+ if (this._page < this._totalPages) {
2305
+ this._page++;
2306
+ this._fetch();
2307
+ }
2308
+ }
2309
+ goToPage(page) {
2310
+ if (page >= 1 && page <= this._totalPages) {
2311
+ this._page = page;
2312
+ this._fetch();
2313
+ }
2314
+ }
2315
+ // ----------------------------------------------------------------------------
2316
+ // Data Fetching
2317
+ // ----------------------------------------------------------------------------
2318
+ /**
2319
+ * Fetches data from the API and updates the table.
2320
+ * Shows a loading spinner while fetching, then displays rows on success
2321
+ * or an error snackbar on failure.
2322
+ * Request/response format depends on dataSource.mode (solr, opensearch, db).
2323
+ */
2324
+ _fetch() {
2325
+ if (!this._def.dataSource)
2326
+ return;
2327
+ this._dataState = 'loading';
2328
+ // Build request based on mode
2329
+ let request;
2330
+ switch (this._def.dataSource.mode) {
2331
+ case 'opensearch':
2332
+ throw Error('Opensearch not supported yet');
2333
+ case 'db':
2334
+ throw Error('DB not supported yet');
2335
+ default: // solr
2336
+ request = {
2337
+ page: this._page - 1,
2338
+ size: this._pageSize,
2339
+ sorts: [],
2340
+ filterFields: [],
2341
+ queryFields: [],
2342
+ facetFields: []
2343
+ };
2344
+ if (this._searchQuery?.trim().length) {
2345
+ request.queryFields.push({
2346
+ name: '_text_',
2347
+ operation: 'IS',
2348
+ value: escapeSolrQuery(this._searchQuery)
2349
+ });
2350
+ }
2351
+ }
2352
+ this._def.dataSource.fetch(request)
2353
+ .then(response => {
2354
+ // Parse response based on mode
2355
+ switch (this._def.dataSource?.mode) {
2356
+ case 'opensearch': {
2357
+ throw Error('Opensearch not supported yet');
2358
+ }
2359
+ case 'db': {
2360
+ throw Error('DB not supported yet');
2361
+ }
2362
+ default: { // solr
2363
+ const res = response;
2364
+ this._data = res.data.content;
2365
+ this._totalItems = res.data.totalElements;
2366
+ this._totalPages = res.data.totalPages;
2367
+ this._pageSize = res.data.size;
2368
+ }
2369
+ }
2370
+ this._dataState = 'success';
2371
+ this._updateSearchPosition();
2372
+ if (!this._widthsLocked)
2373
+ this._lockColumnWidths();
2374
+ })
2375
+ .catch(err => {
2376
+ this._dataState = 'error';
2377
+ exports.KRSnackbar.show({
2378
+ message: err instanceof Error ? err.message : 'Failed to load data',
2379
+ type: 'error'
2380
+ });
2381
+ });
2382
+ }
2383
+ /**
2384
+ * Sets up auto-refresh so the table automatically fetches fresh data
2385
+ * at a regular interval (useful for dashboards, monitoring views).
2386
+ * Configured via def.refreshInterval in milliseconds.
2387
+ */
2388
+ _initRefresh() {
2389
+ clearInterval(this._refreshTimer);
2390
+ if (this._def.refreshInterval && this._def.refreshInterval > 0) {
2391
+ this._refreshTimer = window.setInterval(() => {
2392
+ this._fetch();
2393
+ }, this._def.refreshInterval);
2394
+ }
2395
+ }
2396
+ _handleSearch(e) {
2397
+ const input = e.target;
2398
+ this._searchQuery = input.value;
2399
+ this._page = 1;
2400
+ this._fetch();
2401
+ }
2402
+ _measureTextWidth(text, font) {
2403
+ const canvas = document.createElement('canvas');
2404
+ const ctx = canvas.getContext('2d');
2405
+ ctx.font = font;
2406
+ return ctx.measureText(text).width;
2407
+ }
2408
+ _lockColumnWidths() {
2409
+ this.updateComplete.then(() => {
2410
+ requestAnimationFrame(() => {
2411
+ const headerCell = this.shadowRoot?.querySelector('.header-cell');
2412
+ const dataCell = this.shadowRoot?.querySelector('.cell');
2413
+ if (!headerCell)
2414
+ return;
2415
+ const headerStyle = getComputedStyle(headerCell);
2416
+ const headerFont = `${headerStyle.fontWeight} ${headerStyle.fontSize} ${headerStyle.fontFamily}`;
2417
+ const headerPadding = parseFloat(headerStyle.paddingLeft) + parseFloat(headerStyle.paddingRight);
2418
+ const dataStyle = dataCell ? getComputedStyle(dataCell) : headerStyle;
2419
+ const dataFont = `${dataStyle.fontWeight} ${dataStyle.fontSize} ${dataStyle.fontFamily}`;
2420
+ const dataPadding = dataCell ? parseFloat(dataStyle.paddingLeft) + parseFloat(dataStyle.paddingRight) : headerPadding;
2421
+ this.getDisplayedColumns().forEach(col => {
2422
+ if (!col.width) {
2423
+ let width;
2424
+ // For columns with custom render functions, measure the actual DOM element
2425
+ if (col.render) {
2426
+ const cell = this.shadowRoot?.querySelector(`.cell[data-column-id="${col.id}"]`);
2427
+ width = cell ? cell.scrollWidth : 150;
2428
+ }
2429
+ else {
2430
+ const headerText = col.label ?? col.id;
2431
+ const headerWidth = this._measureTextWidth(headerText, headerFont) + headerPadding;
2432
+ let maxDataWidth = 0;
2433
+ for (const row of this._data) {
2434
+ const value = row[col.id];
2435
+ if (value != null) {
2436
+ const dataWidth = this._measureTextWidth(String(value), dataFont) + dataPadding;
2437
+ if (dataWidth > maxDataWidth)
2438
+ maxDataWidth = dataWidth;
2439
+ }
2440
+ }
2441
+ width = Math.ceil(Math.max(headerWidth, maxDataWidth));
2442
+ }
2443
+ col.width = `${Math.max(width, 150)}px`;
2444
+ }
2445
+ });
2446
+ this._widthsLocked = true;
2447
+ this.classList.add('kr-table--widths-locked');
2448
+ this.requestUpdate();
2449
+ });
2450
+ });
2451
+ }
2452
+ /**
2453
+ * Updates search position to be centered with equal gaps from title and tools.
2454
+ * On first call: resets to flex centering, measures position, then locks with fixed margin.
2455
+ * Subsequent calls are ignored unless _searchPositionLocked is reset (e.g., on resize).
2456
+ */
2457
+ _updateSearchPosition() {
2458
+ // Skip if already locked (prevents shifts on pagination changes)
2459
+ if (this._searchPositionLocked)
2460
+ return;
2461
+ const search = this.shadowRoot?.querySelector('.search');
2462
+ const searchField = search?.querySelector('.search-field');
2463
+ if (!search || !searchField)
2464
+ return;
2465
+ // Reset to flex centering
2466
+ search.style.justifyContent = 'center';
2467
+ searchField.style.marginLeft = '';
2468
+ requestAnimationFrame(() => {
2469
+ const searchRect = search.getBoundingClientRect();
2470
+ const fieldRect = searchField.getBoundingClientRect();
2471
+ // Calculate how far from the left of search container the field currently is
2472
+ const currentOffset = fieldRect.left - searchRect.left;
2473
+ // Lock position: switch to flex-start and use fixed margin
2474
+ search.style.justifyContent = 'flex-start';
2475
+ searchField.style.marginLeft = `${currentOffset}px`;
2476
+ // Mark as locked so pagination changes don't shift the search
2477
+ this._searchPositionLocked = true;
2478
+ });
2479
+ }
2480
+ // ----------------------------------------------------------------------------
2481
+ // Columns
2482
+ // ----------------------------------------------------------------------------
2483
+ _toggleColumnPicker() {
2484
+ this._columnPickerOpen = !this._columnPickerOpen;
2485
+ }
2486
+ _toggleColumn(columnId) {
2487
+ if (this._displayedColumns.includes(columnId)) {
2488
+ this._displayedColumns = this._displayedColumns.filter(id => id !== columnId);
2489
+ }
2490
+ else {
2491
+ this._displayedColumns = [...this._displayedColumns, columnId];
2492
+ }
2493
+ }
2494
+ // When a user toggles a column on via the column picker, it gets appended
2495
+ // to _displayedColumns. By mapping over _displayedColumns (not def.columns),
2496
+ // the new column appears at the right edge of the table instead of jumping
2497
+ // back to its original position in the column definition.
2498
+ // Actions columns are always moved to the end.
2499
+ getDisplayedColumns() {
2500
+ return this._displayedColumns
2501
+ .map(id => this._def.columns.find(col => col.id === id))
2502
+ .sort((a, b) => {
2503
+ if (a.type === 'actions' && b.type !== 'actions')
2504
+ return 1;
2505
+ if (a.type !== 'actions' && b.type === 'actions')
2506
+ return -1;
2507
+ return 0;
2508
+ });
2509
+ }
2510
+ // ----------------------------------------------------------------------------
2511
+ // Scrolling
2512
+ // ----------------------------------------------------------------------------
2513
+ /**
2514
+ * Scroll event handler that updates scroll flags in real-time as user scrolls.
2515
+ * Updates shadow indicators to show if more content exists left/right.
2516
+ */
2517
+ _handleScroll(e) {
2518
+ const container = e.target;
2519
+ this._canScrollLeft = container.scrollLeft > 0;
2520
+ this._canScrollRight = container.scrollLeft < container.scrollWidth - container.clientWidth - 1;
2521
+ }
2522
+ /**
2523
+ * Updates scroll state flags for the table content container.
2524
+ * - _canScrollLeft: true if scrolled right (can scroll back left)
2525
+ * - _canScrollRight: true if more content exists to the right
2526
+ * - _canScrollHorizontal: true if content is wider than container
2527
+ * These flags control scroll shadow indicators and CSS classes.
2528
+ */
2529
+ _updateScrollFlags() {
2530
+ const container = this.shadowRoot?.querySelector('.content');
2531
+ if (container) {
2532
+ this._canScrollLeft = container.scrollLeft > 0;
2533
+ this._canScrollRight = container.scrollWidth > container.clientWidth && container.scrollLeft < container.scrollWidth - container.clientWidth - 1;
2534
+ this._canScrollHorizontal = container.scrollWidth > container.clientWidth;
2535
+ }
2536
+ this.classList.toggle('kr-table--scroll-left-available', this._canScrollLeft);
2537
+ this.classList.toggle('kr-table--scroll-right-available', this._canScrollRight);
2538
+ this.classList.toggle('kr-table--scroll-horizontal-available', this._canScrollHorizontal);
2539
+ this.classList.toggle('kr-table--sticky-left', this.getDisplayedColumns().some(c => c.sticky === 'left'));
2540
+ this.classList.toggle('kr-table--sticky-right', this.getDisplayedColumns().some(c => c.sticky === 'right'));
2541
+ }
2542
+ // ----------------------------------------------------------------------------
2543
+ // Column Resizing
2544
+ // ----------------------------------------------------------------------------
2545
+ _handleResizeStart(e, columnId) {
2546
+ e.preventDefault();
2547
+ const headerCell = this.shadowRoot?.querySelector(`.header-cell[data-column-id="${columnId}"]`);
2548
+ this._resizing = {
2549
+ columnId,
2550
+ startX: e.clientX,
2551
+ startWidth: headerCell?.offsetWidth || 200
2552
+ };
2553
+ document.addEventListener('mousemove', this._handleResizeMove);
2554
+ document.addEventListener('mouseup', this._handleResizeEnd);
2555
+ }
2556
+ // ----------------------------------------------------------------------------
2557
+ // Header
2558
+ // ----------------------------------------------------------------------------
2559
+ _handleAction(action) {
2560
+ this.dispatchEvent(new CustomEvent('action', {
2561
+ detail: { action: action.id },
2562
+ bubbles: true,
2563
+ composed: true
2564
+ }));
2565
+ }
2566
+ // ----------------------------------------------------------------------------
2567
+ // Rendering
2568
+ // ----------------------------------------------------------------------------
2569
+ _renderCellContent(column, row) {
2570
+ const value = row[column.id];
2571
+ if (column.render) {
2572
+ const result = column.render(row);
2573
+ // If render returns a string, treat it as HTML
2574
+ return typeof result === 'string' ? o$2(result) : result;
2575
+ }
2576
+ if (value === null || value === undefined) {
2577
+ return '';
2578
+ }
2579
+ switch (column.type) {
2580
+ case 'number':
2581
+ return typeof value === 'number' ? value.toLocaleString() : String(value);
2582
+ case 'currency':
2583
+ return typeof value === 'number'
2584
+ ? value.toLocaleString('en-US', { style: 'currency', currency: 'USD' })
2585
+ : String(value);
2586
+ case 'date':
2587
+ return value instanceof Date
2588
+ ? value.toLocaleDateString()
2589
+ : new Date(value).toLocaleDateString();
2590
+ case 'boolean':
2591
+ if (value === true)
2592
+ return 'Yes';
2593
+ if (value === false)
2594
+ return 'No';
2595
+ return '';
2596
+ default:
2597
+ return String(value);
2598
+ }
2599
+ }
2600
+ /**
2601
+ * Returns CSS classes for a header cell based on column config.
2602
+ */
2603
+ _getHeaderCellClasses(column, index) {
2604
+ return {
2605
+ 'header-cell': true,
2606
+ 'header-cell--align-center': column.align === 'center',
2607
+ 'header-cell--align-right': column.align === 'right',
2608
+ 'header-cell--sticky-left': column.sticky === 'left',
2609
+ 'header-cell--sticky-left-last': column.sticky === 'left' &&
2610
+ !this.getDisplayedColumns().slice(index + 1).some(c => c.sticky === 'left'),
2611
+ 'header-cell--sticky-right': column.sticky === 'right',
2612
+ 'header-cell--sticky-right-first': column.sticky === 'right' &&
2613
+ !this.getDisplayedColumns().slice(0, index).some(c => c.sticky === 'right')
2614
+ };
2615
+ }
2616
+ /**
2617
+ * Returns CSS classes for a table cell based on column config:
2618
+ * - Alignment (center, right)
2619
+ * - Sticky positioning (left, right)
2620
+ * - Border classes for the last left-sticky or first right-sticky column
2621
+ */
2622
+ _getCellClasses(column, index) {
2623
+ return {
2624
+ 'cell': true,
2625
+ 'cell--align-center': column.align === 'center',
2626
+ 'cell--align-right': column.align === 'right',
2627
+ 'cell--sticky-left': column.sticky === 'left',
2628
+ 'cell--sticky-left-last': column.sticky === 'left' &&
2629
+ !this.getDisplayedColumns().slice(index + 1).some(c => c.sticky === 'left'),
2630
+ 'cell--sticky-right': column.sticky === 'right',
2631
+ 'cell--sticky-right-first': column.sticky === 'right' &&
2632
+ !this.getDisplayedColumns().slice(0, index).some(c => c.sticky === 'right')
2633
+ };
2634
+ }
2635
+ /**
2636
+ * Returns inline styles for a table cell:
2637
+ * - Width (from column config or default 150px)
2638
+ * - Min-width (if specified)
2639
+ * - Left/right offset for sticky columns (calculated from widths of preceding sticky columns)
2640
+ */
2641
+ _getCellStyle(column, index) {
2642
+ const styles = {};
2643
+ if (column.sticky === 'left') {
2644
+ let leftOffset = 0;
2645
+ for (let i = 0; i < index; i++) {
2646
+ const col = this.getDisplayedColumns()[i];
2647
+ if (col.sticky === 'left') {
2648
+ leftOffset += parseInt(col.width || '0', 10);
2649
+ }
2650
+ }
2651
+ styles.left = `${leftOffset}px`;
2652
+ }
2653
+ if (column.sticky === 'right') {
2654
+ let rightOffset = 0;
2655
+ for (let i = index + 1; i < this.getDisplayedColumns().length; i++) {
2656
+ const col = this.getDisplayedColumns()[i];
2657
+ if (col.sticky === 'right') {
2658
+ rightOffset += parseInt(col.width || '0', 10);
2659
+ }
2660
+ }
2661
+ styles.right = `${rightOffset}px`;
2662
+ }
2663
+ return styles;
2664
+ }
2665
+ /**
2666
+ * Renders the pagination controls:
2667
+ * - Previous page arrow (disabled on first page)
2668
+ * - Range text showing "1-50 of 150" format
2669
+ * - Next page arrow (disabled on last page)
2670
+ *
2671
+ * Hidden when there's no data or all data fits on one page.
2672
+ */
2673
+ _renderPagination() {
2674
+ const start = (this._page - 1) * this._pageSize + 1;
2675
+ const end = Math.min(this._page * this._pageSize, this._totalItems);
2676
+ return b `
2677
+ <div class="pagination">
2678
+ <span
2679
+ class="pagination-icon ${this._page === 1 ? 'pagination-icon--disabled' : ''}"
2680
+ @click=${this.goToPrevPage}
2681
+ >
2682
+ <svg viewBox="0 0 24 24" fill="currentColor"><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>
2683
+ </span>
2684
+ <span class="pagination-info">${start}-${end} of ${this._totalItems}</span>
2685
+ <span
2686
+ class="pagination-icon ${this._page === this._totalPages ? 'pagination-icon--disabled' : ''}"
2687
+ @click=${this.goToNextPage}
2688
+ >
2689
+ <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>
2690
+ </span>
2691
+ </div>
2692
+ `;
2693
+ }
2694
+ /**
2695
+ * Renders the header toolbar containing:
2696
+ * - Title (left)
2697
+ * - Search bar with view selector dropdown (center)
2698
+ * - Tools (right): page navigation, refresh button, column visibility picker, actions dropdown
2699
+ *
2700
+ * Hidden when there's no title, no actions, and data fits on one page.
2701
+ */
2702
+ _renderHeader() {
2703
+ if (!this._def.title && !this._def.actions?.length && this._totalPages <= 1) {
2704
+ return A;
2705
+ }
2706
+ return b `
2707
+ <div class="header">
2708
+ <div class="title">${this._def.title ?? ''}</div>
2709
+ <div class="search">
2710
+ <!-- TODO: Saved views dropdown
2711
+ <div class="views">
2712
+ <span>Default View</span>
2713
+ <svg 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>
2714
+ </div>
2715
+ -->
2716
+ <div class="search-field">
2717
+ <svg class="search-icon" viewBox="0 -960 960 960" fill="currentColor"><path d="M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"/></svg>
2718
+ <input
2719
+ type="text"
2720
+ class="search-input"
2721
+ placeholder="Search..."
2722
+ .value=${this._searchQuery}
2723
+ @input=${this._handleSearch}
2724
+ />
2725
+ </div>
2726
+ </div>
2727
+ <div class="tools">
2728
+ ${this._renderPagination()}
2729
+ <span class="refresh" title="Refresh" @click=${() => this.refresh()}>
2730
+ <svg viewBox="0 -960 960 960" fill="currentColor"><path d="M480-160q-134 0-227-93t-93-227q0-134 93-227t227-93q69 0 132 28.5T720-690v-110h80v280H520v-80h168q-32-56-87.5-88T480-720q-100 0-170 70t-70 170q0 100 70 170t170 70q77 0 139-44t87-116h84q-28 106-114 173t-196 67Z"/></svg>
2731
+ </span>
2732
+ <div class="column-picker-wrapper">
2733
+ <span class="header-icon" title="Columns" @click=${this._toggleColumnPicker}>
2734
+ <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>
2735
+ </span>
2736
+ <div class="column-picker ${this._columnPickerOpen ? 'open' : ''}">
2737
+ ${[...this._def.columns].filter(col => col.type !== 'actions').sort((a, b) => (a.label ?? a.id).localeCompare(b.label ?? b.id)).map(col => b `
2738
+ <div class="column-picker-item" @click=${() => this._toggleColumn(col.id)}>
2739
+ <div class="column-picker-checkbox ${this._displayedColumns.includes(col.id) ? 'checked' : ''}">
2740
+ <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>
2741
+ </div>
2742
+ <span class="column-picker-label">${col.label ?? col.id}</span>
2743
+ </div>
2744
+ `)}
2745
+ </div>
2746
+ </div>
2747
+ ${this._def.actions?.length === 1 ? b `
2748
+ <kr-button
2749
+ class="actions"
2750
+ @click=${() => this._handleAction(this._def.actions[0])}
2751
+ >
2752
+ ${this._def.actions[0].label}
2753
+ </kr-button>
2754
+ ` : this._def.actions?.length ? b `
2755
+ <kr-button
2756
+ class="actions"
2757
+ .options=${this._def.actions.map(a => ({ id: a.id, label: a.label }))}
2758
+ @option-select=${(e) => this._handleAction({ id: e.detail.id, label: e.detail.label })}
2759
+ >
2760
+ Actions
2761
+ </kr-button>
2762
+ ` : A}
2763
+ </div>
2764
+ </div>
2765
+ `;
2766
+ }
2767
+ /** Renders status message (loading, error, empty) */
2768
+ _renderStatus() {
2769
+ if (this._dataState === 'loading' && this._data.length === 0) {
2770
+ return b `<div class="status">Loading...</div>`;
2771
+ }
2772
+ if (this._dataState === 'error' && this._data.length === 0) {
2773
+ return b `<div class="status status--error">Error loading data</div>`;
2774
+ }
2775
+ if (this._data.length === 0) {
2776
+ return b `<div class="status">No data available</div>`;
2777
+ }
2778
+ return A;
2779
+ }
2780
+ _getGridTemplateColumns() {
2781
+ const cols = this.getDisplayedColumns();
2782
+ const lastNonStickyIndex = cols.map((c, i) => c.sticky ? -1 : i).filter(i => i >= 0).pop();
2783
+ return cols.map((col, i) => {
2784
+ if (i === lastNonStickyIndex && this._widthsLocked) {
2785
+ return `minmax(${col.width || 'auto'}, 1fr)`;
2786
+ }
2787
+ return col.width || 'auto';
2788
+ }).join(' ');
2789
+ }
2790
+ /** Renders the scrollable data grid with column headers and rows. */
2791
+ _renderTable() {
2792
+ return b `
2793
+ <div class="wrapper">
2794
+ <div class="overlay-left"></div>
2795
+ <div class="overlay-right"></div>
2796
+ ${this._renderStatus()}
2797
+ <div class="content" @scroll=${this._handleScroll}>
2798
+ <div class="table" style="grid-template-columns: ${this._getGridTemplateColumns()}">
2799
+ <div class="header-row">
2800
+ ${this.getDisplayedColumns().map((col, i) => b `
2801
+ <div
2802
+ class=${e$1(this._getHeaderCellClasses(col, i))}
2803
+ style=${o$1(this._getCellStyle(col, i))}
2804
+ data-column-id=${col.id}
2805
+ >${col.label ?? col.id}${col.resizable !== false ? b `<div
2806
+ class="header-cell__resize"
2807
+ @mousedown=${(e) => this._handleResizeStart(e, col.id)}
2808
+ ></div>` : A}</div>
2809
+ `)}
2810
+ </div>
2811
+ ${this._data.map(row => b `
2812
+ <div class="row">
2813
+ ${this.getDisplayedColumns().map((col, i) => b `
2814
+ <div
2815
+ class=${e$1(this._getCellClasses(col, i))}
2816
+ style=${o$1(this._getCellStyle(col, i))}
2817
+ data-column-id=${col.id}
2818
+ >
2819
+ ${this._renderCellContent(col, row)}
2820
+ </div>
2821
+ `)}
2822
+ </div>
2823
+ `)}
2824
+ </div>
2825
+ </div>
2826
+ </div>
2827
+ `;
2828
+ }
2829
+ /**
2830
+ * Renders a data table with:
2831
+ * - Header bar with title, search input with view selector, and tools (pagination, refresh, column visibility, actions dropdown)
2832
+ * - Scrollable grid with sticky header row and optional sticky left/right columns
2833
+ * - Loading, error message, or empty state when no data
2834
+ */
2835
+ render() {
2836
+ if (!this._def.columns.length) {
2837
+ return b `<slot></slot>`;
2838
+ }
2839
+ return b `
2840
+ ${this._renderHeader()}
2841
+ ${this._renderTable()}
2842
+ `;
2843
+ }
2844
+ };
2845
+ exports.KRTable.styles = [krBaseCSS, i$5 `
2846
+ /* -------------------------------------------------------------------------
2847
+ * Host
2848
+ * ----------------------------------------------------------------------- */
2849
+ :host {
2850
+ display: flex;
2851
+ flex-direction: column;
2852
+ width: 100%;
2853
+ height: 100%;
2854
+ overflow: hidden;
2855
+ container-type: inline-size;
2856
+ }
2857
+
2858
+ /* -------------------------------------------------------------------------
2859
+ * Header
2860
+ * ----------------------------------------------------------------------- */
2861
+ .header {
2862
+ flex-shrink: 0;
2863
+ display: flex;
2864
+ align-items: center;
2865
+ gap: 16px;
2866
+ margin: 0 24px;
2867
+ padding: 0 4px;
2868
+ height: 64px;
2869
+ border-bottom: 1px solid #e5e7eb;
2870
+ background: #fff;
2871
+ }
2872
+
2873
+ :host(.kr-table--scroll-edge) .header {
2874
+ border-bottom: none;
2875
+ }
2876
+
2877
+ .title {
2878
+ font-size: 20px;
2879
+ font-weight: 400;
2880
+ color: #000;
2881
+ }
2882
+
2883
+ /* -------------------------------------------------------------------------
2884
+ * Content
2885
+ * ----------------------------------------------------------------------- */
2886
+ .wrapper {
2887
+ flex: 1;
2888
+ position: relative;
2889
+ overflow: hidden;
2890
+ }
2891
+
2892
+ .content {
2893
+ height: 100%;
2894
+ overflow: auto;
2895
+ padding-bottom: 24px;
2896
+ }
2897
+
2898
+ /* -------------------------------------------------------------------------
2899
+ * Search
2900
+ * ----------------------------------------------------------------------- */
2901
+ .search {
2902
+ flex: 1;
2903
+ display: flex;
2904
+ align-items: center;
2905
+ justify-content: center;
2906
+ min-width: 0;
2907
+ }
2908
+
2909
+ .search-field {
2910
+ width: 100%;
2911
+ max-width: 400px;
2912
+ position: relative;
2913
+ display: flex;
2914
+ align-items: center;
2915
+ border: 1px solid #00000038;
2916
+ border-radius: 18px;
2917
+ transition: border-color 0.2s, box-shadow 0.2s;
2918
+ }
2919
+
2920
+ .search-field:focus-within {
2921
+ border-color: #163052;
2922
+ box-shadow: 0 0 0 3px rgba(22, 48, 82, 0.1);
2923
+ }
2924
+
2925
+ /* TODO: Uncomment when views dropdown is added
2926
+ .search-field:focus-within .views {
2927
+ border-color: #163052;
2928
+ }
2929
+ */
2930
+
2931
+ .search-icon {
2932
+ position: absolute;
2933
+ left: 16px;
2934
+ width: 20px;
2935
+ height: 20px;
2936
+ color: #656871;
2937
+ pointer-events: none;
2938
+ }
2939
+
2940
+ .search-input {
2941
+ height: 36px;
2942
+ padding: 0 16px 0 42px;
2943
+ border: none;
2944
+ border-radius: 16px;
2945
+ font-size: 14px;
2946
+ font-weight: 400;
2947
+ font-family: inherit;
2948
+ color: #163052;
2949
+ background: transparent;
2950
+ outline: none;
2951
+ flex: 1;
2952
+ min-width: 0;
2953
+ width: 100%;
2954
+ }
2955
+
2956
+ .search-input::placeholder {
2957
+ color: #656871;
2958
+ font-weight: 400;
2959
+ }
2960
+
2961
+ .search-input:focus {
2962
+ outline: none;
2963
+ }
2964
+
2965
+ @container (max-width: 800px) {
2966
+ .search-field {
2967
+ max-width: 250px;
2968
+ }
2969
+ }
2970
+
2971
+ .views {
2972
+ display: flex;
2973
+ align-items: center;
2974
+ gap: 4px;
2975
+ height: 36px;
2976
+ padding: 0 16px;
2977
+ border: 1px solid #00000038;
2978
+ border-right: none;
2979
+ border-radius: 16px 0 0 16px;
2980
+ font-size: 14px;
2981
+ font-family: inherit;
2982
+ color: #163052;
2983
+ background: transparent;
2984
+ cursor: pointer;
2985
+ white-space: nowrap;
2986
+ transition: border-color 0.2s;
2987
+ }
2988
+
2989
+ .views:hover {
2990
+ background: #e8f0f8;
2991
+ }
2992
+
2993
+ .views svg {
2994
+ width: 16px;
2995
+ height: 16px;
2996
+ color: #163052;
2997
+ }
2998
+
2999
+ /* -------------------------------------------------------------------------
3000
+ * Pagination
3001
+ * ----------------------------------------------------------------------- */
3002
+ .tools {
3003
+ display: flex;
3004
+ align-items: center;
3005
+ gap: 8px;
3006
+ }
3007
+
3008
+ .pagination {
3009
+ display: flex;
3010
+ align-items: center;
3011
+ gap: 2px;
3012
+ }
3013
+
3014
+ .pagination-info {
3015
+ font-size: 13px;
3016
+ color: var(--kr-primary);
3017
+ white-space: nowrap;
3018
+ }
3019
+
3020
+ .pagination-icon {
3021
+ display: flex;
3022
+ color: var(--kr-primary);
3023
+ cursor: pointer;
3024
+ }
3025
+
3026
+ .pagination-icon--disabled {
3027
+ opacity: 0.3;
3028
+ pointer-events: none;
3029
+ }
3030
+
3031
+ .pagination-icon svg {
3032
+ width: 24px;
3033
+ height: 24px;
3034
+ }
3035
+
3036
+ /* -------------------------------------------------------------------------
3037
+ * Header Icons
3038
+ * ----------------------------------------------------------------------- */
3039
+ .refresh,
3040
+ .header-icon {
3041
+ display: flex;
3042
+ align-items: center;
3043
+ justify-content: center;
3044
+ color: var(--kr-primary);
3045
+ background: #EBF1FA;
3046
+ cursor: pointer;
3047
+ padding: 6px;
3048
+ border-radius: 50%;
3049
+ transition: background 0.15s;
3050
+ }
3051
+
3052
+ .refresh:hover,
3053
+ .header-icon:hover {
3054
+ background: #e8f0f8;
3055
+ }
3056
+
3057
+ .refresh svg,
3058
+ .header-icon svg {
3059
+ width: 24px;
3060
+ height: 24px;
3061
+ }
3062
+
3063
+ /* -------------------------------------------------------------------------
3064
+ * Column Picker
3065
+ * ----------------------------------------------------------------------- */
3066
+ .column-picker-wrapper {
3067
+ position: relative;
3068
+ }
3069
+
3070
+ .column-picker {
3071
+ position: absolute;
3072
+ top: 100%;
3073
+ right: 0;
3074
+ margin-top: 4px;
3075
+ min-width: 200px;
3076
+ max-height: calc(100vh - 120px);
3077
+ overflow-y: auto;
3078
+ background: white;
3079
+ border: 1px solid #9ba7b6;
3080
+ border-radius: 8px;
3081
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
3082
+ padding: 8px 0;
3083
+ z-index: 100;
3084
+ display: none;
3085
+ transform-origin: top;
3086
+ }
3087
+
3088
+ .column-picker.open {
3089
+ display: block;
3090
+ animation: column-picker-fade-in 150ms ease-out;
3091
+ }
3092
+
3093
+ @keyframes column-picker-fade-in {
3094
+ from {
3095
+ opacity: 0;
3096
+ transform: translateY(-4px);
3097
+ }
3098
+ to {
3099
+ opacity: 1;
3100
+ transform: translateY(0);
3101
+ }
3102
+ }
3103
+
3104
+ .column-picker-item {
3105
+ display: flex;
3106
+ align-items: center;
3107
+ gap: 10px;
3108
+ padding: 8px 16px;
3109
+ cursor: pointer;
3110
+ white-space: nowrap;
3111
+ }
3112
+
3113
+ .column-picker-item:hover {
3114
+ background: #f3f4f6;
3115
+ }
3116
+
3117
+ .column-picker-checkbox {
3118
+ width: 16px;
3119
+ height: 16px;
3120
+ border: 1.5px solid #9ca3af;
3121
+ border-radius: 3px;
3122
+ display: flex;
3123
+ align-items: center;
3124
+ justify-content: center;
3125
+ flex-shrink: 0;
3126
+ transition: all 0.15s;
3127
+ }
3128
+
3129
+ .column-picker-checkbox.checked {
3130
+ background: var(--kr-primary);
3131
+ border-color: var(--kr-primary);
3132
+ }
3133
+
3134
+ .column-picker-checkbox svg {
3135
+ width: 12px;
3136
+ height: 12px;
3137
+ color: white;
3138
+ opacity: 0;
3139
+ }
3140
+
3141
+ .column-picker-checkbox.checked svg {
3142
+ opacity: 1;
3143
+ }
3144
+
3145
+ .column-picker-label {
3146
+ font-size: 14px;
3147
+ color: #374151;
3148
+ }
3149
+
3150
+ /* -------------------------------------------------------------------------
3151
+ * Table Structure
3152
+ * ----------------------------------------------------------------------- */
3153
+ .table {
3154
+ display: grid;
3155
+ width: max-content;
3156
+ min-width: 100%;
3157
+ font-size: 14px;
3158
+ }
3159
+
3160
+ .row {
3161
+ display: contents;
3162
+ }
3163
+
3164
+ .row:hover .cell {
3165
+ background: #f9fafb;
3166
+ }
3167
+
3168
+ .header-row {
3169
+ display: contents;
3170
+ }
3171
+
3172
+ .cell {
3173
+ height: 48px;
3174
+ padding: 0 16px;
3175
+ display: flex;
3176
+ align-items: center;
3177
+ white-space: nowrap;
3178
+ overflow: hidden;
3179
+ text-overflow: ellipsis;
3180
+ box-sizing: border-box;
3181
+ }
3182
+
3183
+ .header-cell {
3184
+ position: sticky;
3185
+ top: 0;
3186
+ z-index: 2;
3187
+ height: 48px;
3188
+ line-height: 48px;
3189
+ padding: 0 16px;
3190
+ white-space: nowrap;
3191
+ box-sizing: border-box;
3192
+ background: #f9fafb;
3193
+ border-bottom: 2px solid #e5e7eb;
3194
+ font-weight: 600;
3195
+ color: #374151;
3196
+ overflow: hidden;
3197
+ text-overflow: ellipsis;
3198
+ }
3199
+
3200
+ .header-cell__resize {
3201
+ position: absolute;
3202
+ right: -7px;
3203
+ top: 0;
3204
+ bottom: 0;
3205
+ width: 14px;
3206
+ cursor: col-resize;
3207
+ display: flex;
3208
+ align-items: center;
3209
+ justify-content: center;
3210
+ z-index: 10;
3211
+ }
3212
+
3213
+ .header-cell__resize::after {
3214
+ content: '';
3215
+ width: 2px;
3216
+ height: 20px;
3217
+ background: #c6c6cd;
3218
+ }
3219
+
3220
+ .header-cell:last-child .header-cell__resize::after {
3221
+ display: none;
3222
+ }
3223
+
3224
+ .cell {
3225
+ background: #fff;
3226
+ border-bottom: 1px solid #e5e7eb;
3227
+ color: #1f2937;
3228
+ }
3229
+
3230
+ .cell--align-center {
3231
+ text-align: center;
3232
+ }
3233
+
3234
+ .cell--align-right {
3235
+ text-align: right;
3236
+ }
3237
+
3238
+ .cell--sticky-left,
3239
+ .cell--sticky-right {
3240
+ position: sticky;
3241
+ z-index: 1;
3242
+ }
3243
+
3244
+ .header-cell--sticky-left,
3245
+ .header-cell--sticky-right {
3246
+ position: sticky;
3247
+ z-index: 3;
3248
+ }
3249
+
3250
+ .header-cell--align-center {
3251
+ text-align: center;
3252
+ }
3253
+
3254
+ .header-cell--align-right {
3255
+ text-align: right;
3256
+ }
3257
+
3258
+ .header-cell--sticky-left-last,
3259
+ .cell--sticky-left-last {
3260
+ border-right: 1px solid #d1d5db;
3261
+ }
3262
+
3263
+ .header-cell--sticky-right-first,
3264
+ .cell--sticky-right-first {
3265
+ border-left: 1px solid #d1d5db;
3266
+ }
3267
+
3268
+ /* -------------------------------------------------------------------------
3269
+ * Scroll Mode: Edge
3270
+ * Padding scrolls with content, table can reach edges when scrolling
3271
+ * ----------------------------------------------------------------------- */
3272
+ :host(.kr-table--scroll-edge) .table {
3273
+ padding-left: 24px;
3274
+ }
3275
+
3276
+ /* Only add right padding when no horizontal scroll is needed */
3277
+ :host(.kr-table--scroll-edge):not(.kr-table--scroll-horizontal-available) .table {
3278
+ padding-right: 24px;
3279
+ }
3280
+
3281
+ :host(.kr-table--scroll-edge) .header-row .header-cell {
3282
+ border-top: 1px solid #e5e7eb;
3283
+ }
3284
+
3285
+ /* -------------------------------------------------------------------------
3286
+ * Scroll Mode: Overlay
3287
+ * Fixed padding with overlay elements that hide content at edges
3288
+ * ----------------------------------------------------------------------- */
3289
+ :host(.kr-table--scroll-overlay) .content {
3290
+ padding-left: 24px;
3291
+ padding-right: 24px;
3292
+ }
3293
+
3294
+ .overlay-left,
3295
+ .overlay-right {
3296
+ display: none;
3297
+ position: absolute;
3298
+ top: 0;
3299
+ bottom: 0;
3300
+ width: 24px;
3301
+ z-index: 5;
3302
+ pointer-events: none;
3303
+ transition: box-shadow 0.15s ease;
3304
+ }
3305
+
3306
+ :host(.kr-table--scroll-overlay) .overlay-left,
3307
+ :host(.kr-table--scroll-overlay) .overlay-right {
3308
+ display: block;
3309
+ }
3310
+
3311
+ .overlay-left {
3312
+ left: 0;
3313
+ background: #fff;
3314
+ }
3315
+
3316
+ .overlay-right {
3317
+ right: 0;
3318
+ background: #fff;
3319
+ }
3320
+
3321
+ :host(.kr-table--scroll-overlay.kr-table--scroll-left-available:not(.kr-table--sticky-left)) .overlay-left {
3322
+ border-right: 1px solid #d1d5db54;
3323
+ }
3324
+
3325
+ :host(.kr-table--scroll-overlay.kr-table--scroll-right-available:not(.kr-table--sticky-right)) .overlay-right {
3326
+ border-left: 1px solid #d1d5db54;
3327
+ }
3328
+
3329
+ /* -------------------------------------------------------------------------
3330
+ * Status (Loading, Error, Empty)
3331
+ * ----------------------------------------------------------------------- */
3332
+ .status {
3333
+ position: absolute;
3334
+ top: 0;
3335
+ left: 0;
3336
+ right: 0;
3337
+ bottom: 0;
3338
+ display: flex;
3339
+ align-items: center;
3340
+ justify-content: center;
3341
+ font-size: 14px;
3342
+ font-weight: 400;
3343
+ color: #5f6368;
3344
+ pointer-events: none;
3345
+ }
3346
+
3347
+ .status--error {
3348
+ color: #dc2626;
3349
+ }
3350
+ `];
3351
+ __decorate$3([
3352
+ r$1()
3353
+ ], exports.KRTable.prototype, "_data", void 0);
3354
+ __decorate$3([
3355
+ r$1()
3356
+ ], exports.KRTable.prototype, "_dataState", void 0);
3357
+ __decorate$3([
3358
+ r$1()
3359
+ ], exports.KRTable.prototype, "_page", void 0);
3360
+ __decorate$3([
3361
+ r$1()
3362
+ ], exports.KRTable.prototype, "_pageSize", void 0);
3363
+ __decorate$3([
3364
+ r$1()
3365
+ ], exports.KRTable.prototype, "_totalItems", void 0);
3366
+ __decorate$3([
3367
+ r$1()
3368
+ ], exports.KRTable.prototype, "_totalPages", void 0);
3369
+ __decorate$3([
3370
+ r$1()
3371
+ ], exports.KRTable.prototype, "_searchQuery", void 0);
3372
+ __decorate$3([
3373
+ r$1()
3374
+ ], exports.KRTable.prototype, "_canScrollLeft", void 0);
3375
+ __decorate$3([
3376
+ r$1()
3377
+ ], exports.KRTable.prototype, "_canScrollRight", void 0);
3378
+ __decorate$3([
3379
+ r$1()
3380
+ ], exports.KRTable.prototype, "_canScrollHorizontal", void 0);
3381
+ __decorate$3([
3382
+ r$1()
3383
+ ], exports.KRTable.prototype, "_columnPickerOpen", void 0);
3384
+ __decorate$3([
3385
+ r$1()
3386
+ ], exports.KRTable.prototype, "_displayedColumns", void 0);
3387
+ __decorate$3([
3388
+ n$1({ type: Object })
3389
+ ], exports.KRTable.prototype, "def", void 0);
3390
+ exports.KRTable = __decorate$3([
3391
+ t$1('kr-table')
3392
+ ], exports.KRTable);
3393
+
2038
3394
  /**
2039
3395
  * @license
2040
3396
  * Copyright 2018 Google LLC
@@ -2272,8 +3628,8 @@
2272
3628
 
2273
3629
  input:focus {
2274
3630
  outline: none;
2275
- border-color: var(--kr-text-field-focus-border-color, #2563eb);
2276
- box-shadow: 0 0 0 3px var(--kr-text-field-focus-ring-color, rgba(37, 99, 235, 0.1));
3631
+ border-color: var(--kr-text-field-focus-border-color, #163052);
3632
+ box-shadow: 0 0 0 3px var(--kr-text-field-focus-ring-color, rgba(22, 48, 82, 0.1));
2277
3633
  }
2278
3634
 
2279
3635
  input:disabled {