revotech-ui-kit 0.0.19 → 0.0.20-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.
package/dist/revotech-ui-kit.js
CHANGED
|
@@ -6724,7 +6724,7 @@ var Li = Object.defineProperty, Mi = Object.getOwnPropertyDescriptor, ue = (e, t
|
|
|
6724
6724
|
};
|
|
6725
6725
|
let R = class extends h {
|
|
6726
6726
|
constructor() {
|
|
6727
|
-
super(...arguments), this.isOpen = !
|
|
6727
|
+
super(...arguments), this.isOpen = !0, this.selectedValue = "", this.searchTerm = "", this.focusedIndex = -1, this.filteredItems = [], this.label = "Select an item", this.items = [];
|
|
6728
6728
|
}
|
|
6729
6729
|
firstUpdated(e) {
|
|
6730
6730
|
console.log("this. items", this.items), this.items && this.items.length > 0 && (this.filteredItems = this.items.filter(
|
|
@@ -6770,10 +6770,10 @@ let R = class extends h {
|
|
|
6770
6770
|
}
|
|
6771
6771
|
connectedCallback() {
|
|
6772
6772
|
var e, t, o, s;
|
|
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;
|
|
6773
|
+
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", () => {
|
|
6774
|
+
this.isOpen = !0, console.log("connectedCallback focus", this.isOpen);
|
|
6775
6775
|
}), (s = (o = this.shadowRoot) == null ? void 0 : o.querySelector("input")) == null || s.addEventListener("blur", () => {
|
|
6776
|
-
this.isOpen && (this.isOpen = !1);
|
|
6776
|
+
this.isOpen && (this.isOpen = !1, console.log("connectedCallback blur", this.isOpen));
|
|
6777
6777
|
});
|
|
6778
6778
|
}
|
|
6779
6779
|
disconnectedCallback() {
|
|
@@ -6806,7 +6806,7 @@ let R = class extends h {
|
|
|
6806
6806
|
});
|
|
6807
6807
|
}
|
|
6808
6808
|
render() {
|
|
6809
|
-
return console.log("render "), l`
|
|
6809
|
+
return console.log("render ", this.isOpen), l`
|
|
6810
6810
|
<div class="relative" data-hs-combo-box="">
|
|
6811
6811
|
isopen:${this.isOpen}
|
|
6812
6812
|
<div>
|
|
@@ -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=!
|
|
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=!0,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,this.requestUpdate(),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`
|
|
3142
3142
|
<div class="relative" data-hs-combo-box="">
|
|
3143
3143
|
isopen:${this.isOpen}
|
|
3144
3144
|
<div>
|
package/package.json
CHANGED