@momentum-design/components 0.22.0 → 0.22.1

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.
@@ -1325,7 +1325,7 @@
1325
1325
  </div>`}renderHelperText(){return m`<div class="mdc-help-text" part="mdc-help-text">
1326
1326
  <slot name="help-icon">${this.renderHelpTextIcon()}</slot>
1327
1327
  <slot name="help-text">${this.renderHelpText()}</slot>
1328
- </div>`}};J.styles=[...g.styles,...Ao],s([d({reflect:!0,type:String})],J.prototype,"label",2),s([d({type:String})],J.prototype,"id",2),s([d({reflect:!0,attribute:"help-text-type"})],J.prototype,"helpTextType",2),s([d({type:String,reflect:!0,attribute:"help-text"})],J.prototype,"helpText",2);var B=J;B.register(So);var Ce=B;var ee=o=>{class t extends o{constructor(){super(...arguments);this.name=""}}return s([d({reflect:!0,type:String})],t.prototype,"name",2),t};var No=u.constructTagName("input"),Co={OFF:"off",NONE:"none",ON:"on",SENTENCES:"sentences",WORDS:"words",CHARACTERS:"characters"},ko={MAX_LENGTH:10,HELPERTEXT:"Prefix text should not exceed 10 characters",VALIDATION:D.ERROR},te={VALIDATION:D.DEFAULT,ICON_SIZE_VALUE:1,ICON_SIZE_UNIT:"rem",CLEAR_BUTTON_ICON:"cancel-bold",CLEAR_BUTTON_VARIANT:me.TERTIARY,CLEAR_BUTTON_SIZE:H[20],PREFIX_TEXT_TYPE:C.BODY_MIDSIZE_REGULAR,PREFIX_TEXT_TAG:A.SPAN};var re=o=>{class t extends o{constructor(){super(...arguments);this.value=""}}return s([d({reflect:!0,type:String})],t.prototype,"value",2),t};var oe=o=>{class t extends o{constructor(){super(...arguments);this.dataAriaLabel=null}}return s([d({type:String,reflect:!0,attribute:"data-aria-label"})],t.prototype,"dataAriaLabel",2),t};var T=class extends oe(re(ee(Ce))){constructor(){super();this.placeholder="";this.required=!1;this.readonly=!1;this.trailingButton=!1;this.autocapitalize=Co.OFF;this.autocomplete="off";this.autofocus=!1;this.clearAriaLabel="";this.internals=this.attachInternals()}checkValidity(){return this.setValidityFromInput(),this.internals.checkValidity()}reportValidity(){return this.setValidityFromInput(),this.internals.reportValidity()}get form(){return this.internals.form}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.inputElement&&(this.inputElement.checkValidity(),this.setValidityFromInput(),this.internals.setFormValue(this.inputElement.value))}).catch(e=>{this.onerror&&this.onerror(e)})}updated(e){super.updated(e),e.has("value")&&this.handleValueChange()}handleValueChange(){this.internals.setFormValue(this.value),this.updateComplete.then(()=>{this.setValidityFromInput()}).catch(e=>{this.onerror&&this.onerror(e)})}attributeChangedCallback(e,r,i){super.attributeChangedCallback(e,r,i),["maxlength","minlength","pattern","required"].includes(e)&&this.updateComplete.then(()=>{this.setValidityFromInput()}).catch(a=>{this.onerror&&this.onerror(a)})}setValidityFromInput(){this.inputElement&&this.internals.setValidity(this.inputElement.validity,this.inputElement.validationMessage,this.inputElement)}updateValue(){this.value=this.inputElement.value,this.internals.setFormValue(this.inputElement.value)}onInput(){this.updateValue(),this.setValidityFromInput()}onChange(e){this.updateValue(),this.setValidityFromInput();let r=e.constructor;this.dispatchEvent(new r(e.type,e))}renderLeadingIcon(){return this.leadingIcon?m`
1328
+ </div>`}};J.styles=[...g.styles,...Ao],s([d({reflect:!0,type:String})],J.prototype,"label",2),s([d({type:String})],J.prototype,"id",2),s([d({reflect:!0,attribute:"help-text-type"})],J.prototype,"helpTextType",2),s([d({type:String,reflect:!0,attribute:"help-text"})],J.prototype,"helpText",2);var B=J;B.register(So);var Ce=B;var ee=o=>{class t extends o{constructor(){super(...arguments);this.name=""}}return s([d({reflect:!0,type:String})],t.prototype,"name",2),t};var No=u.constructTagName("input"),Co={OFF:"off",NONE:"none",ON:"on",SENTENCES:"sentences",WORDS:"words",CHARACTERS:"characters"},ko={MAX_LENGTH:10,HELPERTEXT:"Prefix text should not exceed 10 characters",VALIDATION:D.ERROR},te={VALIDATION:D.DEFAULT,ICON_SIZE_VALUE:1,ICON_SIZE_UNIT:"rem",CLEAR_BUTTON_ICON:"cancel-bold",CLEAR_BUTTON_VARIANT:me.TERTIARY,CLEAR_BUTTON_SIZE:H[20],PREFIX_TEXT_TYPE:C.BODY_MIDSIZE_REGULAR,PREFIX_TEXT_TAG:A.SPAN};var re=o=>{class t extends o{constructor(){super(...arguments);this.value=""}}return s([d({reflect:!0,type:String})],t.prototype,"value",2),t};var oe=o=>{class t extends o{constructor(){super(...arguments);this.dataAriaLabel=null}}return s([d({type:String,reflect:!0,attribute:"data-aria-label"})],t.prototype,"dataAriaLabel",2),t};var T=class extends oe(re(ee(Ce))){constructor(){super();this.placeholder="";this.required=!1;this.readonly=!1;this.trailingButton=!1;this.autocapitalize=Co.OFF;this.autocomplete="off";this.autofocus=!1;this.clearAriaLabel="";this.internals=this.attachInternals()}checkValidity(){return this.setValidityFromInput(),this.internals.checkValidity()}reportValidity(){return this.setValidityFromInput(),this.internals.reportValidity()}get form(){return this.internals.form}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.inputElement&&(this.inputElement.checkValidity(),this.setValidityFromInput(),this.internals.setFormValue(this.inputElement.value))}).catch(e=>{this.onerror&&this.onerror(e)})}updated(e){super.updated(e),e.has("value")&&this.handleValueChange()}handleValueChange(){this.internals.setFormValue(this.value),this.updateComplete.then(()=>{this.setValidityFromInput()}).catch(e=>{this.onerror&&this.onerror(e)})}attributeChangedCallback(e,r,i){super.attributeChangedCallback(e,r,i),["maxlength","minlength","pattern","required"].includes(e)&&this.updateComplete.then(()=>{this.setValidityFromInput()}).catch(a=>{this.onerror&&this.onerror(a)})}setValidityFromInput(){this.inputElement&&this.internals.setValidity(this.inputElement.validity,this.inputElement.validationMessage,this.inputElement)}updateValue(){this.value=this.inputElement.value,this.internals.setFormValue(this.inputElement.value)}onInput(){this.updateValue(),this.setValidityFromInput()}onChange(e){this.updateValue(),this.setValidityFromInput();let r=e.constructor;this.dispatchEvent(new r(e.type,e))}handleKeyDown(e){var r;e.key==="Enter"&&((r=this.internals.form)==null||r.requestSubmit())}renderLeadingIcon(){return this.leadingIcon?m`
1329
1329
  <mdc-icon
1330
1330
  class="leading-icon"
1331
1331
  part="leading-icon"
@@ -1383,6 +1383,7 @@
1383
1383
  size=${f(this.size)}
1384
1384
  @input=${this.onInput}
1385
1385
  @change=${this.onChange}
1386
+ @keydown=${this.handleKeyDown}
1386
1387
  />
1387
1388
  </slot>
1388
1389
  </div>