@logosphere-ui/core 0.0.0-alpha.3 → 0.0.0-alpha.4

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.
@@ -1,44 +0,0 @@
1
- "use strict";const i=require("lit"),t=require("lit/decorators.js"),p=require("./live-BX-yBGvT.cjs"),u=".textarea__field{width:100%;background:transparent;border:none;outline:none;font-size:var(--font-size-sm);font-family:var(--font-family-base);color:var(--color-body-text);box-sizing:border-box;line-height:1.5}.textarea__field::placeholder{color:var(--color-tertiary)}.textarea__field:disabled{cursor:not-allowed}.textarea__field--resize-none{resize:none}.textarea__field--resize-vertical{resize:vertical}.textarea__field--resize-horizontal{resize:horizontal}.textarea__field--resize-both{resize:both}.textarea__field--auto-resize{resize:none;overflow:hidden}.textarea__clear-btn{border:none;background:transparent;color:var(--color-gray-400);cursor:pointer;padding:0;display:inline-flex;align-items:flex-start;align-self:flex-start;margin-top:var(--spacing-1);outline:none;flex-shrink:0;transition:color var(--transition-speed-fast) var(--transition-timing)}.textarea__clear-btn:hover{color:var(--color-gray-600)}";var d=Object.defineProperty,y=Object.getOwnPropertyDescriptor,r=(l,e,a,o)=>{for(var s=o>1?void 0:o?y(e,a):e,n=l.length-1,h;n>=0;n--)(h=l[n])&&(s=(o?h(e,a,s):h(s))||s);return o&&s&&d(e,a,s),s};exports.TextArea=class extends i.LitElement{constructor(){super(...arguments),this.value="",this.placeholder="",this.name="",this.autocomplete="",this.rows=3,this.wrap="soft",this.resize="vertical",this.autoResize=!1,this.size="default",this.variant="default",this.showClear=!1,this.label="",this.helper="",this.error="",this.required=!1,this.disabled=!1,this.readonly=!1,this._internalError="",this.handleInput=e=>{const a=e.target;this.value=a.value,this.autoResize&&this.adjustHeight(),this._internalError&&(this._internalError="",this._textareaElement.setCustomValidity("")),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:this.value,originalEvent:e}}))},this.handleChange=e=>{const a=e.target;this.value=a.value,a.checkValidity()||(this._internalError=a.validationMessage),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.value,originalEvent:e}}))},this.handleKeyDown=e=>{this.dispatchEvent(new CustomEvent("keydown",{bubbles:!0,composed:!0,detail:{key:e.key,originalEvent:e}}))},this.handleKeyUp=e=>{this.dispatchEvent(new CustomEvent("keyup",{bubbles:!0,composed:!0,detail:{key:e.key,originalEvent:e}}))},this.handleClear=()=>{this.value="",this._textareaElement&&(this._textareaElement.value="",this.autoResize&&this.adjustHeight()),this.dispatchEvent(new CustomEvent("clear",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:"",originalEvent:null}}))}}get textareaElement(){return this._textareaElement}focus(){this._textareaElement?.focus()}blur(){this._textareaElement?.blur()}select(){this._textareaElement?.select()}setSelectionRange(e,a,o){this._textareaElement?.setSelectionRange(e,a,o)}checkValidity(){return this._textareaElement?.checkValidity()??!0}reportValidity(){return this._textareaElement?.reportValidity()??!0}setCustomValidity(e){this._textareaElement?.setCustomValidity(e),this._internalError=e,this.requestUpdate()}adjustHeight(){!this.autoResize||!this._textareaElement||(this._textareaElement.style.height="auto",this._textareaElement.style.height=`${this._textareaElement.scrollHeight}px`)}updated(e){super.updated(e),e.has("value")&&this.autoResize&&this.adjustHeight()}getResizeClass(){return this.autoResize?"textarea__field--auto-resize":{none:"textarea__field--resize-none",vertical:"textarea__field--resize-vertical",horizontal:"textarea__field--resize-horizontal",both:"textarea__field--resize-both"}[this.resize]}render(){const e=this.error||this._internalError,a=this.showClear&&this.value&&!this.disabled&&!this.readonly,o=`textarea__field ${this.getResizeClass()}`;return i.html`
2
- <logosphere-formfield
3
- .label=${this.label}
4
- .helper=${this.helper}
5
- .error=${e}
6
- .required=${this.required}
7
- .disabled=${this.disabled}
8
- .readonly=${this.readonly}
9
- .placeholder=${this.placeholder}
10
- .size=${this.size}
11
- .variant=${this.variant}
12
- >
13
- <textarea
14
- class="${o}"
15
- .value=${p.l(this.value)}
16
- placeholder=${this.placeholder||i.nothing}
17
- name=${this.name||i.nothing}
18
- autocomplete=${this.autocomplete||i.nothing}
19
- ?required=${this.required}
20
- ?disabled=${this.disabled}
21
- ?readonly=${this.readonly}
22
- minlength=${this.minlength??i.nothing}
23
- maxlength=${this.maxlength??i.nothing}
24
- rows=${this.rows}
25
- cols=${this.cols??i.nothing}
26
- wrap=${this.wrap}
27
- @input=${this.handleInput}
28
- @change=${this.handleChange}
29
- @keydown=${this.handleKeyDown}
30
- @keyup=${this.handleKeyUp}
31
- ></textarea>
32
- ${a?i.html`
33
- <button
34
- type="button"
35
- slot="suffix"
36
- class="textarea__clear-btn"
37
- @click=${this.handleClear}
38
- tabindex="-1"
39
- >
40
- <ui-icon name="uil-times" size="14"></ui-icon>
41
- </button>
42
- `:i.nothing}
43
- </logosphere-formfield>
44
- `}};exports.TextArea.styles=[i.css`${i.unsafeCSS(u)}`];r([t.query("textarea")],exports.TextArea.prototype,"_textareaElement",2);r([t.property({type:String})],exports.TextArea.prototype,"value",2);r([t.property({type:String})],exports.TextArea.prototype,"placeholder",2);r([t.property({type:String})],exports.TextArea.prototype,"name",2);r([t.property({type:String})],exports.TextArea.prototype,"autocomplete",2);r([t.property({type:Number})],exports.TextArea.prototype,"minlength",2);r([t.property({type:Number})],exports.TextArea.prototype,"maxlength",2);r([t.property({type:Number})],exports.TextArea.prototype,"rows",2);r([t.property({type:Number})],exports.TextArea.prototype,"cols",2);r([t.property({type:String})],exports.TextArea.prototype,"wrap",2);r([t.property({type:String})],exports.TextArea.prototype,"resize",2);r([t.property({type:Boolean})],exports.TextArea.prototype,"autoResize",2);r([t.property({type:String})],exports.TextArea.prototype,"size",2);r([t.property({type:String})],exports.TextArea.prototype,"variant",2);r([t.property({type:Boolean})],exports.TextArea.prototype,"showClear",2);r([t.property({type:String})],exports.TextArea.prototype,"label",2);r([t.property({type:String})],exports.TextArea.prototype,"helper",2);r([t.property({type:String})],exports.TextArea.prototype,"error",2);r([t.property({type:Boolean})],exports.TextArea.prototype,"required",2);r([t.property({type:Boolean})],exports.TextArea.prototype,"disabled",2);r([t.property({type:Boolean})],exports.TextArea.prototype,"readonly",2);r([t.state()],exports.TextArea.prototype,"_internalError",2);exports.TextArea=r([t.customElement("logosphere-textarea")],exports.TextArea);