revotech-ui-kit 0.0.22-beta → 0.0.22-beta-02

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.
@@ -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 firstUpdated", this.items), this.items && this.items.length > 0 && (this.filteredItems = this.items.filter(
6730
+ console.log("this. items", 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,7 +6735,6 @@ 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");
6739
6738
  const t = e.target;
6740
6739
  if (t instanceof HTMLElement) {
6741
6740
  const o = t.closest(
@@ -6749,12 +6748,10 @@ let R = class extends h {
6749
6748
  console.log("-----handleInputClick------"), this.toggleDropdown();
6750
6749
  }
6751
6750
  handleSearch(e) {
6752
- console.log("handleSearch");
6753
6751
  const t = e.target;
6754
6752
  this.searchTerm = t.value, this.filteredItems = this.items.filter((o) => o.toLowerCase().includes(this.searchTerm.toLowerCase()));
6755
6753
  }
6756
6754
  handleKeyDown(e) {
6757
- console.log("handleKeyDown");
6758
6755
  const t = this.filteredItems.length;
6759
6756
  switch (e.key) {
6760
6757
  case "ArrowDown":
@@ -6769,61 +6766,66 @@ let R = class extends h {
6769
6766
  }
6770
6767
  }
6771
6768
  handleMouseOver(e, t) {
6772
- console.log("handleMouseOver"), e.preventDefault(), this.focusedIndex = t;
6769
+ e.preventDefault(), this.focusedIndex = t;
6773
6770
  }
6774
6771
  connectedCallback() {
6775
6772
  var e, t, o, s;
6776
- super.connectedCallback(), console.log("connectedCallback"), document.addEventListener("click", this.handleClickOutside.bind(this)), console.log("connectedCallback click"), (t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("input")) == null || t.addEventListener("focus", () => {
6777
- this.isOpen = !0, console.log("connectedCallback focus", this.isOpen);
6773
+ super.connectedCallback(), document.addEventListener("click", this.handleClickOutside.bind(this)), (t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("input")) == null || t.addEventListener("focus", () => {
6774
+ this.isOpen = !0;
6778
6775
  }), (s = (o = this.shadowRoot) == null ? void 0 : o.querySelector("input")) == null || s.addEventListener("blur", () => {
6779
- this.isOpen && (this.isOpen = !1, console.log("connectedCallback blur", this.isOpen));
6776
+ this.isOpen && (this.isOpen = !1);
6780
6777
  });
6781
6778
  }
6782
6779
  disconnectedCallback() {
6783
6780
  var e, t, o, s;
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", () => {
6781
+ super.disconnectedCallback(), document.removeEventListener("click", this.handleClickOutside), (t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("input")) == null || t.removeEventListener("focus", () => {
6785
6782
  }), (s = (o = this.shadowRoot) == null ? void 0 : o.querySelector("input")) == null || s.removeEventListener("blur", () => {
6786
6783
  });
6787
6784
  }
6788
6785
  handleClickOutside(e) {
6789
- var r, i;
6786
+ var s, r;
6790
6787
  console.log("handleClickOutside");
6791
- const t = e.target, o = (r = this.shadowRoot) == null ? void 0 : r.querySelector(
6788
+ const t = e.target;
6789
+ if ((s = this.shadowRoot) == null || s.querySelector(
6792
6790
  "[data-hs-combo-box]"
6793
- );
6794
- if (console.log("dropdownContainer", o), !this.shadowRoot || !(t instanceof HTMLElement)) {
6791
+ ), console.log("target", t), console.log("this.shadowRoot", this.shadowRoot), !this.shadowRoot || !(t instanceof HTMLElement)) {
6795
6792
  console.log("Invalid target or shadow root");
6796
6793
  return;
6797
6794
  }
6798
- const s = (i = t.shadowRoot) == null ? void 0 : i.firstElementChild;
6799
- if (console.log("firstChild", s), !s) {
6800
- console.log("!firstChild"), this.isOpen = !1;
6795
+ if (!((r = t.shadowRoot) == null ? void 0 : r.firstElementChild)) {
6796
+ this.isOpen = !1;
6801
6797
  return;
6802
6798
  }
6803
- (!o || !o.contains(s)) && (console.log(
6804
- "!dropdownContainer || !dropdownContainer.contains(firstChild)"
6805
- ), this.isOpen = !1);
6806
6799
  }
6807
6800
  updateFocus() {
6808
- if (console.log("updateFocus"), !this.shadowRoot)
6801
+ if (!this.shadowRoot)
6809
6802
  return;
6810
6803
  this.shadowRoot.querySelectorAll("rtg-combo-box-item").forEach((t, o) => {
6811
6804
  o === this.focusedIndex ? t.classList.add("bg-gray-100") : t.classList.remove("bg-gray-100");
6812
6805
  });
6813
6806
  }
6814
6807
  render() {
6815
- return console.log("render ", this.isOpen), l`
6808
+ return l`
6816
6809
  <div class="relative" data-hs-combo-box="">
6817
6810
  isopen:${this.isOpen}
6818
6811
  <div>
6819
- <input part="combobox" class="inline-flex justify-between items-center
6820
- w-full h-10 px-4 py-2 whitespace-nowrap rounded-md text-sm font-medium
6821
- border border-input cursor-pointer ring-offset-background
6822
- transition-colors disabled:pointer-events-none disabled:opacity-50
6823
- bg-background hover:bg-accent hover:text-accent-foreground
6824
- outline-none" role="combobox" aria-expanded=${this.isOpen} readonly
6825
- .value=${this.selectedValue || this.label} //
6826
- @click="${this.handleInputClick}" @keydown="${this.handleKeyDown}" />
6812
+ <input
6813
+ part="combobox"
6814
+ class="inline-flex justify-between items-center w-full h-10 px-4 py-2 whitespace-nowrap rounded-md
6815
+ text-sm font-medium border border-input cursor-pointer
6816
+ ring-offset-background
6817
+ transition-colors disabled:pointer-events-none
6818
+ disabled:opacity-50
6819
+ bg-background hover:bg-accent
6820
+ hover:text-accent-foreground
6821
+ outline-none"
6822
+ role="combobox"
6823
+ aria-expanded=${this.isOpen}
6824
+ readonly
6825
+ .value=${this.selectedValue || this.label}
6826
+ @click="${this.handleInputClick}"
6827
+ @keydown="${this.handleKeyDown}"
6828
+ />
6827
6829
  <div
6828
6830
  class="absolute top-1/2 end-3 -translate-y-1/2 cursor-pointer"
6829
6831
  aria-expanded=${this.isOpen}
@@ -3138,18 +3138,27 @@ 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 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(console.log("dropdownContainer",o),!this.shadowRoot||!(r instanceof HTMLElement)){console.log("Invalid target or shadow root");return}const t=(i=r.shadowRoot)==null?void 0:i.firstElementChild;if(console.log("firstChild",t),!t){console.log("!firstChild"),this.isOpen=!1;return}(!o||!o.contains(t))&&(console.log("!dropdownContainer || !dropdownContainer.contains(firstChild)"),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`
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(),document.addEventListener("click",this.handleClickOutside.bind(this)),(r=(e=this.shadowRoot)==null?void 0:e.querySelector("input"))==null||r.addEventListener("focus",()=>{this.isOpen=!0}),(t=(o=this.shadowRoot)==null?void 0:o.querySelector("input"))==null||t.addEventListener("blur",()=>{this.isOpen&&(this.isOpen=!1)})}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 t,s;console.log("handleClickOutside");const r=e.target;if((t=this.shadowRoot)==null||t.querySelector("[data-hs-combo-box]"),console.log("target",r),console.log("this.shadowRoot",this.shadowRoot),!this.shadowRoot||!(r instanceof HTMLElement)){console.log("Invalid target or shadow root");return}if(!((s=r.shadowRoot)==null?void 0:s.firstElementChild)){this.isOpen=!1;return}}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 l.html`
3142
3142
  <div class="relative" data-hs-combo-box="">
3143
3143
  isopen:${this.isOpen}
3144
3144
  <div>
3145
- <input part="combobox" class="inline-flex justify-between items-center
3146
- w-full h-10 px-4 py-2 whitespace-nowrap rounded-md text-sm font-medium
3147
- border border-input cursor-pointer ring-offset-background
3148
- transition-colors disabled:pointer-events-none disabled:opacity-50
3149
- bg-background hover:bg-accent hover:text-accent-foreground
3150
- outline-none" role="combobox" aria-expanded=${this.isOpen} readonly
3151
- .value=${this.selectedValue||this.label} //
3152
- @click="${this.handleInputClick}" @keydown="${this.handleKeyDown}" />
3145
+ <input
3146
+ part="combobox"
3147
+ class="inline-flex justify-between items-center w-full h-10 px-4 py-2 whitespace-nowrap rounded-md
3148
+ text-sm font-medium border border-input cursor-pointer
3149
+ ring-offset-background
3150
+ transition-colors disabled:pointer-events-none
3151
+ disabled:opacity-50
3152
+ bg-background hover:bg-accent
3153
+ hover:text-accent-foreground
3154
+ outline-none"
3155
+ role="combobox"
3156
+ aria-expanded=${this.isOpen}
3157
+ readonly
3158
+ .value=${this.selectedValue||this.label}
3159
+ @click="${this.handleInputClick}"
3160
+ @keydown="${this.handleKeyDown}"
3161
+ />
3153
3162
  <div
3154
3163
  class="absolute top-1/2 end-3 -translate-y-1/2 cursor-pointer"
3155
3164
  aria-expanded=${this.isOpen}
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.22-beta",
6
+ "version": "0.0.22-beta-02",
7
7
  "type": "module",
8
8
  "main": "dist/revotech-ui-kit.umd.cjs",
9
9
  "module": "./dist/revotech-ui-kit.js",