@universal-material/web 3.0.57 → 3.0.58
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/button/button.styles.d.ts.map +1 -1
- package/button/button.styles.js +5 -1
- package/button/button.styles.js.map +1 -1
- package/button/fab.styles.d.ts.map +1 -1
- package/button/fab.styles.js +5 -1
- package/button/fab.styles.js.map +1 -1
- package/button/icon-button.styles.d.ts.map +1 -1
- package/button/icon-button.styles.js +5 -1
- package/button/icon-button.styles.js.map +1 -1
- package/chip/chip.styles.d.ts.map +1 -1
- package/chip/chip.styles.js +5 -1
- package/chip/chip.styles.js.map +1 -1
- package/chip-field/chip-field.d.ts +1 -2
- package/chip-field/chip-field.d.ts.map +1 -1
- package/chip-field/chip-field.js +20 -16
- package/chip-field/chip-field.js.map +1 -1
- package/chip-field/chip-field.styles.d.ts.map +1 -1
- package/chip-field/chip-field.styles.js +10 -9
- package/chip-field/chip-field.styles.js.map +1 -1
- package/css/universal-material.css +2 -1
- package/css/universal-material.min.css +2 -2
- package/custom-elements.json +6070 -4616
- package/field/field-base.d.ts +52 -0
- package/field/field-base.d.ts.map +1 -0
- package/field/field-base.js +172 -0
- package/field/field-base.js.map +1 -0
- package/field/{field.styles.d.ts → field-base.styles.d.ts} +1 -1
- package/field/field-base.styles.d.ts.map +1 -0
- package/field/{field.styles.js → field-base.styles.js} +61 -61
- package/field/field-base.styles.js.map +1 -0
- package/field/field-defaults-context.d.ts +5 -0
- package/field/field-defaults-context.d.ts.map +1 -0
- package/field/field-defaults-context.js +3 -0
- package/field/field-defaults-context.js.map +1 -0
- package/field/field-defaults.d.ts +5 -0
- package/field/field-defaults.d.ts.map +1 -0
- package/field/field-defaults.js +2 -0
- package/field/field-defaults.js.map +1 -0
- package/field/field-variant.d.ts +2 -0
- package/field/field-variant.d.ts.map +1 -0
- package/field/field-variant.js +2 -0
- package/field/field-variant.js.map +1 -0
- package/field/field.d.ts +3 -47
- package/field/field.d.ts.map +1 -1
- package/field/field.js +6 -146
- package/field/field.js.map +1 -1
- package/menu/menu-item.d.ts +6 -0
- package/menu/menu-item.d.ts.map +1 -1
- package/menu/menu-item.js +31 -0
- package/menu/menu-item.js.map +1 -1
- package/menu/menu-item.styles.d.ts.map +1 -1
- package/menu/menu-item.styles.js +7 -6
- package/menu/menu-item.styles.js.map +1 -1
- package/navigation/drawer-item.styles.d.ts.map +1 -1
- package/navigation/drawer-item.styles.js +5 -1
- package/navigation/drawer-item.styles.js.map +1 -1
- package/package.json +3 -2
- package/scss/layout/_container.scss +1 -0
- package/shared/base.styles.d.ts.map +1 -1
- package/shared/base.styles.js +5 -1
- package/shared/base.styles.js.map +1 -1
- package/shared/button-wrapper.d.ts +1 -1
- package/shared/button-wrapper.d.ts.map +1 -1
- package/shared/button-wrapper.js.map +1 -1
- package/shared/text-field-base/text-field-base.d.ts +3 -15
- package/shared/text-field-base/text-field-base.d.ts.map +1 -1
- package/shared/text-field-base/text-field-base.js +6 -66
- package/shared/text-field-base/text-field-base.js.map +1 -1
- package/text-field/text-field.d.ts +1 -2
- package/text-field/text-field.d.ts.map +1 -1
- package/text-field/text-field.js +3 -4
- package/text-field/text-field.js.map +1 -1
- package/typeahead/typeahead.d.ts +5 -0
- package/typeahead/typeahead.d.ts.map +1 -1
- package/typeahead/typeahead.js +46 -3
- package/typeahead/typeahead.js.map +1 -1
- package/typeahead/typeahead.styles.js +1 -1
- package/typeahead/typeahead.styles.js.map +1 -1
- package/field/field.styles.d.ts.map +0 -1
- package/field/field.styles.js.map +0 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Context, ContextProvider } from '@lit/context';
|
|
2
|
+
import { PropertyValues } from '@lit/reactive-element';
|
|
3
|
+
import { CSSResultGroup } from '@lit/reactive-element/css-tag';
|
|
4
|
+
import { HTMLTemplateResult, LitElement } from 'lit';
|
|
5
|
+
import { UmFieldDefaults } from './field-defaults.js';
|
|
6
|
+
export declare abstract class UmFieldBase extends LitElement {
|
|
7
|
+
static styles: CSSResultGroup;
|
|
8
|
+
private config;
|
|
9
|
+
variant: 'filled' | 'outlined' | undefined;
|
|
10
|
+
label: string | undefined;
|
|
11
|
+
counter: string | undefined;
|
|
12
|
+
supportingText: string | undefined;
|
|
13
|
+
errorText: string | undefined;
|
|
14
|
+
empty: boolean;
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
invalid: boolean;
|
|
17
|
+
static setDefaults(contextRoot: HTMLElement, config: UmFieldDefaults): ContextProvider<Context<HTMLElement, UmFieldDefaults>>;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the field has a leading icon or not
|
|
20
|
+
*
|
|
21
|
+
* _Note:_ Readonly
|
|
22
|
+
*/
|
|
23
|
+
hasLeadingIcon: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the field has a trailing icon or not
|
|
26
|
+
*
|
|
27
|
+
* _Note:_ Readonly
|
|
28
|
+
*/
|
|
29
|
+
hasTrailingIcon: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the field has an error text or not
|
|
32
|
+
*
|
|
33
|
+
* _Note:_ Readonly
|
|
34
|
+
*/
|
|
35
|
+
hasErrorText: boolean;
|
|
36
|
+
private readonly assignedLeadingIcons;
|
|
37
|
+
private readonly assignedTrailingIcons;
|
|
38
|
+
private readonly assignedErrorTexts;
|
|
39
|
+
labelElement: HTMLElement;
|
|
40
|
+
container: HTMLElement;
|
|
41
|
+
private labelSizeObserver;
|
|
42
|
+
constructor();
|
|
43
|
+
protected render(): HTMLTemplateResult;
|
|
44
|
+
protected abstract renderControl(): HTMLTemplateResult;
|
|
45
|
+
firstUpdated(changedProperties: PropertyValues): void;
|
|
46
|
+
disconnectedCallback(): void;
|
|
47
|
+
private handleLeadingIconSlotChange;
|
|
48
|
+
private handleTrailingIconSlotChange;
|
|
49
|
+
private handleErrorTextSlotChange;
|
|
50
|
+
private setLabelWidthProperties;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=field-base.d.ts.map
|
|
@@ -0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A+B;;cAOrC,MAAM,IAAI,kBAAkB;IAuC/C,SAAS,CAAC,QAAQ,CAAC,aAAa,IAAI,kBAAkB;IAE7C,YAAY,CAAC,iBAAiB,EAAE,cAAc;IAS9C,oBAAoB;IAO7B,OAAO,CAAC,2BAA2B;IASnC,OAAO,CAAC,4BAA4B;IAIpC,OAAO,CAAC,yBAAyB;IAIjC,OAAO,CAAC,uBAAuB;CAWhC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { consume, ContextProvider } from '@lit/context';
|
|
8
|
+
import { html, LitElement } from 'lit';
|
|
9
|
+
import { property, query, queryAssignedElements, state } from 'lit/decorators.js';
|
|
10
|
+
import { styles as baseStyles } from '../shared/base.styles.js';
|
|
11
|
+
import { styles } from './field-base.styles.js';
|
|
12
|
+
import { fieldDefaultsContext } from './field-defaults-context.js';
|
|
13
|
+
export class UmFieldBase extends LitElement {
|
|
14
|
+
static setDefaults(contextRoot, config) {
|
|
15
|
+
return new ContextProvider(contextRoot, {
|
|
16
|
+
context: fieldDefaultsContext,
|
|
17
|
+
initialValue: config
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
this.variant = 'filled';
|
|
23
|
+
this.empty = false;
|
|
24
|
+
this.disabled = false;
|
|
25
|
+
this.invalid = false;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the field has a leading icon or not
|
|
28
|
+
*
|
|
29
|
+
* _Note:_ Readonly
|
|
30
|
+
*/
|
|
31
|
+
this.hasLeadingIcon = false;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the field has a trailing icon or not
|
|
34
|
+
*
|
|
35
|
+
* _Note:_ Readonly
|
|
36
|
+
*/
|
|
37
|
+
this.hasTrailingIcon = false;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the field has an error text or not
|
|
40
|
+
*
|
|
41
|
+
* _Note:_ Readonly
|
|
42
|
+
*/
|
|
43
|
+
this.hasErrorText = false;
|
|
44
|
+
this.labelSizeObserver = null;
|
|
45
|
+
this.variant = undefined;
|
|
46
|
+
}
|
|
47
|
+
render() {
|
|
48
|
+
return html `
|
|
49
|
+
<div class="container ${this.variant ?? this.config?.variant ?? 'filled'}">
|
|
50
|
+
<slot
|
|
51
|
+
class="icon leading-icon"
|
|
52
|
+
name="leading-icon"
|
|
53
|
+
@slotchange="${this.handleLeadingIconSlotChange}">
|
|
54
|
+
</slot>
|
|
55
|
+
<label class="label" slot="label" id="label">
|
|
56
|
+
<slot name="label">${this.label}</slot>
|
|
57
|
+
</label>
|
|
58
|
+
<div class="input-wrapper" part="wrapper">
|
|
59
|
+
<slot name="prefix"></slot>
|
|
60
|
+
<div class="input">${this.renderControl()}</div>
|
|
61
|
+
<slot name="suffix"></slot>
|
|
62
|
+
</div>
|
|
63
|
+
<slot
|
|
64
|
+
class="icon trailing-icon"
|
|
65
|
+
name="trailing-icon"
|
|
66
|
+
@slotchange="${this.handleTrailingIconSlotChange}">
|
|
67
|
+
</slot>
|
|
68
|
+
</div>
|
|
69
|
+
<div class="supporting-text" id="supporting-text">
|
|
70
|
+
<slot
|
|
71
|
+
class="error-text"
|
|
72
|
+
name="error-text"
|
|
73
|
+
@slotchange="${this.handleErrorTextSlotChange}">
|
|
74
|
+
<div>${this.errorText}</div>
|
|
75
|
+
</slot>
|
|
76
|
+
<slot name="supporting-text" id="supporting-text">
|
|
77
|
+
<div>${this.supportingText}</div>
|
|
78
|
+
</slot>
|
|
79
|
+
<slot class="counter" name="counter">
|
|
80
|
+
<div>${this.counter}</div>
|
|
81
|
+
</slot>
|
|
82
|
+
</div>
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
firstUpdated(changedProperties) {
|
|
86
|
+
super.firstUpdated(changedProperties);
|
|
87
|
+
this.hasLeadingIcon = !!this.assignedLeadingIcons.length;
|
|
88
|
+
this.labelSizeObserver = new ResizeObserver(() => this.setLabelWidthProperties());
|
|
89
|
+
this.labelSizeObserver.observe(this.labelElement);
|
|
90
|
+
this.setLabelWidthProperties();
|
|
91
|
+
}
|
|
92
|
+
disconnectedCallback() {
|
|
93
|
+
super.disconnectedCallback();
|
|
94
|
+
this.labelSizeObserver.disconnect();
|
|
95
|
+
this.labelSizeObserver = null;
|
|
96
|
+
}
|
|
97
|
+
handleLeadingIconSlotChange() {
|
|
98
|
+
this.labelElement.style.transition = 'none';
|
|
99
|
+
this.hasLeadingIcon = this.assignedLeadingIcons.length > 0;
|
|
100
|
+
setTimeout(() => {
|
|
101
|
+
this.labelElement.style.transition = '';
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
handleTrailingIconSlotChange() {
|
|
105
|
+
this.hasTrailingIcon = this.assignedTrailingIcons.length > 0;
|
|
106
|
+
}
|
|
107
|
+
handleErrorTextSlotChange() {
|
|
108
|
+
this.hasErrorText = this.assignedErrorTexts.length > 0;
|
|
109
|
+
}
|
|
110
|
+
setLabelWidthProperties() {
|
|
111
|
+
const width = this.labelElement.offsetWidth;
|
|
112
|
+
this.style.setProperty('--u-field-label-width', `${width}px`);
|
|
113
|
+
this.style.setProperty('--u-field-label-half-width', `${width / 2}px`);
|
|
114
|
+
if (!width) {
|
|
115
|
+
this.container.classList.add('no-label');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
UmFieldBase.styles = [baseStyles, styles];
|
|
120
|
+
__decorate([
|
|
121
|
+
consume({ context: fieldDefaultsContext, subscribe: true }),
|
|
122
|
+
state()
|
|
123
|
+
], UmFieldBase.prototype, "config", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
property()
|
|
126
|
+
], UmFieldBase.prototype, "variant", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
property()
|
|
129
|
+
], UmFieldBase.prototype, "label", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
property()
|
|
132
|
+
], UmFieldBase.prototype, "counter", void 0);
|
|
133
|
+
__decorate([
|
|
134
|
+
property({ attribute: 'supporting-text' })
|
|
135
|
+
], UmFieldBase.prototype, "supportingText", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
property({ attribute: 'error-text' })
|
|
138
|
+
], UmFieldBase.prototype, "errorText", void 0);
|
|
139
|
+
__decorate([
|
|
140
|
+
property({ type: Boolean, reflect: true })
|
|
141
|
+
], UmFieldBase.prototype, "empty", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
property({ type: Boolean, reflect: true })
|
|
144
|
+
], UmFieldBase.prototype, "disabled", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
property({ type: Boolean, reflect: true })
|
|
147
|
+
], UmFieldBase.prototype, "invalid", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
property({ type: Boolean, attribute: 'has-leading-icon', reflect: true })
|
|
150
|
+
], UmFieldBase.prototype, "hasLeadingIcon", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
property({ type: Boolean, attribute: 'has-trailing-icon', reflect: true })
|
|
153
|
+
], UmFieldBase.prototype, "hasTrailingIcon", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
property({ type: Boolean, attribute: 'has-error-text', reflect: true })
|
|
156
|
+
], UmFieldBase.prototype, "hasErrorText", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
queryAssignedElements({ slot: 'leading-icon', flatten: true })
|
|
159
|
+
], UmFieldBase.prototype, "assignedLeadingIcons", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
queryAssignedElements({ slot: 'trailing-icon', flatten: true })
|
|
162
|
+
], UmFieldBase.prototype, "assignedTrailingIcons", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
queryAssignedElements({ slot: 'error-text', flatten: true })
|
|
165
|
+
], UmFieldBase.prototype, "assignedErrorTexts", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
query('.label')
|
|
168
|
+
], UmFieldBase.prototype, "labelElement", void 0);
|
|
169
|
+
__decorate([
|
|
170
|
+
query('.container')
|
|
171
|
+
], UmFieldBase.prototype, "container", void 0);
|
|
172
|
+
//# sourceMappingURL=field-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-base.js","sourceRoot":"","sources":["../../src/field/field-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAW,eAAe,EAAE,MAAM,cAAc,CAAC;AAGjE,OAAO,EAAE,IAAI,EAAsB,UAAU,EAAE,MAAM,KAAK,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAElF,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGnE,MAAM,OAAgB,WAAY,SAAQ,UAAU;IAkBlD,MAAM,CAAC,WAAW,CAAC,WAAwB,EAAE,MAAuB;QAClE,OAAO,IAAI,eAAe,CAAC,WAAW,EAAE;YACtC,OAAO,EAAE,oBAAoB;YAC7B,YAAY,EAAE,MAAM;SACrB,CAAC,CAAC;IACL,CAAC;IAqCD;QACE,KAAK,EAAE,CAAC;QAtDE,YAAO,GAAsC,QAAQ,CAAC;QAOxB,UAAK,GAAG,KAAK,CAAC;QACd,aAAQ,GAAG,KAAK,CAAC;QACjB,YAAO,G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ApC,QAAQ,CAAC,EAAC,SAAS,EAAE,YAAY,EAAC,CAAC;8CAA+B;AAEzB;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;0CAAe;AACd;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;6CAAkB;AACjB;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;4CAAiB;AAce;IAAxE,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;mDAAwB;AAOtB;IAAzE,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;oDAAyB;AAO3B;IAAtE,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;iDAAsB;AAG3E;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;yDACP;AAGrC;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;0DACP;AAGtC;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;uDACP;AAEnC;IAAhB,KAAK,CAAC,QAAQ,CAAC;iDAA4B;AACvB;IAApB,KAAK,CAAC,YAAY,CAAC;8CAAyB","sourcesContent":["import { consume, Context, ContextProvider } from '@lit/context';\nimport { PropertyValues } from '@lit/reactive-element';\nimport { CSSResultGroup } from '@lit/reactive-element/css-tag';\nimport { html, HTMLTemplateResult, LitElement } from 'lit';\nimport { property, query, queryAssignedElements, state } from 'lit/decorators.js';\n\nimport { styles as baseStyles } from '../shared/base.styles.js';\nimport { styles } from './field-base.styles.js';\n\nimport { fieldDefaultsContext } from './field-defaults-context.js';\nimport { UmFieldDefaults } from './field-defaults.js';\n\nexport abstract class UmFieldBase extends LitElement {\n static override styles: CSSResultGroup = [baseStyles, styles];\n\n @consume({context: fieldDefaultsContext, subscribe: true})\n @state()\n private config: UmFieldDefaults | undefined;\n\n @property() variant: 'filled' | 'outlined' | undefined = 'filled';\n\n @property() label: string | undefined;\n @property() counter: string | undefined;\n @property({attribute: 'supporting-text'}) supportingText: string | undefined;\n @property({attribute: 'error-text'}) errorText: string | undefined;\n\n @property({type: Boolean, reflect: true}) empty = false;\n @property({type: Boolean, reflect: true}) disabled = false;\n @property({type: Boolean, reflect: true}) invalid = false;\n\n static setDefaults(contextRoot: HTMLElement, config: UmFieldDefaults): ContextProvider<Context<HTMLElement, UmFieldDefaults>> {\n return new ContextProvider(contextRoot, {\n context: fieldDefaultsContext,\n initialValue: config\n });\n }\n\n /**\n * Whether the field has a leading icon or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-leading-icon', reflect: true}) hasLeadingIcon = false;\n\n /**\n * Whether the field has a trailing icon or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-trailing-icon', reflect: true}) hasTrailingIcon = false;\n\n /**\n * Whether the field has an error text or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-error-text', reflect: true}) hasErrorText = false;\n\n @queryAssignedElements({slot: 'leading-icon', flatten: true})\n private readonly assignedLeadingIcons!: HTMLElement[];\n\n @queryAssignedElements({slot: 'trailing-icon', flatten: true})\n private readonly assignedTrailingIcons!: HTMLElement[];\n\n @queryAssignedElements({slot: 'error-text', flatten: true})\n private readonly assignedErrorTexts!: HTMLElement[];\n\n @query('.label') labelElement!: HTMLElement;\n @query('.container') container!: HTMLElement;\n\n private labelSizeObserver: ResizeObserver | null = null;\n\n constructor() {\n super();\n this.variant = undefined;\n }\n\n protected override render(): HTMLTemplateResult {\n return html`\n <div class=\"container ${this.variant ?? this.config?.variant ?? 'filled'}\">\n <slot\n class=\"icon leading-icon\"\n name=\"leading-icon\"\n @slotchange=\"${this.handleLeadingIconSlotChange}\">\n </slot>\n <label class=\"label\" slot=\"label\" id=\"label\">\n <slot name=\"label\">${this.label}</slot>\n </label>\n <div class=\"input-wrapper\" part=\"wrapper\">\n <slot name=\"prefix\"></slot>\n <div class=\"input\">${this.renderControl()}</div>\n <slot name=\"suffix\"></slot>\n </div>\n <slot\n class=\"icon trailing-icon\"\n name=\"trailing-icon\"\n @slotchange=\"${this.handleTrailingIconSlotChange}\">\n </slot>\n </div>\n <div class=\"supporting-text\" id=\"supporting-text\">\n <slot\n class=\"error-text\"\n name=\"error-text\"\n @slotchange=\"${this.handleErrorTextSlotChange}\">\n <div>${this.errorText}</div>\n </slot>\n <slot name=\"supporting-text\" id=\"supporting-text\">\n <div>${this.supportingText}</div>\n </slot>\n <slot class=\"counter\" name=\"counter\">\n <div>${this.counter}</div>\n </slot>\n </div>\n `;\n }\n\n protected abstract renderControl(): HTMLTemplateResult;\n\n override firstUpdated(changedProperties: PropertyValues) {\n super.firstUpdated(changedProperties);\n this.hasLeadingIcon = !!this.assignedLeadingIcons.length;\n\n this.labelSizeObserver = new ResizeObserver(() => this.setLabelWidthProperties())\n this.labelSizeObserver.observe(this.labelElement);\n this.setLabelWidthProperties();\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n\n this.labelSizeObserver!.disconnect();\n this.labelSizeObserver = null;\n }\n\n private handleLeadingIconSlotChange() {\n this.labelElement.style.transition = 'none';\n this.hasLeadingIcon = this.assignedLeadingIcons.length > 0;\n\n setTimeout(() => {\n this.labelElement.style.transition = '';\n });\n }\n\n private handleTrailingIconSlotChange() {\n this.hasTrailingIcon = this.assignedTrailingIcons.length > 0;\n }\n\n private handleErrorTextSlotChange() {\n this.hasErrorText = this.assignedErrorTexts.length > 0;\n }\n\n private setLabelWidthProperties() {\n\n const width = this.labelElement.offsetWidth;\n\n this.style.setProperty('--u-field-label-width', `${width}px`);\n this.style.setProperty('--u-field-label-half-width', `${width / 2}px`);\n\n if (!width) {\n this.container.classList.add('no-label');\n }\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const styles: import("lit").CSSResult;
|
|
2
|
-
//# sourceMappingURL=field.styles.d.ts.map
|
|
2
|
+
//# sourceMappingURL=field-base.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-base.styles.d.ts","sourceRoot":"","sources":["../../src/field/field-base.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAgTlB,CAAC"}
|
|
@@ -28,12 +28,12 @@ export const styles = css `
|
|
|
28
28
|
--u-text-field-horizontal-padding: 12px;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.
|
|
31
|
+
.container {
|
|
32
32
|
display: flex;
|
|
33
33
|
align-items: center;
|
|
34
34
|
position: relative;
|
|
35
35
|
}
|
|
36
|
-
.
|
|
36
|
+
.container::before, .container::after {
|
|
37
37
|
content: "";
|
|
38
38
|
position: absolute;
|
|
39
39
|
top: 0;
|
|
@@ -43,21 +43,21 @@ export const styles = css `
|
|
|
43
43
|
box-sizing: border-box;
|
|
44
44
|
pointer-events: none;
|
|
45
45
|
}
|
|
46
|
-
.
|
|
46
|
+
.container::before {
|
|
47
47
|
background: var(--u-color-on-surface, rgb(29, 27, 32));
|
|
48
48
|
transition: opacity 150ms;
|
|
49
49
|
opacity: 0;
|
|
50
50
|
}
|
|
51
|
-
.
|
|
51
|
+
.container::after {
|
|
52
52
|
border-width: var(--u-field-border-width, 1px);
|
|
53
53
|
border-color: var(--u-field-border-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
@media (hover: hover) {
|
|
57
|
-
:host(
|
|
57
|
+
:host(:not([disabled]):not([invalid]):hover) .container.filled::before {
|
|
58
58
|
opacity: var(--u-state-hover-opacity, 0.08);
|
|
59
59
|
}
|
|
60
|
-
:host(:not([disabled]):not([invalid]):not(:focus-within):hover) .
|
|
60
|
+
:host(:not([disabled]):not([invalid]):not(:focus-within):hover) .container::after {
|
|
61
61
|
border-color: var(--u-field-hover-border-color, var(--u-color-on-surface, rgb(29, 27, 32)));
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -111,11 +111,13 @@ export const styles = css `
|
|
|
111
111
|
|
|
112
112
|
.input {
|
|
113
113
|
color: var(--u-field-input-text-color, var(--u-color-on-surface, rgb(29, 27, 32)));
|
|
114
|
+
flex: 1;
|
|
114
115
|
}
|
|
115
116
|
.input:focus {
|
|
116
117
|
outline: 0;
|
|
117
118
|
}
|
|
118
|
-
.input
|
|
119
|
+
.input input,
|
|
120
|
+
.input ::slotted(*) {
|
|
119
121
|
font-family: var(--u-font-family, var(--u-font-family, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"));
|
|
120
122
|
line-height: var(--u-field-control-line-height, var(--u-body-l-line-height, 1.5rem));
|
|
121
123
|
font-size: var(--u-field-control-font-size, var(--u-body-l-font-size, 1rem));
|
|
@@ -132,10 +134,12 @@ export const styles = css `
|
|
|
132
134
|
border: none;
|
|
133
135
|
outline: 0 !important;
|
|
134
136
|
}
|
|
135
|
-
.input,
|
|
137
|
+
.input,
|
|
138
|
+
.input ::slotted(select),
|
|
139
|
+
.input ::slotted(:is(input, textarea))::placeholder {
|
|
136
140
|
transition: color 150ms 100ms;
|
|
137
141
|
}
|
|
138
|
-
.input::slotted(:is(input, textarea))::placeholder {
|
|
142
|
+
.input ::slotted(:is(input, textarea))::placeholder {
|
|
139
143
|
color: var(--_field-placeholder-color);
|
|
140
144
|
}
|
|
141
145
|
|
|
@@ -150,9 +154,10 @@ export const styles = css `
|
|
|
150
154
|
padding-inline: 16px;
|
|
151
155
|
gap: 16px;
|
|
152
156
|
}
|
|
153
|
-
.supporting-text
|
|
154
|
-
display:
|
|
157
|
+
.supporting-text div:empty {
|
|
158
|
+
display: none;
|
|
155
159
|
}
|
|
160
|
+
.supporting-text div,
|
|
156
161
|
.supporting-text ::slotted(*) {
|
|
157
162
|
display: inline-block;
|
|
158
163
|
margin-top: 4px;
|
|
@@ -162,15 +167,10 @@ export const styles = css `
|
|
|
162
167
|
display: none;
|
|
163
168
|
}
|
|
164
169
|
|
|
165
|
-
.counter {
|
|
166
|
-
display: none;
|
|
170
|
+
.counter div, .counter::slotted(*) {
|
|
167
171
|
margin-inline-start: auto;
|
|
168
172
|
}
|
|
169
173
|
|
|
170
|
-
:host([has-counter]) .counter {
|
|
171
|
-
display: block;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
174
|
:host([has-leading-icon]) {
|
|
175
175
|
--_field-control-leading-padding: calc(var(--_icon-padding) + var(--_icon-size) + var(--_field-control-inline-padding)) ;
|
|
176
176
|
}
|
|
@@ -186,14 +186,14 @@ export const styles = css `
|
|
|
186
186
|
:host(:focus-within) {
|
|
187
187
|
--u-field-border-width: var(--_focus-border-width);
|
|
188
188
|
}
|
|
189
|
-
:host(:focus-within) .
|
|
189
|
+
:host(:focus-within) .container::after {
|
|
190
190
|
border-color: var(--u-field-focused-border-color, var(--_color-primary));
|
|
191
191
|
}
|
|
192
192
|
:host(:focus-within) .label {
|
|
193
193
|
color: var(--u-field-label-focused-color, var(--_color-primary));
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
:host([invalid]) .
|
|
196
|
+
:host([invalid]) .container::after {
|
|
197
197
|
border-color: var(--u-field-error-border-color, var(--_color-error));
|
|
198
198
|
}
|
|
199
199
|
:host([invalid]) .label {
|
|
@@ -209,75 +209,50 @@ export const styles = css `
|
|
|
209
209
|
color: var(--u-field-leading-icon-error-color, var(--_icon-color));
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
:host([invalid]) .supporting-text:has(.error-text div:not(:empty)) .error-text,
|
|
212
213
|
:host([invalid][has-error-text]) .error-text {
|
|
213
|
-
display:
|
|
214
|
+
display: contents;
|
|
214
215
|
}
|
|
215
|
-
:host([invalid]
|
|
216
|
+
:host([invalid]) .supporting-text:has(.error-text div:not(:empty)) slot[name=supporting-text],
|
|
217
|
+
:host([invalid][has-error-text]) slot[name=supporting-text] {
|
|
216
218
|
display: none;
|
|
217
219
|
}
|
|
218
220
|
|
|
219
|
-
|
|
220
|
-
border-color: var(--u-field-disabled-border-color, var(--_disabled-color));
|
|
221
|
-
}
|
|
222
|
-
:host([disabled]) .supporting-text {
|
|
223
|
-
color: var(--u-field-supporting-text-disabled-color, var(--_disabled-color));
|
|
224
|
-
}
|
|
225
|
-
:host([disabled]) .label {
|
|
226
|
-
color: var(--u-field-label-disabled-color, var(--_disabled-color));
|
|
227
|
-
}
|
|
228
|
-
:host([disabled]) .input::slotted(*) {
|
|
229
|
-
color: var(--u-field-input-disabled-color, var(--_disabled-color));
|
|
230
|
-
}
|
|
231
|
-
:host([disabled]) .input::slotted(:is(input, textarea))::placeholder {
|
|
232
|
-
color: var(--u-field-input-disabled-color, var(--_disabled-color));
|
|
233
|
-
}
|
|
234
|
-
:host([disabled]) .trailing-icon {
|
|
235
|
-
color: var(--u-field-trailing-icon-disabled-color, var(--_disabled-color));
|
|
236
|
-
}
|
|
237
|
-
:host([disabled]) .leading-icon {
|
|
238
|
-
color: var(--u-field-leading-icon-disabled-color, var(--_disabled-color));
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
:host([variant=filled]) .field {
|
|
221
|
+
.container.filled {
|
|
242
222
|
border-radius: var(--u-field-filled-border-radius, 4px 4px 0 0);
|
|
243
223
|
background-color: var(--u-color-surface-container-highest, rgb(230, 224, 233));
|
|
244
224
|
}
|
|
245
|
-
|
|
225
|
+
.container.filled::after {
|
|
246
226
|
border-bottom-style: solid;
|
|
247
227
|
}
|
|
248
|
-
|
|
228
|
+
.container.filled:not(.no-label) .input-wrapper {
|
|
249
229
|
padding-top: calc(var(--_vertical-padding) + var(--_label-line-height));
|
|
250
230
|
padding-bottom: var(--_vertical-padding);
|
|
251
231
|
}
|
|
252
|
-
|
|
232
|
+
.container.filled .label {
|
|
253
233
|
top: var(--_vertical-padding);
|
|
254
234
|
}
|
|
255
|
-
|
|
235
|
+
.container.filled .input ::slotted(:is(input, textarea, select, button)) {
|
|
256
236
|
display: block;
|
|
257
237
|
}
|
|
258
|
-
|
|
259
|
-
:host([variant=filled][disabled]) .field {
|
|
260
|
-
background-color: var(--u-filled-field-disabled-background-color, rgba(var(--u-color-on-surface-rgb, 29, 27, 32), var(--u-filled-field-background-disabled-opacity, 0.04)));
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
:host([variant=outlined]) .field::after {
|
|
238
|
+
.container.outlined::after {
|
|
264
239
|
--_mid-point: calc(var(--u-field-label-half-width) + var(--_outlined-label-margin) + var(--_outlined-label-padding));
|
|
265
240
|
border-radius: var(--u-outlined-field-shape-corder, var(--u-shape-corner-small, 8px));
|
|
266
241
|
border-style: solid;
|
|
267
242
|
clip-path: polygon(0 0, var(--_mid-point) 0, var(--_mid-point) var(--_focus-border-width), var(--_mid-point) var(--_focus-border-width), var(--_mid-point) 0, 100% 0, 100% 100%, 0 100%);
|
|
268
243
|
transition: clip-path 100ms;
|
|
269
244
|
}
|
|
270
|
-
|
|
245
|
+
.container.outlined .label {
|
|
271
246
|
top: calc(var(--_label-line-height) / -2);
|
|
272
247
|
}
|
|
273
248
|
|
|
274
|
-
|
|
275
|
-
:host(
|
|
249
|
+
.container.outlined:focus-within::after,
|
|
250
|
+
:host(:not([empty])) .container.outlined::after {
|
|
276
251
|
--_end-point: calc(var(--u-field-label-width) + var(--_outlined-label-margin) + (var(--_outlined-label-padding) * 2));
|
|
277
252
|
clip-path: polygon(0 0, var(--_outlined-label-margin) 0, var(--_outlined-label-margin) var(--_focus-border-width), var(--_end-point) var(--_focus-border-width), var(--_end-point) 0, 100% 0, 100% 100%, 0 100%);
|
|
278
253
|
}
|
|
279
|
-
|
|
280
|
-
:host(
|
|
254
|
+
.container.outlined:focus-within .label,
|
|
255
|
+
:host(:not([empty])) .container.outlined .label {
|
|
281
256
|
inset-inline-start: calc(var(--_outlined-label-margin) + var(--_outlined-label-padding));
|
|
282
257
|
}
|
|
283
258
|
|
|
@@ -300,8 +275,33 @@ export const styles = css `
|
|
|
300
275
|
transition: color 150ms;
|
|
301
276
|
}
|
|
302
277
|
|
|
303
|
-
.
|
|
278
|
+
.container.no-label::after {
|
|
304
279
|
clip-path: none !important;
|
|
305
280
|
}
|
|
281
|
+
|
|
282
|
+
:host([disabled]) .container .filled {
|
|
283
|
+
background-color: var(--u-filled-field-disabled-background-color, rgba(var(--u-color-on-surface-rgb, 29, 27, 32), var(--u-filled-field-background-disabled-opacity, 0.04)));
|
|
284
|
+
}
|
|
285
|
+
:host([disabled]) .container::after {
|
|
286
|
+
border-color: var(--u-field-disabled-border-color, var(--_disabled-color));
|
|
287
|
+
}
|
|
288
|
+
:host([disabled]) .supporting-text {
|
|
289
|
+
color: var(--u-field-supporting-text-disabled-color, var(--_disabled-color));
|
|
290
|
+
}
|
|
291
|
+
:host([disabled]) .label {
|
|
292
|
+
color: var(--u-field-label-disabled-color, var(--_disabled-color));
|
|
293
|
+
}
|
|
294
|
+
:host([disabled]) .input ::slotted(*) {
|
|
295
|
+
color: var(--u-field-input-disabled-color, var(--_disabled-color));
|
|
296
|
+
}
|
|
297
|
+
:host([disabled]) .input ::slotted(:is(input, textarea))::placeholder {
|
|
298
|
+
color: var(--u-field-input-disabled-color, var(--_disabled-color));
|
|
299
|
+
}
|
|
300
|
+
:host([disabled]) .trailing-icon {
|
|
301
|
+
color: var(--u-field-trailing-icon-disabled-color, var(--_disabled-color));
|
|
302
|
+
}
|
|
303
|
+
:host([disabled]) .leading-icon {
|
|
304
|
+
color: var(--u-field-leading-icon-disabled-color, var(--_disabled-color));
|
|
305
|
+
}
|
|
306
306
|
`;
|
|
307
|
-
//# sourceMappingURL=field.styles.js.map
|
|
307
|
+
//# sourceMappingURL=field-base.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-base.styles.js","sourceRoot":"","sources":["../../src/field/field-base.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgTzB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css `\n :host {\n --_control-line-height: var(--u-field-control-line-height, 1.5rem);\n --_label-line-height: var(--u-field-label-line-height, 1rem);\n --_field-icon-size: var(--u-field-icon-size, 1.5rem);\n --_field-control-padding: var(--u-field-control-padding, 16px);\n --_field-control-inline-padding: var(--u-field-control-inline-padding, var(--_field-control-padding));\n --_field-control-block-padding: var(--u-field-control-block-padding, var(--_field-control-padding));\n --_field-min-height: var(--u-field-min-height, 56px);\n --_field-placeholder-color: var(--u-field-placeholder-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));\n --_disabled-color: var(--u-field-disabled-color, rgba(var(--u-color-on-surface-rgb, 29, 27, 32), var(--u-field-disabled-opacity, .38)));\n --_disabled-background-color: var(--u-filled-field-disabled-background-color, rgba(var(--u-color-on-surface-rgb, ), var(--u-filled-field-background-disabled-opacity, .12)));\n --_color-primary: var(--u-color-primary, rgb(103, 80, 164));\n --_color-error: var(--u-field-error-color, var(--u-color-error, rgb(179, 38, 30)));\n --_active-indicator-opacity: 1;\n --_vertical-padding: var(--u-field-vertical-padding, 8px);\n --_icon-size: var(--u-field-icon-size, 1.5rem);\n --_icon-padding: var(--u-field-icon-padding, 12px);\n --_icon-color: var(--u-icon-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));\n --_focus-border-width: var(--u-text-field-focus-border-width, 2px);\n --_field-control-leading-padding: var(--_field-control-inline-padding);\n --_outlined-label-margin: var(--u-outlined-field-label-margin, 12px);\n --_outlined-label-padding: var(--u-outlined-field-label-padding, 4px);\n --u-label-input-start: auto;\n --u-label-input-span-leading-offset: 0;\n --u-label-input-span-trailing-offset: 0;\n --u-text-field-horizontal-padding: 12px;\n }\n\n .container {\n display: flex;\n align-items: center;\n position: relative;\n }\n .container::before, .container::after {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n pointer-events: none;\n }\n .container::before {\n background: var(--u-color-on-surface, rgb(29, 27, 32));\n transition: opacity 150ms;\n opacity: 0;\n }\n .container::after {\n border-width: var(--u-field-border-width, 1px);\n border-color: var(--u-field-border-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));\n }\n\n @media (hover: hover) {\n :host(:not([disabled]):not([invalid]):hover) .container.filled::before {\n opacity: var(--u-state-hover-opacity, 0.08);\n }\n :host(:not([disabled]):not([invalid]):not(:focus-within):hover) .container::after {\n border-color: var(--u-field-hover-border-color, var(--u-color-on-surface, rgb(29, 27, 32)));\n }\n }\n .icon {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: var(--_icon-size);\n color: var(--_icon-color);\n font-size: var(--_icon-size);\n line-height: var(--_icon-size);\n }\n .icon::slotted(*) {\n flex-shrink: 0;\n }\n\n .leading-icon {\n margin-inline-start: var(--_icon-padding);\n }\n\n .trailing-icon {\n margin-inline-end: var(--_icon-padding);\n }\n\n .label {\n font-family: var(--u-font-family, var(--u-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", \"Liberation Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"));\n line-height: var(--u-field-label-line-height, var(--u-body-l-line-height, 1.5rem));\n font-size: var(--u-field-label-font-size, var(--u-body-l-font-size, 1rem));\n letter-spacing: var(--u-field-label-letter-spacing, var(--u-body-l-letter-spacing, 0.03125rem));\n font-weight: var(--u-field-label-font-weight, var(--u-body-l-font-weight, var(--u-font-weight-regular, 400)));\n font-size: var(--u-field-label-font-size, var(--u-body-s-font-size, 0.75rem));\n display: block;\n position: absolute;\n inset-inline-start: var(--_field-control-leading-padding);\n margin-bottom: 0;\n line-height: var(--_label-line-height);\n color: var(--u-field-label-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));\n transition: inset 200ms, font-size 200ms;\n }\n\n .input-wrapper {\n display: flex;\n align-items: center;\n flex: 1;\n padding-block: var(--_vertical-padding);\n padding-inline: var(--_field-control-inline-padding);\n min-height: var(--_field-min-height);\n transition: opacity 150ms;\n }\n\n .input {\n color: var(--u-field-input-text-color, var(--u-color-on-surface, rgb(29, 27, 32)));\n flex: 1;\n }\n .input:focus {\n outline: 0;\n }\n .input input,\n .input ::slotted(*) {\n font-family: var(--u-font-family, var(--u-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", \"Liberation Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"));\n line-height: var(--u-field-control-line-height, var(--u-body-l-line-height, 1.5rem));\n font-size: var(--u-field-control-font-size, var(--u-body-l-font-size, 1rem));\n letter-spacing: var(--u-field-control-letter-spacing, var(--u-body-l-letter-spacing, 0.03125rem));\n font-weight: var(--u-field-control-font-weight, var(--u-body-l-font-weight, var(--u-font-weight-regular, 400)));\n width: 100%;\n color: var(--u-field-input-text-color, var(--u-color-on-surface, rgb(29, 27, 32)));\n min-height: var(--_control-line-height);\n line-height: var(--_control-line-height);\n padding: 0;\n margin: 0;\n appearance: none;\n background: transparent;\n border: none;\n outline: 0 !important;\n }\n .input,\n .input ::slotted(select),\n .input ::slotted(:is(input, textarea))::placeholder {\n transition: color 150ms 100ms;\n }\n .input ::slotted(:is(input, textarea))::placeholder {\n color: var(--_field-placeholder-color);\n }\n\n .supporting-text {\n font-family: var(--u-font-family, var(--u-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", \"Liberation Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"));\n line-height: var(--u-field-supporting-text-line-height, var(--u-body-s-line-height, 1rem));\n font-size: var(--u-field-supporting-text-font-size, var(--u-body-s-font-size, 0.75rem));\n letter-spacing: var(--u-field-supporting-text-letter-spacing, var(--u-body-s-letter-spacing, 0.0333333333rem));\n font-weight: var(--u-field-supporting-text-font-weight, var(--u-body-s-font-weight, var(--u-font-weight-regular, 400)));\n display: flex;\n color: var(--u-field-supporting-text, var(--u-color-on-surface-variant, rgb(73, 69, 79)));\n padding-inline: 16px;\n gap: 16px;\n }\n .supporting-text div:empty {\n display: none;\n }\n .supporting-text div,\n .supporting-text ::slotted(*) {\n display: inline-block;\n margin-top: 4px;\n }\n\n .error-text {\n display: none;\n }\n\n .counter div, .counter::slotted(*) {\n margin-inline-start: auto;\n }\n\n :host([has-leading-icon]) {\n --_field-control-leading-padding: calc(var(--_icon-padding) + var(--_icon-size) + var(--_field-control-inline-padding)) ;\n }\n\n :host(:not([has-leading-icon])) .leading-icon {\n display: none;\n }\n\n :host(:not([has-trailing-icon])) .trailing-icon {\n display: none;\n }\n\n :host(:focus-within) {\n --u-field-border-width: var(--_focus-border-width);\n }\n :host(:focus-within) .container::after {\n border-color: var(--u-field-focused-border-color, var(--_color-primary));\n }\n :host(:focus-within) .label {\n color: var(--u-field-label-focused-color, var(--_color-primary));\n }\n\n :host([invalid]) .container::after {\n border-color: var(--u-field-error-border-color, var(--_color-error));\n }\n :host([invalid]) .label {\n color: var(--u-field-label-error-color, var(--_color-error));\n }\n :host([invalid]) .supporting-text {\n color: var(--u-field-supporting-text-error-color, var(--_color-error));\n }\n :host([invalid]) .trailing-icon {\n color: var(--u-field-trailing-icon-error-color, var(--_color-error));\n }\n :host([invalid]) .leading-icon {\n color: var(--u-field-leading-icon-error-color, var(--_icon-color));\n }\n\n :host([invalid]) .supporting-text:has(.error-text div:not(:empty)) .error-text,\n :host([invalid][has-error-text]) .error-text {\n display: contents;\n }\n :host([invalid]) .supporting-text:has(.error-text div:not(:empty)) slot[name=supporting-text],\n :host([invalid][has-error-text]) slot[name=supporting-text] {\n display: none;\n }\n\n .container.filled {\n border-radius: var(--u-field-filled-border-radius, 4px 4px 0 0);\n background-color: var(--u-color-surface-container-highest, rgb(230, 224, 233));\n }\n .container.filled::after {\n border-bottom-style: solid;\n }\n .container.filled:not(.no-label) .input-wrapper {\n padding-top: calc(var(--_vertical-padding) + var(--_label-line-height));\n padding-bottom: var(--_vertical-padding);\n }\n .container.filled .label {\n top: var(--_vertical-padding);\n }\n .container.filled .input ::slotted(:is(input, textarea, select, button)) {\n display: block;\n }\n .container.outlined::after {\n --_mid-point: calc(var(--u-field-label-half-width) + var(--_outlined-label-margin) + var(--_outlined-label-padding));\n border-radius: var(--u-outlined-field-shape-corder, var(--u-shape-corner-small, 8px));\n border-style: solid;\n clip-path: polygon(0 0, var(--_mid-point) 0, var(--_mid-point) var(--_focus-border-width), var(--_mid-point) var(--_focus-border-width), var(--_mid-point) 0, 100% 0, 100% 100%, 0 100%);\n transition: clip-path 100ms;\n }\n .container.outlined .label {\n top: calc(var(--_label-line-height) / -2);\n }\n\n .container.outlined:focus-within::after,\n :host(:not([empty])) .container.outlined::after {\n --_end-point: calc(var(--u-field-label-width) + var(--_outlined-label-margin) + (var(--_outlined-label-padding) * 2));\n clip-path: polygon(0 0, var(--_outlined-label-margin) 0, var(--_outlined-label-margin) var(--_focus-border-width), var(--_end-point) var(--_focus-border-width), var(--_end-point) 0, 100% 0, 100% 100%, 0 100%);\n }\n .container.outlined:focus-within .label,\n :host(:not([empty])) .container.outlined .label {\n inset-inline-start: calc(var(--_outlined-label-margin) + var(--_outlined-label-padding));\n }\n\n :host([empty]) ::slotted(select) {\n color: var(--_field-placeholder-color);\n }\n\n :host([empty]:not(:focus-within)) .label {\n font-size: var(--u-field-label-font-size, var(--u-body-l-font-size, 1rem));\n pointer-events: none;\n top: calc(var(--_field-min-height) / 2 - var(--_label-line-height) / 2);\n }\n :host([empty]:not(:focus-within)) .input-wrapper {\n opacity: 0;\n }\n :host([empty]:not(:focus-within)) .input,\n :host([empty]:not(:focus-within)) ::slotted(:is(input, textarea))::placeholder,\n :host([empty]:not(:focus-within)) ::slotted(select) {\n color: transparent;\n transition: color 150ms;\n }\n\n .container.no-label::after {\n clip-path: none !important;\n }\n\n :host([disabled]) .container .filled {\n background-color: var(--u-filled-field-disabled-background-color, rgba(var(--u-color-on-surface-rgb, 29, 27, 32), var(--u-filled-field-background-disabled-opacity, 0.04)));\n }\n :host([disabled]) .container::after {\n border-color: var(--u-field-disabled-border-color, var(--_disabled-color));\n }\n :host([disabled]) .supporting-text {\n color: var(--u-field-supporting-text-disabled-color, var(--_disabled-color));\n }\n :host([disabled]) .label {\n color: var(--u-field-label-disabled-color, var(--_disabled-color));\n }\n :host([disabled]) .input ::slotted(*) {\n color: var(--u-field-input-disabled-color, var(--_disabled-color));\n }\n :host([disabled]) .input ::slotted(:is(input, textarea))::placeholder {\n color: var(--u-field-input-disabled-color, var(--_disabled-color));\n }\n :host([disabled]) .trailing-icon {\n color: var(--u-field-trailing-icon-disabled-color, var(--_disabled-color));\n }\n :host([disabled]) .leading-icon {\n color: var(--u-field-leading-icon-disabled-color, var(--_disabled-color));\n }\n`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-defaults-context.d.ts","sourceRoot":"","sources":["../../src/field/field-defaults-context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,eAAO,MAAM,oBAAoB;;CAA6D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-defaults-context.js","sourceRoot":"","sources":["../../src/field/field-defaults-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAkB,0BAA0B,CAAC,CAAC","sourcesContent":["import { createContext } from '@lit/context';\n\nimport { UmFieldDefaults } from './field-defaults.js';\n\nexport const fieldDefaultsContext = createContext<UmFieldDefaults>('u-field-defaults-context');\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-defaults.d.ts","sourceRoot":"","sources":["../../src/field/field-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,cAAc,CAAA;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-defaults.js","sourceRoot":"","sources":["../../src/field/field-defaults.ts"],"names":[],"mappings":"","sourcesContent":["import { UmFieldVariant } from './field-variant.js';\n\nexport interface UmFieldDefaults {\n variant: UmFieldVariant\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-variant.d.ts","sourceRoot":"","sources":["../../src/field/field-variant.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-variant.js","sourceRoot":"","sources":["../../src/field/field-variant.ts"],"names":[],"mappings":"","sourcesContent":["export type UmFieldVariant = 'filled' | 'outlined';\n"]}
|
package/field/field.d.ts
CHANGED
|
@@ -1,55 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare class UmField extends LitElement {
|
|
4
|
-
static styles: import("lit").CSSResult[];
|
|
5
|
-
variant: 'filled' | 'outlined';
|
|
6
|
-
empty: boolean;
|
|
1
|
+
import { UmFieldBase } from './field-base.js';
|
|
2
|
+
export declare class UmField extends UmFieldBase {
|
|
7
3
|
autoEmpty: boolean;
|
|
8
|
-
disabled: boolean;
|
|
9
|
-
invalid: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Whether the field has a leading icon or not
|
|
12
|
-
*
|
|
13
|
-
* _Note:_ Readonly
|
|
14
|
-
*/
|
|
15
|
-
hasLeadingIcon: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Whether the field has a trailing icon or not
|
|
18
|
-
*
|
|
19
|
-
* _Note:_ Readonly
|
|
20
|
-
*/
|
|
21
|
-
hasTrailingIcon: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Whether the field has an error text or not
|
|
24
|
-
*
|
|
25
|
-
* _Note:_ Readonly
|
|
26
|
-
*/
|
|
27
|
-
hasErrorText: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Whether the field has a counter or not
|
|
30
|
-
*
|
|
31
|
-
* _Note:_ Readonly
|
|
32
|
-
*/
|
|
33
|
-
hasCounter: boolean;
|
|
34
|
-
private readonly assignedLeadingIcons;
|
|
35
|
-
private readonly assignedTrailingIcons;
|
|
36
|
-
private readonly assignedErrorTexts;
|
|
37
|
-
private readonly assignedCounters;
|
|
38
|
-
counter: HTMLElement | undefined;
|
|
39
|
-
label: HTMLElement;
|
|
40
|
-
field: HTMLElement;
|
|
41
4
|
private control;
|
|
42
|
-
private labelSizeObserver;
|
|
43
|
-
protected render(): HTMLTemplateResult;
|
|
44
|
-
firstUpdated(changedProperties: PropertyValues): void;
|
|
45
5
|
connectedCallback(): void;
|
|
46
6
|
disconnectedCallback(): void;
|
|
47
7
|
private handleControlInput;
|
|
48
|
-
|
|
49
|
-
private handleTrailingIconSlotChange;
|
|
50
|
-
private handleErrorTextSlotChange;
|
|
51
|
-
private handleCounterSlotChange;
|
|
52
|
-
private setLabelWidthProperties;
|
|
8
|
+
protected renderControl(): import("lit-html").TemplateResult<1>;
|
|
53
9
|
}
|
|
54
10
|
declare global {
|
|
55
11
|
interface HTMLElementTagNameMap {
|