@haiilo/catalyst 5.0.0 → 5.0.1

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.
@@ -5561,13 +5561,13 @@ const CatSelect = class {
5561
5561
  }
5562
5562
  }
5563
5563
  onStateChange(newState, oldState) {
5564
- var _a;
5564
+ var _a, _b;
5565
5565
  const changed = (key) => newState[key] !== oldState[key];
5566
- if (changed('activeOptionIndex')) {
5567
- if (this.state.activeOptionIndex >= 0) {
5568
- const option = (_a = this.dropdown) === null || _a === void 0 ? void 0 : _a.querySelector(`#select-${this.id}-option-${this.state.activeOptionIndex}`);
5569
- option === null || option === void 0 ? void 0 : option.scrollIntoView({ block: 'nearest' });
5570
- }
5566
+ if (changed('isOpen')) {
5567
+ this.update();
5568
+ }
5569
+ if (changed('activeOptionIndex') && this.state.activeOptionIndex >= 0) {
5570
+ (_b = (_a = this.dropdown) === null || _a === void 0 ? void 0 : _a.querySelector(`#select-${this.id}-option-${this.state.activeOptionIndex}`)) === null || _b === void 0 ? void 0 : _b.scrollIntoView({ block: 'nearest' });
5571
5571
  }
5572
5572
  if (changed('selection')) {
5573
5573
  let newValue;
@@ -5611,6 +5611,9 @@ const CatSelect = class {
5611
5611
  if (this.input) {
5612
5612
  autosizeInput(this.input);
5613
5613
  }
5614
+ if (this.trigger && this.dropdown) {
5615
+ autoUpdate(this.trigger, this.dropdown, () => this.update());
5616
+ }
5614
5617
  }
5615
5618
  componentWillRender() {
5616
5619
  this.watchErrorsHandler(this.errors);
@@ -5835,17 +5838,12 @@ const CatSelect = class {
5835
5838
  this.catOpen.emit();
5836
5839
  this.term$.next(this.state.term);
5837
5840
  (_a = this.input) === null || _a === void 0 ? void 0 : _a.classList.remove('select-input-transparent-caret');
5838
- if (this.trigger && this.dropdown) {
5839
- this.cleanupAutoUpdate = autoUpdate(this.trigger, this.dropdown, () => this.update());
5840
- }
5841
5841
  }
5842
5842
  }
5843
5843
  hide() {
5844
- var _a;
5845
5844
  if (this.state.isOpen) {
5846
5845
  this.patchState({ isOpen: false, activeOptionIndex: -1 });
5847
5846
  this.catClose.emit();
5848
- (_a = this.cleanupAutoUpdate) === null || _a === void 0 ? void 0 : _a.call(this);
5849
5847
  }
5850
5848
  }
5851
5849
  search(term) {
@@ -6237,7 +6235,7 @@ const CatSelectTest = class {
6237
6235
  setTimeout(() => this.multipleSelect && (this.multipleSelect.value = []), 5000);
6238
6236
  }
6239
6237
  render() {
6240
- return (index.h(index.Host, { style: { display: 'flex', flexDirection: 'column' } }, index.h("cat-select", { label: "Multiple Select", hint: "This is a hint!", ref: el => (this.multipleSelect = el), value: ['1'], placeholder: "Hello World", onCatChange: () => { var _a; return console.log('Multiple change', (_a = this.multipleSelect) === null || _a === void 0 ? void 0 : _a.value); }, onCatBlur: e => console.log('Multiple blur', e), multiple: true, noItems: "No results", clearable: true }, index.h("span", { slot: "hint" }, "Searching for \"no\" -", '>', " no options are returned!")), index.h("cat-select", { label: "Multiple with img", ref: el => (this.multipleSelectAvatar = el), value: ['1'], placeholder: "Hello World", multiple: true, clearable: true }), index.h("cat-select", { label: "Multiple with initials", ref: el => (this.multipleSelectAvatarInitials = el), value: ['1'], placeholder: "Hello World", multiple: true, clearable: true }), index.h("cat-select", { label: "Multiple with tagging support", hint: "This is a hint!", ref: el => (this.multipleSelectTagging = el), value: { ids: ['1'], tags: ['Test', 'Albania', 'Algeria'] }, placeholder: "Select country", onCatChange: () => { var _a; return console.log('Multiple tagging change', (_a = this.multipleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, multiple: true, tags: true, clearable: true }), index.h("cat-select", { label: "Single Select", hint: "This is a hint!", ref: el => (this.singleSelect = el), placeholder: "Search for a country or capital", onCatBlur: e => console.log('Single blur', e), clearable: true }), index.h("cat-select", { label: "Single with img", ref: el => (this.singleSelectAvatar = el), value: '1', placeholder: "Search for a country or capital", clearable: true }), index.h("cat-select", { label: "Single with initials", ref: el => (this.singleSelectAvatarInitials = el), placeholder: "Hello World", clearable: true }), index.h("cat-dropdown", { overflow: true, noAutoClose: true }, index.h("cat-button", { slot: "trigger", style: { width: '50%' } }, "Open select"), index.h("div", { slot: "content", style: { width: '400px' } }, index.h("cat-select", { label: "Single with tagging support", ref: el => (this.singleSelectTagging = el), value: { id: '', tag: 'Albania' }, placeholder: "Search for a country or capital", onCatChange: () => { var _a; return console.log('Single change', (_a = this.singleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, tagHint: "new country", tags: true, clearable: true, style: { width: '90%' } })))));
6238
+ return (index.h(index.Host, { style: { display: 'flex', flexDirection: 'column' } }, index.h("cat-select", { label: "Multiple Select", hint: "This is a hint!", ref: el => (this.multipleSelect = el), value: ['1'], placeholder: "Hello World", onCatChange: () => { var _a; return console.log('Multiple change', (_a = this.multipleSelect) === null || _a === void 0 ? void 0 : _a.value); }, onCatBlur: e => console.log('Multiple blur', e), multiple: true, noItems: "No results", clearable: true, errorUpdate: false }, index.h("span", { slot: "hint" }, "Searching for \"no\" -", '>', " no options are returned!")), index.h("cat-select", { label: "Multiple with img", ref: el => (this.multipleSelectAvatar = el), value: ['1'], placeholder: "Hello World", multiple: true, clearable: true, errorUpdate: false }), index.h("cat-select", { label: "Multiple with initials", ref: el => (this.multipleSelectAvatarInitials = el), value: ['1'], placeholder: "Hello World", multiple: true, clearable: true, errorUpdate: false }), index.h("cat-select", { label: "Multiple with tagging support", hint: "This is a hint!", ref: el => (this.multipleSelectTagging = el), value: { ids: ['1'], tags: ['Test', 'Albania', 'Algeria'] }, placeholder: "Select country", onCatChange: () => { var _a; return console.log('Multiple tagging change', (_a = this.multipleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, multiple: true, tags: true, clearable: true, errorUpdate: false }), index.h("cat-select", { label: "Single Select", hint: "This is a hint!", ref: el => (this.singleSelect = el), placeholder: "Search for a country or capital", onCatBlur: e => console.log('Single blur', e), clearable: true, errorUpdate: false }), index.h("cat-select", { label: "Single with img", ref: el => (this.singleSelectAvatar = el), value: '1', placeholder: "Search for a country or capital", clearable: true, errorUpdate: false }), index.h("cat-select", { label: "Single with initials", ref: el => (this.singleSelectAvatarInitials = el), placeholder: "Hello World", clearable: true, errorUpdate: false }), index.h("cat-dropdown", { overflow: true, noAutoClose: true }, index.h("cat-button", { slot: "trigger", style: { width: '50%' } }, "Open select"), index.h("div", { slot: "content", style: { width: '400px' } }, index.h("cat-select", { label: "Single with tagging support", ref: el => (this.singleSelectTagging = el), value: { id: '', tag: 'Albania' }, placeholder: "Search for a country or capital", onCatChange: () => { var _a; return console.log('Single change', (_a = this.singleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, tagHint: "new country", tags: true, clearable: true, errorUpdate: false, style: { width: '90%' } })))));
6241
6239
  }
6242
6240
  get countryConnector() {
6243
6241
  return {