@m3e/form-field 1.0.6 → 1.1.0
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.js +671 -767
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -450
- package/dist/index.min.js.map +1 -1
- package/package.json +2 -16
package/dist/index.min.js
CHANGED
|
@@ -57,454 +57,5 @@ function J(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 K,X,Q,Y,Z,tt,et,it,ot,st,rt,at,nt,lt,dt,ht,ct,ft,pt,ut,mt,bt,vt,gt,yt,_t;let wt=class extends(r(t)){constructor(){super(),K.add(this),X.set(this,null),Q.set(this,()=>_(this,K,"m",vt).call(this)),Y.set(this,()=>_(this,K,"m",mt).call(this)),Z.set(this,new a(this,{target:null,config:{attributeFilter:["disabled","readonly","required"]},callback:()=>this.notifyControlStateChange()})),tt.set(this,new n(this,{target:null,callback:()=>_(this,K,"m",ft).call(this)})),et.set(this,new l(this,{target:null,callback:t=>{t=t&&!(_(this,X,"f")?.disabled??1),this.classList.toggle("-no-animate",!1),w(this,st,t,"f"),t?this.classList.toggle("-float-label",!0):(this._invalid=!(_(this,X,"f")?.checkValidity?.()??1),this.notifyControlStateChange())}})),it.set(this,new a(this,{target:null,config:{childList:!0,subtree:!0},callback:()=>_(this,K,"m",yt).call(this)})),ot.set(this,new a(this,{target:null,config:{childList:!0,subtree:!0},callback:()=>_(this,K,"m",_t).call(this)})),st.set(this,!1),this._pseudoLabel="",this._required=!1,this._invalid=!1,this._validationMessage="",rt.set(this,""),at.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,X,"f")?.disabled??1))})}get menuAnchor(){return this._base}get control(){return _(this,X,"f")}notifyControlStateChange(t=!1){this._required=!0===_(this,X,"f")?.required,this.classList.toggle("-required",this._required),this.classList.toggle("-disabled",!0===_(this,X,"f")?.disabled),this.classList.toggle("-readonly",c(_(this,X,"f"))&&!0===_(this,X,"f").readOnly),"auto"===this.floatLabel&&this.classList.toggle("-float-label",_(this,K,"a",nt)||_(this,st,"f")),t&&(this._invalid=!(_(this,X,"f")?.checkValidity?.()??1)),this.classList.toggle("-invalid",this._invalid),this._validationMessage=_(this,X,"f")?.validationMessage??"",this.isUpdatePending||this.performUpdate()}connectedCallback(){super.connectedCallback(),this.classList.toggle("-no-animate",!0)}disconnectedCallback(){super.disconnectedCallback(),_(this,K,"m",gt).call(this,null)}firstUpdated(t){super.firstUpdated(t),_(this,et,"f").observe(this._base),_(this,it,"f").observe(this._hint),_(this,K,"m",yt).call(this),_(this,ot,"f").observe(this._error),_(this,K,"m",_t).call(this)}update(t){super.update(t),t.has("_invalid")&&_(this,X,"f")&&(_(this,X,"f").ariaInvalid=this._invalid?"true":null,_(this,at,"f")&&(this._invalid?m.describe(_(this,X,"f"),_(this,at,"f")):m.removeDescription(_(this,X,"f"),_(this,at,"f"))))}render(){return i`<div class="base" @click="${_(this,K,"m",ut)}">
|
|
61
|
-
${"outlined"===this.variant?i`<div class="outline" aria-hidden="true">
|
|
62
|
-
<div class="outline-start"></div>
|
|
63
|
-
<div class="outline-notch">
|
|
64
|
-
<div class="pseudo-label">
|
|
65
|
-
${this._pseudoLabel} ${!this.hideRequiredMarker&&this._required?i` *`:e}
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
<div class="outline-end"></div>
|
|
69
|
-
</div>`:e}
|
|
70
|
-
<div class="prefix">
|
|
71
|
-
<slot name="prefix" @slotchange="${_(this,K,"m",ht)}"></slot>
|
|
72
|
-
</div>
|
|
73
|
-
<div class="content">
|
|
74
|
-
<span class="prefix-text"><slot name="prefix-text"></slot></span>
|
|
75
|
-
<span class="input">
|
|
76
|
-
<slot @slotchange="${_(this,K,"m",pt)}" @change="${_(this,K,"m",bt)}"></slot>
|
|
77
|
-
</span>
|
|
78
|
-
<span class="suffix-text"><slot name="suffix-text"></slot></span>
|
|
79
|
-
<span class="label">
|
|
80
|
-
<slot name="label" @slotchange="${_(this,K,"m",dt)}"></slot>
|
|
81
|
-
${!this.hideRequiredMarker&&this._required?i`<span class="required-marker" aria-hidden="true"> *</span>`:e}
|
|
82
|
-
</span>
|
|
83
|
-
</div>
|
|
84
|
-
<div class="suffix" @click="${_(this,K,"m",lt)}">
|
|
85
|
-
<slot name="suffix" @slotchange="${_(this,K,"m",ct)}"></slot>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
<span class="subscript" aria-hidden="true">
|
|
89
|
-
<span class="error"><slot name="error">${this._validationMessage}</slot></span>
|
|
90
|
-
<span class="hint"><slot name="hint"></slot></span>
|
|
91
|
-
</span>`}};X=new WeakMap,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,K=new WeakSet,nt=function(){return void 0!==_(this,X,"f")?.shouldLabelFloat?!0===_(this,X,"f").shouldLabelFloat:"string"==typeof _(this,X,"f")?.value&&_(this,X,"f").value.length>0},lt=function(t){t.stopImmediatePropagation(),t.stopPropagation()},dt=function(t){const e=t.target.assignedElements({flatten:!0});this.classList.toggle("-with-label",e.length>0),this._pseudoLabel=e[0]?.textContent??""},ht=function(t){this.classList.toggle("-with-prefix",p(t.target)),_(this,tt,"f").observe(this._prefix)},ct=function(t){this.classList.toggle("-with-suffix",p(t.target))},ft=function(){"outlined"===this.variant&&this._base.style.setProperty("--_prefix-width",`${this._prefix.clientWidth}px`)},pt=function(t){_(this,K,"m",gt).call(this,g(t.target))},ut=function(t){!_(this,X,"f")||_(this,st,"f")||_(this,X,"f").disabled||(_(this,X,"f").onContainerClick?_(this,X,"f").onContainerClick(t):_(this,X,"f").focus())},mt=function(){this._invalid=!0,this.notifyControlStateChange()},bt=function(){this._invalid=!(_(this,X,"f")?.checkValidity?.()??1),this.notifyControlStateChange()},vt=function(){this._invalid=!1,setTimeout(()=>this.notifyControlStateChange())},gt=function(t){_(this,X,"f")!==t&&(_(this,X,"f")&&(_(this,rt,"f")&&m.removeDescription(_(this,X,"f"),_(this,rt,"f")),_(this,at,"f")&&m.removeDescription(_(this,X,"f"),_(this,at,"f")),_(this,Z,"f").unobserve(_(this,X,"f")),_(this,X,"f").removeEventListener("invalid",_(this,Y,"f")),_(this,X,"f").form?.removeEventListener("reset",_(this,Q,"f"))),w(this,X,t,"f"),["INPUT","TEXTAREA"].includes(_(this,X,"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,X,"f")?.tagName),this.classList.contains("-with-select")&&this._base.style.setProperty("--_form-field-cursor","pointer"),_(this,X,"f")&&(_(this,Z,"f").observe(_(this,X,"f")),_(this,X,"f").addEventListener("invalid",_(this,Y,"f")),_(this,X,"f").form?.addEventListener("reset",_(this,Q,"f")),_(this,X,"f").removeAttribute("aria-invalid"),_(this,rt,"f")&&m.describe(_(this,X,"f"),_(this,rt,"f")),this.notifyControlStateChange()))},yt=function(){const t=u(this._hint,!0);t!==_(this,rt,"f")&&(_(this,X,"f")&&_(this,rt,"f")&&m.removeDescription(_(this,X,"f"),_(this,rt,"f")),w(this,rt,t,"f"),_(this,X,"f")&&_(this,rt,"f")&&m.describe(_(this,X,"f"),_(this,rt,"f")))},_t=function(){const t=u(this._error,!0);t!==_(this,at,"f")&&(_(this,X,"f")&&_(this,at,"f")&&m.removeDescription(_(this,X,"f"),_(this,at,"f")),w(this,at,t,"f"),_(this,X,"f")&&_(this,at,"f")&&this._invalid&&m.describe(_(this,X,"f"),_(this,at,"f")))},(()=>{const t=new CSSStyleSheet;t.replaceSync(o`
|
|
92
|
-
m3e-form-field input::placeholder,
|
|
93
|
-
m3e-form-field textarea::placeholder {
|
|
94
|
-
user-select: none;
|
|
95
|
-
color: currentColor;
|
|
96
|
-
transition: opacity ${f.motion.duration.extraLong1};
|
|
97
|
-
}
|
|
98
|
-
m3e-form-field[float-label="auto"]:not(.-float-label).-with-label input::placeholder,
|
|
99
|
-
m3e-form-field[float-label="auto"]:not(.-float-label).-with-label textarea::placeholder {
|
|
100
|
-
opacity: 0;
|
|
101
|
-
transition: opacity 0s;
|
|
102
|
-
}
|
|
103
|
-
@media (prefers-reduced-motion) {
|
|
104
|
-
m3e-form-field input::placeholder,
|
|
105
|
-
m3e-form-field textarea::placeholder {
|
|
106
|
-
transition: none !important;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
`.toString()),document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]})(),wt.styles=o`
|
|
110
|
-
:host {
|
|
111
|
-
display: inline-flex;
|
|
112
|
-
flex-direction: column;
|
|
113
|
-
vertical-align: middle;
|
|
114
|
-
font-size: var(--m3e-form-field-font-size, ${f.typescale.standard.body.large.fontSize});
|
|
115
|
-
font-weight: var(--m3e-form-field-font-weight, ${f.typescale.standard.body.large.fontWeight});
|
|
116
|
-
line-height: var(--m3e-form-field-line-height, ${f.typescale.standard.body.large.lineHeight});
|
|
117
|
-
letter-spacing: var(--m3e-form-field-tracking, ${f.typescale.standard.body.large.tracking});
|
|
118
|
-
width: var(--m3e-form-field-width, 14.5rem);
|
|
119
|
-
color: var(--_form-field-color);
|
|
120
|
-
}
|
|
121
|
-
:host(:not(.-disabled)) .base {
|
|
122
|
-
cursor: var(--_form-field-cursor);
|
|
123
|
-
}
|
|
124
|
-
.base {
|
|
125
|
-
display: flex;
|
|
126
|
-
align-items: center;
|
|
127
|
-
position: relative;
|
|
128
|
-
min-height: calc(3.5rem + ${f.density.calc(-2)});
|
|
129
|
-
--_form-field-label-font-size: var(
|
|
130
|
-
--m3e-form-field-label-font-size,
|
|
131
|
-
${f.typescale.standard.body.small.fontSize}
|
|
132
|
-
);
|
|
133
|
-
--_form-field-label-line-height: var(
|
|
134
|
-
--m3e-form-field-label-line-height,
|
|
135
|
-
${f.typescale.standard.body.small.lineHeight}
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
.content {
|
|
139
|
-
display: flex;
|
|
140
|
-
align-items: center;
|
|
141
|
-
position: relative;
|
|
142
|
-
flex: 1 1 auto;
|
|
143
|
-
min-width: 0;
|
|
144
|
-
min-height: var(--m3e-form-field-icon-size, 1.5rem);
|
|
145
|
-
}
|
|
146
|
-
.prefix,
|
|
147
|
-
.suffix {
|
|
148
|
-
display: flex;
|
|
149
|
-
align-items: center;
|
|
150
|
-
position: relative;
|
|
151
|
-
user-select: none;
|
|
152
|
-
flex: none;
|
|
153
|
-
font-size: var(--m3e-form-field-icon-size, 1.5rem);
|
|
154
|
-
}
|
|
155
|
-
.prefix-text,
|
|
156
|
-
.suffix-text {
|
|
157
|
-
opacity: 1;
|
|
158
|
-
transition: opacity ${f.motion.duration.extraLong1};
|
|
159
|
-
user-select: none;
|
|
160
|
-
flex: none;
|
|
161
|
-
}
|
|
162
|
-
.input {
|
|
163
|
-
display: inline-flex;
|
|
164
|
-
flex-wrap: wrap;
|
|
165
|
-
flex: 1 1 auto;
|
|
166
|
-
min-width: 0;
|
|
167
|
-
}
|
|
168
|
-
.label {
|
|
169
|
-
display: flex;
|
|
170
|
-
position: absolute;
|
|
171
|
-
pointer-events: none;
|
|
172
|
-
user-select: none;
|
|
173
|
-
top: 0;
|
|
174
|
-
left: 0;
|
|
175
|
-
right: 0;
|
|
176
|
-
font-size: var(--m3e-form-field-label-font-size, ${f.typescale.standard.body.small.fontSize});
|
|
177
|
-
font-weight: var(--m3e-form-field-label-font-weight, ${f.typescale.standard.body.small.fontWeight});
|
|
178
|
-
line-height: var(--m3e-form-field-label-line-height, ${f.typescale.standard.body.small.lineHeight});
|
|
179
|
-
letter-spacing: var(--m3e-form-field-label-tracking, ${f.typescale.standard.body.small.tracking});
|
|
180
|
-
color: var(--_form-field-label-color, inherit);
|
|
181
|
-
transition: ${s(`top ${f.motion.duration.short4}, \n font-size ${f.motion.duration.short4}, \n line-height ${f.motion.duration.short4}`)};
|
|
182
|
-
}
|
|
183
|
-
:host(.-with-select) .label {
|
|
184
|
-
margin-inline-end: 1.5rem;
|
|
185
|
-
}
|
|
186
|
-
::slotted([slot="label"]) {
|
|
187
|
-
white-space: nowrap;
|
|
188
|
-
overflow: hidden;
|
|
189
|
-
text-overflow: ellipsis;
|
|
190
|
-
}
|
|
191
|
-
.subscript {
|
|
192
|
-
display: inline-flex;
|
|
193
|
-
width: 100%;
|
|
194
|
-
margin-top: 0.25rem;
|
|
195
|
-
font-size: var(--m3e-form-field-subscript-font-size, ${f.typescale.standard.body.small.fontSize});
|
|
196
|
-
font-weight: var(--m3e-form-field-subscript-font-weight, ${f.typescale.standard.body.small.fontWeight});
|
|
197
|
-
line-height: var(--m3e-form-field-subscript-line-height, ${f.typescale.standard.body.small.lineHeight});
|
|
198
|
-
letter-spacing: var(--m3e-form-field-subscript-tracking, ${f.typescale.standard.body.small.tracking});
|
|
199
|
-
min-height: var(--m3e-form-field-subscript-line-height, ${f.typescale.standard.body.small.lineHeight});
|
|
200
|
-
color: var(--m3e-form-field-subscript-color, ${f.color.onSurfaceVariant});
|
|
201
|
-
}
|
|
202
|
-
.error,
|
|
203
|
-
.hint {
|
|
204
|
-
flex: 1 1 auto;
|
|
205
|
-
}
|
|
206
|
-
:host([hide-subscript="always"]) .subscript {
|
|
207
|
-
display: none;
|
|
208
|
-
}
|
|
209
|
-
:host([hide-subscript="auto"]:not(.-invalid)) .subscript {
|
|
210
|
-
opacity: 0;
|
|
211
|
-
margin-top: 0px;
|
|
212
|
-
margin-bottom: 0.25rem;
|
|
213
|
-
transition: ${s(`opacity ${f.motion.duration.short4}, \n margin-top ${f.motion.duration.short4}, \n margin-bottom ${f.motion.duration.short4}`)};
|
|
214
|
-
}
|
|
215
|
-
:host([hide-subscript="auto"]:not(.-invalid):focus-within) .subscript,
|
|
216
|
-
:host([hide-subscript="auto"]:not(.-invalid).-pressed) .subscript {
|
|
217
|
-
opacity: 1;
|
|
218
|
-
margin-top: 0.25rem;
|
|
219
|
-
margin-bottom: 0;
|
|
220
|
-
}
|
|
221
|
-
:host(.-invalid) .hint {
|
|
222
|
-
display: none;
|
|
223
|
-
}
|
|
224
|
-
:host(:not(.-invalid)) .error {
|
|
225
|
-
display: none;
|
|
226
|
-
}
|
|
227
|
-
::slotted(input),
|
|
228
|
-
::slotted(textarea),
|
|
229
|
-
::slotted(select) {
|
|
230
|
-
outline: unset;
|
|
231
|
-
border: unset;
|
|
232
|
-
background-color: transparent;
|
|
233
|
-
box-shadow: none;
|
|
234
|
-
font-family: inherit;
|
|
235
|
-
font-size: inherit;
|
|
236
|
-
line-height: initial;
|
|
237
|
-
letter-spacing: inherit;
|
|
238
|
-
color: var(--_form-field-input-color, inherit);
|
|
239
|
-
flex: 1 1 auto;
|
|
240
|
-
min-width: 0;
|
|
241
|
-
padding: unset;
|
|
242
|
-
}
|
|
243
|
-
::slotted(textarea) {
|
|
244
|
-
scrollbar-width: ${f.scrollbar.thinWidth};
|
|
245
|
-
scrollbar-color: ${f.scrollbar.color};
|
|
246
|
-
}
|
|
247
|
-
::slotted(m3e-select),
|
|
248
|
-
::slotted(m3e-input-chip-set) {
|
|
249
|
-
flex: 1 1 auto;
|
|
250
|
-
min-width: 0;
|
|
251
|
-
}
|
|
252
|
-
:host([variant="outlined"]) ::slotted(m3e-input-chip-set) {
|
|
253
|
-
margin-block: calc(calc(3.5rem + ${f.density.calc(-2)}) / 4);
|
|
254
|
-
}
|
|
255
|
-
:host([float-label="auto"]:not(.-float-label):not(.-pressed)) .label {
|
|
256
|
-
font-size: inherit;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
:host([float-label="auto"]:not(.-float-label).-with-label) .prefix-text,
|
|
260
|
-
:host([float-label="auto"]:not(.-float-label).-with-label) .suffix-text {
|
|
261
|
-
opacity: 0;
|
|
262
|
-
transition: opacity 0s;
|
|
263
|
-
}
|
|
264
|
-
.prefix {
|
|
265
|
-
margin-inline-start: 1rem;
|
|
266
|
-
}
|
|
267
|
-
:host(.-with-prefix) .prefix {
|
|
268
|
-
margin-inline-end: 1rem;
|
|
269
|
-
margin-inline-start: 0.75rem;
|
|
270
|
-
}
|
|
271
|
-
.suffix {
|
|
272
|
-
margin-inline-end: 1rem;
|
|
273
|
-
}
|
|
274
|
-
:host(.-with-suffix) .suffix {
|
|
275
|
-
margin-inline-start: 0.25rem;
|
|
276
|
-
margin-inline-end: unset;
|
|
277
|
-
}
|
|
278
|
-
:host(.-with-suffix.-with-select) .suffix {
|
|
279
|
-
margin-inline-start: unset;
|
|
280
|
-
}
|
|
281
|
-
:host(.-with-select) .suffix-text {
|
|
282
|
-
display: none;
|
|
283
|
-
}
|
|
284
|
-
:host([variant="outlined"]) .label {
|
|
285
|
-
margin-top: calc(0px - var(--_form-field-label-line-height) / 2);
|
|
286
|
-
}
|
|
287
|
-
:host([variant="outlined"]) .outline {
|
|
288
|
-
position: absolute;
|
|
289
|
-
display: flex;
|
|
290
|
-
pointer-events: none;
|
|
291
|
-
left: 0;
|
|
292
|
-
top: 0;
|
|
293
|
-
bottom: 0;
|
|
294
|
-
right: 0;
|
|
295
|
-
}
|
|
296
|
-
:host([variant="outlined"]) .pseudo-label {
|
|
297
|
-
visibility: hidden;
|
|
298
|
-
margin-inline-end: 0.25rem;
|
|
299
|
-
font-size: var(--_form-field-label-font-size);
|
|
300
|
-
line-height: var(--_form-field-label-line-height);
|
|
301
|
-
letter-spacing: var(--_form-field-label-tracking);
|
|
302
|
-
max-width: 100%;
|
|
303
|
-
transition-property: max-width, margin-inline-end;
|
|
304
|
-
transition-duration: 1ms;
|
|
305
|
-
}
|
|
306
|
-
:host([variant="outlined"][float-label="auto"]:not(.-float-label):not(.-pressed)) .pseudo-label {
|
|
307
|
-
max-width: 0;
|
|
308
|
-
margin-inline-end: 0px;
|
|
309
|
-
transition-delay: ${f.motion.duration.short2};
|
|
310
|
-
}
|
|
311
|
-
:host([variant="outlined"]) .outline-start,
|
|
312
|
-
:host([variant="outlined"]) .outline-notch,
|
|
313
|
-
:host([variant="outlined"]) .outline-end {
|
|
314
|
-
box-sizing: border-box;
|
|
315
|
-
border-width: var(--_form-field-outline-size, 0.0625rem);
|
|
316
|
-
border-color: var(--_form-field-outline-color);
|
|
317
|
-
transition: border-color ${f.motion.duration.short4};
|
|
318
|
-
}
|
|
319
|
-
:host([variant="outlined"]:not(.-with-label)) .outline-notch {
|
|
320
|
-
display: none;
|
|
321
|
-
}
|
|
322
|
-
:host([variant="outlined"]) .outline-start {
|
|
323
|
-
min-width: 0.75rem;
|
|
324
|
-
border-top-style: solid;
|
|
325
|
-
border-left-style: solid;
|
|
326
|
-
border-bottom-style: solid;
|
|
327
|
-
border-radius: var(--m3e-outlined-form-field-container-shape, ${f.shape.corner.extraSmall}) 0 0
|
|
328
|
-
var(--m3e-outlined-form-field-container-shape, ${f.shape.corner.extraSmall});
|
|
329
|
-
}
|
|
330
|
-
:host([variant="outlined"]) .outline-notch {
|
|
331
|
-
border-bottom-style: solid;
|
|
332
|
-
}
|
|
333
|
-
:host([variant="outlined"]) .outline-end {
|
|
334
|
-
flex-grow: 1;
|
|
335
|
-
min-width: 1rem;
|
|
336
|
-
border-top-style: solid;
|
|
337
|
-
border-right-style: solid;
|
|
338
|
-
border-bottom-style: solid;
|
|
339
|
-
border-radius: 0 var(--m3e-outlined-form-field-container-shape, ${f.shape.corner.extraSmall})
|
|
340
|
-
var(--m3e-outlined-form-field-container-shape, ${f.shape.corner.extraSmall}) 0;
|
|
341
|
-
}
|
|
342
|
-
:host([variant="outlined"].-with-prefix) .outline-start {
|
|
343
|
-
min-width: calc(1.25rem + var(--_prefix-width, 0px) + 0.25rem);
|
|
344
|
-
}
|
|
345
|
-
:host([variant="outlined"]:not(.-disabled)) .base:hover .outline,
|
|
346
|
-
:host([variant="outlined"]:not(.-disabled):focus-within) .outline,
|
|
347
|
-
:host([variant="outlined"]:not(.-disabled).-pressed) .outline {
|
|
348
|
-
--_form-field-outline-size: 0.125rem;
|
|
349
|
-
}
|
|
350
|
-
:host([variant="outlined"]) .subscript {
|
|
351
|
-
margin-inline: 1rem;
|
|
352
|
-
width: calc(100% - 2rem);
|
|
353
|
-
}
|
|
354
|
-
:host([variant="outlined"]) .content {
|
|
355
|
-
min-height: calc(3.5rem + ${f.density.calc(-2)});
|
|
356
|
-
--_form-field-label-font-size: var(
|
|
357
|
-
--m3e-form-field-label-font-size,
|
|
358
|
-
${f.typescale.standard.body.small.fontSize}
|
|
359
|
-
);
|
|
360
|
-
}
|
|
361
|
-
:host([variant="outlined"][float-label="auto"]:not(.-float-label):not(.-pressed)) .label {
|
|
362
|
-
margin-top: unset;
|
|
363
|
-
line-height: calc(3.5rem + ${f.density.calc(-2)});
|
|
364
|
-
--_form-field-label-font-size: var(
|
|
365
|
-
--m3e-form-field-label-font-size,
|
|
366
|
-
${f.typescale.standard.body.small.fontSize}
|
|
367
|
-
);
|
|
368
|
-
}
|
|
369
|
-
:host([variant="filled"]) .base {
|
|
370
|
-
--_select-arrow-margin-top: calc(
|
|
371
|
-
0px - calc(1rem / max(calc(0 - calc(var(--m3e-density-scale, 0) + var(--m3e-density-scale, 0))), 1))
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
:host([variant="filled"]) .base::before {
|
|
375
|
-
content: "";
|
|
376
|
-
box-sizing: border-box;
|
|
377
|
-
position: absolute;
|
|
378
|
-
pointer-events: none;
|
|
379
|
-
top: 0;
|
|
380
|
-
left: 0;
|
|
381
|
-
right: 0;
|
|
382
|
-
bottom: 0;
|
|
383
|
-
border-bottom-style: solid;
|
|
384
|
-
border-width: 0.0625rem;
|
|
385
|
-
border-radius: var(--m3e-form-field-container-shape, ${f.shape.corner.extraSmallTop});
|
|
386
|
-
border-color: var(--_form-field-outline-color);
|
|
387
|
-
background-color: var(--_form-field-container-color);
|
|
388
|
-
}
|
|
389
|
-
:host([variant="filled"]:not(.-disabled)) .base:hover::before,
|
|
390
|
-
:host([variant="filled"]:not(.-disabled):focus-within) .base::before,
|
|
391
|
-
:host([variant="filled"]:not(.-disabled).-pressed) .base::before {
|
|
392
|
-
border-width: 0.1875rem;
|
|
393
|
-
}
|
|
394
|
-
:host([variant="filled"]) .base::after {
|
|
395
|
-
content: "";
|
|
396
|
-
box-sizing: border-box;
|
|
397
|
-
position: absolute;
|
|
398
|
-
pointer-events: none;
|
|
399
|
-
top: 0;
|
|
400
|
-
left: 0;
|
|
401
|
-
right: 0;
|
|
402
|
-
bottom: 0;
|
|
403
|
-
background-color: var(--_form-field-hover-container-color);
|
|
404
|
-
transition: background-color ${f.motion.duration.short4};
|
|
405
|
-
}
|
|
406
|
-
:host([variant="filled"]) .subscript {
|
|
407
|
-
margin-inline: 1rem;
|
|
408
|
-
width: calc(100% - 2rem);
|
|
409
|
-
}
|
|
410
|
-
:host([variant="filled"]) .content {
|
|
411
|
-
padding-top: calc(1.5rem + ${f.density.calc(-2)});
|
|
412
|
-
margin-bottom: 0.5rem;
|
|
413
|
-
}
|
|
414
|
-
:host([variant="filled"]) .label {
|
|
415
|
-
top: calc(0.5rem + ${f.density.calc(-2)});
|
|
416
|
-
}
|
|
417
|
-
:host([variant="filled"][float-label="auto"]:not(.-float-label):not(.-pressed)) .label {
|
|
418
|
-
top: 0px;
|
|
419
|
-
line-height: calc(3.5rem + ${f.density.calc(-2)} - 0.0625rem);
|
|
420
|
-
--_form-field-label-font-size: var(
|
|
421
|
-
--m3e-form-field-label-font-size,
|
|
422
|
-
${f.typescale.standard.body.small.fontSize}
|
|
423
|
-
);
|
|
424
|
-
}
|
|
425
|
-
:host(:not(.-disabled):not(:focus-within):not(.-pressed)) .base:hover {
|
|
426
|
-
--_form-field-hover-container-color: color-mix(
|
|
427
|
-
in srgb,
|
|
428
|
-
var(--m3e-form-field-hover-container-color, ${f.color.onSurface})
|
|
429
|
-
var(--m3e-form-field-hover-container-opacity, 8%),
|
|
430
|
-
transparent
|
|
431
|
-
);
|
|
432
|
-
}
|
|
433
|
-
:host(:not(.-disabled):not(.-invalid)) {
|
|
434
|
-
color: var(--m3e-form-field-color, ${f.color.onSurface});
|
|
435
|
-
}
|
|
436
|
-
:host([variant="outlined"]:not(.-disabled):not(.-invalid)) .base {
|
|
437
|
-
--_form-field-outline-color: var(--m3e-form-field-outline-color, ${f.color.outline});
|
|
438
|
-
}
|
|
439
|
-
:host([variant="filled"]:not(.-disabled):not(.-invalid)) .base {
|
|
440
|
-
--_form-field-outline-color: var(--m3e-form-field-outline-color, ${f.color.onSurfaceVariant});
|
|
441
|
-
}
|
|
442
|
-
:host([variant="outlined"]:not(.-disabled):not(.-invalid):focus-within) .base,
|
|
443
|
-
:host([variant="outlined"]:not(.-disabled):not(.-invalid).-pressed) .base,
|
|
444
|
-
:host([variant="filled"]:not(.-disabled):not(.-invalid):focus-within) .base,
|
|
445
|
-
:host([variant="filled"]:not(.-disabled):not(.-invalid).-pressed) .base {
|
|
446
|
-
--_form-field-outline-color: var(--m3e-form-field-focused-outline-color, ${f.color.primary});
|
|
447
|
-
--_form-field-label-color: var(--m3e-form-field-focused-color, ${f.color.primary});
|
|
448
|
-
}
|
|
449
|
-
:host(:not(.-disabled)) .base {
|
|
450
|
-
--_form-field-container-color: var(
|
|
451
|
-
--m3e-form-field-container-color,
|
|
452
|
-
${f.color.surfaceContainerHighest}
|
|
453
|
-
);
|
|
454
|
-
}
|
|
455
|
-
:host(:not(.-disabled).-invalid) .base {
|
|
456
|
-
--_form-field-label-color: var(--m3e-form-field-invalid-color, ${f.color.error});
|
|
457
|
-
--_form-field-outline-color: var(--m3e-form-field-invalid-color, ${f.color.error});
|
|
458
|
-
}
|
|
459
|
-
:host(:not(.-disabled).-invalid) .subscript {
|
|
460
|
-
color: var(--m3e-form-field-invalid-color, ${f.color.error});
|
|
461
|
-
}
|
|
462
|
-
:host(.-disabled) {
|
|
463
|
-
color: color-mix(
|
|
464
|
-
in srgb,
|
|
465
|
-
var(--m3e-form-field-disabled-color, ${f.color.onSurface}) var(--m3e-form-field-disabled-opacity, 38%),
|
|
466
|
-
transparent
|
|
467
|
-
);
|
|
468
|
-
}
|
|
469
|
-
:host(.-disabled) .base {
|
|
470
|
-
--_form-field-container-color: color-mix(
|
|
471
|
-
in srgb,
|
|
472
|
-
var(--m3e-form-field-disabled-container-color, ${f.color.onSurface})
|
|
473
|
-
var(--m3e-form-field-disabled-container-opacity, 4%),
|
|
474
|
-
transparent
|
|
475
|
-
);
|
|
476
|
-
}
|
|
477
|
-
:host(.-no-animate) *,
|
|
478
|
-
:host(.-no-animate) *::before,
|
|
479
|
-
:host(.-no-animate) *::after {
|
|
480
|
-
transition: none !important;
|
|
481
|
-
}
|
|
482
|
-
@media (forced-colors: active) {
|
|
483
|
-
:host([variant="filled"]) .base::after {
|
|
484
|
-
transition: none;
|
|
485
|
-
}
|
|
486
|
-
:host {
|
|
487
|
-
--_form-field-outline-color: CanvasText;
|
|
488
|
-
}
|
|
489
|
-
:host(.-disabled) {
|
|
490
|
-
--_form-field-input-color: GrayText;
|
|
491
|
-
--_form-field-color: GrayText;
|
|
492
|
-
--_form-field-label-color: GrayText;
|
|
493
|
-
--_form-field-outline-color: GrayText;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
@media (prefers-reduced-motion) {
|
|
497
|
-
.base::before,
|
|
498
|
-
.prefix-text,
|
|
499
|
-
.suffix-text,
|
|
500
|
-
.label,
|
|
501
|
-
.subscript,
|
|
502
|
-
.outline-start,
|
|
503
|
-
.outline-notch,
|
|
504
|
-
.outline-end,
|
|
505
|
-
.pseudo-label {
|
|
506
|
-
transition: none !important;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
`,y([J(".base")],wt.prototype,"_base",void 0),y([J(".prefix")],wt.prototype,"_prefix",void 0),y([J(".error")],wt.prototype,"_error",void 0),y([J(".hint")],wt.prototype,"_hint",void 0),y([B()],wt.prototype,"_pseudoLabel",void 0),y([B()],wt.prototype,"_required",void 0),y([B()],wt.prototype,"_invalid",void 0),y([B()],wt.prototype,"_validationMessage",void 0),y([G({reflect:!0})],wt.prototype,"variant",void 0),y([G({attribute:"hide-required-marker",type:Boolean,reflect:!0})],wt.prototype,"hideRequiredMarker",void 0),y([G({attribute:"hide-subscript",reflect:!0})],wt.prototype,"hideSubscript",void 0),y([G({attribute:"float-label",reflect:!0})],wt.prototype,"floatLabel",void 0),wt=y([(t=>(e,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)})("m3e-form-field")],wt);export{wt as M3eFormFieldElement,g as findFormFieldControl,v as isFormFieldControl};
|
|
60
|
+
*/var K,X,Q,Y,Z,tt,et,it,ot,st,rt,at,nt,lt,dt,ht,ct,ft,pt,ut,mt,bt,vt,gt,yt,_t;let wt=class extends(r(t)){constructor(){super(),K.add(this),X.set(this,null),Q.set(this,()=>_(this,K,"m",vt).call(this)),Y.set(this,()=>_(this,K,"m",mt).call(this)),Z.set(this,new a(this,{target:null,config:{attributeFilter:["disabled","readonly","required"]},callback:()=>this.notifyControlStateChange()})),tt.set(this,new n(this,{target:null,callback:()=>_(this,K,"m",ft).call(this)})),et.set(this,new l(this,{target:null,callback:t=>{t=t&&!(_(this,X,"f")?.disabled??1),this.classList.toggle("-no-animate",!1),w(this,st,t,"f"),t?this.classList.toggle("-float-label",!0):(this._invalid=!(_(this,X,"f")?.checkValidity?.()??1),this.notifyControlStateChange())}})),it.set(this,new a(this,{target:null,config:{childList:!0,subtree:!0},callback:()=>_(this,K,"m",yt).call(this)})),ot.set(this,new a(this,{target:null,config:{childList:!0,subtree:!0},callback:()=>_(this,K,"m",_t).call(this)})),st.set(this,!1),this._pseudoLabel="",this._required=!1,this._invalid=!1,this._validationMessage="",rt.set(this,""),at.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,X,"f")?.disabled??1))})}get menuAnchor(){return this._base}get control(){return _(this,X,"f")}notifyControlStateChange(t=!1){this._required=!0===_(this,X,"f")?.required,this.classList.toggle("-required",this._required),this.classList.toggle("-disabled",!0===_(this,X,"f")?.disabled),this.classList.toggle("-readonly",c(_(this,X,"f"))&&!0===_(this,X,"f").readOnly),"auto"===this.floatLabel&&this.classList.toggle("-float-label",_(this,K,"a",nt)||_(this,st,"f")),t&&(this._invalid=!(_(this,X,"f")?.checkValidity?.()??1)),this.classList.toggle("-invalid",this._invalid),this._validationMessage=_(this,X,"f")?.validationMessage??"",this.isUpdatePending||this.performUpdate()}connectedCallback(){super.connectedCallback(),this.classList.toggle("-no-animate",!0)}disconnectedCallback(){super.disconnectedCallback(),_(this,K,"m",gt).call(this,null)}firstUpdated(t){super.firstUpdated(t),_(this,et,"f").observe(this._base),_(this,it,"f").observe(this._hint),_(this,K,"m",yt).call(this),_(this,ot,"f").observe(this._error),_(this,K,"m",_t).call(this)}update(t){super.update(t),t.has("_invalid")&&_(this,X,"f")&&(_(this,X,"f").ariaInvalid=this._invalid?"true":null,_(this,at,"f")&&(this._invalid?m.describe(_(this,X,"f"),_(this,at,"f")):m.removeDescription(_(this,X,"f"),_(this,at,"f"))))}render(){return i`<div class="base" @click="${_(this,K,"m",ut)}">${"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` *`:e}</div></div><div class="outline-end"></div></div>`:e}<div class="prefix"><slot name="prefix" @slotchange="${_(this,K,"m",ht)}"></slot></div><div class="content"><span class="prefix-text"><slot name="prefix-text"></slot></span><span class="input"><slot @slotchange="${_(this,K,"m",pt)}" @change="${_(this,K,"m",bt)}"></slot></span><span class="suffix-text"><slot name="suffix-text"></slot></span><span class="label"><slot name="label" @slotchange="${_(this,K,"m",dt)}"></slot>${!this.hideRequiredMarker&&this._required?i`<span class="required-marker" aria-hidden="true"> *</span>`:e}</span></div><div class="suffix" @click="${_(this,K,"m",lt)}"><slot name="suffix" @slotchange="${_(this,K,"m",ct)}"></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>`}};X=new WeakMap,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,K=new WeakSet,nt=function(){return void 0!==_(this,X,"f")?.shouldLabelFloat?!0===_(this,X,"f").shouldLabelFloat:"string"==typeof _(this,X,"f")?.value&&_(this,X,"f").value.length>0},lt=function(t){t.stopImmediatePropagation(),t.stopPropagation()},dt=function(t){const e=t.target.assignedElements({flatten:!0});this.classList.toggle("-with-label",e.length>0),this._pseudoLabel=e[0]?.textContent??""},ht=function(t){this.classList.toggle("-with-prefix",p(t.target)),_(this,tt,"f").observe(this._prefix)},ct=function(t){this.classList.toggle("-with-suffix",p(t.target))},ft=function(){"outlined"===this.variant&&this._base.style.setProperty("--_prefix-width",`${this._prefix.clientWidth}px`)},pt=function(t){_(this,K,"m",gt).call(this,g(t.target))},ut=function(t){!_(this,X,"f")||_(this,st,"f")||_(this,X,"f").disabled||(_(this,X,"f").onContainerClick?_(this,X,"f").onContainerClick(t):_(this,X,"f").focus())},mt=function(){this._invalid=!0,this.notifyControlStateChange()},bt=function(){this._invalid=!(_(this,X,"f")?.checkValidity?.()??1),this.notifyControlStateChange()},vt=function(){this._invalid=!1,setTimeout(()=>this.notifyControlStateChange())},gt=function(t){_(this,X,"f")!==t&&(_(this,X,"f")&&(_(this,rt,"f")&&m.removeDescription(_(this,X,"f"),_(this,rt,"f")),_(this,at,"f")&&m.removeDescription(_(this,X,"f"),_(this,at,"f")),_(this,Z,"f").unobserve(_(this,X,"f")),_(this,X,"f").removeEventListener("invalid",_(this,Y,"f")),_(this,X,"f").form?.removeEventListener("reset",_(this,Q,"f"))),w(this,X,t,"f"),["INPUT","TEXTAREA"].includes(_(this,X,"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,X,"f")?.tagName),this.classList.contains("-with-select")&&this._base.style.setProperty("--_form-field-cursor","pointer"),_(this,X,"f")&&(_(this,Z,"f").observe(_(this,X,"f")),_(this,X,"f").addEventListener("invalid",_(this,Y,"f")),_(this,X,"f").form?.addEventListener("reset",_(this,Q,"f")),_(this,X,"f").removeAttribute("aria-invalid"),_(this,rt,"f")&&m.describe(_(this,X,"f"),_(this,rt,"f")),this.notifyControlStateChange()))},yt=function(){const t=u(this._hint,!0);t!==_(this,rt,"f")&&(_(this,X,"f")&&_(this,rt,"f")&&m.removeDescription(_(this,X,"f"),_(this,rt,"f")),w(this,rt,t,"f"),_(this,X,"f")&&_(this,rt,"f")&&m.describe(_(this,X,"f"),_(this,rt,"f")))},_t=function(){const t=u(this._error,!0);t!==_(this,at,"f")&&(_(this,X,"f")&&_(this,at,"f")&&m.removeDescription(_(this,X,"f"),_(this,at,"f")),w(this,at,t,"f"),_(this,X,"f")&&_(this,at,"f")&&this._invalid&&m.describe(_(this,X,"f"),_(this,at,"f")))},(()=>{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; } @media (prefers-reduced-motion) { m3e-form-field input::placeholder, m3e-form-field textarea::placeholder { transition: none !important; } }`.toString()),document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]})(),wt.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([variant="outlined"]) ::slotted(m3e-input-chip-set) { margin-block: calc(calc(3.5rem + ${f.density.calc(-2)}) / 4); } :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: unset; } :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; } }`,y([J(".base")],wt.prototype,"_base",void 0),y([J(".prefix")],wt.prototype,"_prefix",void 0),y([J(".error")],wt.prototype,"_error",void 0),y([J(".hint")],wt.prototype,"_hint",void 0),y([B()],wt.prototype,"_pseudoLabel",void 0),y([B()],wt.prototype,"_required",void 0),y([B()],wt.prototype,"_invalid",void 0),y([B()],wt.prototype,"_validationMessage",void 0),y([G({reflect:!0})],wt.prototype,"variant",void 0),y([G({attribute:"hide-required-marker",type:Boolean,reflect:!0})],wt.prototype,"hideRequiredMarker",void 0),y([G({attribute:"hide-subscript",reflect:!0})],wt.prototype,"hideSubscript",void 0),y([G({attribute:"float-label",reflect:!0})],wt.prototype,"floatLabel",void 0),wt=y([(t=>(e,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)})("m3e-form-field")],wt);export{wt as M3eFormFieldElement,g as findFormFieldControl,v as isFormFieldControl};
|
|
510
61
|
//# sourceMappingURL=index.min.js.map
|