@nanoporetech-digital/components 2.14.0 → 2.14.2

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 (64) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/nano-field-validator.cjs.entry.js +30 -19
  3. package/dist/cjs/nano-field-validator.cjs.entry.js.map +1 -1
  4. package/dist/cjs/nano-nav-item_2.cjs.entry.js +2 -0
  5. package/dist/cjs/nano-nav-item_2.cjs.entry.js.map +1 -1
  6. package/dist/collection/components/accordion/accordion.js +1 -1
  7. package/dist/collection/components/alert/alert.js +1 -1
  8. package/dist/collection/components/algolia/algolia-filter.js +2 -2
  9. package/dist/collection/components/algolia/algolia-input.js +5 -5
  10. package/dist/collection/components/algolia/algolia-results.js +1 -1
  11. package/dist/collection/components/algolia/algolia.js +6 -6
  12. package/dist/collection/components/checkbox/checkbox-group.js +2 -2
  13. package/dist/collection/components/checkbox/checkbox.js +3 -3
  14. package/dist/collection/components/datalist/datalist.js +1 -1
  15. package/dist/collection/components/date-input/date-input.js +8 -8
  16. package/dist/collection/components/date-picker/date-picker.js +5 -5
  17. package/dist/collection/components/details/details.js +1 -1
  18. package/dist/collection/components/dialog/dialog.js +1 -1
  19. package/dist/collection/components/dropdown/dropdown.js +1 -1
  20. package/dist/collection/components/field-validator/field-validator.js +36 -25
  21. package/dist/collection/components/field-validator/field-validator.js.map +1 -1
  22. package/dist/collection/components/file-upload/file-upload.js +4 -4
  23. package/dist/collection/components/global-nav/global-nav.js +4 -4
  24. package/dist/collection/components/grid/grid-item.js +1 -1
  25. package/dist/collection/components/icon/icon.js +1 -1
  26. package/dist/collection/components/input/input.js +5 -5
  27. package/dist/collection/components/nav-item/nav-item.js +4 -4
  28. package/dist/collection/components/range/range.js +4 -4
  29. package/dist/collection/components/resize-observe/resize-observe.js +1 -1
  30. package/dist/collection/components/select/select.js +9 -7
  31. package/dist/collection/components/select/select.js.map +1 -1
  32. package/dist/collection/components/slides/slides.js +7 -7
  33. package/dist/collection/components/tabs/tab-group.js +2 -2
  34. package/dist/components/nano-field-validator.js +30 -19
  35. package/dist/components/nano-field-validator.js.map +1 -1
  36. package/dist/components/select.js +2 -0
  37. package/dist/components/select.js.map +1 -1
  38. package/dist/custom-elements/index.js +32 -19
  39. package/dist/custom-elements/index.js.map +1 -1
  40. package/dist/esm/nano-field-validator.entry.js +30 -19
  41. package/dist/esm/nano-field-validator.entry.js.map +1 -1
  42. package/dist/esm/nano-nav-item_2.entry.js +2 -0
  43. package/dist/esm/nano-nav-item_2.entry.js.map +1 -1
  44. package/dist/esm-es5/nano-field-validator.entry.js +1 -1
  45. package/dist/esm-es5/nano-field-validator.entry.js.map +1 -1
  46. package/dist/esm-es5/nano-nav-item_2.entry.js +1 -1
  47. package/dist/esm-es5/nano-nav-item_2.entry.js.map +1 -1
  48. package/dist/nano-components/nano-components.esm.js +1 -1
  49. package/dist/nano-components/{p-a1108493.entry.js → p-3f51bdf5.entry.js} +2 -2
  50. package/dist/nano-components/p-3f51bdf5.entry.js.map +1 -0
  51. package/dist/nano-components/{p-f268fe08.system.entry.js → p-3f9c097b.system.entry.js} +2 -2
  52. package/dist/nano-components/p-3f9c097b.system.entry.js.map +1 -0
  53. package/dist/nano-components/p-3fcb6eea.entry.js +5 -0
  54. package/dist/nano-components/p-3fcb6eea.entry.js.map +1 -0
  55. package/dist/nano-components/p-53957ec6.system.js +1 -1
  56. package/dist/nano-components/{p-e8c4ca40.system.entry.js → p-e7628969.system.entry.js} +2 -2
  57. package/dist/nano-components/p-e7628969.system.entry.js.map +1 -0
  58. package/docs-json.json +1 -1
  59. package/package.json +2 -2
  60. package/dist/nano-components/p-0a1d463e.entry.js +0 -5
  61. package/dist/nano-components/p-0a1d463e.entry.js.map +0 -1
  62. package/dist/nano-components/p-a1108493.entry.js.map +0 -1
  63. package/dist/nano-components/p-e8c4ca40.system.entry.js.map +0 -1
  64. package/dist/nano-components/p-f268fe08.system.entry.js.map +0 -1
@@ -13266,9 +13266,16 @@ let FieldValidator = class extends H {
13266
13266
  // field update has come programmatically (not from ui),
13267
13267
  // so let's update the underlying ui field
13268
13268
  if (found &&
13269
+ (found.tagName === 'NANO-CHECKBOX' ||
13270
+ ['radio', 'checkbox'].includes(found.type))) {
13271
+ // it's a cb - always change
13272
+ this.storeToFields([found]);
13273
+ }
13274
+ else if (found &&
13269
13275
  ((found.tagName === 'NANO-FILE-UPLOAD' &&
13270
13276
  !this.fileStateEqual(key, found)) ||
13271
13277
  (found.tagName !== 'NANO-FILE-UPLOAD' && found.value !== newVal))) {
13278
+ // not a cb. Only change if value is different
13272
13279
  this.storeToFields([found]);
13273
13280
  }
13274
13281
  if (this.validateOn === 'dirty' && this.dirty) {
@@ -13478,9 +13485,7 @@ let FieldValidator = class extends H {
13478
13485
  */
13479
13486
  async setStore(state) {
13480
13487
  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;
13488
+ this.store.state[key] = val;
13484
13489
  });
13485
13490
  }
13486
13491
  /**
@@ -13554,29 +13559,35 @@ let FieldValidator = class extends H {
13554
13559
  return;
13555
13560
  if (field.tagName === 'NANO-CHECKBOX' ||
13556
13561
  ['radio', 'checkbox'].includes(field.type)) {
13557
- let cb = field;
13558
- if (cb.type === 'radio' ||
13559
- cb.type === 'segment' ||
13560
- cb.type === 'segment-pill') {
13562
+ let cbs = this.allFields.filter((f) => this.getName(field) === this.getName(f));
13563
+ if (cbs[0].type === 'radio' ||
13564
+ cbs[0].type === 'segment' ||
13565
+ cbs[0].type === 'segment-pill') {
13561
13566
  // single radio type control
13562
- if (this._store.state[fieldName] === cb.value)
13563
- cb.checked = true;
13564
- else
13565
- cb.checked = false;
13567
+ cbs.forEach((cb) => {
13568
+ if (this._store.state[fieldName] === cb.value)
13569
+ cb.checked = true;
13570
+ else
13571
+ cb.checked = false;
13572
+ });
13566
13573
  }
13567
13574
  else if (Array.isArray(this._store.state[fieldName])) {
13568
13575
  // multiple checkbox like controls
13569
- if (this._store.state[fieldName].includes(cb.value))
13570
- cb.checked = true;
13571
- else
13572
- cb.checked = false;
13576
+ cbs.forEach((cb) => {
13577
+ if (this._store.state[fieldName].includes(cb.value))
13578
+ cb.checked = true;
13579
+ else
13580
+ cb.checked = false;
13581
+ });
13573
13582
  }
13574
13583
  else {
13575
13584
  // single checkbox like control
13576
- if (this._store.state[fieldName] === cb.value)
13577
- cb.checked = true;
13578
- else
13579
- cb.checked = false;
13585
+ cbs.forEach((cb) => {
13586
+ if (this._store.state[fieldName] === cb.value)
13587
+ cb.checked = true;
13588
+ else
13589
+ cb.checked = false;
13590
+ });
13580
13591
  }
13581
13592
  return;
13582
13593
  }
@@ -18763,6 +18774,8 @@ let Select = class extends H {
18763
18774
  /** nano-dropdown config options you can pass to the nested dropdown component */
18764
18775
  this.dropDownConfig = {};
18765
18776
  this.customValidate = () => {
18777
+ if (!this.nativeSelect)
18778
+ return;
18766
18779
  this.nativeSelect.setCustomValidity('');
18767
18780
  // add custom validations 'cos html5 validations are a bit rubbish on selects
18768
18781
  if (this.required && !this.valArray.length) {