@kodaris/krubble-components 1.0.38 → 1.0.39

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.
@@ -894,7 +894,7 @@ const Le="important",Re=" !"+Le,je=_e(class extends xe{constructor(e){if(super(e
894
894
  font-size: 18px;
895
895
  font-weight: 600;
896
896
  }
897
- `,De([pe()],He.prototype,"_contentElement",void 0),De([he({type:Boolean,reflect:!0})],He.prototype,"opened",void 0),De([he({type:String})],He.prototype,"label",void 0),De([he({type:String})],He.prototype,"width",void 0),He=De([ae("kr-dialog")],He);var Ve,Ue=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};let Ne=Ve=class extends re{constructor(){super(...arguments),this.dismissTimeout=null,this.type="info",this.title="",this.message="",this.duration=5e3}static show(e){const t=document.createElement("kr-snackbar");return t.message=e.message,t.title=e.title??"",t.type=e.type??"info",void 0!==e.duration?t.duration=e.duration:"error"===t.type?t.duration=0:t.duration=5e3,document.body.appendChild(t),t}connectedCallback(){super.connectedCallback(),this.setAttribute("role","alert"),this.classList.add(`kr-snackbar--${this.type}`),this.title&&this.classList.add("kr-snackbar--has-title"),Ve.activeSnackbars.push(this),this.updatePositions(),this.duration>0&&(this.dismissTimeout=window.setTimeout((()=>{this.dismiss()}),this.duration))}disconnectedCallback(){super.disconnectedCallback();const e=Ve.activeSnackbars.indexOf(this);e>-1&&Ve.activeSnackbars.splice(e,1),this.updatePositions(),this.dismissTimeout&&clearTimeout(this.dismissTimeout)}updatePositions(){let e=24;for(const t of Ve.activeSnackbars)t.style.bottom=`${e}px`,e+=t.offsetHeight+8}dismiss(){this.dismissTimeout&&(clearTimeout(this.dismissTimeout),this.dismissTimeout=null),this.classList.add("kr-snackbar--closing"),this.addEventListener("animationend",(()=>{this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0})),this.remove()}),{once:!0})}render(){const e={info:H`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/></svg>`,success:H`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/></svg>`,warning:H`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/></svg>`,error:H`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/></svg>`};return H`
897
+ `,De([pe()],He.prototype,"_contentElement",void 0),De([he({type:Boolean,reflect:!0})],He.prototype,"opened",void 0),De([he({type:String})],He.prototype,"label",void 0),De([he({type:String})],He.prototype,"width",void 0),He=De([ae("kr-dialog")],He);var Ve,Ue=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};let Ne=Ve=class extends re{constructor(){super(...arguments),this.dismissTimeout=null,this.type="info",this.title="",this.message="",this.duration=5e3}static show(e){for(const e of this.activeSnackbars)e.dismiss();const t=document.createElement("kr-snackbar");return t.message=e.message,t.title=e.title??"",t.type=e.type??"info",void 0!==e.duration?t.duration=e.duration:"error"===t.type?t.duration=0:t.duration=5e3,document.body.appendChild(t),t}connectedCallback(){super.connectedCallback(),this.setAttribute("role","alert"),this.classList.add(`kr-snackbar--${this.type}`),this.title&&this.classList.add("kr-snackbar--has-title"),Ve.activeSnackbars.push(this),this.duration>0&&(this.dismissTimeout=window.setTimeout((()=>{this.dismiss()}),this.duration))}disconnectedCallback(){super.disconnectedCallback();const e=Ve.activeSnackbars.indexOf(this);e>-1&&Ve.activeSnackbars.splice(e,1),this.dismissTimeout&&clearTimeout(this.dismissTimeout)}dismiss(){this.dismissTimeout&&(clearTimeout(this.dismissTimeout),this.dismissTimeout=null),this.classList.add("kr-snackbar--closing"),this.addEventListener("animationend",(()=>{this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0})),this.remove()}),{once:!0})}render(){const e={info:H`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/></svg>`,success:H`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/></svg>`,warning:H`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/></svg>`,error:H`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/></svg>`};return H`
898
898
  ${e[this.type]}
899
899
  <div class="content">
900
900
  ${this.title?H`<div class="title">${this.title}</div>`:""}
@@ -921,6 +921,7 @@ const Le="important",Re=" !"+Le,je=_e(class extends xe{constructor(e){if(super(e
921
921
  :host {
922
922
  position: fixed;
923
923
  left: 16px;
924
+ bottom: 24px;
924
925
  z-index: 10000;
925
926
  display: flex;
926
927
  align-items: center;
@@ -2070,7 +2071,7 @@ const st=e=>e??U
2070
2071
  font-size: 0.75rem;
2071
2072
  color: var(--kr-text-field-helper-color, #6b7280);
2072
2073
  }
2073
- `,at.formAssociated=!0,lt([he({type:String})],at.prototype,"label",void 0),lt([he({type:String})],at.prototype,"name",void 0),lt([he({type:String})],at.prototype,"value",void 0),lt([he({type:String})],at.prototype,"placeholder",void 0),lt([he({type:String})],at.prototype,"type",void 0),lt([he({type:Boolean})],at.prototype,"required",void 0),lt([he({type:Boolean})],at.prototype,"disabled",void 0),lt([he({type:Boolean})],at.prototype,"readonly",void 0),lt([he({type:Number})],at.prototype,"minlength",void 0),lt([he({type:Number})],at.prototype,"maxlength",void 0),lt([he({type:String})],at.prototype,"pattern",void 0),lt([he({type:String})],at.prototype,"autocomplete",void 0),lt([he({type:String})],at.prototype,"hint",void 0),lt([ue("input")],at.prototype,"_input",void 0),lt([pe()],at.prototype,"_touched",void 0),lt([pe()],at.prototype,"_dirty",void 0),at=lt([ae("kr-text-field")],at);var dt=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};let ct=class extends re{constructor(){super(),this.label="",this.name="",this.value="",this.placeholder="Select an option",this.disabled=!1,this.required=!1,this.readonly=!1,this.hint="",this._isOpen=!1,this._highlightedIndex=-1,this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._handleOutsideClick=e=>{e.composedPath().includes(this)||this._close()},this._handleKeyDown=e=>{if(!this._isOpen)return;const t=Array.from(this.querySelectorAll("kr-select-option"));switch(e.key){case"Escape":this._close(),this._triggerElement?.focus();break;case"ArrowDown":if(e.preventDefault(),t.some((e=>!e.disabled))){let e=this._highlightedIndex+1;for(;e<t.length&&t[e]?.disabled;)e++;e<t.length&&(this._highlightedIndex=e)}break;case"ArrowUp":e.preventDefault();{let e=this._highlightedIndex-1;for(;e>=0&&t[e]?.disabled;)e--;e>=0&&(this._highlightedIndex=e)}break;case"Enter":e.preventDefault(),this._highlightedIndex>=0&&this._highlightedIndex<t.length&&this._selectOption(t[this._highlightedIndex])}},this._internals=this.attachInternals()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._touched=!1,this._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(e){this.value=e}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick),document.addEventListener("keydown",this._handleKeyDown),this.addEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick),document.removeEventListener("keydown",this._handleKeyDown),this.removeEventListener("invalid",this._handleInvalid)}_toggle(){if(!this.disabled&&!this.readonly)if(this._isOpen)this._close();else{this._isOpen=!0;const e=Array.from(this.querySelectorAll("kr-select-option"));this._highlightedIndex=e.findIndex((e=>e.value===this.value)),requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".select-dropdown");if(e){const t=this._triggerElement.getBoundingClientRect();e.style.top=t.bottom+4+"px",e.style.left=t.left+"px",e.style.width=t.width+"px"}}))}}_close(){this._isOpen=!1,this._highlightedIndex=-1}_selectOption(e){e.disabled||(this.value=e.value,this._internals.setFormValue(this.value),this._updateValidity(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._close(),this._triggerElement?.focus())}_handleBlur(){this._touched=!0,this._updateValidity()}_updateValidity(){this.required&&!this.value?this._internals.setValidity({valueMissing:!0},"Please select an option",this._triggerElement):this._internals.setValidity({})}render(){const e=Array.from(this.querySelectorAll("kr-select-option")),t=e.find((e=>e.value===this.value))?.label;return H`
2074
+ `,at.formAssociated=!0,lt([he({type:String})],at.prototype,"label",void 0),lt([he({type:String})],at.prototype,"name",void 0),lt([he({type:String})],at.prototype,"value",void 0),lt([he({type:String})],at.prototype,"placeholder",void 0),lt([he({type:String})],at.prototype,"type",void 0),lt([he({type:Boolean})],at.prototype,"required",void 0),lt([he({type:Boolean})],at.prototype,"disabled",void 0),lt([he({type:Boolean})],at.prototype,"readonly",void 0),lt([he({type:Number})],at.prototype,"minlength",void 0),lt([he({type:Number})],at.prototype,"maxlength",void 0),lt([he({type:String})],at.prototype,"pattern",void 0),lt([he({type:String})],at.prototype,"autocomplete",void 0),lt([he({type:String})],at.prototype,"hint",void 0),lt([ue("input")],at.prototype,"_input",void 0),lt([pe()],at.prototype,"_touched",void 0),lt([pe()],at.prototype,"_dirty",void 0),at=lt([ae("kr-text-field")],at);var dt=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};let ct=class extends re{constructor(){super(),this.label="",this.name="",this.value="",this.placeholder="Select an option",this.disabled=!1,this.required=!1,this.readonly=!1,this.hint="",this._isOpen=!1,this._highlightedIndex=-1,this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._handleOutsideClick=e=>{e.composedPath().includes(this)||this._close()},this._handleKeyDown=e=>{if(!this._isOpen)return;const t=Array.from(this.querySelectorAll("kr-select-option"));switch(e.key){case"Escape":this._close(),this._triggerElement?.focus();break;case"ArrowDown":if(e.preventDefault(),t.some((e=>!e.disabled))){let e=this._highlightedIndex+1;for(;e<t.length&&t[e]?.disabled;)e++;e<t.length&&(this._highlightedIndex=e)}break;case"ArrowUp":e.preventDefault();{let e=this._highlightedIndex-1;for(;e>=0&&t[e]?.disabled;)e--;e>=0&&(this._highlightedIndex=e)}break;case"Enter":e.preventDefault(),this._highlightedIndex>=0&&this._highlightedIndex<t.length&&this._selectOption(t[this._highlightedIndex])}},this._internals=this.attachInternals()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._touched=!1,this._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(e){this.value=e}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick),document.addEventListener("keydown",this._handleKeyDown),this.addEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick),document.removeEventListener("keydown",this._handleKeyDown),this.removeEventListener("invalid",this._handleInvalid)}_toggle(){if(!this.disabled&&!this.readonly)if(this._isOpen)this._close();else{this._isOpen=!0;const e=Array.from(this.querySelectorAll("kr-select-option"));this._highlightedIndex=e.findIndex((e=>e.value===this.value)),requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".select-dropdown");if(e){const t=this._triggerElement.getBoundingClientRect(),i=window.innerHeight-t.bottom-4-8;e.style.top=t.bottom+4+"px",e.style.left=t.left+"px",e.style.width=t.width+"px",e.style.maxHeight=i+"px"}}))}}_close(){this._isOpen=!1,this._highlightedIndex=-1}_selectOption(e){e.disabled||(this.value=e.value,this._internals.setFormValue(this.value),this._updateValidity(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._close(),this._triggerElement?.focus())}_handleBlur(){this._touched=!0,this._updateValidity()}_updateValidity(){this.required&&!this.value?this._internals.setValidity({valueMissing:!0},"Please select an option",this._triggerElement):this._internals.setValidity({})}render(){const e=Array.from(this.querySelectorAll("kr-select-option")),t=e.find((e=>e.value===this.value))?.label;return H`
2074
2075
  <div class="wrapper">
2075
2076
  ${this.label?H`
2076
2077
  <label>
@@ -2111,9 +2112,6 @@ const st=e=>e??U
2111
2112
  @mouseenter=${()=>this._highlightedIndex=t}
2112
2113
  >
2113
2114
  ${e.label}
2114
- ${i?H`<svg class="chevron-icon select-check" viewBox="0 0 20 20" fill="currentColor">
2115
- <path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd" />
2116
- </svg>`:U}
2117
2115
  </div>
2118
2116
  `}))}
2119
2117
  </div>
@@ -2229,7 +2227,6 @@ const st=e=>e??U
2229
2227
  border-radius: 8px;
2230
2228
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
2231
2229
  padding: 8px 0;
2232
- max-height: 300px;
2233
2230
  overflow-y: auto;
2234
2231
  }
2235
2232
 
@@ -2240,8 +2237,8 @@ const st=e=>e??U
2240
2237
  .select-option {
2241
2238
  display: flex;
2242
2239
  align-items: center;
2243
- height: 36px;
2244
- padding: 0 16px;
2240
+ min-height: 36px;
2241
+ padding: 8px 16px;
2245
2242
  font-size: 14px;
2246
2243
  color: #000000;
2247
2244
  cursor: pointer;
@@ -2278,12 +2275,6 @@ const st=e=>e??U
2278
2275
  font-size: 14px;
2279
2276
  }
2280
2277
 
2281
- .select-check {
2282
- color: var(--kr-primary);
2283
- flex-shrink: 0;
2284
- margin-left: auto;
2285
- }
2286
-
2287
2278
  .hint {
2288
2279
  font-size: 0.75rem;
2289
2280
  color: var(--kr-select-helper-color, #6b7280);