@kodaris/krubble-components 1.0.53 → 1.0.55

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.
Files changed (34) hide show
  1. package/custom-elements.json +845 -239
  2. package/dist/form/auto-suggest/auto-suggest.d.ts +20 -42
  3. package/dist/form/auto-suggest/auto-suggest.d.ts.map +1 -1
  4. package/dist/form/auto-suggest/auto-suggest.js +194 -426
  5. package/dist/form/auto-suggest/auto-suggest.js.map +1 -1
  6. package/dist/form/combo-box/combo-box.d.ts +93 -0
  7. package/dist/form/combo-box/combo-box.d.ts.map +1 -0
  8. package/dist/form/combo-box/combo-box.js +726 -0
  9. package/dist/form/combo-box/combo-box.js.map +1 -0
  10. package/dist/form/index.d.ts +1 -0
  11. package/dist/form/index.d.ts.map +1 -1
  12. package/dist/form/index.js +1 -0
  13. package/dist/form/index.js.map +1 -1
  14. package/dist/index.d.ts +2 -2
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/krubble-components.bundled.js +1092 -582
  19. package/dist/krubble-components.bundled.js.map +1 -1
  20. package/dist/krubble-components.bundled.min.js +371 -239
  21. package/dist/krubble-components.bundled.min.js.map +1 -1
  22. package/dist/krubble-components.umd.js +1093 -583
  23. package/dist/krubble-components.umd.js.map +1 -1
  24. package/dist/krubble-components.umd.min.js +464 -332
  25. package/dist/krubble-components.umd.min.js.map +1 -1
  26. package/dist/table/table.d.ts +21 -2
  27. package/dist/table/table.d.ts.map +1 -1
  28. package/dist/table/table.js +14 -2
  29. package/dist/table/table.js.map +1 -1
  30. package/dist/tabs/tab.d.ts +1 -0
  31. package/dist/tabs/tab.d.ts.map +1 -1
  32. package/dist/tabs/tab.js +8 -1
  33. package/dist/tabs/tab.js.map +1 -1
  34. package/package.json +5 -1
@@ -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$j = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
98
+ var __decorate$k = (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$j([
205
+ __decorate$k([
206
206
  n$1({ type: String })
207
207
  ], exports.KRAccordion.prototype, "header", void 0);
208
- __decorate$j([
208
+ __decorate$k([
209
209
  n$1({ type: Boolean, reflect: true })
210
210
  ], exports.KRAccordion.prototype, "expanded", void 0);
211
- exports.KRAccordion = __decorate$j([
211
+ exports.KRAccordion = __decorate$k([
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$i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
228
+ var __decorate$j = (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;
@@ -423,23 +423,23 @@
423
423
  outline-offset: 2px;
424
424
  }
425
425
  `;
426
- __decorate$i([
426
+ __decorate$j([
427
427
  n$1({ type: String })
428
428
  ], exports.KRAlert.prototype, "type", void 0);
429
- __decorate$i([
429
+ __decorate$j([
430
430
  n$1({ type: String })
431
431
  ], exports.KRAlert.prototype, "title", void 0);
432
- __decorate$i([
432
+ __decorate$j([
433
433
  n$1({ type: Boolean })
434
434
  ], exports.KRAlert.prototype, "dismissible", void 0);
435
- __decorate$i([
435
+ __decorate$j([
436
436
  n$1({ type: Boolean })
437
437
  ], exports.KRAlert.prototype, "visible", void 0);
438
- exports.KRAlert = __decorate$i([
438
+ exports.KRAlert = __decorate$j([
439
439
  t$1('kr-alert')
440
440
  ], exports.KRAlert);
441
441
 
442
- var __decorate$h = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
442
+ var __decorate$i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
443
443
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
444
444
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
445
445
  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;
@@ -938,40 +938,40 @@
938
938
  height: 22px;
939
939
  }
940
940
  `;
941
- __decorate$h([
941
+ __decorate$i([
942
942
  n$1({ type: String, reflect: true })
943
943
  ], exports.KRButton.prototype, "variant", void 0);
944
- __decorate$h([
944
+ __decorate$i([
945
945
  n$1({ type: String, reflect: true })
946
946
  ], exports.KRButton.prototype, "color", void 0);
947
- __decorate$h([
947
+ __decorate$i([
948
948
  n$1({ type: String, reflect: true })
949
949
  ], exports.KRButton.prototype, "size", void 0);
950
- __decorate$h([
950
+ __decorate$i([
951
951
  n$1({ type: Boolean, reflect: true })
952
952
  ], exports.KRButton.prototype, "disabled", void 0);
953
- __decorate$h([
953
+ __decorate$i([
954
954
  n$1({ type: String })
955
955
  ], exports.KRButton.prototype, "href", void 0);
956
- __decorate$h([
956
+ __decorate$i([
957
957
  n$1({ type: String })
958
958
  ], exports.KRButton.prototype, "target", void 0);
959
- __decorate$h([
959
+ __decorate$i([
960
960
  n$1({ type: Array })
961
961
  ], exports.KRButton.prototype, "options", void 0);
962
- __decorate$h([
962
+ __decorate$i([
963
963
  n$1({ type: String, reflect: true, attribute: 'icon-position' })
964
964
  ], exports.KRButton.prototype, "iconPosition", void 0);
965
- __decorate$h([
965
+ __decorate$i([
966
966
  r$1()
967
967
  ], exports.KRButton.prototype, "_state", void 0);
968
- __decorate$h([
968
+ __decorate$i([
969
969
  r$1()
970
970
  ], exports.KRButton.prototype, "_stateText", void 0);
971
- __decorate$h([
971
+ __decorate$i([
972
972
  r$1()
973
973
  ], exports.KRButton.prototype, "_dropdownOpened", void 0);
974
- exports.KRButton = __decorate$h([
974
+ exports.KRButton = __decorate$i([
975
975
  t$1('kr-button')
976
976
  ], exports.KRButton);
977
977
 
@@ -981,7 +981,7 @@
981
981
  * SPDX-License-Identifier: BSD-3-Clause
982
982
  */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);
983
983
 
984
- var __decorate$g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
984
+ var __decorate$h = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
985
985
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
986
986
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
987
987
  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;
@@ -1215,26 +1215,26 @@
1215
1215
  .hljs-property { color: #005cc5; }
1216
1216
 
1217
1217
  `];
1218
- __decorate$g([
1218
+ __decorate$h([
1219
1219
  n$1({ type: String })
1220
1220
  ], exports.KRCodeDemo.prototype, "language", void 0);
1221
- __decorate$g([
1221
+ __decorate$h([
1222
1222
  r$1()
1223
1223
  ], exports.KRCodeDemo.prototype, "code", void 0);
1224
- __decorate$g([
1224
+ __decorate$h([
1225
1225
  r$1()
1226
1226
  ], exports.KRCodeDemo.prototype, "activeTab", void 0);
1227
- __decorate$g([
1227
+ __decorate$h([
1228
1228
  r$1()
1229
1229
  ], exports.KRCodeDemo.prototype, "copied", void 0);
1230
- __decorate$g([
1230
+ __decorate$h([
1231
1231
  r$1()
1232
1232
  ], exports.KRCodeDemo.prototype, "highlightedCode", void 0);
1233
- exports.KRCodeDemo = __decorate$g([
1233
+ exports.KRCodeDemo = __decorate$h([
1234
1234
  t$1('kr-code-demo')
1235
1235
  ], exports.KRCodeDemo);
1236
1236
 
1237
- var __decorate$f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1237
+ var __decorate$g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1238
1238
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1239
1239
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1240
1240
  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;
@@ -1403,10 +1403,10 @@
1403
1403
  margin: 4px 0;
1404
1404
  }
1405
1405
  `;
1406
- __decorate$f([
1406
+ __decorate$g([
1407
1407
  r$1()
1408
1408
  ], exports.KRContextMenu.prototype, "items", void 0);
1409
- exports.KRContextMenu = __decorate$f([
1409
+ exports.KRContextMenu = __decorate$g([
1410
1410
  t$1('kr-context-menu')
1411
1411
  ], exports.KRContextMenu);
1412
1412
 
@@ -1416,7 +1416,7 @@
1416
1416
  * SPDX-License-Identifier: BSD-3-Clause
1417
1417
  */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}});
1418
1418
 
1419
- var __decorate$e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1419
+ var __decorate$f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1420
1420
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1421
1421
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1422
1422
  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;
@@ -1443,7 +1443,7 @@
1443
1443
  font-weight: 600;
1444
1444
  }
1445
1445
  `;
1446
- KRDialogHeader = __decorate$e([
1446
+ KRDialogHeader = __decorate$f([
1447
1447
  t$1('kr-dialog-header')
1448
1448
  ], KRDialogHeader);
1449
1449
  let KRDialogContent = class KRDialogContent extends i$2 {
@@ -1459,7 +1459,7 @@
1459
1459
  flex: 1 1 auto;
1460
1460
  }
1461
1461
  `;
1462
- KRDialogContent = __decorate$e([
1462
+ KRDialogContent = __decorate$f([
1463
1463
  t$1('kr-dialog-content')
1464
1464
  ], KRDialogContent);
1465
1465
  let KRDialogFooter = class KRDialogFooter extends i$2 {
@@ -1479,7 +1479,7 @@
1479
1479
  justify-content: flex-end;
1480
1480
  }
1481
1481
  `;
1482
- KRDialogFooter = __decorate$e([
1482
+ KRDialogFooter = __decorate$f([
1483
1483
  t$1('kr-dialog-footer')
1484
1484
  ], KRDialogFooter);
1485
1485
  /**
@@ -1687,23 +1687,23 @@
1687
1687
  font-weight: 600;
1688
1688
  }
1689
1689
  `;
1690
- __decorate$e([
1690
+ __decorate$f([
1691
1691
  r$1()
1692
1692
  ], exports.KRDialog.prototype, "_contentElement", void 0);
1693
- __decorate$e([
1693
+ __decorate$f([
1694
1694
  n$1({ type: Boolean, reflect: true })
1695
1695
  ], exports.KRDialog.prototype, "opened", void 0);
1696
- __decorate$e([
1696
+ __decorate$f([
1697
1697
  n$1({ type: String })
1698
1698
  ], exports.KRDialog.prototype, "label", void 0);
1699
- __decorate$e([
1699
+ __decorate$f([
1700
1700
  n$1({ type: String })
1701
1701
  ], exports.KRDialog.prototype, "width", void 0);
1702
- exports.KRDialog = __decorate$e([
1702
+ exports.KRDialog = __decorate$f([
1703
1703
  t$1('kr-dialog')
1704
1704
  ], exports.KRDialog);
1705
1705
 
1706
- var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1706
+ var __decorate$e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1707
1707
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1708
1708
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1709
1709
  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;
@@ -2005,23 +2005,23 @@
2005
2005
  `;
2006
2006
  /** Track active snackbars for stacking */
2007
2007
  exports.KRSnackbar.activeSnackbars = [];
2008
- __decorate$d([
2008
+ __decorate$e([
2009
2009
  n$1({ type: String })
2010
2010
  ], exports.KRSnackbar.prototype, "type", void 0);
2011
- __decorate$d([
2011
+ __decorate$e([
2012
2012
  n$1({ type: String })
2013
2013
  ], exports.KRSnackbar.prototype, "title", void 0);
2014
- __decorate$d([
2014
+ __decorate$e([
2015
2015
  n$1({ type: String })
2016
2016
  ], exports.KRSnackbar.prototype, "message", void 0);
2017
- __decorate$d([
2017
+ __decorate$e([
2018
2018
  n$1({ type: Number })
2019
2019
  ], exports.KRSnackbar.prototype, "duration", void 0);
2020
- exports.KRSnackbar = KRSnackbar_1 = __decorate$d([
2020
+ exports.KRSnackbar = KRSnackbar_1 = __decorate$e([
2021
2021
  t$1('kr-snackbar')
2022
2022
  ], exports.KRSnackbar);
2023
2023
 
2024
- var __decorate$c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2024
+ var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2025
2025
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2026
2026
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2027
2027
  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;
@@ -2324,20 +2324,20 @@
2324
2324
  }
2325
2325
  `,
2326
2326
  ];
2327
- __decorate$c([
2327
+ __decorate$d([
2328
2328
  n$1({ type: String, attribute: 'active-tab-id' })
2329
2329
  ], exports.KRTabGroup.prototype, "activeTabId", void 0);
2330
- __decorate$c([
2330
+ __decorate$d([
2331
2331
  n$1({ type: Boolean })
2332
2332
  ], exports.KRTabGroup.prototype, "justified", void 0);
2333
- __decorate$c([
2333
+ __decorate$d([
2334
2334
  n$1({ type: String, reflect: true })
2335
2335
  ], exports.KRTabGroup.prototype, "size", void 0);
2336
- exports.KRTabGroup = __decorate$c([
2336
+ exports.KRTabGroup = __decorate$d([
2337
2337
  t$1('kr-tab-group')
2338
2338
  ], exports.KRTabGroup);
2339
2339
 
2340
- var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2340
+ var __decorate$c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2341
2341
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2342
2342
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2343
2343
  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;
@@ -2392,8 +2392,15 @@
2392
2392
  getIconElement() {
2393
2393
  return this.querySelector('[slot="icon"]');
2394
2394
  }
2395
+ updated() {
2396
+ // The parent kr-tab-group renders tab headers by reading properties from its
2397
+ // kr-tab children. When those properties change, tell the parent to re-render.
2398
+ const tabGroup = this.closest('kr-tab-group');
2399
+ if (tabGroup) {
2400
+ tabGroup.requestUpdate();
2401
+ }
2402
+ }
2395
2403
  render() {
2396
- console.log('tab render');
2397
2404
  return b `<slot></slot>`;
2398
2405
  }
2399
2406
  };
@@ -2411,35 +2418,35 @@
2411
2418
  }
2412
2419
  `,
2413
2420
  ];
2414
- __decorate$b([
2421
+ __decorate$c([
2415
2422
  n$1({ type: String, reflect: true })
2416
2423
  ], exports.KRTab.prototype, "id", void 0);
2417
- __decorate$b([
2424
+ __decorate$c([
2418
2425
  n$1({ type: String })
2419
2426
  ], exports.KRTab.prototype, "label", void 0);
2420
- __decorate$b([
2427
+ __decorate$c([
2421
2428
  n$1({ type: String })
2422
2429
  ], exports.KRTab.prototype, "badge", void 0);
2423
- __decorate$b([
2430
+ __decorate$c([
2424
2431
  n$1({ type: String, attribute: 'badge-background' })
2425
2432
  ], exports.KRTab.prototype, "badgeBackground", void 0);
2426
- __decorate$b([
2433
+ __decorate$c([
2427
2434
  n$1({ type: String, attribute: 'badge-color' })
2428
2435
  ], exports.KRTab.prototype, "badgeColor", void 0);
2429
- __decorate$b([
2436
+ __decorate$c([
2430
2437
  n$1({ type: Boolean })
2431
2438
  ], exports.KRTab.prototype, "disabled", void 0);
2432
- __decorate$b([
2439
+ __decorate$c([
2433
2440
  n$1({ type: Boolean })
2434
2441
  ], exports.KRTab.prototype, "dismissible", void 0);
2435
- __decorate$b([
2442
+ __decorate$c([
2436
2443
  n$1({ type: Boolean, reflect: true })
2437
2444
  ], exports.KRTab.prototype, "active", void 0);
2438
- exports.KRTab = __decorate$b([
2445
+ exports.KRTab = __decorate$c([
2439
2446
  t$1('kr-tab')
2440
2447
  ], exports.KRTab);
2441
2448
 
2442
- var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2449
+ var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2443
2450
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2444
2451
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2445
2452
  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;
@@ -2911,47 +2918,47 @@
2911
2918
  `];
2912
2919
  // Enable form association
2913
2920
  exports.KRSelectField.formAssociated = true;
2914
- __decorate$a([
2921
+ __decorate$b([
2915
2922
  n$1({ type: String })
2916
2923
  ], exports.KRSelectField.prototype, "label", void 0);
2917
- __decorate$a([
2924
+ __decorate$b([
2918
2925
  n$1({ type: String })
2919
2926
  ], exports.KRSelectField.prototype, "name", void 0);
2920
- __decorate$a([
2927
+ __decorate$b([
2921
2928
  n$1({ type: String })
2922
2929
  ], exports.KRSelectField.prototype, "value", void 0);
2923
- __decorate$a([
2930
+ __decorate$b([
2924
2931
  n$1({ type: String })
2925
2932
  ], exports.KRSelectField.prototype, "placeholder", void 0);
2926
- __decorate$a([
2933
+ __decorate$b([
2927
2934
  n$1({ type: Boolean })
2928
2935
  ], exports.KRSelectField.prototype, "disabled", void 0);
2929
- __decorate$a([
2936
+ __decorate$b([
2930
2937
  n$1({ type: Boolean })
2931
2938
  ], exports.KRSelectField.prototype, "required", void 0);
2932
- __decorate$a([
2939
+ __decorate$b([
2933
2940
  n$1({ type: Boolean })
2934
2941
  ], exports.KRSelectField.prototype, "readonly", void 0);
2935
- __decorate$a([
2942
+ __decorate$b([
2936
2943
  n$1({ type: String })
2937
2944
  ], exports.KRSelectField.prototype, "hint", void 0);
2938
- __decorate$a([
2945
+ __decorate$b([
2939
2946
  r$1()
2940
2947
  ], exports.KRSelectField.prototype, "_isOpen", void 0);
2941
- __decorate$a([
2948
+ __decorate$b([
2942
2949
  r$1()
2943
2950
  ], exports.KRSelectField.prototype, "_highlightedIndex", void 0);
2944
- __decorate$a([
2951
+ __decorate$b([
2945
2952
  r$1()
2946
2953
  ], exports.KRSelectField.prototype, "_touched", void 0);
2947
- __decorate$a([
2954
+ __decorate$b([
2948
2955
  e$3('.select-trigger')
2949
2956
  ], exports.KRSelectField.prototype, "_triggerElement", void 0);
2950
- exports.KRSelectField = __decorate$a([
2957
+ exports.KRSelectField = __decorate$b([
2951
2958
  t$1('kr-select-field')
2952
2959
  ], exports.KRSelectField);
2953
2960
 
2954
- var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2961
+ var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2955
2962
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2956
2963
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2957
2964
  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;
@@ -2988,13 +2995,13 @@
2988
2995
  display: none;
2989
2996
  }
2990
2997
  `;
2991
- __decorate$9([
2998
+ __decorate$a([
2992
2999
  n$1({ type: String })
2993
3000
  ], exports.KRSelectOption.prototype, "value", void 0);
2994
- __decorate$9([
3001
+ __decorate$a([
2995
3002
  n$1({ type: Boolean })
2996
3003
  ], exports.KRSelectOption.prototype, "disabled", void 0);
2997
- exports.KRSelectOption = __decorate$9([
3004
+ exports.KRSelectOption = __decorate$a([
2998
3005
  t$1('kr-select-option')
2999
3006
  ], exports.KRSelectOption);
3000
3007
 
@@ -4013,7 +4020,7 @@
4013
4020
  }
4014
4021
  }
4015
4022
 
4016
- var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
4023
+ var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
4017
4024
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4018
4025
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4019
4026
  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;
@@ -4159,7 +4166,11 @@
4159
4166
  column.filter = new KRQuery();
4160
4167
  column.filter.field = col.id;
4161
4168
  column.filter.type = column.type;
4162
- if (col.facetable && !col.filterable) {
4169
+ if (col.filter) {
4170
+ column.filter.setOperator(col.filter.operator);
4171
+ column.filter.setValue(col.filter.value);
4172
+ }
4173
+ else if (col.facetable && !col.filterable) {
4163
4174
  column.filter.operator = 'in';
4164
4175
  column.filter.value = [];
4165
4176
  }
@@ -4495,6 +4506,7 @@
4495
4506
  else {
4496
4507
  this._model.displayedColumns = [...this._model.displayedColumns, columnId];
4497
4508
  }
4509
+ this.requestUpdate();
4498
4510
  }
4499
4511
  // Clear any existing text selection on mousedown so we only detect
4500
4512
  // selections made during this click gesture, not stale selections from elsewhere
@@ -4619,7 +4631,14 @@
4619
4631
  }
4620
4632
  else {
4621
4633
  const rect = e.currentTarget.getBoundingClientRect();
4622
- this._filterPanelPos = { top: rect.bottom + 4, left: rect.left };
4634
+ let left = rect.left;
4635
+ if (left + 328 > window.innerWidth) {
4636
+ left = window.innerWidth - 328;
4637
+ }
4638
+ this._filterPanelPos = {
4639
+ top: rect.bottom + 4,
4640
+ left
4641
+ };
4623
4642
  this._filterPanelOpened = column.id;
4624
4643
  if (column.facetable) {
4625
4644
  this._filterPanelTab = 'counts';
@@ -6127,56 +6146,56 @@
6127
6146
  }
6128
6147
 
6129
6148
  `];
6130
- __decorate$8([
6149
+ __decorate$9([
6131
6150
  r$1()
6132
6151
  ], exports.KRTable.prototype, "_data", void 0);
6133
- __decorate$8([
6152
+ __decorate$9([
6134
6153
  r$1()
6135
6154
  ], exports.KRTable.prototype, "_dataState", void 0);
6136
- __decorate$8([
6155
+ __decorate$9([
6137
6156
  r$1()
6138
6157
  ], exports.KRTable.prototype, "_page", void 0);
6139
- __decorate$8([
6158
+ __decorate$9([
6140
6159
  r$1()
6141
6160
  ], exports.KRTable.prototype, "_pageSize", void 0);
6142
- __decorate$8([
6161
+ __decorate$9([
6143
6162
  r$1()
6144
6163
  ], exports.KRTable.prototype, "_totalItems", void 0);
6145
- __decorate$8([
6164
+ __decorate$9([
6146
6165
  r$1()
6147
6166
  ], exports.KRTable.prototype, "_totalPages", void 0);
6148
- __decorate$8([
6167
+ __decorate$9([
6149
6168
  r$1()
6150
6169
  ], exports.KRTable.prototype, "_searchQuery", void 0);
6151
- __decorate$8([
6170
+ __decorate$9([
6152
6171
  r$1()
6153
6172
  ], exports.KRTable.prototype, "_canScrollLeft", void 0);
6154
- __decorate$8([
6173
+ __decorate$9([
6155
6174
  r$1()
6156
6175
  ], exports.KRTable.prototype, "_canScrollRight", void 0);
6157
- __decorate$8([
6176
+ __decorate$9([
6158
6177
  r$1()
6159
6178
  ], exports.KRTable.prototype, "_canScrollHorizontal", void 0);
6160
- __decorate$8([
6179
+ __decorate$9([
6161
6180
  r$1()
6162
6181
  ], exports.KRTable.prototype, "_columnPickerOpen", void 0);
6163
- __decorate$8([
6182
+ __decorate$9([
6164
6183
  r$1()
6165
6184
  ], exports.KRTable.prototype, "_filterPanelOpened", void 0);
6166
- __decorate$8([
6185
+ __decorate$9([
6167
6186
  r$1()
6168
6187
  ], exports.KRTable.prototype, "_filterPanelTab", void 0);
6169
- __decorate$8([
6188
+ __decorate$9([
6170
6189
  r$1()
6171
6190
  ], exports.KRTable.prototype, "_buckets", void 0);
6172
- __decorate$8([
6191
+ __decorate$9([
6173
6192
  n$1({ type: Object })
6174
6193
  ], exports.KRTable.prototype, "def", void 0);
6175
- exports.KRTable = __decorate$8([
6194
+ exports.KRTable = __decorate$9([
6176
6195
  t$1('kr-table')
6177
6196
  ], exports.KRTable);
6178
6197
 
6179
- var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
6198
+ var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
6180
6199
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6181
6200
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6182
6201
  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;
@@ -6296,17 +6315,17 @@
6296
6315
  stroke-linecap: round;
6297
6316
  }
6298
6317
  `;
6299
- __decorate$7([
6318
+ __decorate$8([
6300
6319
  n$1({ type: String, reflect: true })
6301
6320
  ], exports.KRSpinner.prototype, "size", void 0);
6302
- __decorate$7([
6321
+ __decorate$8([
6303
6322
  n$1({ type: String, reflect: true })
6304
6323
  ], exports.KRSpinner.prototype, "color", void 0);
6305
- exports.KRSpinner = __decorate$7([
6324
+ exports.KRSpinner = __decorate$8([
6306
6325
  t$1('kr-spinner')
6307
6326
  ], exports.KRSpinner);
6308
6327
 
6309
- var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
6328
+ var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
6310
6329
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6311
6330
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6312
6331
  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;
@@ -6397,17 +6416,17 @@
6397
6416
  }
6398
6417
  }
6399
6418
  `;
6400
- __decorate$6([
6419
+ __decorate$7([
6401
6420
  n$1({ type: String, reflect: true })
6402
6421
  ], exports.KRProgressBar.prototype, "color", void 0);
6403
- __decorate$6([
6422
+ __decorate$7([
6404
6423
  n$1({ type: String, reflect: true })
6405
6424
  ], exports.KRProgressBar.prototype, "trackColor", void 0);
6406
- exports.KRProgressBar = __decorate$6([
6425
+ exports.KRProgressBar = __decorate$7([
6407
6426
  t$1('kr-progress-bar')
6408
6427
  ], exports.KRProgressBar);
6409
6428
 
6410
- var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
6429
+ var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
6411
6430
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6412
6431
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6413
6432
  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;
@@ -6875,23 +6894,23 @@
6875
6894
  }
6876
6895
  `;
6877
6896
  exports.KRFilePreview._activePreview = null;
6878
- __decorate$5([
6897
+ __decorate$6([
6879
6898
  n$1({ type: String })
6880
6899
  ], exports.KRFilePreview.prototype, "src", void 0);
6881
- __decorate$5([
6900
+ __decorate$6([
6882
6901
  n$1({ type: String })
6883
6902
  ], exports.KRFilePreview.prototype, "name", void 0);
6884
- __decorate$5([
6903
+ __decorate$6([
6885
6904
  r$1()
6886
6905
  ], exports.KRFilePreview.prototype, "_zoomLevel", void 0);
6887
- __decorate$5([
6906
+ __decorate$6([
6888
6907
  r$1()
6889
6908
  ], exports.KRFilePreview.prototype, "_textContent", void 0);
6890
- exports.KRFilePreview = KRFilePreview_1 = __decorate$5([
6909
+ exports.KRFilePreview = KRFilePreview_1 = __decorate$6([
6891
6910
  t$1('kr-file-preview')
6892
6911
  ], exports.KRFilePreview);
6893
6912
 
6894
- var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
6913
+ var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
6895
6914
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6896
6915
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6897
6916
  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;
@@ -7134,13 +7153,13 @@
7134
7153
  padding: 20px;
7135
7154
  }
7136
7155
  `;
7137
- __decorate$4([
7156
+ __decorate$5([
7138
7157
  n$1({ type: Array })
7139
7158
  ], exports.KRFileList.prototype, "files", void 0);
7140
- __decorate$4([
7159
+ __decorate$5([
7141
7160
  n$1({ type: String, attribute: 'empty-message' })
7142
7161
  ], exports.KRFileList.prototype, "emptyMessage", void 0);
7143
- exports.KRFileList = __decorate$4([
7162
+ exports.KRFileList = __decorate$5([
7144
7163
  t$1('kr-file-list')
7145
7164
  ], exports.KRFileList);
7146
7165
 
@@ -7162,7 +7181,7 @@
7162
7181
  * SPDX-License-Identifier: BSD-3-Clause
7163
7182
  */const l=e$2(class extends i$1{constructor(r$1){if(super(r$1),r$1.type!==t.PROPERTY&&r$1.type!==t.ATTRIBUTE&&r$1.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!r(r$1))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(i,[t$1]){if(t$1===E||t$1===A)return t$1;const o=i.element,l=i.name;if(i.type===t.PROPERTY){if(t$1===o[l])return E}else if(i.type===t.BOOLEAN_ATTRIBUTE){if(!!t$1===o.hasAttribute(l))return E}else if(i.type===t.ATTRIBUTE&&o.getAttribute(l)===t$1+"")return E;return p(i),t$1}});
7164
7183
 
7165
- var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
7184
+ var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
7166
7185
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7167
7186
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7168
7187
  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;
@@ -7415,59 +7434,59 @@
7415
7434
  `;
7416
7435
  // Enable form association
7417
7436
  exports.KRTextField.formAssociated = true;
7418
- __decorate$3([
7437
+ __decorate$4([
7419
7438
  n$1({ type: String })
7420
7439
  ], exports.KRTextField.prototype, "label", void 0);
7421
- __decorate$3([
7440
+ __decorate$4([
7422
7441
  n$1({ type: String })
7423
7442
  ], exports.KRTextField.prototype, "name", void 0);
7424
- __decorate$3([
7443
+ __decorate$4([
7425
7444
  n$1({ type: String })
7426
7445
  ], exports.KRTextField.prototype, "value", void 0);
7427
- __decorate$3([
7446
+ __decorate$4([
7428
7447
  n$1({ type: String })
7429
7448
  ], exports.KRTextField.prototype, "placeholder", void 0);
7430
- __decorate$3([
7449
+ __decorate$4([
7431
7450
  n$1({ type: String })
7432
7451
  ], exports.KRTextField.prototype, "type", void 0);
7433
- __decorate$3([
7452
+ __decorate$4([
7434
7453
  n$1({ type: Boolean })
7435
7454
  ], exports.KRTextField.prototype, "required", void 0);
7436
- __decorate$3([
7455
+ __decorate$4([
7437
7456
  n$1({ type: Boolean })
7438
7457
  ], exports.KRTextField.prototype, "disabled", void 0);
7439
- __decorate$3([
7458
+ __decorate$4([
7440
7459
  n$1({ type: Boolean })
7441
7460
  ], exports.KRTextField.prototype, "readonly", void 0);
7442
- __decorate$3([
7461
+ __decorate$4([
7443
7462
  n$1({ type: Number })
7444
7463
  ], exports.KRTextField.prototype, "minlength", void 0);
7445
- __decorate$3([
7464
+ __decorate$4([
7446
7465
  n$1({ type: Number })
7447
7466
  ], exports.KRTextField.prototype, "maxlength", void 0);
7448
- __decorate$3([
7467
+ __decorate$4([
7449
7468
  n$1({ type: String })
7450
7469
  ], exports.KRTextField.prototype, "pattern", void 0);
7451
- __decorate$3([
7470
+ __decorate$4([
7452
7471
  n$1({ type: String })
7453
7472
  ], exports.KRTextField.prototype, "autocomplete", void 0);
7454
- __decorate$3([
7473
+ __decorate$4([
7455
7474
  n$1({ type: String })
7456
7475
  ], exports.KRTextField.prototype, "hint", void 0);
7457
- __decorate$3([
7476
+ __decorate$4([
7458
7477
  e$3('input')
7459
7478
  ], exports.KRTextField.prototype, "_input", void 0);
7460
- __decorate$3([
7479
+ __decorate$4([
7461
7480
  r$1()
7462
7481
  ], exports.KRTextField.prototype, "_touched", void 0);
7463
- __decorate$3([
7482
+ __decorate$4([
7464
7483
  r$1()
7465
7484
  ], exports.KRTextField.prototype, "_dirty", void 0);
7466
- exports.KRTextField = __decorate$3([
7485
+ exports.KRTextField = __decorate$4([
7467
7486
  t$1('kr-text-field')
7468
7487
  ], exports.KRTextField);
7469
7488
 
7470
- var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
7489
+ var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
7471
7490
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7472
7491
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7473
7492
  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;
@@ -7725,59 +7744,59 @@
7725
7744
  `;
7726
7745
  // Enable form association
7727
7746
  exports.KRTextareaField.formAssociated = true;
7728
- __decorate$2([
7747
+ __decorate$3([
7729
7748
  n$1({ type: String })
7730
7749
  ], exports.KRTextareaField.prototype, "label", void 0);
7731
- __decorate$2([
7750
+ __decorate$3([
7732
7751
  n$1({ type: String })
7733
7752
  ], exports.KRTextareaField.prototype, "name", void 0);
7734
- __decorate$2([
7753
+ __decorate$3([
7735
7754
  n$1({ type: String })
7736
7755
  ], exports.KRTextareaField.prototype, "value", void 0);
7737
- __decorate$2([
7756
+ __decorate$3([
7738
7757
  n$1({ type: String })
7739
7758
  ], exports.KRTextareaField.prototype, "placeholder", void 0);
7740
- __decorate$2([
7759
+ __decorate$3([
7741
7760
  n$1({ type: Boolean })
7742
7761
  ], exports.KRTextareaField.prototype, "required", void 0);
7743
- __decorate$2([
7762
+ __decorate$3([
7744
7763
  n$1({ type: Boolean })
7745
7764
  ], exports.KRTextareaField.prototype, "disabled", void 0);
7746
- __decorate$2([
7765
+ __decorate$3([
7747
7766
  n$1({ type: Boolean })
7748
7767
  ], exports.KRTextareaField.prototype, "readonly", void 0);
7749
- __decorate$2([
7768
+ __decorate$3([
7750
7769
  n$1({ type: Number })
7751
7770
  ], exports.KRTextareaField.prototype, "rows", void 0);
7752
- __decorate$2([
7771
+ __decorate$3([
7753
7772
  n$1({ type: Number })
7754
7773
  ], exports.KRTextareaField.prototype, "cols", void 0);
7755
- __decorate$2([
7774
+ __decorate$3([
7756
7775
  n$1({ type: Number })
7757
7776
  ], exports.KRTextareaField.prototype, "minlength", void 0);
7758
- __decorate$2([
7777
+ __decorate$3([
7759
7778
  n$1({ type: Number })
7760
7779
  ], exports.KRTextareaField.prototype, "maxlength", void 0);
7761
- __decorate$2([
7780
+ __decorate$3([
7762
7781
  n$1({ type: String })
7763
7782
  ], exports.KRTextareaField.prototype, "autocomplete", void 0);
7764
- __decorate$2([
7783
+ __decorate$3([
7765
7784
  n$1({ type: String })
7766
7785
  ], exports.KRTextareaField.prototype, "hint", void 0);
7767
- __decorate$2([
7786
+ __decorate$3([
7768
7787
  e$3('textarea')
7769
7788
  ], exports.KRTextareaField.prototype, "_textarea", void 0);
7770
- __decorate$2([
7789
+ __decorate$3([
7771
7790
  r$1()
7772
7791
  ], exports.KRTextareaField.prototype, "_touched", void 0);
7773
- __decorate$2([
7792
+ __decorate$3([
7774
7793
  r$1()
7775
7794
  ], exports.KRTextareaField.prototype, "_dirty", void 0);
7776
- exports.KRTextareaField = __decorate$2([
7795
+ exports.KRTextareaField = __decorate$3([
7777
7796
  t$1('kr-textarea-field')
7778
7797
  ], exports.KRTextareaField);
7779
7798
 
7780
- var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
7799
+ var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
7781
7800
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7782
7801
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7783
7802
  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;
@@ -7834,25 +7853,22 @@
7834
7853
  color: black;
7835
7854
  }
7836
7855
  `;
7837
- __decorate$1([
7856
+ __decorate$2([
7838
7857
  n$1({ type: String })
7839
7858
  ], KRDetailField.prototype, "label", void 0);
7840
- __decorate$1([
7859
+ __decorate$2([
7841
7860
  n$1({ type: String })
7842
7861
  ], KRDetailField.prototype, "value", void 0);
7843
- KRDetailField = __decorate$1([
7862
+ KRDetailField = __decorate$2([
7844
7863
  t$1('kr-detail-field')
7845
7864
  ], KRDetailField);
7846
7865
 
7847
- var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
7866
+ var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
7848
7867
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7849
7868
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7850
7869
  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;
7851
7870
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7852
7871
  };
7853
- function isGroup(option) {
7854
- return 'options' in option;
7855
- }
7856
7872
  /**
7857
7873
  * @element kr-auto-suggest
7858
7874
  *
@@ -7864,23 +7880,24 @@
7864
7880
  * @property {boolean} readonly - Whether the input is readonly
7865
7881
  * @property {boolean} required - Whether the input is required
7866
7882
  * @property {string} hint - Helper text displayed below the input
7867
- * @property {SuggestionOptions} options - Array of suggestion options or groups
7868
- * @property {AutoSuggestStatusType} statusType - Loading state: 'pending' | 'loading' | 'finished' | 'error'
7869
- * @property {string} loadingText - Text to show during loading
7870
- * @property {string} errorText - Text to show on error
7871
- * @property {string} emptyText - Text to show when no matches
7872
- * @property {AutoSuggestFilteringType} filteringType - 'auto' (client-side) or 'manual' (server-side)
7873
- * @property {boolean} highlightMatches - Whether to highlight matching text
7883
+ * @property {KRAutoSuggestOption[]} options - Array of suggestion options
7884
+ * @property {Function} fetch - Function that returns a promise of options
7874
7885
  *
7875
7886
  * @fires change - Fired when the input value changes
7876
7887
  * @fires select - Fired when a suggestion is selected
7877
- * @fires load-items - Fired when items should be loaded (manual filtering)
7878
7888
  *
7879
7889
  * @slot - Not used
7880
7890
  */
7881
7891
  exports.KRAutoSuggest = class KRAutoSuggest extends i$2 {
7882
7892
  constructor() {
7883
7893
  super();
7894
+ this._requestId = 0;
7895
+ this._handleDocumentClick = (e) => {
7896
+ const path = e.composedPath();
7897
+ if (!path.includes(this)) {
7898
+ this._isOpen = false;
7899
+ }
7900
+ };
7884
7901
  this.label = '';
7885
7902
  this.name = '';
7886
7903
  this.value = '';
@@ -7890,29 +7907,36 @@
7890
7907
  this.required = false;
7891
7908
  this.hint = '';
7892
7909
  this.options = [];
7893
- this.statusType = 'finished';
7894
- this.loadingText = 'Loading...';
7895
- this.errorText = 'Error loading options';
7896
- this.emptyText = 'No matches found';
7897
- this.filteringType = 'auto';
7898
- this.highlightMatches = true;
7910
+ this.fetch = null;
7899
7911
  this._isOpen = false;
7900
7912
  this._highlightedIndex = -1;
7901
7913
  this._touched = false;
7902
- this._dirty = false;
7903
- this._handleDocumentClick = this._onDocumentClick.bind(this);
7914
+ this._handleInvalid = (e) => {
7915
+ e.preventDefault();
7916
+ this._touched = true;
7917
+ };
7904
7918
  this._internals = this.attachInternals();
7905
7919
  }
7906
7920
  connectedCallback() {
7907
7921
  super.connectedCallback();
7908
7922
  document.addEventListener('click', this._handleDocumentClick);
7923
+ this.addEventListener('invalid', this._handleInvalid);
7909
7924
  }
7910
7925
  disconnectedCallback() {
7911
7926
  super.disconnectedCallback();
7912
7927
  document.removeEventListener('click', this._handleDocumentClick);
7928
+ this.removeEventListener('invalid', this._handleInvalid);
7913
7929
  }
7914
7930
  firstUpdated() {
7915
- this._updateFormValue();
7931
+ this._updateValidity();
7932
+ }
7933
+ updated(changedProperties) {
7934
+ if (changedProperties.has('required') || changedProperties.has('value')) {
7935
+ this._updateValidity();
7936
+ }
7937
+ if (changedProperties.has('options') && this._isOpen) {
7938
+ this._positionDropdown();
7939
+ }
7916
7940
  }
7917
7941
  get form() {
7918
7942
  return this._internals.form;
@@ -7932,120 +7956,104 @@
7932
7956
  formResetCallback() {
7933
7957
  this.value = '';
7934
7958
  this._touched = false;
7935
- this._dirty = false;
7936
7959
  this._isOpen = false;
7937
7960
  this._highlightedIndex = -1;
7938
- this._updateFormValue();
7961
+ this._internals.setFormValue('');
7962
+ this._internals.setValidity({});
7939
7963
  }
7940
7964
  formStateRestoreCallback(state) {
7941
7965
  this.value = state;
7942
7966
  }
7943
- get _filteredOptions() {
7944
- if (this.filteringType === 'manual' || !this.value) {
7945
- return this.options;
7946
- }
7947
- const searchValue = this.value.toLowerCase();
7948
- const filtered = [];
7949
- for (const option of this.options) {
7950
- if (isGroup(option)) {
7951
- const filteredGroupOptions = option.options.filter((opt) => {
7952
- const label = (opt.label || opt.value).toLowerCase();
7953
- const tags = opt.filteringTags?.join(' ').toLowerCase() || '';
7954
- return label.includes(searchValue) || tags.includes(searchValue);
7955
- });
7956
- if (filteredGroupOptions.length > 0) {
7957
- filtered.push({ ...option, options: filteredGroupOptions });
7958
- }
7959
- }
7960
- else {
7961
- const label = (option.label || option.value).toLowerCase();
7962
- const tags = option.filteringTags?.join(' ').toLowerCase() || '';
7963
- if (label.includes(searchValue) || tags.includes(searchValue)) {
7964
- filtered.push(option);
7965
- }
7966
- }
7967
- }
7968
- return filtered;
7969
- }
7970
- get _flatOptions() {
7971
- const flat = [];
7972
- for (const option of this._filteredOptions) {
7973
- if (isGroup(option)) {
7974
- flat.push(...option.options);
7975
- }
7976
- else {
7977
- flat.push(option);
7978
- }
7967
+ _updateValidity() {
7968
+ if (this._input) {
7969
+ this._internals.setValidity(this._input.validity, this._input.validationMessage);
7979
7970
  }
7980
- return flat;
7981
7971
  }
7982
- _updateFormValue() {
7983
- this._internals.setFormValue(this.value);
7984
- // Validation
7985
- if (this.required && !this.value) {
7986
- this._internals.setValidity({ valueMissing: true }, 'This field is required', this._input);
7987
- }
7988
- else {
7989
- this._internals.setValidity({});
7972
+ _fetch() {
7973
+ if (!this.fetch) {
7974
+ return;
7990
7975
  }
7976
+ this._requestId++;
7977
+ const requestId = this._requestId;
7978
+ this.fetch(this.value).then((options) => {
7979
+ if (requestId === this._requestId) {
7980
+ this.options = options;
7981
+ }
7982
+ }).catch((error) => {
7983
+ console.error('kr-auto-suggest: fetch failed', error);
7984
+ });
7991
7985
  }
7992
- _onInput(e) {
7993
- const target = e.target;
7994
- this.value = target.value;
7995
- this._dirty = true;
7986
+ _handleInput(e) {
7987
+ this.value = e.target.value;
7996
7988
  this._isOpen = true;
7997
7989
  this._highlightedIndex = -1;
7998
- this._updateFormValue();
7999
- this.dispatchEvent(new CustomEvent('change', {
8000
- detail: { value: this.value },
8001
- bubbles: true,
8002
- composed: true,
8003
- }));
8004
- if (this.filteringType === 'manual') {
8005
- this.dispatchEvent(new CustomEvent('load-items', {
8006
- detail: { filteringText: this.value },
8007
- bubbles: true,
8008
- composed: true,
8009
- }));
8010
- }
7990
+ this._positionDropdown();
7991
+ this._internals.setFormValue(this.value);
7992
+ this._internals.setValidity(this._input.validity, this._input.validationMessage);
7993
+ this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
7994
+ this._fetch();
7995
+ }
7996
+ _positionDropdown() {
7997
+ requestAnimationFrame(() => {
7998
+ const dropdown = this.shadowRoot?.querySelector('.dropdown');
7999
+ if (!dropdown) {
8000
+ return;
8001
+ }
8002
+ const inputRect = this._input.getBoundingClientRect();
8003
+ const spaceBelow = window.innerHeight - inputRect.bottom - 4 - 8;
8004
+ const spaceAbove = inputRect.top - 4 - 8;
8005
+ dropdown.style.left = inputRect.left + 'px';
8006
+ dropdown.style.width = inputRect.width + 'px';
8007
+ // Open above the input if there's more room above than below
8008
+ if (spaceAbove > spaceBelow) {
8009
+ dropdown.style.top = '';
8010
+ dropdown.style.bottom = (window.innerHeight - inputRect.top + 4) + 'px';
8011
+ dropdown.style.maxHeight = spaceAbove + 'px';
8012
+ }
8013
+ else {
8014
+ dropdown.style.bottom = '';
8015
+ dropdown.style.top = inputRect.bottom + 4 + 'px';
8016
+ dropdown.style.maxHeight = spaceBelow + 'px';
8017
+ }
8018
+ });
8011
8019
  }
8012
- _onFocus() {
8020
+ _handleFocus() {
8013
8021
  this._isOpen = true;
8014
- if (this.filteringType === 'manual') {
8015
- this.dispatchEvent(new CustomEvent('load-items', {
8016
- detail: { filteringText: this.value },
8017
- bubbles: true,
8018
- composed: true,
8019
- }));
8020
- }
8022
+ this._positionDropdown();
8023
+ this._fetch();
8021
8024
  }
8022
- _onBlur() {
8025
+ _handleBlur() {
8023
8026
  this._touched = true;
8027
+ this._internals.setValidity(this._input.validity, this._input.validationMessage);
8024
8028
  // Delay to allow click on option
8025
8029
  setTimeout(() => {
8026
8030
  this._isOpen = false;
8027
8031
  this._highlightedIndex = -1;
8028
8032
  }, 200);
8029
- this._updateFormValue();
8030
8033
  }
8031
- _onKeyDown(e) {
8032
- const options = this._flatOptions;
8034
+ _handleKeyDown(e) {
8033
8035
  switch (e.key) {
8034
8036
  case 'ArrowDown':
8035
8037
  e.preventDefault();
8036
8038
  this._isOpen = true;
8037
- this._highlightedIndex = Math.min(this._highlightedIndex + 1, options.length - 1);
8039
+ this._highlightedIndex = Math.min(this._highlightedIndex + 1, this.options.length - 1);
8038
8040
  this._scrollToHighlighted();
8039
8041
  break;
8040
8042
  case 'ArrowUp':
8041
8043
  e.preventDefault();
8042
- this._highlightedIndex = Math.max(this._highlightedIndex - 1, -1);
8044
+ if (this._highlightedIndex === -1) {
8045
+ this._isOpen = true;
8046
+ this._highlightedIndex = this.options.length - 1;
8047
+ }
8048
+ else {
8049
+ this._highlightedIndex = Math.max(this._highlightedIndex - 1, 0);
8050
+ }
8043
8051
  this._scrollToHighlighted();
8044
8052
  break;
8045
8053
  case 'Enter':
8046
- if (this._highlightedIndex >= 0 && options[this._highlightedIndex]) {
8054
+ if (this._highlightedIndex >= 0 && this.options[this._highlightedIndex]) {
8047
8055
  e.preventDefault();
8048
- this._selectOption(options[this._highlightedIndex]);
8056
+ this._selectOption(this.options[this._highlightedIndex]);
8049
8057
  }
8050
8058
  break;
8051
8059
  case 'Escape':
@@ -8062,7 +8070,7 @@
8062
8070
  _scrollToHighlighted() {
8063
8071
  this.updateComplete.then(() => {
8064
8072
  const container = this.shadowRoot?.querySelector('.dropdown');
8065
- const highlighted = this.shadowRoot?.querySelector('.option.is-highlighted');
8073
+ const highlighted = this.shadowRoot?.querySelector('.option--highlighted');
8066
8074
  if (container && highlighted) {
8067
8075
  const containerRect = container.getBoundingClientRect();
8068
8076
  const highlightedRect = highlighted.getBoundingClientRect();
@@ -8076,15 +8084,15 @@
8076
8084
  });
8077
8085
  }
8078
8086
  _selectOption(option) {
8079
- if (option.disabled)
8087
+ if (option.disabled) {
8080
8088
  return;
8081
- this.value = option.label || option.value;
8089
+ }
8090
+ this.value = option.value;
8082
8091
  this._isOpen = false;
8083
8092
  this._highlightedIndex = -1;
8084
- this._dirty = true;
8085
- this._updateFormValue();
8093
+ this._internals.setFormValue(this.value);
8086
8094
  this.dispatchEvent(new CustomEvent('select', {
8087
- detail: { value: option.value, selectedOption: option },
8095
+ detail: { value: option.value, option: option },
8088
8096
  bubbles: true,
8089
8097
  composed: true,
8090
8098
  }));
@@ -8092,119 +8100,41 @@
8092
8100
  }
8093
8101
  _handleClear() {
8094
8102
  this.value = '';
8095
- this._updateFormValue();
8096
- this.dispatchEvent(new CustomEvent('change', {
8097
- detail: { value: '' },
8098
- bubbles: true,
8099
- composed: true,
8100
- }));
8103
+ this._internals.setFormValue(this.value);
8104
+ this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
8101
8105
  this._input?.focus();
8102
8106
  }
8103
- _onDocumentClick(e) {
8104
- const path = e.composedPath();
8105
- if (!path.includes(this)) {
8106
- this._isOpen = false;
8107
- }
8108
- }
8109
- _highlightMatch(text) {
8110
- if (!this.value || this.filteringType === 'manual' || !this.highlightMatches) {
8111
- return b `${text}`;
8112
- }
8113
- const searchValue = this.value.toLowerCase();
8114
- const index = text.toLowerCase().indexOf(searchValue);
8115
- if (index === -1) {
8116
- return b `${text}`;
8117
- }
8118
- const before = text.slice(0, index);
8119
- const match = text.slice(index, index + this.value.length);
8120
- const after = text.slice(index + this.value.length);
8121
- return b `${before}<span class="highlight">${match}</span>${after}`;
8107
+ _handleOptionMouseEnter(e, index) {
8108
+ this._highlightedIndex = index;
8122
8109
  }
8123
8110
  _renderOption(option, index) {
8124
- const isHighlighted = index === this._highlightedIndex;
8125
8111
  return b `
8126
8112
  <button
8127
8113
  class=${e$1({
8128
8114
  option: true,
8129
- 'is-highlighted': isHighlighted,
8115
+ 'option--highlighted': index === this._highlightedIndex,
8130
8116
  })}
8131
8117
  type="button"
8132
8118
  role="option"
8133
- aria-selected=${isHighlighted}
8119
+ aria-selected=${index === this._highlightedIndex}
8134
8120
  ?disabled=${option.disabled}
8135
- @click=${() => this._selectOption(option)}
8136
- @mouseenter=${() => {
8137
- this._highlightedIndex = index;
8138
- }}
8121
+ @click=${(e) => this._selectOption(option)}
8122
+ @mouseenter=${(e) => this._handleOptionMouseEnter(e, index)}
8139
8123
  >
8140
- <div class="option-content">
8141
- <div class="option-label">
8142
- ${this._highlightMatch(option.label || option.value)}
8143
- ${option.labelTag ? b `<span class="option-tag">${option.labelTag}</span>` : A}
8144
- </div>
8145
- ${option.description
8146
- ? b `<div class="option-description">${option.description}</div>`
8147
- : A}
8148
- ${option.tags && option.tags.length > 0
8149
- ? b `
8150
- <div class="option-tags">
8151
- ${option.tags.map((tag) => b `<span class="option-tag">${tag}</span>`)}
8152
- </div>
8153
- `
8154
- : A}
8155
- </div>
8124
+ ${option.label || option.value}
8156
8125
  </button>
8157
8126
  `;
8158
8127
  }
8159
- _renderDropdownContent() {
8160
- if (this.statusType === 'loading') {
8161
- return b `
8162
- <div class="status">
8163
- <div class="spinner"></div>
8164
- ${this.loadingText}
8165
- </div>
8166
- `;
8167
- }
8168
- if (this.statusType === 'error') {
8169
- return b `
8170
- <div class="status is-error">
8171
- <svg width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
8172
- <path
8173
- d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"
8174
- />
8175
- </svg>
8176
- ${this.errorText}
8177
- </div>
8178
- `;
8128
+ render() {
8129
+ let footer = A;
8130
+ if (this._touched && this._input && !this._input.validity.valid) {
8131
+ footer = b `<div class="validation-message">${this._input.validationMessage}</div>`;
8179
8132
  }
8180
- const filtered = this._filteredOptions;
8181
- if (filtered.length === 0) {
8182
- return b `<div class="empty">${this.emptyText}</div>`;
8133
+ else if (this.hint) {
8134
+ footer = b `<div class="hint">${this.hint}</div>`;
8183
8135
  }
8184
- let optionIndex = 0;
8185
- return b `
8186
- ${filtered.map((option) => {
8187
- if (isGroup(option)) {
8188
- const groupOptions = option.options.map((opt) => {
8189
- const rendered = this._renderOption(opt, optionIndex);
8190
- optionIndex++;
8191
- return rendered;
8192
- });
8193
- return b `
8194
- <div class="group-label">${option.label}</div>
8195
- ${groupOptions}
8196
- `;
8197
- }
8198
- const rendered = this._renderOption(option, optionIndex);
8199
- optionIndex++;
8200
- return rendered;
8201
- })}
8202
- `;
8203
- }
8204
- render() {
8205
- const hasError = this._touched && !this.validity.valid;
8206
8136
  return b `
8207
- <div class="field-wrapper">
8137
+ <div class="wrapper">
8208
8138
  ${this.label
8209
8139
  ? b `
8210
8140
  <label>
@@ -8214,75 +8144,58 @@
8214
8144
  `
8215
8145
  : A}
8216
8146
 
8217
- <div class="input-container">
8218
- <div class="input-wrapper">
8219
- <input
8220
- type="text"
8221
- .value=${l(this.value)}
8222
- placeholder=${o(this.placeholder || undefined)}
8223
- ?disabled=${this.disabled}
8224
- ?readonly=${this.readonly}
8225
- ?required=${this.required}
8226
- name=${o(this.name || undefined)}
8227
- autocomplete="off"
8228
- role="combobox"
8229
- aria-autocomplete="list"
8230
- aria-expanded=${this._isOpen}
8231
- aria-controls="dropdown"
8232
- class=${e$1({
8233
- 'input--invalid': hasError,
8147
+ <div class="input-wrapper">
8148
+ <input
8149
+ type="text"
8150
+ .value=${l(this.value)}
8151
+ placeholder=${this.placeholder}
8152
+ ?disabled=${this.disabled}
8153
+ ?readonly=${this.readonly}
8154
+ ?required=${this.required}
8155
+ name=${this.name}
8156
+ autocomplete="off"
8157
+ role="combobox"
8158
+ aria-autocomplete="list"
8159
+ aria-expanded=${this._isOpen}
8160
+ aria-controls="dropdown"
8161
+ class=${e$1({
8162
+ 'input--invalid': this._touched && this._input && !this._input.validity.valid,
8234
8163
  })}
8235
- @input=${this._onInput}
8236
- @blur=${this._onBlur}
8237
- @focus=${this._onFocus}
8238
- @keydown=${this._onKeyDown}
8239
- />
8240
- <div class="icon-container">
8241
- ${this.value && !this.disabled && !this.readonly
8164
+ @input=${this._handleInput}
8165
+ @blur=${this._handleBlur}
8166
+ @focus=${this._handleFocus}
8167
+ @keydown=${this._handleKeyDown}
8168
+ />
8169
+ <div class="icon-wrapper">
8170
+ ${this.value && !this.disabled && !this.readonly
8242
8171
  ? b `
8243
- <button
8244
- class="clear-button"
8245
- type="button"
8246
- aria-label="Clear"
8247
- @click=${this._handleClear}
8248
- >
8249
- <svg width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
8250
- <path
8251
- d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"
8252
- />
8253
- </svg>
8254
- </button>
8255
- `
8256
- : ''}
8257
- ${!this.value && !this.disabled && !this.readonly
8172
+ <svg class="clear" viewBox="0 0 24 24" fill="currentColor" aria-label="Clear" @click=${this._handleClear}>
8173
+ <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"/>
8174
+ </svg>
8175
+ `
8176
+ : A}
8177
+ ${!this.value && !this.disabled && !this.readonly
8258
8178
  ? b `
8259
- <svg class="search-icon" fill="currentColor" viewBox="0 0 16 16">
8260
- <path
8261
- d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"
8262
- />
8263
- </svg>
8264
- `
8265
- : ''}
8266
- </div>
8179
+ <svg class="search-icon" viewBox="0 0 24 24" fill="currentColor">
8180
+ <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"/>
8181
+ </svg>
8182
+ `
8183
+ : A}
8267
8184
  </div>
8185
+ </div>
8268
8186
 
8269
- <div
8270
- id="dropdown"
8271
- role="listbox"
8272
- class=${e$1({
8187
+ <div
8188
+ id="dropdown"
8189
+ role="listbox"
8190
+ class=${e$1({
8273
8191
  dropdown: true,
8274
- 'is-open': this._isOpen,
8192
+ 'dropdown--open': this._isOpen && this.options.length > 0,
8275
8193
  })}
8276
- >
8277
- ${this._renderDropdownContent()}
8278
- </div>
8194
+ >
8195
+ ${this.options.map((option, index) => this._renderOption(option, index))}
8279
8196
  </div>
8280
8197
 
8281
- ${hasError
8282
- ? b `<div class="validation-message">${this.validationMessage}</div>`
8283
- : this.hint
8284
- ? b `<div class="hint">${this.hint}</div>`
8285
- : A}
8198
+ ${footer}
8286
8199
  </div>
8287
8200
  `;
8288
8201
  }
@@ -8290,30 +8203,24 @@
8290
8203
  exports.KRAutoSuggest.styles = i$5 `
8291
8204
  :host {
8292
8205
  display: block;
8293
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
8294
- 'Helvetica Neue', sans-serif;
8206
+ font-family: inherit;
8295
8207
  }
8296
8208
 
8297
- .field-wrapper {
8209
+ .wrapper {
8298
8210
  display: flex;
8299
8211
  flex-direction: column;
8300
- gap: 4px;
8212
+ gap: 6px;
8301
8213
  }
8302
8214
 
8303
8215
  label {
8304
8216
  font-size: 14px;
8305
8217
  font-weight: 500;
8306
- color: var(--kr-text-field-label-color, #374151);
8307
- display: block;
8218
+ color: black;
8308
8219
  }
8309
8220
 
8310
8221
  .required {
8311
8222
  color: var(--kr-text-field-required-color, #ef4444);
8312
- margin-left: 2px;
8313
- }
8314
-
8315
- .input-container {
8316
- position: relative;
8223
+ margin-left: 0.125rem;
8317
8224
  }
8318
8225
 
8319
8226
  .input-wrapper {
@@ -8325,15 +8232,15 @@
8325
8232
  input {
8326
8233
  flex: 1;
8327
8234
  width: 100%;
8328
- padding: 8px 32px 8px 12px;
8235
+ padding: 10px 32px 10px 12px;
8329
8236
  font-size: 14px;
8330
- border: 1px solid var(--kr-text-field-border-color, #d1d5db);
8331
- border-radius: 6px;
8332
- background: var(--kr-text-field-bg, #ffffff);
8333
- color: var(--kr-text-field-color, #000000);
8334
- transition: all 0.2s ease;
8335
- box-sizing: border-box;
8336
8237
  font-family: inherit;
8238
+ border: 1px solid var(--kr-text-field-border-color, #0000003d);
8239
+ border-radius: 8px;
8240
+ background-color: var(--kr-text-field-bg, #fff);
8241
+ color: var(--kr-text-field-color, #111827);
8242
+ transition: border-color 0.2s, box-shadow 0.2s;
8243
+ box-sizing: border-box;
8337
8244
  }
8338
8245
 
8339
8246
  input:focus {
@@ -8343,13 +8250,13 @@
8343
8250
  }
8344
8251
 
8345
8252
  input:disabled {
8346
- background: var(--kr-text-field-disabled-bg, #f3f4f6);
8253
+ background-color: var(--kr-text-field-disabled-bg, #f3f4f6);
8254
+ color: var(--kr-text-field-disabled-color, #9ca3af);
8347
8255
  cursor: not-allowed;
8348
- opacity: 0.6;
8349
8256
  }
8350
8257
 
8351
8258
  input:read-only {
8352
- background: var(--kr-text-field-disabled-bg, #f3f4f6);
8259
+ background-color: var(--kr-text-field-disabled-bg, #f3f4f6);
8353
8260
  cursor: default;
8354
8261
  }
8355
8262
 
@@ -8358,14 +8265,14 @@
8358
8265
  }
8359
8266
 
8360
8267
  input.input--invalid:focus {
8361
- box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
8268
+ box-shadow: 0 0 0 3px var(--kr-text-field-error-ring-color, rgba(239, 68, 68, 0.1));
8362
8269
  }
8363
8270
 
8364
8271
  input::placeholder {
8365
8272
  color: var(--kr-text-field-placeholder-color, #9ca3af);
8366
8273
  }
8367
8274
 
8368
- .icon-container {
8275
+ .icon-wrapper {
8369
8276
  position: absolute;
8370
8277
  right: 8px;
8371
8278
  display: flex;
@@ -8373,51 +8280,40 @@
8373
8280
  gap: 4px;
8374
8281
  }
8375
8282
 
8376
- .clear-button {
8377
- display: flex;
8378
- align-items: center;
8379
- justify-content: center;
8283
+ .clear {
8380
8284
  width: 20px;
8381
8285
  height: 20px;
8382
- padding: 0;
8383
- background: none;
8384
- border: none;
8385
- border-radius: 50%;
8386
8286
  color: var(--kr-text-muted, #6b7280);
8387
8287
  cursor: pointer;
8388
- transition: all 0.15s ease;
8288
+ transition: color 0.15s ease;
8389
8289
  }
8390
8290
 
8391
- .clear-button:hover {
8392
- background-color: var(--kr-select-option-hover-bg, #f3f4f6);
8291
+ .clear:hover {
8393
8292
  color: var(--kr-text, #000000);
8394
8293
  }
8395
8294
 
8396
8295
  .search-icon {
8397
- width: 16px;
8398
- height: 16px;
8296
+ width: 20px;
8297
+ height: 20px;
8399
8298
  color: var(--kr-text-muted, #6b7280);
8400
8299
  pointer-events: none;
8401
8300
  }
8402
8301
 
8403
8302
  /* Dropdown */
8404
8303
  .dropdown {
8405
- position: absolute;
8406
- top: 100%;
8407
- left: 0;
8408
- right: 0;
8409
- z-index: 50;
8410
- margin-top: 4px;
8411
- max-height: 300px;
8304
+ position: fixed;
8305
+ z-index: 10000;
8412
8306
  overflow-y: auto;
8413
8307
  background: white;
8414
- border: 1px solid var(--kr-text-field-border-color, #d1d5db);
8415
- border-radius: 6px;
8416
- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
8308
+ border: 1px solid #9ba7b6;
8309
+ border-radius: 8px;
8310
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
8311
+ padding: 8px 0;
8312
+ box-sizing: border-box;
8417
8313
  display: none;
8418
8314
  }
8419
8315
 
8420
- .dropdown.is-open {
8316
+ .dropdown--open {
8421
8317
  display: block;
8422
8318
  }
8423
8319
 
@@ -8431,6 +8327,7 @@
8431
8327
  background: none;
8432
8328
  border: none;
8433
8329
  font-size: 14px;
8330
+ line-height: 1.5;
8434
8331
  font-family: inherit;
8435
8332
  color: var(--kr-text, #000000);
8436
8333
  text-align: left;
@@ -8442,180 +8339,793 @@
8442
8339
  background: var(--kr-select-option-hover-bg, #f3f4f6);
8443
8340
  }
8444
8341
 
8445
- .option.is-highlighted {
8446
- background: var(--kr-select-option-highlight-bg, #e5e7eb);
8342
+ .option--highlighted {
8343
+ background-color: var(--kr-select-option-hover-bg, #f3f4f6);
8447
8344
  }
8448
8345
 
8449
8346
  .option:disabled {
8450
8347
  opacity: 0.5;
8451
8348
  cursor: not-allowed;
8452
8349
  }
8453
-
8454
- .option-content {
8455
- flex: 1;
8456
- min-width: 0;
8457
- }
8458
-
8459
- .option-label {
8460
- display: flex;
8461
- align-items: center;
8462
- gap: 6px;
8463
- flex-wrap: wrap;
8464
- }
8465
-
8466
- .option-tag {
8467
- flex-shrink: 0;
8468
- padding: 2px 6px;
8469
- font-size: 11px;
8470
- color: var(--kr-text-muted, #6b7280);
8471
- background: var(--kr-select-option-hover-bg, #f3f4f6);
8472
- border-radius: 3px;
8473
- }
8474
-
8475
- .option-description {
8476
- font-size: 12px;
8477
- color: var(--kr-text-muted, #6b7280);
8478
- margin-top: 2px;
8479
- }
8480
-
8481
- .option-tags {
8482
- display: flex;
8483
- flex-wrap: wrap;
8484
- gap: 4px;
8485
- margin-top: 4px;
8486
- }
8487
-
8488
- /* Highlight */
8489
- .highlight {
8490
- font-weight: 600;
8491
- background-color: #fef3c7;
8492
- color: #92400e;
8350
+
8351
+ .hint {
8352
+ font-size: 0.75rem;
8353
+ color: var(--kr-text-field-helper-color, #6b7280);
8493
8354
  }
8494
8355
 
8495
- /* Group */
8496
- .group-label {
8497
- padding: 8px 12px;
8498
- font-size: 11px;
8499
- font-weight: 600;
8500
- color: var(--kr-text-muted, #6b7280);
8501
- text-transform: uppercase;
8502
- letter-spacing: 0.05em;
8503
- background: var(--kr-select-option-hover-bg, #f9fafb);
8504
- border-bottom: 1px solid var(--kr-text-field-border-color, #e5e7eb);
8356
+ .validation-message {
8357
+ font-size: 0.75rem;
8358
+ color: var(--kr-text-field-error-color, #ef4444);
8505
8359
  }
8506
-
8507
- /* Status */
8508
- .status {
8509
- display: flex;
8510
- align-items: center;
8511
- justify-content: center;
8512
- gap: 8px;
8513
- padding: 16px;
8514
- font-size: 14px;
8515
- color: var(--kr-text-muted, #6b7280);
8360
+ `;
8361
+ exports.KRAutoSuggest.formAssociated = true;
8362
+ __decorate$1([
8363
+ n$1({ type: String })
8364
+ ], exports.KRAutoSuggest.prototype, "label", void 0);
8365
+ __decorate$1([
8366
+ n$1({ type: String })
8367
+ ], exports.KRAutoSuggest.prototype, "name", void 0);
8368
+ __decorate$1([
8369
+ n$1({ type: String })
8370
+ ], exports.KRAutoSuggest.prototype, "value", void 0);
8371
+ __decorate$1([
8372
+ n$1({ type: String })
8373
+ ], exports.KRAutoSuggest.prototype, "placeholder", void 0);
8374
+ __decorate$1([
8375
+ n$1({ type: Boolean })
8376
+ ], exports.KRAutoSuggest.prototype, "disabled", void 0);
8377
+ __decorate$1([
8378
+ n$1({ type: Boolean })
8379
+ ], exports.KRAutoSuggest.prototype, "readonly", void 0);
8380
+ __decorate$1([
8381
+ n$1({ type: Boolean })
8382
+ ], exports.KRAutoSuggest.prototype, "required", void 0);
8383
+ __decorate$1([
8384
+ n$1({ type: String })
8385
+ ], exports.KRAutoSuggest.prototype, "hint", void 0);
8386
+ __decorate$1([
8387
+ n$1({ type: Array })
8388
+ ], exports.KRAutoSuggest.prototype, "options", void 0);
8389
+ __decorate$1([
8390
+ n$1({ attribute: false })
8391
+ ], exports.KRAutoSuggest.prototype, "fetch", void 0);
8392
+ __decorate$1([
8393
+ r$1()
8394
+ ], exports.KRAutoSuggest.prototype, "_isOpen", void 0);
8395
+ __decorate$1([
8396
+ r$1()
8397
+ ], exports.KRAutoSuggest.prototype, "_highlightedIndex", void 0);
8398
+ __decorate$1([
8399
+ r$1()
8400
+ ], exports.KRAutoSuggest.prototype, "_touched", void 0);
8401
+ __decorate$1([
8402
+ e$3('input')
8403
+ ], exports.KRAutoSuggest.prototype, "_input", void 0);
8404
+ exports.KRAutoSuggest = __decorate$1([
8405
+ t$1('kr-auto-suggest')
8406
+ ], exports.KRAutoSuggest);
8407
+
8408
+ var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
8409
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8410
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
8411
+ 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;
8412
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
8413
+ };
8414
+ /**
8415
+ * @element kr-combo-box
8416
+ *
8417
+ * A searchable select field. Looks like a select dropdown but when opened
8418
+ * shows a search input at the top of the panel for filtering options via
8419
+ * a fetch function. Works with any object shape — use optionValue and
8420
+ * optionLabel to tell the component how to extract the value and display text.
8421
+ *
8422
+ * @property {string} label - Label text
8423
+ * @property {string} name - Name for form submission
8424
+ * @property {string} value - Currently selected value
8425
+ * @property {string} placeholder - Placeholder text when nothing is selected
8426
+ * @property {boolean} disabled - Whether the field is disabled
8427
+ * @property {boolean} readonly - Whether the field is readonly
8428
+ * @property {boolean} required - Whether the field is required
8429
+ * @property {string} hint - Helper text displayed below the field
8430
+ * @property {string|Function} optionValue - Field name or function to extract the value from an option
8431
+ * @property {string|Function} optionLabel - Field name or function to extract the label from an option
8432
+ * @property {any[]} options - Array of options
8433
+ * @property {Function} fetch - Function that returns a promise of options
8434
+ * @property {Function} fetchSelection - Function that resolves a single option by its value
8435
+ *
8436
+ * @fires change - Fired when the selected value changes
8437
+ * @fires select - Fired when an option is selected
8438
+ */
8439
+ exports.KRComboBox = class KRComboBox extends i$2 {
8440
+ constructor() {
8441
+ super();
8442
+ this._requestId = 0;
8443
+ this._selectedOption = null;
8444
+ this._handleDocumentClick = (e) => {
8445
+ if (!e.composedPath().includes(this)) {
8446
+ this._close();
8447
+ }
8448
+ };
8449
+ this.label = '';
8450
+ this.name = '';
8451
+ this.value = '';
8452
+ this.placeholder = 'Select an option';
8453
+ this.disabled = false;
8454
+ this.readonly = false;
8455
+ this.required = false;
8456
+ this.hint = '';
8457
+ this.optionValue = 'value';
8458
+ this.optionLabel = 'label';
8459
+ this.options = [];
8460
+ this.fetch = null;
8461
+ this.fetchSelection = null;
8462
+ this._isOpen = false;
8463
+ this._highlightedIndex = -1;
8464
+ this._touched = false;
8465
+ this._searchQuery = '';
8466
+ this._loading = false;
8467
+ this._handleInvalid = (e) => {
8468
+ e.preventDefault();
8469
+ this._touched = true;
8470
+ };
8471
+ this._internals = this.attachInternals();
8472
+ }
8473
+ connectedCallback() {
8474
+ super.connectedCallback();
8475
+ document.addEventListener('click', this._handleDocumentClick);
8476
+ this.addEventListener('invalid', this._handleInvalid);
8477
+ }
8478
+ disconnectedCallback() {
8479
+ super.disconnectedCallback();
8480
+ document.removeEventListener('click', this._handleDocumentClick);
8481
+ this.removeEventListener('invalid', this._handleInvalid);
8482
+ }
8483
+ firstUpdated() {
8484
+ this._updateValidity();
8485
+ if (this.value && this.fetchSelection) {
8486
+ this._resolveSelection();
8487
+ }
8488
+ }
8489
+ updated(changedProperties) {
8490
+ if (changedProperties.has('required') || changedProperties.has('value')) {
8491
+ this._updateValidity();
8492
+ }
8493
+ if (changedProperties.has('value')) {
8494
+ if (this.value) {
8495
+ // Only resolve if the selected option doesn't match the current value
8496
+ if (!this._selectedOption || this._getOptionValue(this._selectedOption) !== this.value) {
8497
+ this._resolveSelection();
8498
+ }
8499
+ }
8500
+ else {
8501
+ this._selectedOption = null;
8502
+ }
8503
+ }
8504
+ if (changedProperties.has('options') && this._isOpen) {
8505
+ this._positionDropdown();
8506
+ }
8507
+ }
8508
+ get form() {
8509
+ return this._internals.form;
8510
+ }
8511
+ get validity() {
8512
+ return this._internals.validity;
8513
+ }
8514
+ get validationMessage() {
8515
+ return this._internals.validationMessage;
8516
+ }
8517
+ checkValidity() {
8518
+ return this._internals.checkValidity();
8519
+ }
8520
+ reportValidity() {
8521
+ return this._internals.reportValidity();
8522
+ }
8523
+ formResetCallback() {
8524
+ this.value = '';
8525
+ this._selectedOption = null;
8526
+ this._touched = false;
8527
+ this._isOpen = false;
8528
+ this._highlightedIndex = -1;
8529
+ this._searchQuery = '';
8530
+ this._internals.setFormValue('');
8531
+ this._internals.setValidity({});
8532
+ }
8533
+ formStateRestoreCallback(state) {
8534
+ this.value = state;
8535
+ }
8536
+ focus() {
8537
+ if (!this._isOpen) {
8538
+ this._open();
8539
+ }
8540
+ }
8541
+ blur() {
8542
+ this._triggerElement?.blur();
8543
+ }
8544
+ _updateValidity() {
8545
+ if (this.required && !this.value) {
8546
+ this._internals.setValidity({ valueMissing: true }, 'Please select an option', this._triggerElement);
8547
+ }
8548
+ else {
8549
+ this._internals.setValidity({});
8550
+ }
8551
+ }
8552
+ _handleTriggerClick() {
8553
+ if (this.disabled || this.readonly) {
8554
+ return;
8555
+ }
8556
+ if (this._isOpen) {
8557
+ this._close();
8558
+ }
8559
+ else {
8560
+ this._open();
8561
+ }
8562
+ }
8563
+ _open() {
8564
+ this._isOpen = true;
8565
+ this._searchQuery = '';
8566
+ this._highlightedIndex = -1;
8567
+ this._fetch();
8568
+ this.updateComplete.then(() => {
8569
+ this._positionDropdown();
8570
+ if (this._searchInput) {
8571
+ this._searchInput.focus();
8572
+ }
8573
+ });
8574
+ }
8575
+ _close() {
8576
+ this._isOpen = false;
8577
+ this._highlightedIndex = -1;
8578
+ this._searchQuery = '';
8579
+ }
8580
+ _positionDropdown() {
8581
+ requestAnimationFrame(() => {
8582
+ const dropdown = this.shadowRoot?.querySelector('.dropdown');
8583
+ if (!dropdown) {
8584
+ return;
8585
+ }
8586
+ const triggerRect = this._triggerElement.getBoundingClientRect();
8587
+ const spaceBelow = window.innerHeight - triggerRect.bottom - 4 - 8;
8588
+ const spaceAbove = triggerRect.top - 4 - 8;
8589
+ dropdown.style.left = triggerRect.left + 'px';
8590
+ dropdown.style.width = triggerRect.width + 'px';
8591
+ // Prefer opening below; only flip above when space below is tight
8592
+ if (spaceBelow < 200 && spaceAbove > spaceBelow) {
8593
+ dropdown.style.top = '';
8594
+ dropdown.style.bottom = (window.innerHeight - triggerRect.top + 4) + 'px';
8595
+ dropdown.style.maxHeight = spaceAbove + 'px';
8596
+ }
8597
+ else {
8598
+ dropdown.style.bottom = '';
8599
+ dropdown.style.top = triggerRect.bottom + 4 + 'px';
8600
+ dropdown.style.maxHeight = spaceBelow + 'px';
8601
+ }
8602
+ });
8603
+ }
8604
+ _fetch() {
8605
+ if (!this.fetch) {
8606
+ return;
8607
+ }
8608
+ this._loading = true;
8609
+ this._requestId++;
8610
+ const requestId = this._requestId;
8611
+ this.fetch(this._searchQuery).then((options) => {
8612
+ if (requestId === this._requestId) {
8613
+ this.options = options;
8614
+ this._loading = false;
8615
+ }
8616
+ }).catch((error) => {
8617
+ console.error('kr-combo-box: fetch failed', error);
8618
+ this._loading = false;
8619
+ });
8620
+ }
8621
+ _handleSearchInput(e) {
8622
+ this._searchQuery = e.target.value;
8623
+ this._highlightedIndex = -1;
8624
+ this._fetch();
8625
+ }
8626
+ _handleSearchKeyDown(e) {
8627
+ switch (e.key) {
8628
+ case 'ArrowDown':
8629
+ e.preventDefault();
8630
+ this._highlightedIndex = Math.min(this._highlightedIndex + 1, this.options.length - 1);
8631
+ this._scrollToHighlighted();
8632
+ break;
8633
+ case 'ArrowUp':
8634
+ e.preventDefault();
8635
+ if (this._highlightedIndex === -1) {
8636
+ this._highlightedIndex = this.options.length - 1;
8637
+ }
8638
+ else {
8639
+ this._highlightedIndex = Math.max(this._highlightedIndex - 1, 0);
8640
+ }
8641
+ this._scrollToHighlighted();
8642
+ break;
8643
+ case 'Enter':
8644
+ e.preventDefault();
8645
+ if (this._highlightedIndex >= 0 && this.options[this._highlightedIndex]) {
8646
+ this._selectOption(this.options[this._highlightedIndex]);
8647
+ }
8648
+ break;
8649
+ case 'Escape':
8650
+ e.preventDefault();
8651
+ this._close();
8652
+ this._triggerElement?.focus();
8653
+ break;
8654
+ case 'Tab':
8655
+ this._close();
8656
+ break;
8657
+ }
8658
+ }
8659
+ _handleTriggerKeyDown(e) {
8660
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Enter' || e.key === ' ') {
8661
+ e.preventDefault();
8662
+ if (!this._isOpen) {
8663
+ this._open();
8664
+ }
8665
+ }
8666
+ }
8667
+ _handleTriggerBlur() {
8668
+ this._touched = true;
8669
+ this._updateValidity();
8670
+ }
8671
+ _scrollToHighlighted() {
8672
+ this.updateComplete.then(() => {
8673
+ const container = this.shadowRoot?.querySelector('.options');
8674
+ const highlighted = this.shadowRoot?.querySelector('.option--highlighted');
8675
+ if (container && highlighted) {
8676
+ const containerRect = container.getBoundingClientRect();
8677
+ const highlightedRect = highlighted.getBoundingClientRect();
8678
+ if (highlightedRect.bottom > containerRect.bottom) {
8679
+ highlighted.scrollIntoView({ block: 'nearest' });
8680
+ }
8681
+ else if (highlightedRect.top < containerRect.top) {
8682
+ highlighted.scrollIntoView({ block: 'nearest' });
8683
+ }
8684
+ }
8685
+ });
8686
+ }
8687
+ _getOptionValue(option) {
8688
+ if (typeof this.optionValue === 'function') {
8689
+ return this.optionValue(option);
8690
+ }
8691
+ return option[this.optionValue];
8692
+ }
8693
+ _getOptionLabel(option) {
8694
+ let label;
8695
+ if (typeof this.optionLabel === 'function') {
8696
+ label = this.optionLabel(option);
8697
+ }
8698
+ else {
8699
+ label = option[this.optionLabel];
8700
+ }
8701
+ if (!label) {
8702
+ return this._getOptionValue(option);
8703
+ }
8704
+ return label;
8705
+ }
8706
+ _resolveSelection() {
8707
+ if (!this.fetchSelection) {
8708
+ return;
8709
+ }
8710
+ const fetchedValue = this.value;
8711
+ this.fetchSelection(this.value).then((option) => {
8712
+ if (this.value !== fetchedValue) {
8713
+ return;
8714
+ }
8715
+ if (!option) {
8716
+ return;
8717
+ }
8718
+ this._selectedOption = option;
8719
+ this.requestUpdate();
8720
+ }).catch((error) => {
8721
+ console.error('kr-combo-box: fetchSelection failed', error);
8722
+ });
8723
+ }
8724
+ _selectOption(option) {
8725
+ if (option.disabled) {
8726
+ return;
8727
+ }
8728
+ this.value = this._getOptionValue(option);
8729
+ this._selectedOption = option;
8730
+ this._close();
8731
+ this._internals.setFormValue(this.value);
8732
+ this._updateValidity();
8733
+ this.dispatchEvent(new CustomEvent('select', {
8734
+ detail: { option: option },
8735
+ bubbles: true,
8736
+ composed: true,
8737
+ }));
8738
+ this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
8739
+ this._triggerElement?.focus();
8740
+ }
8741
+ _handleOptionMouseEnter(e, index) {
8742
+ this._highlightedIndex = index;
8743
+ }
8744
+ _renderOption(option, index) {
8745
+ const optionValue = this._getOptionValue(option);
8746
+ return b `
8747
+ <button
8748
+ class=${e$1({
8749
+ option: true,
8750
+ 'option--highlighted': index === this._highlightedIndex,
8751
+ 'option--selected': optionValue === this.value,
8752
+ })}
8753
+ type="button"
8754
+ role="option"
8755
+ aria-selected=${optionValue === this.value}
8756
+ ?disabled=${option.disabled}
8757
+ @click=${(e) => this._selectOption(option)}
8758
+ @mouseenter=${(e) => this._handleOptionMouseEnter(e, index)}
8759
+ >
8760
+ ${this._getOptionLabel(option)}
8761
+ </button>
8762
+ `;
8763
+ }
8764
+ render() {
8765
+ let footer = A;
8766
+ if (this._touched && this.required && !this.value) {
8767
+ footer = b `<div class="validation-message">Please select an option</div>`;
8768
+ }
8769
+ else if (this.hint) {
8770
+ footer = b `<div class="hint">${this.hint}</div>`;
8771
+ }
8772
+ return b `
8773
+ <div class="wrapper">
8774
+ ${this.label
8775
+ ? b `
8776
+ <label>
8777
+ ${this.label}
8778
+ ${this.required ? b `<span class="required">*</span>` : A}
8779
+ </label>
8780
+ `
8781
+ : A}
8782
+
8783
+ <button
8784
+ class=${e$1({
8785
+ trigger: true,
8786
+ 'trigger--open': this._isOpen,
8787
+ 'trigger--invalid': this._touched && this.required && !this.value,
8788
+ })}
8789
+ type="button"
8790
+ ?disabled=${this.disabled}
8791
+ aria-haspopup="listbox"
8792
+ aria-expanded=${this._isOpen}
8793
+ @click=${this._handleTriggerClick}
8794
+ @keydown=${this._handleTriggerKeyDown}
8795
+ @blur=${this._handleTriggerBlur}
8796
+ >
8797
+ <span class=${e$1({
8798
+ trigger__value: true,
8799
+ trigger__placeholder: !this._selectedOption,
8800
+ })}>
8801
+ ${this._selectedOption ? this._getOptionLabel(this._selectedOption) : this.placeholder}
8802
+ </span>
8803
+ <svg
8804
+ class=${e$1({
8805
+ trigger__icon: true,
8806
+ 'trigger__icon--open': this._isOpen,
8807
+ })}
8808
+ viewBox="0 0 24 24"
8809
+ fill="currentColor"
8810
+ >
8811
+ <path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6z"/>
8812
+ </svg>
8813
+ </button>
8814
+
8815
+ <div
8816
+ role="listbox"
8817
+ class=${e$1({
8818
+ dropdown: true,
8819
+ 'dropdown--open': this._isOpen,
8820
+ })}
8821
+ >
8822
+ <div class="search">
8823
+ <div class="search__field">
8824
+ <input
8825
+ class="search__input"
8826
+ type="text"
8827
+ placeholder="Search..."
8828
+ .value=${this._searchQuery}
8829
+ @input=${this._handleSearchInput}
8830
+ @keydown=${this._handleSearchKeyDown}
8831
+ />
8832
+ <svg class="search__icon" viewBox="0 0 24 24" fill="currentColor">
8833
+ <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"/>
8834
+ </svg>
8835
+ </div>
8836
+ </div>
8837
+
8838
+ <div class="options">
8839
+ ${this._loading
8840
+ ? b `<div class="empty">Loading...</div>`
8841
+ : this.options.length === 0
8842
+ ? b `<div class="empty">No options found</div>`
8843
+ : this.options.map((option, index) => this._renderOption(option, index))}
8844
+ </div>
8845
+ </div>
8846
+
8847
+ ${footer}
8848
+ </div>
8849
+ `;
8850
+ }
8851
+ };
8852
+ exports.KRComboBox.styles = i$5 `
8853
+ :host {
8854
+ display: block;
8855
+ font-family: inherit;
8856
+ }
8857
+
8858
+ .wrapper {
8859
+ display: flex;
8860
+ flex-direction: column;
8861
+ gap: 6px;
8516
8862
  }
8517
8863
 
8518
- .status.is-error {
8519
- color: var(--kr-text-field-error-border-color, #ef4444);
8864
+ label {
8865
+ font-size: 14px;
8866
+ font-weight: 500;
8867
+ color: black;
8520
8868
  }
8521
8869
 
8522
- .spinner {
8523
- width: 16px;
8524
- height: 16px;
8525
- border: 2px solid var(--kr-text-field-border-color, #e5e7eb);
8526
- border-top-color: var(--kr-text-field-focus-border-color, #163052);
8527
- border-radius: 50%;
8528
- animation: spin 0.6s linear infinite;
8870
+ .required {
8871
+ color: var(--kr-text-field-required-color, #ef4444);
8872
+ margin-left: 0.125rem;
8529
8873
  }
8530
8874
 
8531
- @keyframes spin {
8532
- to {
8533
- transform: rotate(360deg);
8534
- }
8875
+ /* Trigger button */
8876
+ .trigger {
8877
+ display: flex;
8878
+ align-items: center;
8879
+ justify-content: space-between;
8880
+ width: 100%;
8881
+ padding: 10px 12px;
8882
+ font-family: inherit;
8883
+ font-size: 14px;
8884
+ line-height: 1.5;
8885
+ color: var(--kr-text-field-color, #111827);
8886
+ background-color: var(--kr-text-field-bg, #fff);
8887
+ border: 1px solid var(--kr-text-field-border-color, #0000003d);
8888
+ border-radius: 8px;
8889
+ cursor: pointer;
8890
+ transition: border-color 0.2s, box-shadow 0.2s;
8891
+ text-align: left;
8535
8892
  }
8536
8893
 
8537
- .empty {
8538
- padding: 16px;
8539
- text-align: center;
8894
+ .trigger:hover:not(:disabled) {
8895
+ border-color: #9ca3af;
8896
+ }
8897
+
8898
+ .trigger:focus {
8899
+ outline: none;
8900
+ border-color: var(--kr-text-field-focus-border-color, #163052);
8901
+ box-shadow: 0 0 0 3px var(--kr-text-field-focus-ring-color, rgba(22, 48, 82, 0.1));
8902
+ }
8903
+
8904
+ .trigger:disabled {
8905
+ background-color: var(--kr-text-field-disabled-bg, #f3f4f6);
8906
+ color: var(--kr-text-field-disabled-color, #9ca3af);
8907
+ cursor: not-allowed;
8908
+ }
8909
+
8910
+ .trigger--open {
8911
+ border-color: var(--kr-text-field-focus-border-color, #163052);
8912
+ box-shadow: 0 0 0 3px var(--kr-text-field-focus-ring-color, rgba(22, 48, 82, 0.1));
8913
+ }
8914
+
8915
+ .trigger--invalid {
8916
+ border-color: var(--kr-text-field-error-border-color, #ef4444);
8917
+ }
8918
+
8919
+ .trigger--invalid:focus {
8920
+ box-shadow: 0 0 0 3px var(--kr-text-field-error-ring-color, rgba(239, 68, 68, 0.1));
8921
+ }
8922
+
8923
+ .trigger__value {
8924
+ flex: 1;
8925
+ overflow: hidden;
8926
+ text-overflow: ellipsis;
8927
+ white-space: nowrap;
8928
+ }
8929
+
8930
+ .trigger__placeholder {
8931
+ color: var(--kr-text-field-placeholder-color, #9ca3af);
8932
+ }
8933
+
8934
+ .trigger__icon {
8935
+ flex-shrink: 0;
8936
+ margin-left: 0.5rem;
8937
+ width: 20px;
8938
+ height: 20px;
8939
+ color: var(--kr-text-muted, #6b7280);
8940
+ transition: transform 0.2s;
8941
+ }
8942
+
8943
+ .trigger__icon--open {
8944
+ transform: rotate(180deg);
8945
+ }
8946
+
8947
+ /* Dropdown */
8948
+ .dropdown {
8949
+ position: fixed;
8950
+ z-index: 10000;
8951
+ background: white;
8952
+ border: 1px solid #9ba7b6;
8953
+ border-radius: 8px;
8954
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
8955
+ box-sizing: border-box;
8956
+ display: none;
8957
+ overflow: hidden;
8958
+ }
8959
+
8960
+ .dropdown--open {
8961
+ display: flex;
8962
+ flex-direction: column;
8963
+ }
8964
+
8965
+ /* Search input inside dropdown */
8966
+ .search {
8967
+ padding: 12px 12px 2px 12px;
8968
+ flex-shrink: 0;
8969
+ }
8970
+
8971
+ .search__field {
8972
+ display: flex;
8973
+ align-items: center;
8974
+ padding: 8px 12px;
8975
+ border: 1px solid var(--kr-text-field-border-color, #0000003d);
8976
+ border-radius: 8px;
8977
+ background-color: var(--kr-text-field-bg, #fff);
8978
+ transition: border-color 0.2s, box-shadow 0.2s;
8979
+ }
8980
+
8981
+ .search__field:focus-within {
8982
+ border-color: var(--kr-text-field-focus-border-color, #163052);
8983
+ box-shadow: 0 0 0 3px var(--kr-text-field-focus-ring-color, rgba(22, 48, 82, 0.1));
8984
+ }
8985
+
8986
+ .search__icon {
8987
+ width: 20px;
8988
+ height: 20px;
8989
+ color: var(--kr-text-muted, #6b7280);
8990
+ flex-shrink: 0;
8991
+ margin-left: 8px;
8992
+ }
8993
+
8994
+ .search__input {
8995
+ flex: 1;
8996
+ border: none;
8997
+ outline: none;
8998
+ font-size: 14px;
8999
+ font-family: inherit;
9000
+ color: var(--kr-text-field-color, #111827);
9001
+ background: transparent;
9002
+ padding: 0;
9003
+ }
9004
+
9005
+ .search__input::placeholder {
9006
+ color: var(--kr-text-field-placeholder-color, #9ca3af);
9007
+ }
9008
+
9009
+ /* Options list */
9010
+ .options {
9011
+ overflow-y: auto;
9012
+ padding: 4px 0;
9013
+ }
9014
+
9015
+ .option {
9016
+ display: flex;
9017
+ align-items: center;
9018
+ width: 100%;
9019
+ padding: 12px 18px;
9020
+ background: none;
9021
+ border: none;
8540
9022
  font-size: 14px;
9023
+ line-height: 1.5;
9024
+ font-family: inherit;
9025
+ color: var(--kr-text, #000000);
9026
+ text-align: left;
9027
+ cursor: pointer;
9028
+ transition: background 0.15s ease;
9029
+ }
9030
+
9031
+ .option:hover:not(:disabled) {
9032
+ background: var(--kr-select-option-hover-bg, #f3f4f6);
9033
+ }
9034
+
9035
+ .option--highlighted {
9036
+ background-color: var(--kr-select-option-hover-bg, #f3f4f6);
9037
+ }
9038
+
9039
+ .option--selected {
9040
+ color: var(--kr-text-field-focus-border-color, #163052);
9041
+ }
9042
+
9043
+ .option:disabled {
9044
+ opacity: 0.5;
9045
+ cursor: not-allowed;
9046
+ }
9047
+
9048
+ .empty {
9049
+ padding: 12px 18px;
9050
+ text-align: left;
8541
9051
  color: var(--kr-text-muted, #6b7280);
9052
+ font-size: 14px;
8542
9053
  }
8543
9054
 
8544
9055
  .hint {
8545
- font-size: 12px;
8546
- color: var(--kr-text-field-hint-color, #6b7280);
9056
+ font-size: 0.75rem;
9057
+ color: var(--kr-text-field-helper-color, #6b7280);
8547
9058
  }
8548
9059
 
8549
9060
  .validation-message {
8550
- font-size: 12px;
8551
- color: var(--kr-text-field-error-border-color, #ef4444);
8552
- margin-top: 2px;
9061
+ font-size: 0.75rem;
9062
+ color: var(--kr-text-field-error-color, #ef4444);
8553
9063
  }
8554
9064
  `;
8555
- exports.KRAutoSuggest.formAssociated = true;
9065
+ exports.KRComboBox.formAssociated = true;
8556
9066
  __decorate([
8557
9067
  n$1({ type: String })
8558
- ], exports.KRAutoSuggest.prototype, "label", void 0);
9068
+ ], exports.KRComboBox.prototype, "label", void 0);
8559
9069
  __decorate([
8560
9070
  n$1({ type: String })
8561
- ], exports.KRAutoSuggest.prototype, "name", void 0);
9071
+ ], exports.KRComboBox.prototype, "name", void 0);
8562
9072
  __decorate([
8563
9073
  n$1({ type: String })
8564
- ], exports.KRAutoSuggest.prototype, "value", void 0);
9074
+ ], exports.KRComboBox.prototype, "value", void 0);
8565
9075
  __decorate([
8566
9076
  n$1({ type: String })
8567
- ], exports.KRAutoSuggest.prototype, "placeholder", void 0);
9077
+ ], exports.KRComboBox.prototype, "placeholder", void 0);
8568
9078
  __decorate([
8569
9079
  n$1({ type: Boolean })
8570
- ], exports.KRAutoSuggest.prototype, "disabled", void 0);
9080
+ ], exports.KRComboBox.prototype, "disabled", void 0);
8571
9081
  __decorate([
8572
9082
  n$1({ type: Boolean })
8573
- ], exports.KRAutoSuggest.prototype, "readonly", void 0);
9083
+ ], exports.KRComboBox.prototype, "readonly", void 0);
8574
9084
  __decorate([
8575
9085
  n$1({ type: Boolean })
8576
- ], exports.KRAutoSuggest.prototype, "required", void 0);
9086
+ ], exports.KRComboBox.prototype, "required", void 0);
8577
9087
  __decorate([
8578
9088
  n$1({ type: String })
8579
- ], exports.KRAutoSuggest.prototype, "hint", void 0);
8580
- __decorate([
8581
- n$1({ type: Array })
8582
- ], exports.KRAutoSuggest.prototype, "options", void 0);
9089
+ ], exports.KRComboBox.prototype, "hint", void 0);
8583
9090
  __decorate([
8584
- n$1({ type: String, attribute: 'status-type' })
8585
- ], exports.KRAutoSuggest.prototype, "statusType", void 0);
9091
+ n$1({ attribute: 'option-value' })
9092
+ ], exports.KRComboBox.prototype, "optionValue", void 0);
8586
9093
  __decorate([
8587
- n$1({ type: String, attribute: 'loading-text' })
8588
- ], exports.KRAutoSuggest.prototype, "loadingText", void 0);
9094
+ n$1({ attribute: 'option-label' })
9095
+ ], exports.KRComboBox.prototype, "optionLabel", void 0);
8589
9096
  __decorate([
8590
- n$1({ type: String, attribute: 'error-text' })
8591
- ], exports.KRAutoSuggest.prototype, "errorText", void 0);
9097
+ n$1({ type: Array })
9098
+ ], exports.KRComboBox.prototype, "options", void 0);
8592
9099
  __decorate([
8593
- n$1({ type: String, attribute: 'empty-text' })
8594
- ], exports.KRAutoSuggest.prototype, "emptyText", void 0);
9100
+ n$1({ attribute: false })
9101
+ ], exports.KRComboBox.prototype, "fetch", void 0);
8595
9102
  __decorate([
8596
- n$1({ type: String, attribute: 'filtering-type' })
8597
- ], exports.KRAutoSuggest.prototype, "filteringType", void 0);
9103
+ n$1({ attribute: false })
9104
+ ], exports.KRComboBox.prototype, "fetchSelection", void 0);
8598
9105
  __decorate([
8599
- n$1({ type: Boolean, attribute: 'highlight-matches' })
8600
- ], exports.KRAutoSuggest.prototype, "highlightMatches", void 0);
9106
+ r$1()
9107
+ ], exports.KRComboBox.prototype, "_isOpen", void 0);
8601
9108
  __decorate([
8602
9109
  r$1()
8603
- ], exports.KRAutoSuggest.prototype, "_isOpen", void 0);
9110
+ ], exports.KRComboBox.prototype, "_highlightedIndex", void 0);
8604
9111
  __decorate([
8605
9112
  r$1()
8606
- ], exports.KRAutoSuggest.prototype, "_highlightedIndex", void 0);
9113
+ ], exports.KRComboBox.prototype, "_touched", void 0);
8607
9114
  __decorate([
8608
9115
  r$1()
8609
- ], exports.KRAutoSuggest.prototype, "_touched", void 0);
9116
+ ], exports.KRComboBox.prototype, "_searchQuery", void 0);
8610
9117
  __decorate([
8611
9118
  r$1()
8612
- ], exports.KRAutoSuggest.prototype, "_dirty", void 0);
9119
+ ], exports.KRComboBox.prototype, "_loading", void 0);
8613
9120
  __decorate([
8614
- e$3('input')
8615
- ], exports.KRAutoSuggest.prototype, "_input", void 0);
8616
- exports.KRAutoSuggest = __decorate([
8617
- t$1('kr-auto-suggest')
8618
- ], exports.KRAutoSuggest);
9121
+ e$3('.trigger')
9122
+ ], exports.KRComboBox.prototype, "_triggerElement", void 0);
9123
+ __decorate([
9124
+ e$3('.search__input')
9125
+ ], exports.KRComboBox.prototype, "_searchInput", void 0);
9126
+ exports.KRComboBox = __decorate([
9127
+ t$1('kr-combo-box')
9128
+ ], exports.KRComboBox);
8619
9129
 
8620
9130
  exports.KRDialogRef = KRDialogRef;
8621
9131
  exports.KRQuery = KRQuery;