revotech-ui-kit 0.0.20-4 → 0.0.20-5

Sign up to get free protection for your applications and to get access to all the features.
@@ -6727,7 +6727,7 @@ let R = class extends h {
6727
6727
  super(...arguments), this.isOpen = !1, this.selectedValue = "", this.searchTerm = "", this.focusedIndex = -1, this.filteredItems = [], this.label = "Select an item", this.items = [];
6728
6728
  }
6729
6729
  firstUpdated(e) {
6730
- console.log("this. items", this.items), this.items && this.items.length > 0 && (this.filteredItems = this.items.filter(
6730
+ console.log("this. items firstUpdated", this.items), this.items && this.items.length > 0 && (this.filteredItems = this.items.filter(
6731
6731
  (t) => t.toLowerCase().includes(this.searchTerm)
6732
6732
  ));
6733
6733
  }
@@ -6735,6 +6735,7 @@ let R = class extends h {
6735
6735
  this.isOpen = !this.isOpen, this.focusedIndex = -1, console.log("toggleDropdown", this.isOpen);
6736
6736
  }
6737
6737
  selectItem(e) {
6738
+ console.log("selectItem");
6738
6739
  const t = e.target;
6739
6740
  if (t instanceof HTMLElement) {
6740
6741
  const o = t.closest(
@@ -6748,10 +6749,12 @@ let R = class extends h {
6748
6749
  console.log("-----handleInputClick------"), this.toggleDropdown();
6749
6750
  }
6750
6751
  handleSearch(e) {
6752
+ console.log("handleSearch");
6751
6753
  const t = e.target;
6752
6754
  this.searchTerm = t.value, this.filteredItems = this.items.filter((o) => o.toLowerCase().includes(this.searchTerm.toLowerCase()));
6753
6755
  }
6754
6756
  handleKeyDown(e) {
6757
+ console.log("handleKeyDown");
6755
6758
  const t = this.filteredItems.length;
6756
6759
  switch (e.key) {
6757
6760
  case "ArrowDown":
@@ -6766,7 +6769,7 @@ let R = class extends h {
6766
6769
  }
6767
6770
  }
6768
6771
  handleMouseOver(e, t) {
6769
- e.preventDefault(), this.focusedIndex = t;
6772
+ console.log("handleMouseOver"), e.preventDefault(), this.focusedIndex = t;
6770
6773
  }
6771
6774
  connectedCallback() {
6772
6775
  var e, t, o, s;
@@ -6778,12 +6781,13 @@ let R = class extends h {
6778
6781
  }
6779
6782
  disconnectedCallback() {
6780
6783
  var e, t, o, s;
6781
- super.disconnectedCallback(), document.removeEventListener("click", this.handleClickOutside), (t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("input")) == null || t.removeEventListener("focus", () => {
6784
+ console.log("disconnectedCallback"), super.disconnectedCallback(), document.removeEventListener("click", this.handleClickOutside), (t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("input")) == null || t.removeEventListener("focus", () => {
6782
6785
  }), (s = (o = this.shadowRoot) == null ? void 0 : o.querySelector("input")) == null || s.removeEventListener("blur", () => {
6783
6786
  });
6784
6787
  }
6785
6788
  handleClickOutside(e) {
6786
6789
  var r, i;
6790
+ console.log("handleClickOutside");
6787
6791
  const t = e.target, o = (r = this.shadowRoot) == null ? void 0 : r.querySelector(
6788
6792
  "[data-hs-combo-box]"
6789
6793
  );
@@ -6799,7 +6803,7 @@ let R = class extends h {
6799
6803
  (!o || !o.contains(s)) && (this.isOpen = !1);
6800
6804
  }
6801
6805
  updateFocus() {
6802
- if (!this.shadowRoot)
6806
+ if (console.log("updateFocus"), !this.shadowRoot)
6803
6807
  return;
6804
6808
  this.shadowRoot.querySelectorAll("rtg-combo-box-item").forEach((t, o) => {
6805
6809
  o === this.focusedIndex ? t.classList.add("bg-gray-100") : t.classList.remove("bg-gray-100");
@@ -3138,7 +3138,7 @@ body {
3138
3138
  </div>
3139
3139
  <slot></slot>
3140
3140
  </div>
3141
- `}};be.styles=[l.css``,c],We([d.property({attribute:"data-state",type:String})],be.prototype,"state",2),We([d.state()],be.prototype,"isOpen",2),be=We([d.customElement("rtg-combo-box-list")],be);var In=Object.defineProperty,An=Object.getOwnPropertyDescriptor,U=(n,e,r,o)=>{for(var t=o>1?void 0:o?An(e,r):e,s=n.length-1,i;s>=0;s--)(i=n[s])&&(t=(o?i(e,r,t):i(t))||t);return o&&t&&In(e,r,t),t};a.ComboBox=class extends l.LitElement{constructor(){super(...arguments),this.isOpen=!1,this.selectedValue="",this.searchTerm="",this.focusedIndex=-1,this.filteredItems=[],this.label="Select an item",this.items=[]}firstUpdated(e){console.log("this. items",this.items),this.items&&this.items.length>0&&(this.filteredItems=this.items.filter(r=>r.toLowerCase().includes(this.searchTerm)))}toggleDropdown(){this.isOpen=!this.isOpen,this.focusedIndex=-1,console.log("toggleDropdown",this.isOpen)}selectItem(e){const r=e.target;if(r instanceof HTMLElement){const o=r.closest("rtg-combo-box-item");o?(this.selectedValue=o.getAttribute("data-hs-combo-box-value")||"",this.isOpen=!1):console.log("No valid rtg-combo-box-item found")}else console.log("Event target is not an HTMLElement")}handleInputClick(){console.log("-----handleInputClick------"),this.toggleDropdown()}handleSearch(e){const r=e.target;this.searchTerm=r.value,this.filteredItems=this.items.filter(o=>o.toLowerCase().includes(this.searchTerm.toLowerCase()))}handleKeyDown(e){const r=this.filteredItems.length;switch(e.key){case"ArrowDown":e.preventDefault(),this.focusedIndex=(this.focusedIndex+1)%r;break;case"ArrowUp":e.preventDefault(),this.focusedIndex=(this.focusedIndex-1+r)%r;break;case"Enter":this.focusedIndex>=0&&this.focusedIndex<r&&(this.selectedValue=this.filteredItems[this.focusedIndex],this.isOpen=!1);break}}handleMouseOver(e,r){e.preventDefault(),this.focusedIndex=r}connectedCallback(){var e,r,o,t;super.connectedCallback(),console.log("connectedCallback"),document.addEventListener("click",this.handleClickOutside.bind(this)),console.log("connectedCallback click"),(r=(e=this.shadowRoot)==null?void 0:e.querySelector("input"))==null||r.addEventListener("focus",()=>{this.isOpen=!0,console.log("connectedCallback focus",this.isOpen)}),(t=(o=this.shadowRoot)==null?void 0:o.querySelector("input"))==null||t.addEventListener("blur",()=>{this.isOpen&&(this.isOpen=!1,console.log("connectedCallback blur",this.isOpen))})}disconnectedCallback(){var e,r,o,t;super.disconnectedCallback(),document.removeEventListener("click",this.handleClickOutside),(r=(e=this.shadowRoot)==null?void 0:e.querySelector("input"))==null||r.removeEventListener("focus",()=>{}),(t=(o=this.shadowRoot)==null?void 0:o.querySelector("input"))==null||t.removeEventListener("blur",()=>{})}handleClickOutside(e){var s,i;const r=e.target,o=(s=this.shadowRoot)==null?void 0:s.querySelector("[data-hs-combo-box]");if(!this.shadowRoot||!(r instanceof HTMLElement)){console.log("Invalid target or shadow root");return}const t=(i=r.shadowRoot)==null?void 0:i.firstElementChild;if(!t){this.isOpen=!1;return}(!o||!o.contains(t))&&(this.isOpen=!1)}updateFocus(){if(!this.shadowRoot)return;this.shadowRoot.querySelectorAll("rtg-combo-box-item").forEach((r,o)=>{o===this.focusedIndex?r.classList.add("bg-gray-100"):r.classList.remove("bg-gray-100")})}render(){return console.log("render ",this.isOpen),l.html`
3141
+ `}};be.styles=[l.css``,c],We([d.property({attribute:"data-state",type:String})],be.prototype,"state",2),We([d.state()],be.prototype,"isOpen",2),be=We([d.customElement("rtg-combo-box-list")],be);var In=Object.defineProperty,An=Object.getOwnPropertyDescriptor,U=(n,e,r,o)=>{for(var t=o>1?void 0:o?An(e,r):e,s=n.length-1,i;s>=0;s--)(i=n[s])&&(t=(o?i(e,r,t):i(t))||t);return o&&t&&In(e,r,t),t};a.ComboBox=class extends l.LitElement{constructor(){super(...arguments),this.isOpen=!1,this.selectedValue="",this.searchTerm="",this.focusedIndex=-1,this.filteredItems=[],this.label="Select an item",this.items=[]}firstUpdated(e){console.log("this. items firstUpdated",this.items),this.items&&this.items.length>0&&(this.filteredItems=this.items.filter(r=>r.toLowerCase().includes(this.searchTerm)))}toggleDropdown(){this.isOpen=!this.isOpen,this.focusedIndex=-1,console.log("toggleDropdown",this.isOpen)}selectItem(e){console.log("selectItem");const r=e.target;if(r instanceof HTMLElement){const o=r.closest("rtg-combo-box-item");o?(this.selectedValue=o.getAttribute("data-hs-combo-box-value")||"",this.isOpen=!1):console.log("No valid rtg-combo-box-item found")}else console.log("Event target is not an HTMLElement")}handleInputClick(){console.log("-----handleInputClick------"),this.toggleDropdown()}handleSearch(e){console.log("handleSearch");const r=e.target;this.searchTerm=r.value,this.filteredItems=this.items.filter(o=>o.toLowerCase().includes(this.searchTerm.toLowerCase()))}handleKeyDown(e){console.log("handleKeyDown");const r=this.filteredItems.length;switch(e.key){case"ArrowDown":e.preventDefault(),this.focusedIndex=(this.focusedIndex+1)%r;break;case"ArrowUp":e.preventDefault(),this.focusedIndex=(this.focusedIndex-1+r)%r;break;case"Enter":this.focusedIndex>=0&&this.focusedIndex<r&&(this.selectedValue=this.filteredItems[this.focusedIndex],this.isOpen=!1);break}}handleMouseOver(e,r){console.log("handleMouseOver"),e.preventDefault(),this.focusedIndex=r}connectedCallback(){var e,r,o,t;super.connectedCallback(),console.log("connectedCallback"),document.addEventListener("click",this.handleClickOutside.bind(this)),console.log("connectedCallback click"),(r=(e=this.shadowRoot)==null?void 0:e.querySelector("input"))==null||r.addEventListener("focus",()=>{this.isOpen=!0,console.log("connectedCallback focus",this.isOpen)}),(t=(o=this.shadowRoot)==null?void 0:o.querySelector("input"))==null||t.addEventListener("blur",()=>{this.isOpen&&(this.isOpen=!1,console.log("connectedCallback blur",this.isOpen))})}disconnectedCallback(){var e,r,o,t;console.log("disconnectedCallback"),super.disconnectedCallback(),document.removeEventListener("click",this.handleClickOutside),(r=(e=this.shadowRoot)==null?void 0:e.querySelector("input"))==null||r.removeEventListener("focus",()=>{}),(t=(o=this.shadowRoot)==null?void 0:o.querySelector("input"))==null||t.removeEventListener("blur",()=>{})}handleClickOutside(e){var s,i;console.log("handleClickOutside");const r=e.target,o=(s=this.shadowRoot)==null?void 0:s.querySelector("[data-hs-combo-box]");if(!this.shadowRoot||!(r instanceof HTMLElement)){console.log("Invalid target or shadow root");return}const t=(i=r.shadowRoot)==null?void 0:i.firstElementChild;if(!t){this.isOpen=!1;return}(!o||!o.contains(t))&&(this.isOpen=!1)}updateFocus(){if(console.log("updateFocus"),!this.shadowRoot)return;this.shadowRoot.querySelectorAll("rtg-combo-box-item").forEach((r,o)=>{o===this.focusedIndex?r.classList.add("bg-gray-100"):r.classList.remove("bg-gray-100")})}render(){return console.log("render ",this.isOpen),l.html`
3142
3142
  <div class="relative" data-hs-combo-box="">
3143
3143
  isopen:${this.isOpen}
3144
3144
  <div>
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent wc-ui following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "wc-ui",
6
- "version": "0.0.20-004",
6
+ "version": "0.0.20-005",
7
7
  "type": "module",
8
8
  "main": "dist/revotech-ui-kit.umd.cjs",
9
9
  "module": "./dist/revotech-ui-kit.js",