UNPKG

@freshworks/crayons

Version:
1 lines 2.53 kB
import{r as registerInstance,h,e as Host,i as getElement}from"./index-25bc21e4.js";var dragItemCss=':host{font-family:var(--fw-font-family, -apple-system, blinkmacsystemfont, "Segoe UI", roboto, oxygen, ubuntu, cantarell, "Open Sans", "Helvetica Neue", sans-serif);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-box-sizing:border-box;box-sizing:border-box}:host{display:block}.drag-item{display:-ms-flexbox;display:flex;background:#ffffff;border:1px solid #ebeff3;-webkit-box-shadow:0px 2px 4px rgba(18, 52, 77, 0.06);box-shadow:0px 2px 4px rgba(18, 52, 77, 0.06);border-radius:4px;padding:8px 12px;-ms-flex-align:center;align-items:center;margin:8px 0px}.drag-item .drag-item__label{-ms-flex:1 1 auto;flex:1 1 auto}.drag-item .drag-item__prefix{-ms-flex:0 0 auto;flex:0 0 auto;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.drag-item .drag-item__suffix{-ms-flex:0 0 auto;flex:0 0 auto;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.drag-item .drag-icon{padding-right:12px}.drag-item .drag-icon.drag:hover,.drag-item .drag-icon.drag:focus{cursor:-webkit-grab;cursor:grab}';var DragItem=function(){function e(e){registerInstance(this,e);this.draggable=false;this.disabled=false;this.showDragIcon=true}e.prototype.componentDidLoad=function(){var e,t;if(this.pinned)return;(e=this.dragIcon)===null||e===void 0?void 0:e.addEventListener("mousedown",this.toggleDraggable.bind(this));(t=this.dragIcon)===null||t===void 0?void 0:t.addEventListener("mouseout",this.toggleDraggable.bind(this))};e.prototype.toggleDraggable=function(){this.draggable=!this.draggable};e.prototype.disconnectedCallback=function(){var e,t;(e=this.dragIcon)===null||e===void 0?void 0:e.removeEventListener("mousedown",this.toggleDraggable);(t=this.dragIcon)===null||t===void 0?void 0:t.removeEventListener("mouseout",this.toggleDraggable)};e.prototype.render=function(){var e=this;return h(Host,{draggable:this.draggable},h("div",{class:{"drag-item":true},draggable:this.draggable},this.showDragIcon&&h("span",{class:"drag-item__prefix"},h("fw-icon",{class:{"drag-icon":true,drag:!this.pinned},name:!this.pinned?"drag":"lock",ref:function(t){return e.dragIcon=t}})),h("span",{class:"drag-item__label"},h("slot",null)),h("span",{class:"drag-item__suffix"},h("slot",{name:"suffix"}))))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();DragItem.style=dragItemCss;export{DragItem as fw_drag_item};