@nanoporetech-digital/components 2.13.1 → 2.14.0

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 (83) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/cjs/nano-datalist_3.cjs.entry.js +13 -5
  3. package/dist/cjs/nano-datalist_3.cjs.entry.js.map +1 -1
  4. package/dist/cjs/nano-field-validator.cjs.entry.js +10 -6
  5. package/dist/cjs/nano-field-validator.cjs.entry.js.map +1 -1
  6. package/dist/cjs/nano-nav-item_2.cjs.entry.js +0 -1
  7. package/dist/cjs/nano-nav-item_2.cjs.entry.js.map +1 -1
  8. package/dist/collection/components/accordion/accordion.js +1 -1
  9. package/dist/collection/components/alert/alert.js +1 -1
  10. package/dist/collection/components/algolia/algolia-filter.js +2 -2
  11. package/dist/collection/components/algolia/algolia-input.js +5 -5
  12. package/dist/collection/components/algolia/algolia-results.js +1 -1
  13. package/dist/collection/components/algolia/algolia.js +6 -6
  14. package/dist/collection/components/checkbox/checkbox-group.js +2 -2
  15. package/dist/collection/components/checkbox/checkbox.js +3 -3
  16. package/dist/collection/components/datalist/datalist.js +14 -6
  17. package/dist/collection/components/datalist/datalist.js.map +1 -1
  18. package/dist/collection/components/date-input/date-input.js +8 -8
  19. package/dist/collection/components/date-picker/date-picker.js +5 -5
  20. package/dist/collection/components/details/details.js +1 -1
  21. package/dist/collection/components/dialog/dialog.js +1 -1
  22. package/dist/collection/components/dropdown/dropdown.js +1 -1
  23. package/dist/collection/components/field-validator/field-validator.js +16 -12
  24. package/dist/collection/components/field-validator/field-validator.js.map +1 -1
  25. package/dist/collection/components/file-upload/file-upload.js +4 -4
  26. package/dist/collection/components/global-nav/global-nav.js +4 -4
  27. package/dist/collection/components/grid/grid-item.js +1 -1
  28. package/dist/collection/components/icon/icon.js +1 -1
  29. package/dist/collection/components/input/input.js +5 -5
  30. package/dist/collection/components/nav-item/nav-item.js +4 -4
  31. package/dist/collection/components/range/range.js +4 -4
  32. package/dist/collection/components/resize-observe/resize-observe.js +1 -1
  33. package/dist/collection/components/select/select.js +7 -9
  34. package/dist/collection/components/select/select.js.map +1 -1
  35. package/dist/collection/components/slides/slides.js +7 -7
  36. package/dist/collection/components/tabs/tab-group.js +2 -2
  37. package/dist/components/datalist.js +13 -4
  38. package/dist/components/datalist.js.map +1 -1
  39. package/dist/components/nano-field-validator.js +10 -6
  40. package/dist/components/nano-field-validator.js.map +1 -1
  41. package/dist/components/select.js +0 -1
  42. package/dist/components/select.js.map +1 -1
  43. package/dist/custom-elements/index.js +22 -11
  44. package/dist/custom-elements/index.js.map +1 -1
  45. package/dist/esm/nano-datalist_3.entry.js +13 -5
  46. package/dist/esm/nano-datalist_3.entry.js.map +1 -1
  47. package/dist/esm/nano-field-validator.entry.js +10 -6
  48. package/dist/esm/nano-field-validator.entry.js.map +1 -1
  49. package/dist/esm/nano-nav-item_2.entry.js +0 -1
  50. package/dist/esm/nano-nav-item_2.entry.js.map +1 -1
  51. package/dist/esm-es5/nano-datalist_3.entry.js +2 -2
  52. package/dist/esm-es5/nano-datalist_3.entry.js.map +1 -1
  53. package/dist/esm-es5/nano-field-validator.entry.js +1 -1
  54. package/dist/esm-es5/nano-field-validator.entry.js.map +1 -1
  55. package/dist/esm-es5/nano-nav-item_2.entry.js +1 -1
  56. package/dist/esm-es5/nano-nav-item_2.entry.js.map +1 -1
  57. package/dist/nano-components/nano-components.esm.js +1 -1
  58. package/dist/nano-components/p-0a1d463e.entry.js +5 -0
  59. package/dist/nano-components/p-0a1d463e.entry.js.map +1 -0
  60. package/dist/nano-components/p-53957ec6.system.js +1 -1
  61. package/dist/nano-components/p-6ce533f1.system.entry.js +5 -0
  62. package/dist/nano-components/p-6ce533f1.system.entry.js.map +1 -0
  63. package/dist/nano-components/{p-ed0bdea9.entry.js → p-a1108493.entry.js} +2 -2
  64. package/dist/nano-components/p-a1108493.entry.js.map +1 -0
  65. package/dist/nano-components/{p-cb512cff.system.entry.js → p-e8c4ca40.system.entry.js} +2 -2
  66. package/dist/nano-components/p-e8c4ca40.system.entry.js.map +1 -0
  67. package/dist/nano-components/p-f0e9397c.entry.js +5 -0
  68. package/dist/nano-components/p-f0e9397c.entry.js.map +1 -0
  69. package/dist/nano-components/p-f268fe08.system.entry.js +5 -0
  70. package/dist/nano-components/p-f268fe08.system.entry.js.map +1 -0
  71. package/dist/types/components/datalist/datalist.d.ts +1 -0
  72. package/docs-json.json +1 -1
  73. package/package.json +2 -2
  74. package/dist/nano-components/p-085e03db.system.entry.js +0 -5
  75. package/dist/nano-components/p-085e03db.system.entry.js.map +0 -1
  76. package/dist/nano-components/p-32900c91.entry.js +0 -5
  77. package/dist/nano-components/p-32900c91.entry.js.map +0 -1
  78. package/dist/nano-components/p-aa84c727.system.entry.js +0 -5
  79. package/dist/nano-components/p-aa84c727.system.entry.js.map +0 -1
  80. package/dist/nano-components/p-cb512cff.system.entry.js.map +0 -1
  81. package/dist/nano-components/p-e35226a9.entry.js +0 -5
  82. package/dist/nano-components/p-e35226a9.entry.js.map +0 -1
  83. package/dist/nano-components/p-ed0bdea9.entry.js.map +0 -1
@@ -8974,7 +8974,7 @@ let DataList = class extends H {
8974
8974
  e.stopPropagation();
8975
8975
  this.changeInputValue(e.detail);
8976
8976
  raf(() => this.inputChange());
8977
- if (this.type === 'select')
8977
+ if (this.type !== 'selctMulti')
8978
8978
  this.shouldOpen = false;
8979
8979
  };
8980
8980
  // sets focus immediately on open when 'select' - mirroring native behaviour
@@ -8986,6 +8986,14 @@ let DataList = class extends H {
8986
8986
  else if (this.type === 'select')
8987
8987
  this.listBox.showActiveElement();
8988
8988
  };
8989
+ this.handleHide = () => {
8990
+ this.open = false;
8991
+ const activeElement = getActiveElement();
8992
+ if (activeElement === document.body ||
8993
+ activeElement.closest(this.host.tagName.toLowerCase())) {
8994
+ this.connectedInput.focus();
8995
+ }
8996
+ };
8989
8997
  this.inputClick = () => {
8990
8998
  this.shouldOpen = true;
8991
8999
  // open dropdown if possible
@@ -9166,8 +9174,8 @@ let DataList = class extends H {
9166
9174
  let autocompleteType = 'both';
9167
9175
  let readonly = false;
9168
9176
  switch (this.type) {
9169
- case 'selctMulti':
9170
- // dwConfig.closeOnSelect = false;
9177
+ case 'input':
9178
+ dwConfig = { closeOnSelect: true };
9171
9179
  break;
9172
9180
  case 'select':
9173
9181
  autocompleteType = 'list';
@@ -9389,7 +9397,7 @@ let DataList = class extends H {
9389
9397
  return (h$1(Host$1, { role: "listbox", "aria-owns": this.optionIds.join(' '), "aria-label": "Select options from the list below" }, h$1("nano-dropdown", Object.assign({}, this.dropDownConfig, { ref: (el) => (this.nanoDropdown = el), dialogTitle: "Select options from the list below", class: {
9390
9398
  dlist__dropdown: true,
9391
9399
  'dlist--isfiltered': this.isFiltered,
9392
- }, onNanoAfterShow: this.handleShow, onNanoAfterHide: (_) => (this.open = false) }), h$1("nano-menu", { hidden: !this.actvOptEles.length, type: "listbox", label: this.inputLabel ? this.inputLabel.textContent : undefined, class: {
9400
+ }, onNanoAfterShow: this.handleShow, onNanoAfterHide: this.handleHide }), h$1("nano-menu", { hidden: !this.actvOptEles.length, type: "listbox", label: this.inputLabel ? this.inputLabel.textContent : undefined, class: {
9393
9401
  dlist__menu: true,
9394
9402
  'dlist__menu--open': this.dropwdownOpen,
9395
9403
  }, tabIndex: -1, onNanoSelect: this.optSelected, onKeyDown: this.optionKeyDown, ref: (el) => (this.listBox = el) }, h$1("slot", { name: "list-top" }), !this.options.length && h$1("slot", null), !!this.options.length && h$1("slot", { name: "internal-opts" }), h$1("slot", { name: "list-bottom" })), h$1("nano-menu", { type: "listbox", label: "No results found", hidden: !!this.actvOptEles.length, class: {
@@ -13257,10 +13265,10 @@ let FieldValidator = class extends H {
13257
13265
  const found = this.allFields.find((field) => this.getName(field) === key);
13258
13266
  // field update has come programmatically (not from ui),
13259
13267
  // so let's update the underlying ui field
13260
- if ((found &&
13261
- found.tagName === 'NANO-FILE-UPLOAD' &&
13262
- !this.fileStateEqual(key, found)) ||
13263
- (found.tagName !== 'NANO-FILE-UPLOAD' && found.value !== newVal)) {
13268
+ if (found &&
13269
+ ((found.tagName === 'NANO-FILE-UPLOAD' &&
13270
+ !this.fileStateEqual(key, found)) ||
13271
+ (found.tagName !== 'NANO-FILE-UPLOAD' && found.value !== newVal))) {
13264
13272
  this.storeToFields([found]);
13265
13273
  }
13266
13274
  if (this.validateOn === 'dirty' && this.dirty) {
@@ -13469,7 +13477,11 @@ let FieldValidator = class extends H {
13469
13477
  * @param state - the state to load in the store
13470
13478
  */
13471
13479
  async setStore(state) {
13472
- Object.entries(state).forEach(([key, val]) => (this.store.state[key] = val));
13480
+ Object.entries(state).forEach(([key, val]) => {
13481
+ const found = this.allFields.find((field) => this.getName(field) === key);
13482
+ if (found)
13483
+ this.store.state[key] = val;
13484
+ });
13473
13485
  }
13474
13486
  /**
13475
13487
  * Sets custom validity for all / some form fields.
@@ -13595,7 +13607,7 @@ let FieldValidator = class extends H {
13595
13607
  if (cb.checked)
13596
13608
  this._store.state[fieldName] = cb.value;
13597
13609
  }
13598
- else if (this.allFields.filter((f) => !!this.getName(field) &&
13610
+ else if (this.allFields.filter((f) => this.getName(f) === fieldName &&
13599
13611
  (f.tagName === 'NANO-CHECKBOX' ||
13600
13612
  f.type === 'checkbox')).length > 1) {
13601
13613
  // multiple checkbox type control
@@ -18803,7 +18815,6 @@ let Select = class extends H {
18803
18815
  e.preventDefault();
18804
18816
  if (!this.multiple) {
18805
18817
  this.value = e.detail.value;
18806
- this.inputCtrl.focus();
18807
18818
  return;
18808
18819
  }
18809
18820
  if (this.value && this.value.length && this.value.includes(e.detail.value))