@kodaris/krubble-components 1.0.46 → 1.0.48

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.
@@ -290,7 +290,7 @@ const ve=1,be=2,me=3,ye=4,xe=e=>(...t)=>({_$litDirective$:e,values:t});let _e=cl
290
290
  outline: 2px solid #3b82f6;
291
291
  outline-offset: 2px;
292
292
  }
293
- `,we([pe({type:String})],e.KRAlert.prototype,"type",void 0),we([pe({type:String})],e.KRAlert.prototype,"title",void 0),we([pe({type:Boolean})],e.KRAlert.prototype,"dismissible",void 0),we([pe({type:Boolean})],e.KRAlert.prototype,"visible",void 0),e.KRAlert=we([de("kr-alert")],e.KRAlert);var $e=function(e,t,i,o){var s,r=arguments.length,l=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,o);else for(var n=e.length-1;n>=0;n--)(s=e[n])&&(l=(r<3?s(l):r>3?s(t,i,l):s(t,i))||l);return r>3&&l&&Object.defineProperty(t,i,l),l};e.KRButton=class extends le{constructor(){super(...arguments),this.variant="flat",this.color="primary",this.size="medium",this.disabled=!1,this.options=[],this.iconPosition="left",this._state="idle",this._stateText="",this._dropdownOpened=!1,this._handleHostClick=e=>{this.options.length&&(e.stopPropagation(),this._toggleDropdown())},this._handleKeydown=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.options.length?this._toggleDropdown():this.click()),"Escape"===e.key&&this._dropdownOpened&&(this._dropdownOpened=!1)},this._handleClickOutside=e=>{this._dropdownOpened&&!this.contains(e.target)&&(this._dropdownOpened=!1)}}connectedCallback(){super.connectedCallback(),this.setAttribute("role",this.href?"link":"button"),this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._handleKeydown),this.addEventListener("click",this._handleHostClick),document.addEventListener("click",this._handleClickOutside)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._handleKeydown),this.removeEventListener("click",this._handleHostClick),document.removeEventListener("click",this._handleClickOutside)}_toggleDropdown(){this._dropdownOpened=!this._dropdownOpened,this._dropdownOpened&&requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(e){const t=this.getBoundingClientRect();e.style.top=t.bottom+4+"px",e.style.bottom="",e.style.left=t.left+"px",e.style.right="",e.style.minWidth=t.width+"px",e.style.transformOrigin="top left";const i=e.getBoundingClientRect();i.bottom>window.innerHeight?(e.style.top="",e.style.bottom=window.innerHeight-t.top+4+"px",e.style.transformOrigin="bottom left",e.classList.add("dropdown--above")):e.classList.remove("dropdown--above"),i.right>window.innerWidth&&(e.style.left="",e.style.right=window.innerWidth-t.right+"px",i.bottom>window.innerHeight?e.style.transformOrigin="bottom right":e.style.transformOrigin="top right")}}))}_handleOptionClick(e,t){t.stopPropagation(),this._dropdownOpened=!1,this.dispatchEvent(new CustomEvent("option-select",{detail:{id:e.id,label:e.label},bubbles:!0,composed:!0}))}showLoading(){this._clearStateTimeout(),this._state="loading",this._stateText=""}showSuccess(e="Success",t=2e3){this._clearStateTimeout(),this._state="success",this._stateText=e,t>0&&(this._stateTimeout=window.setTimeout((()=>this.reset()),t))}showError(e="Error",t=2e3){this._clearStateTimeout(),this._state="error",this._stateText=e,t>0&&(this._stateTimeout=window.setTimeout((()=>this.reset()),t))}reset(){this._clearStateTimeout(),this._state="idle",this._stateText=""}_clearStateTimeout(){this._stateTimeout&&(clearTimeout(this._stateTimeout),this._stateTimeout=void 0)}updated(e){this.classList.toggle("kr-button--loading","loading"===this._state),this.classList.toggle("kr-button--success","success"===this._state),this.classList.toggle("kr-button--error","error"===this._state),this.classList.toggle(`kr-button--${this.variant}`,!0),this.classList.toggle(`kr-button--${this.color}`,!0),this.classList.toggle("kr-button--small","small"===this.size),this.classList.toggle("kr-button--large","large"===this.size)}render(){const e=I`
293
+ `,we([pe({type:String})],e.KRAlert.prototype,"type",void 0),we([pe({type:String})],e.KRAlert.prototype,"title",void 0),we([pe({type:Boolean})],e.KRAlert.prototype,"dismissible",void 0),we([pe({type:Boolean})],e.KRAlert.prototype,"visible",void 0),e.KRAlert=we([de("kr-alert")],e.KRAlert);var $e=function(e,t,i,o){var s,r=arguments.length,l=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,o);else for(var n=e.length-1;n>=0;n--)(s=e[n])&&(l=(r<3?s(l):r>3?s(t,i,l):s(t,i))||l);return r>3&&l&&Object.defineProperty(t,i,l),l};e.KRButton=class extends le{constructor(){super(...arguments),this.variant="flat",this.color="primary",this.size="medium",this.disabled=!1,this.options=[],this.iconPosition="left",this._state="idle",this._stateText="",this._dropdownOpened=!1,this._handleHostClick=e=>{this.options.length&&(e.stopPropagation(),this._toggleDropdown())},this._handleKeydown=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.options.length?this._toggleDropdown():this.click()),"Escape"===e.key&&this._dropdownOpened&&(this._dropdownOpened=!1)},this._handleClickOutside=e=>{this._dropdownOpened&&!this.contains(e.target)&&(this._dropdownOpened=!1)}}connectedCallback(){super.connectedCallback(),this.setAttribute("role",this.href?"link":"button"),this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._handleKeydown),this.addEventListener("click",this._handleHostClick),document.addEventListener("click",this._handleClickOutside)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._handleKeydown),this.removeEventListener("click",this._handleHostClick),document.removeEventListener("click",this._handleClickOutside)}_toggleDropdown(){this._dropdownOpened=!this._dropdownOpened,this._dropdownOpened&&requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(e){const t=this.getBoundingClientRect();e.style.top=t.bottom+4+"px",e.style.bottom="",e.style.left=t.left+"px",e.style.right="",e.style.minWidth=t.width+"px",e.style.transformOrigin="top left";const i=e.getBoundingClientRect();i.bottom>window.innerHeight?(e.style.top="",e.style.bottom=window.innerHeight-t.top+4+"px",e.style.transformOrigin="bottom left",e.classList.add("dropdown--above")):e.classList.remove("dropdown--above"),i.right>window.innerWidth&&(e.style.left="",e.style.right=window.innerWidth-t.right+"px",i.bottom>window.innerHeight?e.style.transformOrigin="bottom right":e.style.transformOrigin="top right")}}))}_handleOptionClick(e,t){t.stopPropagation(),this._dropdownOpened=!1,this.dispatchEvent(new CustomEvent("option-select",{detail:{id:e.id,label:e.label},bubbles:!0,composed:!0}))}showLoading(){this._clearStateTimeout(),this._state="loading",this._stateText=""}showSuccess(e="Success",t=2e3){this._clearStateTimeout(),this._state="success",this._stateText=e,t>0&&(this._stateTimeout=window.setTimeout((()=>this.reset()),t))}showError(e="Error",t=2e3){this._clearStateTimeout(),this._state="error",this._stateText=e,t>0&&(this._stateTimeout=window.setTimeout((()=>this.reset()),t))}isLoading(){return"loading"===this._state}reset(){this._clearStateTimeout(),this._state="idle",this._stateText=""}_clearStateTimeout(){this._stateTimeout&&(clearTimeout(this._stateTimeout),this._stateTimeout=void 0)}updated(e){this.classList.toggle("kr-button--loading","loading"===this._state),this.classList.toggle("kr-button--success","success"===this._state),this.classList.toggle("kr-button--error","error"===this._state),this.classList.toggle(`kr-button--${this.variant}`,!0),this.classList.toggle(`kr-button--${this.color}`,!0),this.classList.toggle("kr-button--small","small"===this.size),this.classList.toggle("kr-button--large","large"===this.size)}render(){const e=I`
294
294
  <span class="content">
295
295
  <slot name="icon"></slot>
296
296
  <slot></slot>
@@ -1346,23 +1346,28 @@ const Te="important",Ee=" !"+Te,Ke=xe(class extends _e{constructor(e){if(super(e
1346
1346
  ></div>`:q}</div>
1347
1347
  `))}
1348
1348
  </div>
1349
- ${this._data.map(((e,t)=>I`
1350
- <div
1351
- class=${ke({row:!0,"row--clickable":!!this._def.rowClickable})}
1352
- @mousedown=${()=>this._handleRowMouseDown()}
1353
- @click=${()=>this._handleRowClick(e,t)}
1354
- >
1355
- ${this.getDisplayedColumns().map(((i,o)=>I`
1356
- <div
1357
- class=${ke(this._getCellClasses(i,o))}
1358
- style=${Ke(this._getCellStyle(i,o))}
1359
- data-column-id=${i.id}
1360
- >
1361
- ${this._renderCellContent(i,e,t)}
1362
- </div>
1363
- `))}
1364
- </div>
1365
- `))}
1349
+ ${this._data.map(((e,t)=>{const i=this.getDisplayedColumns().map(((i,o)=>I`
1350
+ <div
1351
+ class=${ke(this._getCellClasses(i,o))}
1352
+ style=${Ke(this._getCellStyle(i,o))}
1353
+ data-column-id=${i.id}
1354
+ >
1355
+ ${this._renderCellContent(i,e,t)}
1356
+ </div>
1357
+ `));return this._def.rowHref?I`
1358
+ <a
1359
+ href=${this._def.rowHref(e)}
1360
+ class=${ke({row:!0,"row--clickable":!0,"row--link":!0})}
1361
+ @mousedown=${()=>this._handleRowMouseDown()}
1362
+ @click=${()=>this._handleRowClick(e,t)}
1363
+ >${i}</a>
1364
+ `:I`
1365
+ <div
1366
+ class=${ke({row:!0,"row--clickable":!!this._def.rowClickable})}
1367
+ @mousedown=${()=>this._handleRowMouseDown()}
1368
+ @click=${()=>this._handleRowClick(e,t)}
1369
+ >${i}</div>
1370
+ `}))}
1366
1371
  </div>
1367
1372
  </div>
1368
1373
  </div>
@@ -1696,6 +1701,11 @@ const Te="important",Ee=" !"+Te,Ke=xe(class extends _e{constructor(e){if(super(e
1696
1701
  cursor: pointer;
1697
1702
  }
1698
1703
 
1704
+ .row--link {
1705
+ color: inherit;
1706
+ text-decoration: none;
1707
+ }
1708
+
1699
1709
  .header-row {
1700
1710
  display: contents;
1701
1711
  }
@@ -2329,9 +2339,6 @@ const Te="important",Ee=" !"+Te,Ke=xe(class extends _e{constructor(e){if(super(e
2329
2339
  fill: #000;
2330
2340
  }
2331
2341
 
2332
- .file-list__action--delete:hover {
2333
- fill: #dc3545;
2334
- }
2335
2342
 
2336
2343
  .file-list__empty {
2337
2344
  color: #000;