@m3e/form-field 1.2.2 → 1.3.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.
package/dist/index.min.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Copyright (c) 2025 matraic
4
4
  * See LICENSE file in the project root for full license text.
5
5
  */
6
- import{LitElement as t,nothing as e,html as i,css as o,unsafeCSS as s}from"lit";import{AttachInternals as r,MutationController as a,ResizeController as n,FocusController as l,HoverController as d,PressedController as h,isReadOnlyMixin as c,DesignToken as f,hasAssignedNodes as p,interceptProperty as u,getTextContent as m}from"@m3e/core";import{M3eAriaDescriber as b}from"@m3e/core/a11y";
6
+ import{LitElement as t,nothing as e,html as i,css as o,unsafeCSS as s}from"lit";import{AttachInternals as r,MutationController as a,ResizeController as n,FocusController as l,HoverController as d,PressedController as h,isReadOnlyMixin as c,DesignToken as f,hasAssignedNodes as p,interceptProperty as m,getTextContent as u}from"@m3e/core";import{M3eAriaDescriber as b}from"@m3e/core/a11y";
7
7
  /**
8
8
  * Adapted from Angular Material Form Field Control
9
9
  * Source: https://github.com/angular/components/blob/main/src/material/form-field/form-field-control.ts
@@ -17,12 +17,12 @@ import{LitElement as t,nothing as e,html as i,css as o,unsafeCSS as s}from"lit";
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
19
  */
20
- const x=globalThis,S=x.ShadowRoot&&(void 0===x.ShadyCSS||x.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,E=Symbol(),k=new WeakMap;
20
+ const x=globalThis,S=x.ShadowRoot&&(void 0===x.ShadyCSS||x.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,E=Symbol(),C=new WeakMap;
21
21
  /**
22
22
  * @license
23
23
  * Copyright 2019 Google LLC
24
24
  * SPDX-License-Identifier: BSD-3-Clause
25
- */let C=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==E)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(S&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=k.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&k.set(e,t))}return t}toString(){return this.cssText}};const P=(t,e)=>{if(S)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of e){const e=document.createElement("style"),o=x.litNonce;void 0!==o&&e.setAttribute("nonce",o),e.textContent=i.cssText,t.appendChild(e)}},L=S?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new C("string"==typeof t?t:t+"",void 0,E))(e)})(t):t,{is:M,defineProperty:z,getOwnPropertyDescriptor:U,getOwnPropertyNames:O,getOwnPropertySymbols:T,getPrototypeOf:A}=Object,R=globalThis,q=R.trustedTypes,W=q?q.emptyScript:"",j=R.reactiveElementPolyfillSupport,D=(t,e)=>t,N={toAttribute(t,e){switch(e){case Boolean:t=t?W:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},H=(t,e)=>!M(t,e),I={attribute:!0,type:String,converter:N,reflect:!1,useDefault:!1,hasChanged:H};
25
+ */let k=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==E)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(S&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=C.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&C.set(e,t))}return t}toString(){return this.cssText}};const P=(t,e)=>{if(S)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of e){const e=document.createElement("style"),o=x.litNonce;void 0!==o&&e.setAttribute("nonce",o),e.textContent=i.cssText,t.appendChild(e)}},L=S?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new k("string"==typeof t?t:t+"",void 0,E))(e)})(t):t,{is:M,defineProperty:z,getOwnPropertyDescriptor:U,getOwnPropertyNames:O,getOwnPropertySymbols:T,getPrototypeOf:A}=Object,R=globalThis,q=R.trustedTypes,W=q?q.emptyScript:"",j=R.reactiveElementPolyfillSupport,D=(t,e)=>t,N={toAttribute(t,e){switch(e){case Boolean:t=t?W:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},H=(t,e)=>!M(t,e),I={attribute:!0,type:String,converter:N,reflect:!1,useDefault:!1,hasChanged:H};
26
26
  /**
27
27
  * @license
28
28
  * Copyright 2017 Google LLC
@@ -57,5 +57,5 @@ function K(t,e){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Refl
57
57
  * @license MIT
58
58
  * Copyright (c) 2025 Google LLC
59
59
  * See LICENSE file in the project root for full license text.
60
- */var X,Q,Y,Z,tt,et,it,ot,st,rt,at,nt,lt,dt,ht,ct,ft,pt,ut,mt,bt,vt,gt,yt,wt,_t,$t;let xt=class extends(r(t)){constructor(){super(),X.add(this),Q.set(this,null),Y.set(this,void 0),Z.set(this,()=>_(this,X,"m",yt).call(this)),tt.set(this,()=>_(this,X,"m",vt).call(this)),et.set(this,new a(this,{target:null,config:{attributeFilter:["disabled","readonly","required"]},callback:()=>this.notifyControlStateChange()})),it.set(this,new n(this,{target:null,callback:()=>_(this,X,"m",ut).call(this)})),ot.set(this,new l(this,{target:null,callback:t=>{t=t&&!(_(this,Q,"f")?.disabled??1),this.classList.toggle("-no-animate",!1),$(this,at,t,"f"),t?this.classList.toggle("-float-label",!0):(this._invalid=!(_(this,Q,"f")?.checkValidity?.()??1),this.notifyControlStateChange())}})),st.set(this,new a(this,{target:null,config:{childList:!0,subtree:!0},callback:()=>_(this,X,"m",_t).call(this)})),rt.set(this,new a(this,{target:null,config:{childList:!0,subtree:!0},callback:()=>_(this,X,"m",$t).call(this)})),at.set(this,!1),this._pseudoLabel="",this._required=!1,this._invalid=!1,this._validationMessage="",nt.set(this,""),lt.set(this,""),this.variant="outlined",this.hideRequiredMarker=!1,this.hideSubscript="auto",this.floatLabel="auto",new d(this,{callback:()=>this.classList.toggle("-no-animate",!1)}),new h(this,{callback:t=>this.classList.toggle("-pressed",t&&!(_(this,Q,"f")?.disabled??1))})}get menuAnchor(){return this._base}get control(){return _(this,Q,"f")}notifyControlStateChange(t=!1){this._required=!0===_(this,Q,"f")?.required,this.classList.toggle("-required",this._required),this.classList.toggle("-disabled",!0===_(this,Q,"f")?.disabled),this.classList.toggle("-readonly",c(_(this,Q,"f"))&&!0===_(this,Q,"f").readOnly),"auto"===this.floatLabel&&this.classList.toggle("-float-label",_(this,X,"a",dt)||_(this,at,"f")),t&&(this._invalid=!(_(this,Q,"f")?.checkValidity?.()??1)),this.classList.toggle("-invalid",this._invalid),this._validationMessage=_(this,Q,"f")?.validationMessage??"",this.isUpdatePending||this.performUpdate()}connectedCallback(){super.connectedCallback(),this.classList.toggle("-no-animate",!0)}disconnectedCallback(){super.disconnectedCallback(),_(this,X,"m",wt).call(this,null)}firstUpdated(t){super.firstUpdated(t),_(this,ot,"f").observe(this._base),_(this,st,"f").observe(this._hint),_(this,X,"m",_t).call(this),_(this,rt,"f").observe(this._error),_(this,X,"m",$t).call(this)}update(t){super.update(t),t.has("_invalid")&&_(this,Q,"f")&&(_(this,Q,"f").ariaInvalid=this._invalid?"true":null,_(this,lt,"f")&&(this._invalid?b.describe(_(this,Q,"f"),_(this,lt,"f")):b.removeDescription(_(this,Q,"f"),_(this,lt,"f"))))}render(){return i`<div class="base" @click="${_(this,X,"m",bt)}">${"outlined"===this.variant?i`<div class="outline" aria-hidden="true"><div class="outline-start"></div><div class="outline-notch"><div class="pseudo-label">${this._pseudoLabel} ${!this.hideRequiredMarker&&this._required?i`&nbsp;*`:e}</div></div><div class="outline-end"></div></div>`:e}<div class="prefix"><slot name="prefix" @slotchange="${_(this,X,"m",ft)}"></slot></div><div class="content"><span class="prefix-text"><slot name="prefix-text"></slot></span><span class="input"><slot @slotchange="${_(this,X,"m",mt)}" @change="${_(this,X,"m",gt)}"></slot></span><span class="suffix-text"><slot name="suffix-text"></slot></span><span class="label"><slot name="label" @slotchange="${_(this,X,"m",ct)}"></slot>${!this.hideRequiredMarker&&this._required?i`<span class="required-marker" aria-hidden="true">&nbsp;*</span>`:e}</span></div><div class="suffix" @click="${_(this,X,"m",ht)}" @focusin="${_(this,X,"m",ht)}" @focusout="${_(this,X,"m",ht)}" @pointerdown="${_(this,X,"m",ht)}" @keydown="${_(this,X,"m",ht)}" @keyup="${_(this,X,"m",ht)}"><slot name="suffix" @slotchange="${_(this,X,"m",pt)}"></slot></div></div><span class="subscript" aria-hidden="true"><span class="error"><slot name="error">${this._validationMessage}</slot></span><span class="hint"><slot name="hint"></slot></span></span>`}};Q=new WeakMap,Y=new WeakMap,Z=new WeakMap,tt=new WeakMap,et=new WeakMap,it=new WeakMap,ot=new WeakMap,st=new WeakMap,rt=new WeakMap,at=new WeakMap,nt=new WeakMap,lt=new WeakMap,X=new WeakSet,dt=function(){return void 0!==_(this,Q,"f")?.shouldLabelFloat?!0===_(this,Q,"f").shouldLabelFloat:"string"==typeof _(this,Q,"f")?.value&&_(this,Q,"f").value.length>0},ht=function(t){t.stopImmediatePropagation(),t.stopPropagation()},ct=function(t){const e=t.target.assignedElements({flatten:!0});this.classList.toggle("-with-label",e.length>0),this._pseudoLabel=e[0]?.textContent??""},ft=function(t){this.classList.toggle("-with-prefix",p(t.target)),_(this,it,"f").observe(this._prefix)},pt=function(t){this.classList.toggle("-with-suffix",p(t.target))},ut=function(){"outlined"===this.variant&&this._base.style.setProperty("--_prefix-width",`${this._prefix.clientWidth}px`)},mt=function(t){_(this,X,"m",wt).call(this,y(t.target))},bt=function(t){!_(this,Q,"f")||_(this,at,"f")||_(this,Q,"f").disabled||(_(this,Q,"f").onContainerClick?_(this,Q,"f").onContainerClick(t):_(this,Q,"f").focus())},vt=function(){this._invalid=!0,this.notifyControlStateChange()},gt=function(){this._invalid=!(_(this,Q,"f")?.checkValidity?.()??1),this.notifyControlStateChange()},yt=function(){this._invalid=!1,setTimeout(()=>this.notifyControlStateChange())},wt=function(t){_(this,Q,"f")!==t&&(_(this,Q,"f")&&(_(this,nt,"f")&&b.removeDescription(_(this,Q,"f"),_(this,nt,"f")),_(this,lt,"f")&&b.removeDescription(_(this,Q,"f"),_(this,lt,"f")),_(this,et,"f").unobserve(_(this,Q,"f")),_(this,Q,"f").removeEventListener("invalid",_(this,tt,"f")),_(this,Q,"f").form?.removeEventListener("reset",_(this,Z,"f")),_(this,Y,"f")?.call(this),$(this,Y,void 0,"f")),$(this,Q,t,"f"),["INPUT","TEXTAREA"].includes(_(this,Q,"f")?.tagName??"")?this._base.style.setProperty("--_form-field-cursor","text"):this._base.style.removeProperty("--_form-field-cursor"),this.classList.toggle("-with-select","M3E-SELECT"===_(this,Q,"f")?.tagName),this.classList.contains("-with-select")&&this._base.style.setProperty("--_form-field-cursor","pointer"),_(this,Q,"f")&&(_(this,et,"f").observe(_(this,Q,"f")),_(this,Q,"f").addEventListener("invalid",_(this,tt,"f")),_(this,Q,"f").form?.addEventListener("reset",_(this,Z,"f")),_(this,Q,"f").removeAttribute("aria-invalid"),_(this,nt,"f")&&b.describe(_(this,Q,"f"),_(this,nt,"f")),this.notifyControlStateChange(),$(this,Y,u(_(this,Q,"f"),"value",{set:(t,e)=>{e(t),this.notifyControlStateChange(!0)}}),"f")))},_t=function(){const t=m(this._hint,!0);t!==_(this,nt,"f")&&(_(this,Q,"f")&&_(this,nt,"f")&&b.removeDescription(_(this,Q,"f"),_(this,nt,"f")),$(this,nt,t,"f"),_(this,Q,"f")&&_(this,nt,"f")&&b.describe(_(this,Q,"f"),_(this,nt,"f")))},$t=function(){const t=m(this._error,!0);t!==_(this,lt,"f")&&(_(this,Q,"f")&&_(this,lt,"f")&&b.removeDescription(_(this,Q,"f"),_(this,lt,"f")),$(this,lt,t,"f"),_(this,Q,"f")&&_(this,lt,"f")&&this._invalid&&b.describe(_(this,Q,"f"),_(this,lt,"f")))},(()=>{if(document){const t=new CSSStyleSheet;t.replaceSync(o`m3e-form-field input::placeholder, m3e-form-field textarea::placeholder { user-select: none; color: currentColor; transition: opacity ${f.motion.duration.extraLong1}; } m3e-form-field[float-label="auto"]:not(.-float-label).-with-label input::placeholder, m3e-form-field[float-label="auto"]:not(.-float-label).-with-label textarea::placeholder { opacity: 0; transition: opacity 0s; } m3e-form-field[variant="outlined"] m3e-input-chip-set { margin-block: calc(calc(3.5rem + ${f.density.calc(-2)}) / 4); } @media (prefers-reduced-motion) { m3e-form-field input::placeholder, m3e-form-field textarea::placeholder { transition: none !important; } }`.toString()),document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]}})(),xt.styles=o`:host { display: inline-flex; flex-direction: column; vertical-align: middle; font-size: var(--m3e-form-field-font-size, ${f.typescale.standard.body.large.fontSize}); font-weight: var(--m3e-form-field-font-weight, ${f.typescale.standard.body.large.fontWeight}); line-height: var(--m3e-form-field-line-height, ${f.typescale.standard.body.large.lineHeight}); letter-spacing: var(--m3e-form-field-tracking, ${f.typescale.standard.body.large.tracking}); width: var(--m3e-form-field-width, 14.5rem); color: var(--_form-field-color); } :host(:not(.-disabled)) .base { cursor: var(--_form-field-cursor); } .base { display: flex; align-items: center; position: relative; min-height: calc(3.5rem + ${f.density.calc(-2)}); --_form-field-label-font-size: var( --m3e-form-field-label-font-size, ${f.typescale.standard.body.small.fontSize} ); --_form-field-label-line-height: var( --m3e-form-field-label-line-height, ${f.typescale.standard.body.small.lineHeight} ); } .content { display: flex; align-items: center; position: relative; flex: 1 1 auto; min-width: 0; min-height: var(--m3e-form-field-icon-size, 1.5rem); } .prefix, .suffix { display: flex; align-items: center; position: relative; user-select: none; flex: none; font-size: var(--m3e-form-field-icon-size, 1.5rem); } .prefix-text, .suffix-text { opacity: 1; transition: opacity ${f.motion.duration.extraLong1}; user-select: none; flex: none; } .input { display: inline-flex; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; } .label { display: flex; position: absolute; pointer-events: none; user-select: none; top: 0; left: 0; right: 0; font-size: var(--m3e-form-field-label-font-size, ${f.typescale.standard.body.small.fontSize}); font-weight: var(--m3e-form-field-label-font-weight, ${f.typescale.standard.body.small.fontWeight}); line-height: var(--m3e-form-field-label-line-height, ${f.typescale.standard.body.small.lineHeight}); letter-spacing: var(--m3e-form-field-label-tracking, ${f.typescale.standard.body.small.tracking}); color: var(--_form-field-label-color, inherit); transition: ${s(`top ${f.motion.duration.short4}, \n font-size ${f.motion.duration.short4}, \n line-height ${f.motion.duration.short4}`)}; } :host(.-with-select) .label { margin-inline-end: 1.5rem; } ::slotted([slot="label"]) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .subscript { display: inline-flex; width: 100%; margin-top: 0.25rem; font-size: var(--m3e-form-field-subscript-font-size, ${f.typescale.standard.body.small.fontSize}); font-weight: var(--m3e-form-field-subscript-font-weight, ${f.typescale.standard.body.small.fontWeight}); line-height: var(--m3e-form-field-subscript-line-height, ${f.typescale.standard.body.small.lineHeight}); letter-spacing: var(--m3e-form-field-subscript-tracking, ${f.typescale.standard.body.small.tracking}); min-height: var(--m3e-form-field-subscript-line-height, ${f.typescale.standard.body.small.lineHeight}); color: var(--m3e-form-field-subscript-color, ${f.color.onSurfaceVariant}); } .error, .hint { flex: 1 1 auto; } :host([hide-subscript="always"]) .subscript { display: none; } :host([hide-subscript="auto"]:not(.-invalid)) .subscript { opacity: 0; margin-top: 0px; margin-bottom: 0.25rem; transition: ${s(`opacity ${f.motion.duration.short4}, \n margin-top ${f.motion.duration.short4}, \n margin-bottom ${f.motion.duration.short4}`)}; } :host([hide-subscript="auto"]:not(.-invalid):focus-within) .subscript, :host([hide-subscript="auto"]:not(.-invalid).-pressed) .subscript { opacity: 1; margin-top: 0.25rem; margin-bottom: 0; } :host(.-invalid) .hint { display: none; } :host(:not(.-invalid)) .error { display: none; } ::slotted(input), ::slotted(textarea), ::slotted(select) { outline: unset; border: unset; background-color: transparent; box-shadow: none; font-family: inherit; font-size: inherit; line-height: initial; letter-spacing: inherit; color: var(--_form-field-input-color, inherit); flex: 1 1 auto; min-width: 0; padding: unset; } ::slotted(textarea) { scrollbar-width: ${f.scrollbar.thinWidth}; scrollbar-color: ${f.scrollbar.color}; } ::slotted(m3e-select), ::slotted(m3e-input-chip-set) { flex: 1 1 auto; min-width: 0; } :host([float-label="auto"]:not(.-float-label):not(.-pressed)) .label { font-size: inherit; } :host([float-label="auto"]:not(.-float-label).-with-label) .prefix-text, :host([float-label="auto"]:not(.-float-label).-with-label) .suffix-text { opacity: 0; transition: opacity 0s; } .prefix { margin-inline-start: 1rem; } :host(.-with-prefix) .prefix { margin-inline-end: 1rem; margin-inline-start: 0.75rem; } .suffix { margin-inline-end: 1rem; } :host(.-with-suffix) .suffix { margin-inline-start: 0.25rem; margin-inline-end: 0.5rem; } :host(.-with-suffix.-with-select) .suffix { margin-inline-start: unset; } :host(.-with-select) .suffix-text { display: none; } :host([variant="outlined"]) .label { margin-top: calc(0px - var(--_form-field-label-line-height) / 2); } :host([variant="outlined"]) .outline { position: absolute; display: flex; pointer-events: none; left: 0; top: 0; bottom: 0; right: 0; } :host([variant="outlined"]) .pseudo-label { visibility: hidden; margin-inline-end: 0.25rem; font-size: var(--_form-field-label-font-size); line-height: var(--_form-field-label-line-height); letter-spacing: var(--_form-field-label-tracking); max-width: 100%; transition-property: max-width, margin-inline-end; transition-duration: 1ms; } :host([variant="outlined"][float-label="auto"]:not(.-float-label):not(.-pressed)) .pseudo-label { max-width: 0; margin-inline-end: 0px; transition-delay: ${f.motion.duration.short2}; } :host([variant="outlined"]) .outline-start, :host([variant="outlined"]) .outline-notch, :host([variant="outlined"]) .outline-end { box-sizing: border-box; border-width: var(--_form-field-outline-size, 0.0625rem); border-color: var(--_form-field-outline-color); transition: border-color ${f.motion.duration.short4}; } :host([variant="outlined"]:not(.-with-label)) .outline-notch { display: none; } :host([variant="outlined"]) .outline-start { min-width: 0.75rem; border-top-style: solid; border-inline-start-style: solid; border-bottom-style: solid; border-start-start-radius: var(--m3e-outlined-form-field-container-shape, ${f.shape.corner.extraSmall}); border-end-start-radius: var(--m3e-outlined-form-field-container-shape, ${f.shape.corner.extraSmall}); } :host([variant="outlined"]) .outline-notch { border-bottom-style: solid; } :host([variant="outlined"]) .outline-end { flex-grow: 1; min-width: 1rem; border-top-style: solid; border-inline-end-style: solid; border-bottom-style: solid; border-start-end-radius: var(--m3e-outlined-form-field-container-shape, ${f.shape.corner.extraSmall}); border-end-end-radius: var(--m3e-outlined-form-field-container-shape, ${f.shape.corner.extraSmall}); } :host([variant="outlined"].-with-prefix) .outline-start { min-width: calc(1.25rem + var(--_prefix-width, 0px) + 0.25rem); } :host([variant="outlined"]:not(.-disabled)) .base:hover .outline, :host([variant="outlined"]:not(.-disabled):focus-within) .outline, :host([variant="outlined"]:not(.-disabled).-pressed) .outline { --_form-field-outline-size: 0.125rem; } :host([variant="outlined"]) .subscript { margin-inline: 1rem; width: calc(100% - 2rem); } :host([variant="outlined"]) .content { min-height: calc(3.5rem + ${f.density.calc(-2)}); --_form-field-label-font-size: var( --m3e-form-field-label-font-size, ${f.typescale.standard.body.small.fontSize} ); } :host([variant="outlined"][float-label="auto"]:not(.-float-label):not(.-pressed)) .label { margin-top: unset; line-height: calc(3.5rem + ${f.density.calc(-2)}); --_form-field-label-font-size: var( --m3e-form-field-label-font-size, ${f.typescale.standard.body.small.fontSize} ); } :host([variant="filled"]) .base { --_select-arrow-margin-top: calc( 0px - calc(1rem / max(calc(0 - calc(var(--md-sys-density-scale, 0) + var(--md-sys-density-scale, 0))), 1)) ); } :host([variant="filled"]) .base::before { content: ""; box-sizing: border-box; position: absolute; pointer-events: none; top: 0; left: 0; right: 0; bottom: 0; border-bottom-style: solid; border-width: 0.0625rem; border-radius: var(--m3e-form-field-container-shape, ${f.shape.corner.extraSmallTop}); border-color: var(--_form-field-outline-color); background-color: var(--_form-field-container-color); } :host([variant="filled"]:not(.-disabled)) .base:hover::before, :host([variant="filled"]:not(.-disabled):focus-within) .base::before, :host([variant="filled"]:not(.-disabled).-pressed) .base::before { border-width: 0.1875rem; } :host([variant="filled"]) .base::after { content: ""; box-sizing: border-box; position: absolute; pointer-events: none; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--_form-field-hover-container-color); transition: background-color ${f.motion.duration.short4}; } :host([variant="filled"]) .subscript { margin-inline: 1rem; width: calc(100% - 2rem); } :host([variant="filled"]) .content { padding-top: calc(1.5rem + ${f.density.calc(-2)}); margin-bottom: 0.5rem; } :host([variant="filled"]) .label { top: calc(0.5rem + ${f.density.calc(-2)}); } :host([variant="filled"][float-label="auto"]:not(.-float-label):not(.-pressed)) .label { top: 0px; line-height: calc(3.5rem + ${f.density.calc(-2)} - 0.0625rem); --_form-field-label-font-size: var( --m3e-form-field-label-font-size, ${f.typescale.standard.body.small.fontSize} ); } :host(:not(.-disabled):not(:focus-within):not(.-pressed)) .base:hover { --_form-field-hover-container-color: color-mix( in srgb, var(--m3e-form-field-hover-container-color, ${f.color.onSurface}) var(--m3e-form-field-hover-container-opacity, 8%), transparent ); } :host(:not(.-disabled):not(.-invalid)) { color: var(--m3e-form-field-color, ${f.color.onSurface}); } :host([variant="outlined"]:not(.-disabled):not(.-invalid)) .base { --_form-field-outline-color: var(--m3e-form-field-outline-color, ${f.color.outline}); } :host([variant="filled"]:not(.-disabled):not(.-invalid)) .base { --_form-field-outline-color: var(--m3e-form-field-outline-color, ${f.color.onSurfaceVariant}); } :host([variant="outlined"]:not(.-disabled):not(.-invalid):focus-within) .base, :host([variant="outlined"]:not(.-disabled):not(.-invalid).-pressed) .base, :host([variant="filled"]:not(.-disabled):not(.-invalid):focus-within) .base, :host([variant="filled"]:not(.-disabled):not(.-invalid).-pressed) .base { --_form-field-outline-color: var(--m3e-form-field-focused-outline-color, ${f.color.primary}); --_form-field-label-color: var(--m3e-form-field-focused-color, ${f.color.primary}); } :host(:not(.-disabled)) .base { --_form-field-container-color: var( --m3e-form-field-container-color, ${f.color.surfaceContainerHighest} ); } :host(:not(.-disabled).-invalid) .base { --_form-field-label-color: var(--m3e-form-field-invalid-color, ${f.color.error}); --_form-field-outline-color: var(--m3e-form-field-invalid-color, ${f.color.error}); } :host(:not(.-disabled).-invalid) .subscript { color: var(--m3e-form-field-invalid-color, ${f.color.error}); } :host(.-disabled) { color: color-mix( in srgb, var(--m3e-form-field-disabled-color, ${f.color.onSurface}) var(--m3e-form-field-disabled-opacity, 38%), transparent ); } :host(.-disabled) .base { --_form-field-container-color: color-mix( in srgb, var(--m3e-form-field-disabled-container-color, ${f.color.onSurface}) var(--m3e-form-field-disabled-container-opacity, 4%), transparent ); } :host(.-no-animate) *, :host(.-no-animate) *::before, :host(.-no-animate) *::after { transition: none !important; } @media (forced-colors: active) { :host([variant="filled"]) .base::after { transition: none; } :host { --_form-field-outline-color: CanvasText; } :host(.-disabled) { --_form-field-input-color: GrayText; --_form-field-color: GrayText; --_form-field-label-color: GrayText; --_form-field-outline-color: GrayText; } } @media (prefers-reduced-motion) { .base::before, .prefix-text, .suffix-text, .label, .subscript, .outline-start, .outline-notch, .outline-end, .pseudo-label { transition: none !important; } }`,w([K(".base")],xt.prototype,"_base",void 0),w([K(".prefix")],xt.prototype,"_prefix",void 0),w([K(".error")],xt.prototype,"_error",void 0),w([K(".hint")],xt.prototype,"_hint",void 0),w([J()],xt.prototype,"_pseudoLabel",void 0),w([J()],xt.prototype,"_required",void 0),w([J()],xt.prototype,"_invalid",void 0),w([J()],xt.prototype,"_validationMessage",void 0),w([B({reflect:!0})],xt.prototype,"variant",void 0),w([B({attribute:"hide-required-marker",type:Boolean,reflect:!0})],xt.prototype,"hideRequiredMarker",void 0),w([B({attribute:"hide-subscript",reflect:!0})],xt.prototype,"hideSubscript",void 0),w([B({attribute:"float-label",reflect:!0})],xt.prototype,"floatLabel",void 0),xt=w([(t=>(e,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)})("m3e-form-field")],xt);export{xt as M3eFormFieldElement,y as findFormFieldControl,g as isFormFieldControl};
60
+ */var X,Q,Y,Z,tt,et,it,ot,st,rt,at,nt,lt,dt,ht,ct,ft,pt,mt,ut,bt,vt,gt,yt,wt,_t,$t,xt;let St=class extends(r(t)){constructor(){super(),X.add(this),Q.set(this,null),Y.set(this,void 0),Z.set(this,()=>_(this,X,"m",yt).call(this)),tt.set(this,()=>_(this,X,"m",vt).call(this)),et.set(this,new a(this,{target:null,config:{attributeFilter:["disabled","readonly","required"]},callback:()=>this.notifyControlStateChange()})),it.set(this,new n(this,{target:null,callback:()=>_(this,X,"m",mt).call(this)})),ot.set(this,new l(this,{target:null,callback:t=>{t=t&&!(_(this,Q,"f")?.disabled??1),this.classList.toggle("-no-animate",!1),$(this,at,t,"f"),t?this.classList.toggle("-float-label",!0):(this._invalid=!(_(this,Q,"f")?.checkValidity?.()??1),this.notifyControlStateChange())}})),st.set(this,new a(this,{target:null,config:{childList:!0,subtree:!0},callback:()=>_(this,X,"m",$t).call(this)})),rt.set(this,new a(this,{target:null,config:{childList:!0,subtree:!0},callback:()=>_(this,X,"m",xt).call(this)})),at.set(this,!1),this._pseudoLabel="",this._required=!1,this._invalid=!1,this._validationMessage="",nt.set(this,""),lt.set(this,""),this.variant="outlined",this.hideRequiredMarker=!1,this.hideSubscript="auto",this.floatLabel="auto",new d(this,{callback:()=>this.classList.toggle("-no-animate",!1)}),new h(this,{callback:t=>this.classList.toggle("-pressed",t&&!(_(this,Q,"f")?.disabled??1))})}get menuAnchor(){return this._base}get control(){return _(this,Q,"f")}notifyControlStateChange(t=!1){this._required=!0===_(this,Q,"f")?.required,this.classList.toggle("-required",this._required),this.classList.toggle("-disabled",!0===_(this,Q,"f")?.disabled),this.classList.toggle("-readonly",c(_(this,Q,"f"))&&!0===_(this,Q,"f").readOnly),"auto"===this.floatLabel&&this.classList.toggle("-float-label",_(this,X,"a",dt)||_(this,at,"f")),t&&(this._invalid=!(_(this,Q,"f")?.checkValidity?.()??1)),this.classList.toggle("-invalid",this._invalid),this._validationMessage=_(this,Q,"f")?.validationMessage??"",this.isUpdatePending||this.performUpdate()}connectedCallback(){super.connectedCallback(),this.classList.toggle("-no-animate",!0)}disconnectedCallback(){super.disconnectedCallback(),_(this,X,"m",wt).call(this,null)}firstUpdated(t){super.firstUpdated(t),_(this,ot,"f").observe(this._base),_(this,st,"f").observe(this._hint),_(this,X,"m",$t).call(this),_(this,rt,"f").observe(this._error),_(this,X,"m",xt).call(this)}update(t){super.update(t),t.has("_invalid")&&_(this,Q,"f")&&(_(this,Q,"f").ariaInvalid=this._invalid?"true":null,_(this,lt,"f")&&(this._invalid?b.describe(_(this,Q,"f"),_(this,lt,"f")):b.removeDescription(_(this,Q,"f"),_(this,lt,"f"))))}render(){return i`<div class="base" @click="${_(this,X,"m",bt)}">${"outlined"===this.variant?i`<div class="outline" aria-hidden="true"><div class="outline-start"></div><div class="outline-notch"><div class="pseudo-label">${this._pseudoLabel} ${!this.hideRequiredMarker&&this._required?i`&nbsp;*`:e}</div></div><div class="outline-end"></div></div>`:e}<div class="prefix"><slot name="prefix" @slotchange="${_(this,X,"m",ft)}"></slot></div><div class="content"><span class="prefix-text"><slot name="prefix-text"></slot></span><span class="input"><slot @slotchange="${_(this,X,"m",ut)}" @change="${_(this,X,"m",gt)}"></slot></span><span class="suffix-text"><slot name="suffix-text"></slot></span><span class="label"><slot name="label" @slotchange="${_(this,X,"m",ct)}"></slot>${!this.hideRequiredMarker&&this._required?i`<span class="required-marker" aria-hidden="true">&nbsp;*</span>`:e}</span></div><div class="suffix" @click="${_(this,X,"m",ht)}" @focusin="${_(this,X,"m",ht)}" @focusout="${_(this,X,"m",ht)}" @pointerdown="${_(this,X,"m",ht)}" @keydown="${_(this,X,"m",ht)}" @keyup="${_(this,X,"m",ht)}"><slot name="suffix" @slotchange="${_(this,X,"m",pt)}"></slot></div></div><span class="subscript" aria-hidden="true"><span class="error"><slot name="error">${this._validationMessage}</slot></span><span class="hint"><slot name="hint"></slot></span></span>`}};Q=new WeakMap,Y=new WeakMap,Z=new WeakMap,tt=new WeakMap,et=new WeakMap,it=new WeakMap,ot=new WeakMap,st=new WeakMap,rt=new WeakMap,at=new WeakMap,nt=new WeakMap,lt=new WeakMap,X=new WeakSet,dt=function(){return void 0!==_(this,Q,"f")?.shouldLabelFloat?!0===_(this,Q,"f").shouldLabelFloat:"string"==typeof _(this,Q,"f")?.value&&_(this,Q,"f").value.length>0},ht=function(t){t.stopImmediatePropagation(),t.stopPropagation()},ct=function(t){const e=t.target.assignedElements({flatten:!0});this.classList.toggle("-with-label",e.length>0),this._pseudoLabel=e[0]?.textContent??""},ft=function(t){this.classList.toggle("-with-prefix",p(t.target)),_(this,it,"f").observe(this._prefix)},pt=function(t){this.classList.toggle("-with-suffix",p(t.target))},mt=function(){"outlined"===this.variant&&this._base.style.setProperty("--_prefix-width",`${this._prefix.clientWidth}px`)},ut=function(t){_(this,X,"m",wt).call(this,y(t.target))},bt=function(t){!_(this,Q,"f")||_(this,at,"f")||_(this,Q,"f").disabled||(_(this,Q,"f").onContainerClick?_(this,Q,"f").onContainerClick(t):_(this,Q,"f").focus())},vt=function(){this._invalid=!0,this.notifyControlStateChange()},gt=function(){this._invalid=!(_(this,Q,"f")?.checkValidity?.()??1),this.notifyControlStateChange()},yt=function(){this._invalid=!1,setTimeout(()=>this.notifyControlStateChange())},wt=function(t){if(_(this,Q,"f")!==t&&(_(this,Q,"f")&&(_(this,nt,"f")&&b.removeDescription(_(this,Q,"f"),_(this,nt,"f")),_(this,lt,"f")&&b.removeDescription(_(this,Q,"f"),_(this,lt,"f")),_(this,et,"f").unobserve(_(this,Q,"f")),_(this,Q,"f").removeEventListener("invalid",_(this,tt,"f")),_(this,Q,"f").form?.removeEventListener("reset",_(this,Z,"f")),_(this,Y,"f")?.call(this),$(this,Y,void 0,"f")),$(this,Q,t,"f"),["INPUT","TEXTAREA"].includes(_(this,Q,"f")?.tagName??"")?this._base.style.setProperty("--_form-field-cursor","text"):this._base.style.removeProperty("--_form-field-cursor"),this.classList.toggle("-with-select","M3E-SELECT"===_(this,Q,"f")?.tagName),this.classList.contains("-with-select")&&this._base.style.setProperty("--_form-field-cursor","pointer"),_(this,Q,"f"))){_(this,et,"f").observe(_(this,Q,"f")),_(this,Q,"f").addEventListener("invalid",_(this,tt,"f")),_(this,Q,"f").form?.addEventListener("reset",_(this,Z,"f")),_(this,Q,"f").removeAttribute("aria-invalid"),_(this,nt,"f")&&b.describe(_(this,Q,"f"),_(this,nt,"f")),this.notifyControlStateChange();const t=_(this,Q,"f").tagName.toLowerCase();t.startsWith("m3e-")&&!customElements.get(t)?customElements.whenDefined(t).then(()=>_(this,X,"m",_t).call(this)):_(this,X,"m",_t).call(this)}},_t=function(){_(this,Q,"f")&&$(this,Y,m(_(this,Q,"f"),"value",{set:(t,e)=>{e(t),this.notifyControlStateChange(!0)}}),"f")},$t=function(){const t=u(this._hint,!0);t!==_(this,nt,"f")&&(_(this,Q,"f")&&_(this,nt,"f")&&b.removeDescription(_(this,Q,"f"),_(this,nt,"f")),$(this,nt,t,"f"),_(this,Q,"f")&&_(this,nt,"f")&&b.describe(_(this,Q,"f"),_(this,nt,"f")))},xt=function(){const t=u(this._error,!0);t!==_(this,lt,"f")&&(_(this,Q,"f")&&_(this,lt,"f")&&b.removeDescription(_(this,Q,"f"),_(this,lt,"f")),$(this,lt,t,"f"),_(this,Q,"f")&&_(this,lt,"f")&&this._invalid&&b.describe(_(this,Q,"f"),_(this,lt,"f")))},(()=>{if(document){const t=new CSSStyleSheet;t.replaceSync(o`m3e-form-field input::placeholder, m3e-form-field textarea::placeholder { user-select: none; color: currentColor; transition: opacity ${f.motion.duration.extraLong1}; } m3e-form-field[float-label="auto"]:not(.-float-label).-with-label input::placeholder, m3e-form-field[float-label="auto"]:not(.-float-label).-with-label textarea::placeholder { opacity: 0; transition: opacity 0s; } m3e-form-field[variant="outlined"] m3e-input-chip-set { margin-block: calc(calc(3.5rem + ${f.density.calc(-2)}) / 4); } @media (prefers-reduced-motion) { m3e-form-field input::placeholder, m3e-form-field textarea::placeholder { transition: none !important; } }`.toString()),document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]}})(),St.styles=o`:host { display: inline-flex; flex-direction: column; vertical-align: middle; font-size: var(--m3e-form-field-font-size, ${f.typescale.standard.body.large.fontSize}); font-weight: var(--m3e-form-field-font-weight, ${f.typescale.standard.body.large.fontWeight}); line-height: var(--m3e-form-field-line-height, ${f.typescale.standard.body.large.lineHeight}); letter-spacing: var(--m3e-form-field-tracking, ${f.typescale.standard.body.large.tracking}); width: var(--m3e-form-field-width, 14.5rem); color: var(--_form-field-color); } :host(:not(.-disabled)) .base { cursor: var(--_form-field-cursor); } .base { display: flex; align-items: center; position: relative; min-height: calc(3.5rem + ${f.density.calc(-2)}); --_form-field-label-font-size: var( --m3e-form-field-label-font-size, ${f.typescale.standard.body.small.fontSize} ); --_form-field-label-line-height: var( --m3e-form-field-label-line-height, ${f.typescale.standard.body.small.lineHeight} ); } .content { display: flex; align-items: center; position: relative; flex: 1 1 auto; min-width: 0; min-height: var(--m3e-form-field-icon-size, 1.5rem); } .prefix, .suffix { display: flex; align-items: center; position: relative; user-select: none; flex: none; font-size: var(--m3e-form-field-icon-size, 1.5rem); } .prefix-text, .suffix-text { opacity: 1; transition: opacity ${f.motion.duration.extraLong1}; user-select: none; flex: none; } .input { display: inline-flex; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; } .label { display: flex; position: absolute; pointer-events: none; user-select: none; top: 0; left: 0; right: 0; font-size: var(--m3e-form-field-label-font-size, ${f.typescale.standard.body.small.fontSize}); font-weight: var(--m3e-form-field-label-font-weight, ${f.typescale.standard.body.small.fontWeight}); line-height: var(--m3e-form-field-label-line-height, ${f.typescale.standard.body.small.lineHeight}); letter-spacing: var(--m3e-form-field-label-tracking, ${f.typescale.standard.body.small.tracking}); color: var(--_form-field-label-color, inherit); transition: ${s(`top ${f.motion.duration.short4}, \n font-size ${f.motion.duration.short4}, \n line-height ${f.motion.duration.short4}`)}; } :host(.-with-select) .label { margin-inline-end: 1.5rem; } ::slotted([slot="label"]) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .subscript { display: inline-flex; width: 100%; margin-top: 0.25rem; font-size: var(--m3e-form-field-subscript-font-size, ${f.typescale.standard.body.small.fontSize}); font-weight: var(--m3e-form-field-subscript-font-weight, ${f.typescale.standard.body.small.fontWeight}); line-height: var(--m3e-form-field-subscript-line-height, ${f.typescale.standard.body.small.lineHeight}); letter-spacing: var(--m3e-form-field-subscript-tracking, ${f.typescale.standard.body.small.tracking}); min-height: var(--m3e-form-field-subscript-line-height, ${f.typescale.standard.body.small.lineHeight}); color: var(--m3e-form-field-subscript-color, ${f.color.onSurfaceVariant}); } .error, .hint { flex: 1 1 auto; } :host([hide-subscript="always"]) .subscript { display: none; } :host([hide-subscript="auto"]:not(.-invalid)) .subscript { opacity: 0; margin-top: 0px; margin-bottom: 0.25rem; transition: ${s(`opacity ${f.motion.duration.short4}, \n margin-top ${f.motion.duration.short4}, \n margin-bottom ${f.motion.duration.short4}`)}; } :host([hide-subscript="auto"]:not(.-invalid):focus-within) .subscript, :host([hide-subscript="auto"]:not(.-invalid).-pressed) .subscript { opacity: 1; margin-top: 0.25rem; margin-bottom: 0; } :host(.-invalid) .hint { display: none; } :host(:not(.-invalid)) .error { display: none; } ::slotted(input), ::slotted(textarea), ::slotted(select) { outline: unset; border: unset; background-color: transparent; box-shadow: none; font-family: inherit; font-size: inherit; line-height: initial; letter-spacing: inherit; color: var(--_form-field-input-color, inherit); flex: 1 1 auto; min-width: 0; padding: unset; } ::slotted(textarea) { scrollbar-width: ${f.scrollbar.thinWidth}; scrollbar-color: ${f.scrollbar.color}; } ::slotted(m3e-select), ::slotted(m3e-input-chip-set) { flex: 1 1 auto; min-width: 0; } :host([float-label="auto"]:not(.-float-label):not(.-pressed)) .label { font-size: inherit; } :host([float-label="auto"]:not(.-float-label).-with-label) .prefix-text, :host([float-label="auto"]:not(.-float-label).-with-label) .suffix-text { opacity: 0; transition: opacity 0s; } .prefix { margin-inline-start: 1rem; } :host(.-with-prefix) .prefix { margin-inline-end: 1rem; margin-inline-start: 0.75rem; } .suffix { margin-inline-end: 1rem; } :host(.-with-suffix) .suffix { margin-inline-start: 0.25rem; margin-inline-end: 0.5rem; } :host(.-with-suffix.-with-select) .suffix { margin-inline-start: unset; } :host(.-with-select) .suffix-text { display: none; } :host([variant="outlined"]) .label { margin-top: calc(0px - var(--_form-field-label-line-height) / 2); } :host([variant="outlined"]) .outline { position: absolute; display: flex; pointer-events: none; left: 0; top: 0; bottom: 0; right: 0; } :host([variant="outlined"]) .pseudo-label { visibility: hidden; margin-inline-end: 0.25rem; font-size: var(--_form-field-label-font-size); line-height: var(--_form-field-label-line-height); letter-spacing: var(--_form-field-label-tracking); max-width: 100%; transition-property: max-width, margin-inline-end; transition-duration: 1ms; } :host([variant="outlined"][float-label="auto"]:not(.-float-label):not(.-pressed)) .pseudo-label { max-width: 0; margin-inline-end: 0px; transition-delay: ${f.motion.duration.short2}; } :host([variant="outlined"]) .outline-start, :host([variant="outlined"]) .outline-notch, :host([variant="outlined"]) .outline-end { box-sizing: border-box; border-width: var(--_form-field-outline-size, 0.0625rem); border-color: var(--_form-field-outline-color); transition: border-color ${f.motion.duration.short4}; } :host([variant="outlined"]:not(.-with-label)) .outline-notch { display: none; } :host([variant="outlined"]) .outline-start { min-width: 0.75rem; border-top-style: solid; border-inline-start-style: solid; border-bottom-style: solid; border-start-start-radius: var(--m3e-outlined-form-field-container-shape, ${f.shape.corner.extraSmall}); border-end-start-radius: var(--m3e-outlined-form-field-container-shape, ${f.shape.corner.extraSmall}); } :host([variant="outlined"]) .outline-notch { border-bottom-style: solid; } :host([variant="outlined"]) .outline-end { flex-grow: 1; min-width: 1rem; border-top-style: solid; border-inline-end-style: solid; border-bottom-style: solid; border-start-end-radius: var(--m3e-outlined-form-field-container-shape, ${f.shape.corner.extraSmall}); border-end-end-radius: var(--m3e-outlined-form-field-container-shape, ${f.shape.corner.extraSmall}); } :host([variant="outlined"].-with-prefix) .outline-start { min-width: calc(1.25rem + var(--_prefix-width, 0px) + 0.25rem); } :host([variant="outlined"]:not(.-disabled)) .base:hover .outline, :host([variant="outlined"]:not(.-disabled):focus-within) .outline, :host([variant="outlined"]:not(.-disabled).-pressed) .outline { --_form-field-outline-size: 0.125rem; } :host([variant="outlined"]) .subscript { margin-inline: 1rem; width: calc(100% - 2rem); } :host([variant="outlined"]) .content { min-height: calc(3.5rem + ${f.density.calc(-2)}); --_form-field-label-font-size: var( --m3e-form-field-label-font-size, ${f.typescale.standard.body.small.fontSize} ); } :host([variant="outlined"][float-label="auto"]:not(.-float-label):not(.-pressed)) .label { margin-top: unset; line-height: calc(3.5rem + ${f.density.calc(-2)}); --_form-field-label-font-size: var( --m3e-form-field-label-font-size, ${f.typescale.standard.body.small.fontSize} ); } :host([variant="filled"]) .base { --_select-arrow-margin-top: calc( 0px - calc(1rem / max(calc(0 - calc(var(--md-sys-density-scale, 0) + var(--md-sys-density-scale, 0))), 1)) ); } :host([variant="filled"]) .base::before { content: ""; box-sizing: border-box; position: absolute; pointer-events: none; top: 0; left: 0; right: 0; bottom: 0; border-bottom-style: solid; border-width: 0.0625rem; border-radius: var(--m3e-form-field-container-shape, ${f.shape.corner.extraSmallTop}); border-color: var(--_form-field-outline-color); background-color: var(--_form-field-container-color); } :host([variant="filled"]:not(.-disabled)) .base:hover::before, :host([variant="filled"]:not(.-disabled):focus-within) .base::before, :host([variant="filled"]:not(.-disabled).-pressed) .base::before { border-width: 0.1875rem; } :host([variant="filled"]) .base::after { content: ""; box-sizing: border-box; position: absolute; pointer-events: none; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--_form-field-hover-container-color); transition: background-color ${f.motion.duration.short4}; } :host([variant="filled"]) .subscript { margin-inline: 1rem; width: calc(100% - 2rem); } :host([variant="filled"]) .content { padding-top: calc(1.5rem + ${f.density.calc(-2)}); margin-bottom: 0.5rem; } :host([variant="filled"]) .label { top: calc(0.5rem + ${f.density.calc(-2)}); } :host([variant="filled"][float-label="auto"]:not(.-float-label):not(.-pressed)) .label { top: 0px; line-height: calc(3.5rem + ${f.density.calc(-2)} - 0.0625rem); --_form-field-label-font-size: var( --m3e-form-field-label-font-size, ${f.typescale.standard.body.small.fontSize} ); } :host(:not(.-disabled):not(:focus-within):not(.-pressed)) .base:hover { --_form-field-hover-container-color: color-mix( in srgb, var(--m3e-form-field-hover-container-color, ${f.color.onSurface}) var(--m3e-form-field-hover-container-opacity, 8%), transparent ); } :host(:not(.-disabled):not(.-invalid)) { color: var(--m3e-form-field-color, ${f.color.onSurface}); } :host([variant="outlined"]:not(.-disabled):not(.-invalid)) .base { --_form-field-outline-color: var(--m3e-form-field-outline-color, ${f.color.outline}); } :host([variant="filled"]:not(.-disabled):not(.-invalid)) .base { --_form-field-outline-color: var(--m3e-form-field-outline-color, ${f.color.onSurfaceVariant}); } :host([variant="outlined"]:not(.-disabled):not(.-invalid):focus-within) .base, :host([variant="outlined"]:not(.-disabled):not(.-invalid).-pressed) .base, :host([variant="filled"]:not(.-disabled):not(.-invalid):focus-within) .base, :host([variant="filled"]:not(.-disabled):not(.-invalid).-pressed) .base { --_form-field-outline-color: var(--m3e-form-field-focused-outline-color, ${f.color.primary}); --_form-field-label-color: var(--m3e-form-field-focused-color, ${f.color.primary}); } :host(:not(.-disabled)) .base { --_form-field-container-color: var( --m3e-form-field-container-color, ${f.color.surfaceContainerHighest} ); } :host(:not(.-disabled).-invalid) .base { --_form-field-label-color: var(--m3e-form-field-invalid-color, ${f.color.error}); --_form-field-outline-color: var(--m3e-form-field-invalid-color, ${f.color.error}); } :host(:not(.-disabled).-invalid) .subscript { color: var(--m3e-form-field-invalid-color, ${f.color.error}); } :host(.-disabled) { color: color-mix( in srgb, var(--m3e-form-field-disabled-color, ${f.color.onSurface}) var(--m3e-form-field-disabled-opacity, 38%), transparent ); } :host(.-disabled) .base { --_form-field-container-color: color-mix( in srgb, var(--m3e-form-field-disabled-container-color, ${f.color.onSurface}) var(--m3e-form-field-disabled-container-opacity, 4%), transparent ); } :host(.-no-animate) *, :host(.-no-animate) *::before, :host(.-no-animate) *::after { transition: none !important; } @media (forced-colors: active) { :host([variant="filled"]) .base::after { transition: none; } :host { --_form-field-outline-color: CanvasText; } :host(.-disabled) { --_form-field-input-color: GrayText; --_form-field-color: GrayText; --_form-field-label-color: GrayText; --_form-field-outline-color: GrayText; } } @media (prefers-reduced-motion) { .base::before, .prefix-text, .suffix-text, .label, .subscript, .outline-start, .outline-notch, .outline-end, .pseudo-label { transition: none !important; } }`,w([K(".base")],St.prototype,"_base",void 0),w([K(".prefix")],St.prototype,"_prefix",void 0),w([K(".error")],St.prototype,"_error",void 0),w([K(".hint")],St.prototype,"_hint",void 0),w([J()],St.prototype,"_pseudoLabel",void 0),w([J()],St.prototype,"_required",void 0),w([J()],St.prototype,"_invalid",void 0),w([J()],St.prototype,"_validationMessage",void 0),w([B({reflect:!0})],St.prototype,"variant",void 0),w([B({attribute:"hide-required-marker",type:Boolean,reflect:!0})],St.prototype,"hideRequiredMarker",void 0),w([B({attribute:"hide-subscript",reflect:!0})],St.prototype,"hideSubscript",void 0),w([B({attribute:"float-label",reflect:!0})],St.prototype,"floatLabel",void 0),St=w([(t=>(e,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)})("m3e-form-field")],St);export{St as M3eFormFieldElement,y as findFormFieldControl,g as isFormFieldControl};
61
61
  //# sourceMappingURL=index.min.js.map