UNPKG

@rocketspark/domain-checker

Version:
13 lines 18.4 kB
/*! * * @rocketspark/domain-checker v0.0.34 * https://github.com/rocketspark/domain-checker.git * * Copyright (c) Lee Reichardt and project contributors. * * This source code is licensed under the no license license found in the * LICENSE file in the root directory of this source tree. * */ "use strict";(self.webpackChunkDomainChecker=self.webpackChunkDomainChecker||[]).push([[795],{2419:function(t,e,s){s.d(e,{d:function(){return o},i:function(){return r},s:function(){return n}});var i=s(7915);const o=(t,e=0)=>{let s;return(...i)=>{clearTimeout(s),s=setTimeout(t,e,...i)}},r=(t,e,s)=>{const o=(void 0!==t.target?t.target:s).tagName.toLowerCase().replace("rs-",""),r=t.detail,n={},l=e.get(o)||{};let a=!1;Object.keys(r).forEach((t=>{if(r[t]){const e=`item-${t}`;l[e]||(a=!0),n[e]=!0}})),a||Object.keys(n).length===Object.keys(l).length||(a=!0),a&&(e.set(o,n),(0,i.f)(s))},n=(t,e,s,i=!1)=>{!e&&!s||i||null!==t&&(t.style.display="block",setTimeout((function(){t.style.opacity="1"}),150))}},2795:function(t,e,s){s.r(e),s.d(e,{rs_dropdown:function(){return n},rs_input:function(){return l},rs_label:function(){return a},rs_toggle:function(){return h},rs_toggle_item:function(){return c}});var i=s(7915),o=s(2419);class r{constructor(t,e,s=null){this._value=t,this._label=e,this._style=s,this.onClick=t=>()=>{t(this)}}element(){return this._el}value(){return this._value}label(){return this._label}render(t,e){return(0,i.h)("div",{key:this.value(),ref:t=>this._el=t,class:{dropdown__item:!0,"dropdown__item--selected":e},"data-value":this.value(),onClick:this.onClick(t)},(0,i.h)("rs-caption",{style:Object.assign(Object.assign({},this._style),{overflow:"hidden",textOverflow:"ellipsis"})},this._label))}}const n=class{constructor(t){(0,i.r)(this,t),this.rsChange=(0,i.c)(this,"rsChange",7),this.showDropdown=(0,i.c)(this,"showDropdown",7),this.hideDropdown=(0,i.c)(this,"hideDropdown",7),this.toggleDropdown=()=>{var t,e;(0!==this._items.length||this.hasActionTop)&&(this.$container.classList.toggle("is-open"),this.$container.classList.contains("is-open")?(this.showDropdown.emit(),this.$itemContainer.scrollTop=(null===(t=this.selectedItem)||void 0===t?void 0:t.element().offsetTop)-this.$itemContainer.offsetTop-(null===(e=this.selectedItem)||void 0===e?void 0:e.element().offsetHeight)):this.hideDropdown.emit())},this.filterItems=t=>{this.filterText=t.target.value},this.selectItem=t=>{this.selectedItem=t,this.value=t.value(),this.closeDropdown(),this.rsChange.emit(t.value())},this.value=null,this.items=[],this.type="selectOne",this.size="large",this.maxHeight="300px",this.searchable=!1,this.placeholder="Choose an option",this.selectedIndex=null,this.maxWidth=null,this._items=void 0,this.selectedItem=null,this.filterText=""}async clear(){this.selectedItem=null}render(){return(0,i.h)(i.H,{tabindex:0},(0,i.h)("div",{class:`container is-${this.size}`,ref:t=>this.$container=t},(0,i.h)("div",{class:"selected__container",onClick:this.toggleDropdown},this.renderSelected()),(0,i.h)("div",{class:"dropdown__container",style:{maxWidth:this.maxWidth}},this.searchable?this.renderSearch():null,this.hasActionTop?this.renderAction("top"):null,(0,i.h)("div",{class:"dropdown__items",ref:t=>this.$itemContainer=t,style:{maxHeight:this.maxHeight}},this.renderItems()))))}componentWillLoad(){this.hasActionTop=!!this.el.querySelector('[slot="action-top"]')}componentWillRender(){var t,e,s;let i;if(i="string"==typeof this.items?JSON.parse(this.items):this.items,this._items=i.map((t=>new r(t.value,t.label,t.style))),null===this.selectedItem&&null!==this.selectedIndex&&(this.selectedItem=null!==(t=this._items[this.selectedIndex])&&void 0!==t?t:null),null!==this.value){const t=null!==(e=this._items.find((t=>t.value()===this.value)))&&void 0!==e?e:null;(null===(s=this.selectedItem)||void 0===s?void 0:s.value())!==(null==t?void 0:t.value())&&(this.selectedItem=t)}}componentDidLoad(){window.addEventListener("mousedown",(t=>{t.composedPath().includes(this.el)||this.closeDropdown()})),"large"===this.size&&this.$container.style.setProperty("--rs-dropdown-selected-container-height","42px"),"small"===this.size&&this.$container.style.setProperty("--rs-dropdown-selected-container-height","32px")}renderSelected(){var t,e;const s=null!==(e=null===(t=this.selectedItem)||void 0===t?void 0:t.label())&&void 0!==e?e:this.placeholder;if("large"===this.size)return(0,i.h)("rs-content",{class:"dropdown__selected",body:2},s);if("small"===this.size)return(0,i.h)("rs-caption",{class:"dropdown__selected"},s);throw new Error(`Invalid size ${this.size}`)}renderItems(){if(0===this._items.length)return null;const t=this._items.filter((t=>t.label().toLowerCase().includes(this.filterText.toLowerCase())));return 0===t.length?(0,i.h)("div",{class:"dropdown__item dropdown__item--no-results"},"No results found"):t.map((t=>{var e;return t.render(this.selectItem,t.value()===(null===(e=this.selectedItem)||void 0===e?void 0:e.value()))}))}renderSearch(){return(0,i.h)("div",{class:"dropdown__search"},(0,i.h)("input",{type:"text",onInput:this.filterItems}))}renderAction(t){return(0,i.h)("div",{class:`dropdown__action dropdown__action--${t}`},(0,i.h)("slot",{name:`action-${t}`}))}closeDropdown(){this.$container.classList.remove("is-open")}get el(){return(0,i.g)(this)}};n.style="*{box-sizing:border-box;margin:0}.container{--rs-dropdown-selected-container-height:0;position:relative;width:100%}.selected__container{position:relative;display:flex;justify-content:space-between;align-items:center;height:var(--rs-dropdown-selected-container-height);border-radius:4px;box-shadow:inset 0 0 0 1px var(--rs-color-select-border);cursor:pointer}.is-small .selected__container{background:var(--rs-color-white);padding:8px 12px}.is-large .selected__container{background:var(--rs-color-select-background);padding:12px}.is-open .selected__container{border-radius:4px 4px 0 0}:host(:focus) .selected__container,:host(:active) .selected__container{box-shadow:inset 0 0 0 1px #b7b7b7}.dropdown__selected{white-space:nowrap;width:100%;overflow:hidden}.selected__container::after{content:'';position:absolute;top:calc(50% - 2.5px);right:12px;border-style:solid;border-color:#333 var(--rs-color-transparent) var(--rs-color-transparent);border-width:5px}.selected__container::before{content:\"\";background:linear-gradient(90deg, rgb(255 255 255 / 0) 0%, white 40%);position:absolute;width:31px;right:1px;top:1px;bottom:1px;border-radius:4px}.dropdown__container{position:absolute;top:calc(var(--rs-dropdown-selected-container-height) - 1px);display:none;min-width:100%;width:min-content;white-space:nowrap;overflow:hidden;background:var(--rs-color-white);border:solid 1px #b7b7b7;border-radius:0 0 4px 4px}.is-open .dropdown__container{display:block;z-index:1}.dropdown__search{border-bottom:1px solid #ddd}.dropdown__search input{width:100%;padding:10px;border:none;color:var(--rs-color-black);font-family:Soleil, sans-serif;outline:none;appearance:none}.dropdown__action{width:100%;padding:16px;border-bottom:1px solid #ddd}.dropdown__action:hover{background-color:var(--rs-color-light)}.dropdown__items{overflow:hidden auto}.dropdown__item{padding:10px;cursor:pointer}.dropdown__item--selected,.dropdown__item:hover{background-color:var(--rs-color-light)}.dropdown__item--no-results{cursor:default}.dropdown__item--no-results:hover{background-color:initial}";const l=class{constructor(t){(0,i.r)(this,t),this.rsInput=(0,i.c)(this,"rsInput",7),this.rsInputChanged=(0,i.c)(this,"rsInputChanged",7),this.rsInputNoFocus=(0,i.c)(this,"rsInputNoFocus",7),this.rsInputFocus=(0,i.c)(this,"rsInputFocus",7),this.rsItem=(0,i.c)(this,"rsItem",7),this.didBlurAfterEdit=!1,this.hasStartSlot=!1,this.hasEndSlot=!1,this.onInput=t=>{const e=t.target;null!==e&&(this.value=e.value||""),this.rsInput.emit(t)},this.onFocus=()=>{this.hasFocus=!0,this.focusChanged(),this.emitRsItem(),this.rsInputFocus.emit()},this.focusChanged=()=>{!this.hasFocus&&this.hasValue()&&(this.didBlurAfterEdit=!0)},this.shouldClearOnEdit=()=>{const{type:t,clearOnEdit:e}=this;return void 0===e?"password"===t:e},this.onKeyDown=()=>{this.shouldClearOnEdit()&&this.didBlurAfterEdit&&this.hasValue()&&this.clearTextInput(),this.didBlurAfterEdit=!1},this.clearTextInput=t=>{void 0===this.clearInput||this.readonly||this.disabled||void 0===t||(t.preventDefault(),t.stopPropagation()),this.value="",null!==this.nativeElement&&(this.nativeElement.value="")},this.onBlur=()=>{this.hasFocus=!1,this.focusChanged(),this.emitRsItem(),this.rsInputNoFocus.emit()},this.hasFocus=!1,this.charsLeft=0,this.type="text",this.value="",this.disabled=!1,this.readonly=!1,this.placeholder=void 0,this.clearOnEdit=!1,this.clearInput=!1,this.required=!1,this.hideMax=!1,this.hardLimit=null,this.softLimit=null,this.name=void 0,this.hasError=!1,this.textAlign="left",this.size="default"}disabledChanged(){this.emitRsItem()}valueChanged(){this.emitRsItem(),this.changeMaxLengthText(),this.rsInputChanged.emit({value:null==this.value?this.value:this.value.toString()})}hasErrorChanged(){this.emitRsItem()}async update(){(0,i.f)(this.el)}async setFocus(){null!==this.nativeElement&&this.nativeElement.focus()}getInputElement(){return Promise.resolve(this.nativeElement)}getValue(){return this.value||""}hasValue(){return this.getValue().length>0}emitRsItem(){this.rsItem.emit({input:!0,interactive:!0,"has-focus":this.hasFocus,"has-value":this.hasValue(),"has-placeholder":null!==this.placeholder,"has-error":this.hasError,"has-max":null!==this.hardLimit||null!==this.softLimit,"hide-max":this.hideMax,"interactive-disabled":this.disabled,"input-has-start-slot":this.hasStartSlot,"input-has-end-slot":this.hasEndSlot,"input-chars-over-max":this.charsLeft<0,"input-is-required":this.required})}changeMaxLengthText(){if(null!==this.softLimit&&this.softLimit>0&&!this.hideMax){const t=this.value.length;this.charsLeft=this.softLimit-t;const e=this.el.querySelector(".max-length");null!==e&&(this.charsLeft<0?(e.innerHTML=`${Math.abs(this.charsLeft)} over`,this.el.classList.add("input-chars-over-max")):(e.innerHTML=`${this.charsLeft} left`,this.el.classList.remove("input-chars-over-max")))}}componentDidLoad(){if(void 0!==this.softLimit||void 0!==this.hardLimit){const t=this.el.querySelector(".max-length");(0,o.s)(t,this.hardLimit,this.softLimit,this.hideMax),this.changeMaxLengthText()}}connectedCallback(){this.hasStartSlot=null!==this.el.querySelector('[slot="start"]'),this.hasEndSlot=null!==this.el.querySelector('[slot="end"]'),this.emitRsItem()}render(){const t=this.getValue();let e=null;if((this.hardLimit||this.softLimit)&&!this.hideMax){const t=this.hardLimit||this.softLimit;e=(0,i.h)("span",{class:"max-length"},t," max")}return(0,i.h)(i.H,{class:{"has-value":this.hasValue(),"has-focus":this.hasFocus,"has-placeholder":null!==this.placeholder,"has-max":null!==this.hardLimit||null!==this.softLimit,"hide-max":this.hideMax,"chars-over-max":this.charsLeft<0,"has-error":this.hasError,[`text-align-${this.textAlign}`]:!0,[`size-${this.size}`]:!0}},e,(0,i.h)("div",{class:"rs-input__inner"},(0,i.h)("slot",{name:"start"}),(0,i.h)("input",{class:"native-input",ref:t=>this.nativeElement=t,disabled:this.disabled,readonly:this.readonly,onInput:this.onInput,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,placeholder:this.placeholder,type:this.type,required:this.required,name:this.name,maxlength:this.hardLimit,value:t}),(0,i.h)("slot",{name:"end"})))}get el(){return(0,i.g)(this)}static get watchers(){return{disabled:["disabledChanged"],value:["valueChanged"],hasError:["hasErrorChanged"]}}};l.style='.sc-rs-input-h{display:block;position:static;width:100%;padding:0}.rs-input__inner.sc-rs-input{display:flex;align-items:center;justify-content:flex-start;width:100%;height:42px;box-shadow:none;background:var(--rs-color-light);border:none;box-sizing:border-box;border-radius:4px;padding:11px 14px;transition:box-shadow .15s ease-out, background-color .15s ease-out}.size-small.sc-rs-input-h .rs-input__inner.sc-rs-input{height:32px;padding:8px}.size-small.sc-rs-input-h .rs-input__inner.sc-rs-input .native-input.sc-rs-input{padding:0 0 2px 0}.text-align-center.sc-rs-input-h .rs-input__inner.sc-rs-input .native-input.sc-rs-input{text-align:center}.text-align-right.sc-rs-input-h .rs-input__inner.sc-rs-input .native-input.sc-rs-input{text-align:right}.text-align-left.sc-rs-input-h .rs-input__inner.sc-rs-input .native-input.sc-rs-input{text-align:left}.native-input.sc-rs-input,.native-input.sc-rs-input:focus{border:none;background-image:none;background-color:transparent;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;-webkit-appearance:none;outline:none;height:100%;width:100%;display:block;font-family:Soleil, sans-serif;font-style:normal;font-weight:normal;font-size:14px;line-height:140%;color:var(--rs-color-heading);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;resize:none;padding:0}.native-input.sc-rs-input::placeholder{color:var(--rs-color-grey);font-family:Soleil, sans-serif;font-style:normal;font-weight:normal}.native-input[disabled].sc-rs-input{opacity:0.4}.has-value.sc-rs-input-h .rs-input__inner.sc-rs-input{box-shadow:inset 0 0 0 1px var(--rs-color-grey-light);background-color:var(--rs-color-white)}.has-focus.sc-rs-input-h .rs-input__inner.sc-rs-input{box-shadow:inset 0 0 0 2px var(--rs-color-primary);background-color:var(--rs-color-white);color:var(--rs-color-heading);outline:none;pointer-events:auto;opacity:1}.has-error.has-focus.sc-rs-input-h .rs-input__inner.sc-rs-input{box-shadow:inset 0 0 0 2px var(--rs-color-negative);background-color:var(--rs-color-white)}.has-error.sc-rs-input-h:not(.has-focus) .rs-input__inner.sc-rs-input{box-shadow:inset 0 0 0 1px var(--rs-color-negative);background-color:var(--rs-color-white)}.has-focus.sc-rs-input-h .max-length.sc-rs-input{color:var(--rs-color-grey)}.has-value.sc-rs-input-h:not(.has-focus) .max-length.sc-rs-input{display:block;opacity:1;color:var(--rs-color-grey-light)}.sc-rs-input-h .max-length.sc-rs-input{font-family:Soleil, sans-serif;font-style:normal;font-weight:normal;font-size:12px;line-height:13px;text-align:right;color:var(--rs-color-grey);display:none;opacity:0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin-bottom:5px;transition:opacity .15s ease-out, color .15s ease-out}.chars-over-max.sc-rs-input-h .max-length.sc-rs-input{color:var(--rs-color-negative)}.sc-rs-input-s>[slot="start"]{margin-right:10px}.sc-rs-input-s>[slot="end"]{margin-left:10px}';const a=class{constructor(t){(0,i.r)(this,t),this.rsItem=(0,i.c)(this,"rsItem",7),this.color="grey",this.position="floating"}emitRsItem(){this.rsItem.emit({[`label-${this.position}`]:null!==this.position,"has-label":!0})}render(){const t=this.position;return this.emitRsItem(),(0,i.h)(i.H,{class:{[`label-${t}`]:null!==t},style:{color:void 0!==this.color?`var(--rs-color-${this.color})`:""}},(0,i.h)("slot",null))}get el(){return(0,i.g)(this)}};a.style="rs-label{display:block;font-family:Soleil, sans-serif;font-style:normal;font-weight:600;font-size:12px;color:var(--rs-color-grey);line-height:13px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;pointer-events:none;margin-bottom:5px}.item-has-focus rs-label{color:var(--rs-color-primary-700) !important}rs-label.label-floating{transform:translate3d(0, 32px, 0);transform-origin:left top;transition:transform 0.25s ease-in-out, font-size 0.25s ease-in-out;font-size:14px;font-weight:normal;padding-left:14px}.item-has-focus rs-label.label-floating,.item-has-value rs-label.label-floating{transform:translate3d(0, 0, 0);font-size:12px;font-weight:600}.item-has-max rs-label.label-fixed,.item-has-max rs-label.label-floating{position:absolute;top:0}.item-has-error rs-label{color:var(--rs-color-negative) !important}.item-input-has-start-slot rs-label.label-floating,.item-textarea-has-start-slot rs-label.label-floating{padding-left:38px}.item-input-has-start-slot.item-has-focus rs-label.label-floating,.item-input-has-start-slot.item-has-value rs-label.label-floating,.item-textarea-has-start-slot.item-has-focus rs-label.label-floating,.item-textarea-has-start-slot.item-has-value rs-label.label-floating{transform:translate3d(-22px, 0, 0);font-size:12px}";const h=class{constructor(t){(0,i.r)(this,t),this.toggle=(0,i.c)(this,"toggle",7),this.hasMovedActiveTab=!1,this.renderToggleBar=()=>{this.toggleItems=this.host.querySelectorAll("rs-toggle-item"),this.activeTabElement.style.width=`calc(${100/this.toggleItems.length}%)`,this.toggleItems.forEach(((t,e)=>{null!==t.getAttribute("active")&&this.moveActiveTab(e),t.addEventListener("click",(()=>{this.currentPosition!==e&&(this.moveActiveTab(e),this.removeAllActiveProp(),t.setAttribute("active","true"),this.emitToggleEvent())}))})),this.hasMovedActiveTab||this.moveActiveTab(0)},this.currentPosition=0}async setActivePosition(t=0){this.removeAllActiveProp(),this.moveActiveTab(t),this.emitToggleEvent()}removeAllActiveProp(){this.toggleItems.forEach((t=>{t.removeAttribute("active")}))}moveActiveTab(t){this.activeTabElement.style.left=`calc(${100/this.toggleItems.length*t}%)`,this.currentPosition=t,this.hasMovedActiveTab=!0}emitToggleEvent(){this.toggle.emit({value:this.currentPosition,target:this.toggleItems[this.currentPosition]})}componentDidRender(){this.renderToggleBar()}render(){return(0,i.h)(i.H,null,(0,i.h)("div",{class:"toggle"},(0,i.h)("div",{class:"toggle__items"},(0,i.h)("slot",{onSlotchange:this.renderToggleBar}),(0,i.h)("div",{ref:t=>this.activeTabElement=t,class:"active-tab"}))))}get host(){return(0,i.g)(this)}};h.style=".toggle{display:block;padding:4px;border-radius:7px;background:var(--rs-color-light)}.toggle__items{display:flex;flex-direction:row;position:relative}.active-tab{position:absolute;height:calc(100%);border-radius:4px;background:var(--rs-color-white);box-shadow:0 1px 5px rgb(195 213 226 / 0.62);z-index:1;transition:left 0.15s ease-out}";const c=class{constructor(t){(0,i.r)(this,t),this.active=!1}render(){return(0,i.h)(i.H,{class:{active:this.active}},(0,i.h)("slot",null))}get el(){return(0,i.g)(this)}};c.style=":host{box-sizing:border-box;display:block;padding:7px;text-align:center;z-index:2;cursor:pointer;color:var(--rs-color-secondary);font-family:Soleil, sans-serif;font-size:14px;user-select:none;flex-grow:1;flex-shrink:1;flex-basis:0;line-height:initial}:host(.active){cursor:default}"}}]); //# sourceMappingURL=795.index.js.map