revotech-ui-kit 0.0.18 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -6806,7 +6806,7 @@ let R = class extends h {
6806
6806
  });
6807
6807
  }
6808
6808
  render() {
6809
- return 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>
@@ -9209,7 +9209,8 @@ let ht = class extends _ {
9209
9209
  return [];
9210
9210
  }
9211
9211
  render() {
9212
- return this.getFilteredAttributes(), l`
9212
+ const e = this.getFilteredAttributes();
9213
+ return console.log("attributes", e), l`
9213
9214
  <div class="flex">
9214
9215
  <slot></slot>
9215
9216
  </div>
@@ -9236,7 +9237,8 @@ let gt = class extends _ {
9236
9237
  return [];
9237
9238
  }
9238
9239
  render() {
9239
- return this.getFilteredAttributes(), l` <div role="separator">${ki()}</div> `;
9240
+ const e = this.getFilteredAttributes();
9241
+ return console.log("attributes", e), l` <div role="separator">${ki()}</div> `;
9240
9242
  }
9241
9243
  };
9242
9244
  gt.styles = [p``, c];
@@ -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,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(),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 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 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,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(),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 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>
@@ -3853,11 +3853,11 @@ body {
3853
3853
  <div class="flex">
3854
3854
  <slot></slot>
3855
3855
  </div>
3856
- `}};O.styles=[l.css``,c],O.PIN_MIN_VALUE="0",O.PIN_MAX_VALUE="9",O.BACKSPACE_KEY="Backspace",H([d.property({type:Function})],O.prototype,"click",2),H([d.property()],O.prototype,"clientName",2),H([d.property()],O.prototype,"username",2),H([d.property()],O.prototype,"pinLength",2),H([d.property()],O.prototype,"onChange",2),H([d.property()],O.prototype,"pin",2),H([d.property({type:Array})],O.prototype,"inputElement",2),O=H([d.customElement("rtg-input-otp")],O);var Ei=Object.defineProperty,ki=Object.getOwnPropertyDescriptor,jt=(n,e,r,o)=>{for(var t=o>1?void 0:o?ki(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&&Ei(e,r,t),t};let Ie=class extends y{constructor(){super(...arguments),this.click=()=>{}}getAttributesToExclude(){return[]}render(){return this.getFilteredAttributes(),l.html`
3856
+ `}};O.styles=[l.css``,c],O.PIN_MIN_VALUE="0",O.PIN_MAX_VALUE="9",O.BACKSPACE_KEY="Backspace",H([d.property({type:Function})],O.prototype,"click",2),H([d.property()],O.prototype,"clientName",2),H([d.property()],O.prototype,"username",2),H([d.property()],O.prototype,"pinLength",2),H([d.property()],O.prototype,"onChange",2),H([d.property()],O.prototype,"pin",2),H([d.property({type:Array})],O.prototype,"inputElement",2),O=H([d.customElement("rtg-input-otp")],O);var Ei=Object.defineProperty,ki=Object.getOwnPropertyDescriptor,jt=(n,e,r,o)=>{for(var t=o>1?void 0:o?ki(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&&Ei(e,r,t),t};let Ie=class extends y{constructor(){super(...arguments),this.click=()=>{}}getAttributesToExclude(){return[]}render(){const n=this.getFilteredAttributes();return console.log("attributes",n),l.html`
3857
3857
  <div class="flex">
3858
3858
  <slot></slot>
3859
3859
  </div>
3860
- `}};Ie.styles=[l.css``,c],jt([d.property({type:Function})],Ie.prototype,"click",2),Ie=jt([d.customElement("input-otp-group")],Ie);var Di=Object.defineProperty,Mi=Object.getOwnPropertyDescriptor,Jt=(n,e,r,o)=>{for(var t=o>1?void 0:o?Mi(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&&Di(e,r,t),t};let Ae=class extends y{constructor(){super(...arguments),this.index=0}getAttributesToExclude(){return[]}render(){return this.getFilteredAttributes(),l.html` <div role="separator">${_n()}</div> `}};Ae.styles=[l.css``,c],Jt([d.property({type:Number})],Ae.prototype,"index",2),Ae=Jt([d.customElement("input-otp-separator")],Ae);var Ii=Object.defineProperty,Ai=Object.getOwnPropertyDescriptor,Qt=(n,e,r,o)=>{for(var t=o>1?void 0:o?Ai(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&&Ii(e,r,t),t};let Le=class extends y{constructor(){super(...arguments),this.click=()=>{}}getAttributesToExclude(){return[]}render(){return this.getFilteredAttributes(),l.html`
3860
+ `}};Ie.styles=[l.css``,c],jt([d.property({type:Function})],Ie.prototype,"click",2),Ie=jt([d.customElement("input-otp-group")],Ie);var Di=Object.defineProperty,Mi=Object.getOwnPropertyDescriptor,Jt=(n,e,r,o)=>{for(var t=o>1?void 0:o?Mi(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&&Di(e,r,t),t};let Ae=class extends y{constructor(){super(...arguments),this.index=0}getAttributesToExclude(){return[]}render(){const n=this.getFilteredAttributes();return console.log("attributes",n),l.html` <div role="separator">${_n()}</div> `}};Ae.styles=[l.css``,c],Jt([d.property({type:Number})],Ae.prototype,"index",2),Ae=Jt([d.customElement("input-otp-separator")],Ae);var Ii=Object.defineProperty,Ai=Object.getOwnPropertyDescriptor,Qt=(n,e,r,o)=>{for(var t=o>1?void 0:o?Ai(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&&Ii(e,r,t),t};let Le=class extends y{constructor(){super(...arguments),this.click=()=>{}}getAttributesToExclude(){return[]}render(){return this.getFilteredAttributes(),l.html`
3861
3861
  <div>
3862
3862
  <input class="border mx-2 rounded-md" style="width:40px" />
3863
3863
  </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.18",
6
+ "version": "0.0.20",
7
7
  "type": "module",
8
8
  "main": "dist/revotech-ui-kit.umd.cjs",
9
9
  "module": "./dist/revotech-ui-kit.js",