@aquera/nile-elements 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +5 -0
  2. package/demo/nxtgen-classes.css +594 -0
  3. package/demo/nxtgen-dark.css +240 -21
  4. package/demo/nxtgen-utilities.css +594 -0
  5. package/demo/nxtgen.css +55 -0
  6. package/dist/index.js +51 -47
  7. package/dist/nile-combobox/nile-combobox.cjs.js +1 -1
  8. package/dist/nile-combobox/nile-combobox.cjs.js.map +1 -1
  9. package/dist/nile-combobox/nile-combobox.css.cjs.js +1 -1
  10. package/dist/nile-combobox/nile-combobox.css.cjs.js.map +1 -1
  11. package/dist/nile-combobox/nile-combobox.css.esm.js +28 -15
  12. package/dist/nile-combobox/nile-combobox.esm.js +11 -8
  13. package/dist/nile-combobox/portal-manager.cjs.js +1 -1
  14. package/dist/nile-combobox/portal-manager.cjs.js.map +1 -1
  15. package/dist/nile-combobox/portal-manager.esm.js +1 -1
  16. package/dist/nile-combobox/renderer.cjs.js +1 -1
  17. package/dist/nile-combobox/renderer.cjs.js.map +1 -1
  18. package/dist/nile-combobox/renderer.esm.js +31 -43
  19. package/dist/src/nile-combobox/nile-combobox.css.js +28 -15
  20. package/dist/src/nile-combobox/nile-combobox.css.js.map +1 -1
  21. package/dist/src/nile-combobox/nile-combobox.js +49 -10
  22. package/dist/src/nile-combobox/nile-combobox.js.map +1 -1
  23. package/dist/src/nile-combobox/portal-manager.js +2 -22
  24. package/dist/src/nile-combobox/portal-manager.js.map +1 -1
  25. package/dist/src/nile-combobox/renderer.d.ts +2 -3
  26. package/dist/src/nile-combobox/renderer.js +14 -45
  27. package/dist/src/nile-combobox/renderer.js.map +1 -1
  28. package/dist/src/version.d.ts +1 -1
  29. package/dist/src/version.js +11 -3
  30. package/dist/src/version.js.map +1 -1
  31. package/dist/tsconfig.tsbuildinfo +1 -1
  32. package/dist/version.cjs.js +1 -1
  33. package/dist/version.cjs.js.map +1 -1
  34. package/dist/version.esm.js +1 -1
  35. package/package.json +2 -1
  36. package/scripts/replace-version.cjs +12 -10
  37. package/src/nile-combobox/nile-combobox.css.ts +28 -15
  38. package/src/nile-combobox/nile-combobox.ts +61 -12
  39. package/src/nile-combobox/portal-manager.ts +4 -22
  40. package/src/nile-combobox/renderer.ts +26 -69
  41. package/src/version.ts +11 -2
@@ -999,8 +999,43 @@ let NileCombobox = class NileCombobox extends NileElement {
999
999
  this.popup.popup.style.visibility = 'hidden';
1000
1000
  }
1001
1001
  this.popup.active = true;
1002
- await new Promise(r => requestAnimationFrame(r));
1003
- await new Promise(r => requestAnimationFrame(r));
1002
+ // Wait for Lit to render the listbox and attach scrollElementRef.
1003
+ await this.updateComplete;
1004
+ const scrollEl = this.isHorizontalGrid
1005
+ ? this.hScrollElementRef.value
1006
+ : this.scrollElementRef.value;
1007
+ await new Promise(resolve => {
1008
+ let attempts = 0;
1009
+ const maxAttempts = 10;
1010
+ const check = () => {
1011
+ attempts++;
1012
+ const hasSize = this.isHorizontalGrid
1013
+ ? (scrollEl?.offsetWidth ?? 0) > 0
1014
+ : (scrollEl?.offsetHeight ?? 0) > 0;
1015
+ if (hasSize || attempts >= maxAttempts) {
1016
+ resolve();
1017
+ }
1018
+ else {
1019
+ requestAnimationFrame(check);
1020
+ }
1021
+ };
1022
+ requestAnimationFrame(check);
1023
+ });
1024
+ if (this.isHorizontalGrid) {
1025
+ const hVirtualizer = this.hVirtualizerCtrl.getVirtualizer();
1026
+ hVirtualizer.scrollOffset = 0;
1027
+ hVirtualizer.measure();
1028
+ }
1029
+ else {
1030
+ const virtualizer = this.virtualizerCtrl.getVirtualizer();
1031
+ virtualizer.scrollOffset = 0;
1032
+ virtualizer.measure();
1033
+ }
1034
+ this.requestUpdate();
1035
+ await this.updateComplete;
1036
+ await new Promise(resolve => {
1037
+ requestAnimationFrame(() => resolve());
1038
+ });
1004
1039
  if (this.popup?.popup) {
1005
1040
  this.popup.popup.style.visibility = '';
1006
1041
  }
@@ -1098,6 +1133,7 @@ let NileCombobox = class NileCombobox extends NileElement {
1098
1133
  this.updateComplete.then(() => this.formControlController.updateValidity());
1099
1134
  }
1100
1135
  async resetScrollPosition() {
1136
+ this.stickyHeaderIndex = -1;
1101
1137
  await this.portalManager.resetScrollPosition();
1102
1138
  }
1103
1139
  // ── Render ──
@@ -1294,8 +1330,8 @@ let NileCombobox = class NileCombobox extends NileElement {
1294
1330
  </button>
1295
1331
  `;
1296
1332
  }
1297
- renderStickyHeaderOverlay(grouped, useVirtual) {
1298
- if (!this.stickyGroupHeader || !grouped || !useVirtual)
1333
+ renderStickyHeaderOverlay() {
1334
+ if (!this.stickyGroupHeader)
1299
1335
  return html ``;
1300
1336
  const idx = this.stickyHeaderIndex;
1301
1337
  if (idx < 0 || idx >= this.filteredRows.length)
@@ -1342,29 +1378,32 @@ let NileCombobox = class NileCombobox extends NileElement {
1342
1378
  class="combobox__listbox ${this.isBidirectionalGrid ? 'combobox__listbox--bidirectional' : ''} ${this.portal ? 'combobox__portal-hidden' : ''}"
1343
1379
  tabindex="-1"
1344
1380
  @mouseup=${this.onOptionClick}
1345
- @scroll=${this.onScroll}
1346
1381
  style="${this.portal ? 'display: none;' : ''}${this.isBidirectionalGrid ? `max-height:${this.gridRows * 38 + 16}px;` : ''}"
1347
- ${ref(this.scrollElementRef)}
1348
1382
  >
1349
- ${this.renderLoader()}
1350
1383
  ${this.renderSelectAll()}
1351
- ${this.renderStickyHeaderOverlay(grouped, useVirtual)}
1384
+ <div
1385
+ class="combobox__options-scroll"
1386
+ @scroll=${this.onScroll}
1387
+ ${ref(this.scrollElementRef)}
1388
+ >
1389
+ ${this.renderLoader()}
1352
1390
  ${this.showNoResults && !this.optionsLoading && !this.loading
1353
1391
  ? this.renderEmptyState()
1354
1392
  : isGrid
1355
1393
  ? ComboboxRenderer.renderVirtualizedGrid(virtualItems, totalSize, this.filteredData, this.value, this.multiple, this.gridColumns, this.getDisplayText.bind(this), this.getItemValue.bind(this), this.optionsLoading || this.loading, this.allowHtmlLabel, this.renderItemConfig?.getDescription ? this.getItemDescription.bind(this) : undefined, this.renderItemConfig?.getPrefix ? this.getItemPrefix.bind(this) : undefined, this.renderItemConfig?.getSuffix ? this.getItemSuffix.bind(this) : undefined, this.isBidirectionalGrid ? this.gridColumnWidth : undefined)
1356
1394
  : grouped
1357
1395
  ? (useVirtual
1358
- ? ComboboxRenderer.renderRowsVirtualized(virtualItems, totalSize, this.filteredRows, this.value, this.multiple, this.getDisplayText.bind(this), this.getItemValue.bind(this), this.optionsLoading || this.loading, this.allowHtmlLabel, this.renderItemConfig?.getDescription ? this.getItemDescription.bind(this) : undefined, this.renderItemConfig?.getPrefix ? this.getItemPrefix.bind(this) : undefined, this.renderItemConfig?.getSuffix ? this.getItemSuffix.bind(this) : undefined)
1396
+ ? ComboboxRenderer.renderRowsVirtualized(virtualItems, totalSize, this.filteredRows, this.value, this.multiple, this.getDisplayText.bind(this), this.getItemValue.bind(this), this.optionsLoading || this.loading, this.allowHtmlLabel, this.renderItemConfig?.getDescription ? this.getItemDescription.bind(this) : undefined, this.renderItemConfig?.getPrefix ? this.getItemPrefix.bind(this) : undefined, this.renderItemConfig?.getSuffix ? this.getItemSuffix.bind(this) : undefined, undefined, this.renderStickyHeaderOverlay(), this.stickyGroupHeader ? this.stickyHeaderIndex : -1)
1359
1397
  : ComboboxRenderer.renderRowsPlain(this.filteredRows, this.value, this.multiple, this.getDisplayText.bind(this), this.getItemValue.bind(this), this.showNoResults, this.noResultsMessage, this.optionsLoading || this.loading, this.onScroll.bind(this), this.allowHtmlLabel, this.renderItemConfig?.getDescription ? this.getItemDescription.bind(this) : undefined, this.renderItemConfig?.getPrefix ? this.getItemPrefix.bind(this) : undefined, this.renderItemConfig?.getSuffix ? this.getItemSuffix.bind(this) : undefined, undefined, this.hasActiveFilter ? this.noResultsSubtitle : undefined))
1360
1398
  : useVirtual
1361
- ? ComboboxRenderer.renderVirtualizedOptions(virtualItems, totalSize, this.filteredData, this.value, this.multiple, this.getDisplayText.bind(this), this.getItemValue.bind(this), this.optionsLoading || this.loading, this.allowHtmlLabel, virtualizer.measureElement, this.renderItemConfig?.getDescription ? this.getItemDescription.bind(this) : undefined, this.renderItemConfig?.getPrefix ? this.getItemPrefix.bind(this) : undefined, this.renderItemConfig?.getSuffix ? this.getItemSuffix.bind(this) : undefined)
1399
+ ? ComboboxRenderer.renderVirtualizedOptions(virtualItems, totalSize, this.filteredData, this.value, this.multiple, this.getDisplayText.bind(this), this.getItemValue.bind(this), this.optionsLoading || this.loading, this.allowHtmlLabel, this.renderItemConfig?.getDescription ? this.getItemDescription.bind(this) : undefined, this.renderItemConfig?.getPrefix ? this.getItemPrefix.bind(this) : undefined, this.renderItemConfig?.getSuffix ? this.getItemSuffix.bind(this) : undefined)
1362
1400
  : ComboboxRenderer.renderPlainOptions(this.filteredData, this.value, this.multiple, this.getDisplayText.bind(this), this.getItemValue.bind(this), this.showNoResults, this.noResultsMessage, this.optionsLoading || this.loading, this.onScroll.bind(this), this.allowHtmlLabel, this.renderItemConfig?.getDescription ? this.getItemDescription.bind(this) : undefined, this.renderItemConfig?.getPrefix ? this.getItemPrefix.bind(this) : undefined, this.renderItemConfig?.getSuffix ? this.getItemSuffix.bind(this) : undefined, undefined, this.hasActiveFilter ? this.noResultsSubtitle : undefined)}
1363
1401
  ${showAddOption ? html `
1364
1402
  <div @mouseup=${(e) => { e.stopPropagation(); this.addCustomValue(this.searchValue.trim()); }}>
1365
1403
  ${ComboboxRenderer.renderAddCustomOption(this.searchValue.trim(), this.multiple)}
1366
1404
  </div>
1367
1405
  ` : ''}
1406
+ </div>
1368
1407
  ${this.multiple && this.showFooter && !this.selectAllEnabled ? this.renderFooter() : ''}
1369
1408
  </div>
1370
1409
  `;