@luzmo/lucero 1.0.1-alpha.25 → 1.0.1-alpha.26
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.
- package/components/color-field/index.cjs +1 -1
- package/components/color-field/index.js +1 -1
- package/components/index.cjs +1 -1
- package/components/index.js +1 -1
- package/components/number-field/index.cjs +1 -1
- package/components/number-field/index.js +1 -1
- package/components/search/index.cjs +1 -1
- package/components/search/index.js +1 -1
- package/components/text-field/index.cjs +1 -1
- package/components/text-field/index.js +1 -1
- package/components/text-field/text-field.d.ts +0 -1
- package/components/{text-field-CQ8t9NU2.js → text-field-BTEpwGFu.js} +52 -68
- package/components/{text-field-Bnei-lTb.cjs → text-field-JMrsh-zo.cjs} +3 -5
- package/custom-elements.json +1 -1
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
"use strict";const n=require("lit"),i=require("lit/decorators.js"),s=require("lit/directives/if-defined.js"),
|
|
18
|
+
"use strict";const n=require("lit"),i=require("lit/decorators.js"),s=require("lit/directives/if-defined.js"),y=require("lit/directives/live.js"),h=require("@luzmo/icons"),v=require("./focusable-CbVKgGfS.cjs"),f=require("./sized-mixin-DcvJLFeo.cjs"),m=require("./manage-help-text-Bat9yGvF.cjs"),g=require("./text-field.module-DXhFA9G-.cjs");var $=Object.defineProperty,x=Object.getOwnPropertyDescriptor,r=(p,e,l,a)=>{for(var o=a>1?void 0:a?x(e,l):e,u=p.length-1,d;u>=0;u--)(d=p[u])&&(o=(a?d(e,l,o):d(o))||o);return a&&o&&$(e,l,o),o};const b=["text","url","tel","email","password"];class t extends m.ManageHelpText(f.SizedMixin(v.Focusable,{noDefaultSize:!0})){constructor(){super(...arguments),this.allowedKeys="",this.focused=!1,this.invalid=!1,this.label="",this.placeholder="",this._type="text",this.grows=!1,this.maxlength=-1,this.minlength=-1,this.multiline=!1,this.readonly=!1,this.rows=-1,this.valid=!1,this._value="",this.quiet=!1,this.required=!1}static get styles(){return[n.unsafeCSS(g.textFieldStyles)]}set type(e){const l=this._type;this._type=e,this.requestUpdate("type",l)}get type(){return b.find(e=>e===this._type)??"text"}set value(e){if(e===this.value)return;const l=this._value;this._value=e,this.requestUpdate("value",l)}get value(){return this._value}get focusElement(){return this.inputElement}setSelectionRange(e,l,a="none"){this.inputElement.setSelectionRange(e,l,a)}select(){this.inputElement.select()}handleInput(e){if(this.allowedKeys&&this.inputElement.value&&!new RegExp(`^[${this.allowedKeys}]*$`,"u").test(this.inputElement.value)){const o=this.inputElement.selectionStart-1;this.inputElement.value=this.value.toString(),this.inputElement.setSelectionRange(o,o);return}this.value=this.inputElement.value}handleChange(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}onFocus(){this.focused=!this.readonly&&!0}onBlur(e){this.focused=!this.readonly&&!1}handleInputElementPointerdown(){}renderStateIcons(){return this.invalid?n.html`
|
|
19
19
|
<div id="invalid" class="icon">${h.luzmoIcon(h.luzmoAlert)}</div>
|
|
20
20
|
`:this.valid?n.html`
|
|
21
21
|
<div id="valid" class="icon">${h.luzmoIcon(h.luzmoCheck)}</div>
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
.value=${this.displayValue}
|
|
40
40
|
@change=${this.handleChange}
|
|
41
41
|
@input=${this.handleInput}
|
|
42
|
-
@keypress=${this.handleKeyPress}
|
|
43
42
|
@focus=${this.onFocus}
|
|
44
43
|
@blur=${this.onBlur}
|
|
45
44
|
?disabled=${this.disabled}
|
|
@@ -62,10 +61,9 @@
|
|
|
62
61
|
minlength=${s.ifDefined(this.minlength>-1?this.minlength:void 0)}
|
|
63
62
|
pattern=${s.ifDefined(this.pattern)}
|
|
64
63
|
placeholder=${this.placeholder}
|
|
65
|
-
.value=${
|
|
64
|
+
.value=${y.live(this.displayValue)}
|
|
66
65
|
@change=${this.handleChange}
|
|
67
66
|
@input=${this.handleInput}
|
|
68
|
-
@keypress=${this.handleKeyPress}
|
|
69
67
|
@pointerdown=${this.handleInputElementPointerdown}
|
|
70
68
|
@focus=${this.onFocus}
|
|
71
69
|
@blur=${this.onBlur}
|
|
@@ -80,4 +78,4 @@
|
|
|
80
78
|
`}render(){return n.html`
|
|
81
79
|
<div id="text-field">${this.renderField()}</div>
|
|
82
80
|
${this.renderHelpText(this.invalid)}
|
|
83
|
-
`}update(e){(e.has("value")||e.has("required")&&this.required)&&this.updateComplete.then(()=>{this.checkValidity()}),super.update(e)}checkValidity(){let e=this.inputElement.checkValidity();return(this.required||this.value&&this.pattern)&&((this.disabled||this.multiline)&&this.pattern&&(e=new RegExp(`^${this.pattern}$`,"u").test(this.value.toString())),this.minlength!==void 0&&(e=e&&this.value.toString().length>=this.minlength),this.valid=e,this.invalid=!e),e}}r([i.state()],t.prototype,"appliedLabel",2);r([i.property({attribute:"allowed-keys"})],t.prototype,"allowedKeys",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"focused",2);r([i.query(".input:not(#sizer)")],t.prototype,"inputElement",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"invalid",2);r([i.property()],t.prototype,"label",2);r([i.property({type:String,reflect:!0})],t.prototype,"name",2);r([i.property()],t.prototype,"placeholder",2);r([i.state()],t.prototype,"type",1);r([i.property({attribute:"type",reflect:!0})],t.prototype,"_type",2);r([i.property()],t.prototype,"pattern",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"grows",2);r([i.property({type:Number})],t.prototype,"maxlength",2);r([i.property({type:Number})],t.prototype,"minlength",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"multiline",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"readonly",2);r([i.property({type:Number})],t.prototype,"rows",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"valid",2);r([i.property({type:String})],t.prototype,"value",1);r([i.property({type:Boolean,reflect:!0})],t.prototype,"quiet",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"required",2);r([i.property({type:String,reflect:!0})],t.prototype,"autocomplete",2);class
|
|
81
|
+
`}update(e){(e.has("value")||e.has("required")&&this.required)&&this.updateComplete.then(()=>{this.checkValidity()}),super.update(e)}checkValidity(){let e=this.inputElement.checkValidity();return(this.required||this.value&&this.pattern)&&((this.disabled||this.multiline)&&this.pattern&&(e=new RegExp(`^${this.pattern}$`,"u").test(this.value.toString())),this.minlength!==void 0&&(e=e&&this.value.toString().length>=this.minlength),this.valid=e,this.invalid=!e),e}}r([i.state()],t.prototype,"appliedLabel",2);r([i.property({attribute:"allowed-keys"})],t.prototype,"allowedKeys",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"focused",2);r([i.query(".input:not(#sizer)")],t.prototype,"inputElement",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"invalid",2);r([i.property()],t.prototype,"label",2);r([i.property({type:String,reflect:!0})],t.prototype,"name",2);r([i.property()],t.prototype,"placeholder",2);r([i.state()],t.prototype,"type",1);r([i.property({attribute:"type",reflect:!0})],t.prototype,"_type",2);r([i.property()],t.prototype,"pattern",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"grows",2);r([i.property({type:Number})],t.prototype,"maxlength",2);r([i.property({type:Number})],t.prototype,"minlength",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"multiline",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"readonly",2);r([i.property({type:Number})],t.prototype,"rows",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"valid",2);r([i.property({type:String})],t.prototype,"value",1);r([i.property({type:Boolean,reflect:!0})],t.prototype,"quiet",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"required",2);r([i.property({type:String,reflect:!0})],t.prototype,"autocomplete",2);class c extends t{constructor(){super(...arguments),this._value=""}set value(e){if(e===this.value)return;const l=this._value;this._value=e,this.requestUpdate("value",l)}get value(){return this._value}}r([i.property({type:String})],c.prototype,"value",1);exports.LuzmoTextField=c;exports.LuzmoTextFieldBase=t;
|