@vaadin/custom-field 24.8.4 → 25.0.0-alpha10
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/README.md +0 -23
- package/package.json +22 -22
- package/src/styles/vaadin-custom-field-base-styles.js +20 -0
- package/{theme/material/vaadin-custom-field.d.ts → src/styles/vaadin-custom-field-core-styles.d.ts} +3 -2
- package/src/vaadin-custom-field-mixin.js +3 -4
- package/src/vaadin-custom-field.d.ts +1 -11
- package/src/vaadin-custom-field.js +15 -10
- package/web-types.json +4 -4
- package/web-types.lit.json +3 -3
- package/src/vaadin-lit-custom-field.js +0 -67
- package/theme/lumo/vaadin-lit-custom-field.d.ts +0 -2
- package/theme/lumo/vaadin-lit-custom-field.js +0 -2
- package/theme/material/vaadin-custom-field-styles.d.ts +0 -9
- package/theme/material/vaadin-custom-field-styles.js +0 -51
- package/theme/material/vaadin-custom-field.js +0 -7
- package/theme/material/vaadin-lit-custom-field.d.ts +0 -2
- package/theme/material/vaadin-lit-custom-field.js +0 -2
- package/vaadin-lit-custom-field.d.ts +0 -1
- package/vaadin-lit-custom-field.js +0 -3
- /package/src/{vaadin-custom-field-styles.d.ts → styles/vaadin-custom-field-base-styles.d.ts} +0 -0
- /package/src/{vaadin-custom-field-styles.js → styles/vaadin-custom-field-core-styles.js} +0 -0
package/README.md
CHANGED
|
@@ -30,29 +30,6 @@ Once installed, import the component in your application:
|
|
|
30
30
|
import '@vaadin/custom-field';
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
## Themes
|
|
34
|
-
|
|
35
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
36
|
-
The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/custom-field/vaadin-custom-field.js) of the package uses the Lumo theme.
|
|
37
|
-
|
|
38
|
-
To use the Material theme, import the component from the `theme/material` folder:
|
|
39
|
-
|
|
40
|
-
```js
|
|
41
|
-
import '@vaadin/custom-field/theme/material/vaadin-custom-field.js';
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
You can also import the Lumo version of the component explicitly:
|
|
45
|
-
|
|
46
|
-
```js
|
|
47
|
-
import '@vaadin/custom-field/theme/lumo/vaadin-custom-field.js';
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
|
|
51
|
-
|
|
52
|
-
```js
|
|
53
|
-
import '@vaadin/custom-field/src/vaadin-custom-field.js';
|
|
54
|
-
```
|
|
55
|
-
|
|
56
33
|
## Contributing
|
|
57
34
|
|
|
58
35
|
Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/custom-field",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0-alpha10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
|
+
"!src/styles/*-base-styles.d.ts",
|
|
25
|
+
"!src/styles/*-base-styles.js",
|
|
24
26
|
"theme",
|
|
25
27
|
"vaadin-*.d.ts",
|
|
26
28
|
"vaadin-*.js",
|
|
@@ -35,34 +37,32 @@
|
|
|
35
37
|
],
|
|
36
38
|
"dependencies": {
|
|
37
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@
|
|
39
|
-
"@vaadin/
|
|
40
|
-
"@vaadin/
|
|
41
|
-
"@vaadin/
|
|
42
|
-
"@vaadin/vaadin-
|
|
43
|
-
"@vaadin/vaadin-material-styles": "~24.8.4",
|
|
44
|
-
"@vaadin/vaadin-themable-mixin": "~24.8.4",
|
|
40
|
+
"@vaadin/a11y-base": "25.0.0-alpha10",
|
|
41
|
+
"@vaadin/component-base": "25.0.0-alpha10",
|
|
42
|
+
"@vaadin/field-base": "25.0.0-alpha10",
|
|
43
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha10",
|
|
44
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha10",
|
|
45
45
|
"lit": "^3.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@vaadin/chai-plugins": "
|
|
49
|
-
"@vaadin/combo-box": "
|
|
50
|
-
"@vaadin/date-picker": "
|
|
51
|
-
"@vaadin/email-field": "
|
|
52
|
-
"@vaadin/form-layout": "
|
|
53
|
-
"@vaadin/number-field": "
|
|
54
|
-
"@vaadin/password-field": "
|
|
55
|
-
"@vaadin/select": "
|
|
56
|
-
"@vaadin/test-runner-commands": "
|
|
57
|
-
"@vaadin/testing-helpers": "^
|
|
58
|
-
"@vaadin/text-area": "
|
|
59
|
-
"@vaadin/text-field": "
|
|
60
|
-
"@vaadin/time-picker": "
|
|
48
|
+
"@vaadin/chai-plugins": "25.0.0-alpha10",
|
|
49
|
+
"@vaadin/combo-box": "25.0.0-alpha10",
|
|
50
|
+
"@vaadin/date-picker": "25.0.0-alpha10",
|
|
51
|
+
"@vaadin/email-field": "25.0.0-alpha10",
|
|
52
|
+
"@vaadin/form-layout": "25.0.0-alpha10",
|
|
53
|
+
"@vaadin/number-field": "25.0.0-alpha10",
|
|
54
|
+
"@vaadin/password-field": "25.0.0-alpha10",
|
|
55
|
+
"@vaadin/select": "25.0.0-alpha10",
|
|
56
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha10",
|
|
57
|
+
"@vaadin/testing-helpers": "^2.0.0",
|
|
58
|
+
"@vaadin/text-area": "25.0.0-alpha10",
|
|
59
|
+
"@vaadin/text-field": "25.0.0-alpha10",
|
|
60
|
+
"@vaadin/time-picker": "25.0.0-alpha10",
|
|
61
61
|
"sinon": "^18.0.0"
|
|
62
62
|
},
|
|
63
63
|
"web-types": [
|
|
64
64
|
"web-types.json",
|
|
65
65
|
"web-types.lit.json"
|
|
66
66
|
],
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "6cc6c94079e805fa5b2f0af4dbf3b2a7485e57d0"
|
|
68
68
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2019 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { css } from 'lit';
|
|
7
|
+
import { container } from '@vaadin/field-base/src/styles/container-base-styles.js';
|
|
8
|
+
import { field } from '@vaadin/field-base/src/styles/field-base-styles.js';
|
|
9
|
+
|
|
10
|
+
const customField = css`
|
|
11
|
+
.vaadin-custom-field-container {
|
|
12
|
+
width: 100%;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.inputs-wrapper {
|
|
16
|
+
flex: none;
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
export const customFieldStyles = [field, container, customField];
|
package/{theme/material/vaadin-custom-field.d.ts → src/styles/vaadin-custom-field-core-styles.d.ts}
RENAMED
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2019 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import '
|
|
7
|
-
|
|
6
|
+
import type { CSSResult } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const customFieldStyles: CSSResult;
|
|
@@ -220,11 +220,10 @@ export const CustomFieldMixin = (superClass) =>
|
|
|
220
220
|
(inputs.indexOf(e.target) < inputs.length - 1 && !e.shiftKey) ||
|
|
221
221
|
(inputs.indexOf(e.target) > 0 && e.shiftKey)
|
|
222
222
|
) {
|
|
223
|
-
|
|
224
|
-
} else {
|
|
225
|
-
// FIXME(yuriy): remove this workaround when value should not be updated before focusout
|
|
226
|
-
this.__setValue();
|
|
223
|
+
return;
|
|
227
224
|
}
|
|
225
|
+
// FIXME(yuriy): remove this workaround when value should not be updated before focusout
|
|
226
|
+
this.__setValue();
|
|
228
227
|
}
|
|
229
228
|
}
|
|
230
229
|
|
|
@@ -31,21 +31,11 @@ export type CustomFieldValueChangedEvent = CustomEvent<{ value: string }>;
|
|
|
31
31
|
*/
|
|
32
32
|
export type CustomFieldValidatedEvent = CustomEvent<{ valid: boolean }>;
|
|
33
33
|
|
|
34
|
-
/**
|
|
35
|
-
* Fired on Tab keydown triggered from the internal inputs, meaning focus will not leave the inputs.
|
|
36
|
-
* @deprecated
|
|
37
|
-
*/
|
|
38
|
-
export type CustomFieldInternalTabEvent = Event & {
|
|
39
|
-
target: CustomField;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
34
|
export interface CustomFieldCustomEventMap {
|
|
43
35
|
'invalid-changed': CustomFieldInvalidChangedEvent;
|
|
44
36
|
|
|
45
37
|
'value-changed': CustomFieldValueChangedEvent;
|
|
46
38
|
|
|
47
|
-
'internal-tab': CustomFieldInternalTabEvent;
|
|
48
|
-
|
|
49
39
|
validated: CustomFieldValidatedEvent;
|
|
50
40
|
}
|
|
51
41
|
|
|
@@ -56,7 +46,7 @@ export interface CustomFieldEventMap extends HTMLElementEventMap, CustomFieldCus
|
|
|
56
46
|
/**
|
|
57
47
|
* `<vaadin-custom-field>` is a web component for wrapping multiple components as a single field.
|
|
58
48
|
*
|
|
59
|
-
* ```
|
|
49
|
+
* ```html
|
|
60
50
|
* <vaadin-custom-field label="Appointment time">
|
|
61
51
|
* <vaadin-date-picker></vaadin-date-picker>
|
|
62
52
|
* <vaadin-time-picker></vaadin-time-picker>
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
* Copyright (c) 2019 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { html,
|
|
6
|
+
import { html, LitElement } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
8
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
9
|
-
import {
|
|
9
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
11
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
+
import { customFieldStyles } from './styles/vaadin-custom-field-core-styles.js';
|
|
10
13
|
import { CustomFieldMixin } from './vaadin-custom-field-mixin.js';
|
|
11
|
-
import { customFieldStyles } from './vaadin-custom-field-styles.js';
|
|
12
|
-
|
|
13
|
-
registerStyles('vaadin-custom-field', customFieldStyles, { moduleId: 'vaadin-custom-field-styles' });
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* `<vaadin-custom-field>` is a web component for wrapping multiple components as a single field.
|
|
17
17
|
*
|
|
18
|
-
* ```
|
|
18
|
+
* ```html
|
|
19
19
|
* <vaadin-custom-field label="Appointment time">
|
|
20
20
|
* <vaadin-date-picker></vaadin-date-picker>
|
|
21
21
|
* <vaadin-time-picker></vaadin-time-picker>
|
|
@@ -61,20 +61,25 @@ registerStyles('vaadin-custom-field', customFieldStyles, { moduleId: 'vaadin-cus
|
|
|
61
61
|
* @mixes ElementMixin
|
|
62
62
|
* @mixes ThemableMixin
|
|
63
63
|
*/
|
|
64
|
-
class CustomField extends CustomFieldMixin(ThemableMixin(ElementMixin(
|
|
64
|
+
class CustomField extends CustomFieldMixin(ThemableMixin(ElementMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
65
65
|
static get is() {
|
|
66
66
|
return 'vaadin-custom-field';
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
static get
|
|
69
|
+
static get styles() {
|
|
70
|
+
return customFieldStyles;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** @protected */
|
|
74
|
+
render() {
|
|
70
75
|
return html`
|
|
71
76
|
<div class="vaadin-custom-field-container">
|
|
72
|
-
<div part="label"
|
|
77
|
+
<div part="label" @click="${this.focus}">
|
|
73
78
|
<slot name="label"></slot>
|
|
74
79
|
<span part="required-indicator" aria-hidden="true"></span>
|
|
75
80
|
</div>
|
|
76
81
|
|
|
77
|
-
<div class="inputs-wrapper" part="input-fields"
|
|
82
|
+
<div class="inputs-wrapper" part="input-fields" @change="${this._onInputChange}">
|
|
78
83
|
<slot id="slot"></slot>
|
|
79
84
|
</div>
|
|
80
85
|
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/custom-field",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "25.0.0-alpha10",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-custom-field",
|
|
11
|
-
"description": "`<vaadin-custom-field>` is a web component for wrapping multiple components as a single field.\n\n
|
|
11
|
+
"description": "`<vaadin-custom-field>` is a web component for wrapping multiple components as a single field.\n\n```html\n<vaadin-custom-field label=\"Appointment time\">\n <vaadin-date-picker></vaadin-date-picker>\n <vaadin-time-picker></vaadin-time-picker>\n</vaadin-custom-field>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The slotted label element wrapper\n`helper-text` | The slotted helper text element wrapper\n`error-message` | The slotted error message element wrapper\n`required-indicator` | The `required` state indicator element\n`input-fields` | The slotted input elements wrapper\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n--------------------|-------------------------------------------|------------\n`invalid` | Set when the element is invalid | :host\n`focused` | Set when the element is focused | :host\n`has-label` | Set when the element has a label | :host\n`has-value` | Set when the element has a value | :host\n`has-helper` | Set when the element has helper text | :host\n`has-error-message` | Set when the element has an error message | :host\n\nYou may also manually set `disabled` or `readonly` attribute on this component to make the label\npart look visually the same as on a `<vaadin-text-field>` when it is disabled or readonly.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "label",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
"name": "value",
|
|
114
|
-
"description": "The value of the field. When wrapping several inputs, it will contain `\\t`\n(Tab character) as a delimiter indicating parts intended to be used as the\ncorresponding inputs values.\nUse the [`formatValue`](https://cdn.vaadin.com/vaadin-web-components/
|
|
114
|
+
"description": "The value of the field. When wrapping several inputs, it will contain `\\t`\n(Tab character) as a delimiter indicating parts intended to be used as the\ncorresponding inputs values.\nUse the [`formatValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha10/#/elements/vaadin-custom-field#property-formatValue)\nand [`parseValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha10/#/elements/vaadin-custom-field#property-parseValue)\nproperties to customize this behavior.",
|
|
115
115
|
"value": {
|
|
116
116
|
"type": [
|
|
117
117
|
"string",
|
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
},
|
|
236
236
|
{
|
|
237
237
|
"name": "value",
|
|
238
|
-
"description": "The value of the field. When wrapping several inputs, it will contain `\\t`\n(Tab character) as a delimiter indicating parts intended to be used as the\ncorresponding inputs values.\nUse the [`formatValue`](https://cdn.vaadin.com/vaadin-web-components/
|
|
238
|
+
"description": "The value of the field. When wrapping several inputs, it will contain `\\t`\n(Tab character) as a delimiter indicating parts intended to be used as the\ncorresponding inputs values.\nUse the [`formatValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha10/#/elements/vaadin-custom-field#property-formatValue)\nand [`parseValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha10/#/elements/vaadin-custom-field#property-parseValue)\nproperties to customize this behavior.",
|
|
239
239
|
"value": {
|
|
240
240
|
"type": [
|
|
241
241
|
"string",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/custom-field",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "25.0.0-alpha10",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-custom-field",
|
|
19
|
-
"description": "`<vaadin-custom-field>` is a web component for wrapping multiple components as a single field.\n\n
|
|
19
|
+
"description": "`<vaadin-custom-field>` is a web component for wrapping multiple components as a single field.\n\n```html\n<vaadin-custom-field label=\"Appointment time\">\n <vaadin-date-picker></vaadin-date-picker>\n <vaadin-time-picker></vaadin-time-picker>\n</vaadin-custom-field>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The slotted label element wrapper\n`helper-text` | The slotted helper text element wrapper\n`error-message` | The slotted error message element wrapper\n`required-indicator` | The `required` state indicator element\n`input-fields` | The slotted input elements wrapper\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n--------------------|-------------------------------------------|------------\n`invalid` | Set when the element is invalid | :host\n`focused` | Set when the element is focused | :host\n`has-label` | Set when the element has a label | :host\n`has-value` | Set when the element has a value | :host\n`has-helper` | Set when the element has helper text | :host\n`has-error-message` | Set when the element has an error message | :host\n\nYou may also manually set `disabled` or `readonly` attribute on this component to make the label\npart look visually the same as on a `<vaadin-text-field>` when it is disabled or readonly.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
"name": ".value",
|
|
87
|
-
"description": "The value of the field. When wrapping several inputs, it will contain `\\t`\n(Tab character) as a delimiter indicating parts intended to be used as the\ncorresponding inputs values.\nUse the [`formatValue`](https://cdn.vaadin.com/vaadin-web-components/
|
|
87
|
+
"description": "The value of the field. When wrapping several inputs, it will contain `\\t`\n(Tab character) as a delimiter indicating parts intended to be used as the\ncorresponding inputs values.\nUse the [`formatValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha10/#/elements/vaadin-custom-field#property-formatValue)\nand [`parseValue`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha10/#/elements/vaadin-custom-field#property-parseValue)\nproperties to customize this behavior.",
|
|
88
88
|
"value": {
|
|
89
89
|
"kind": "expression"
|
|
90
90
|
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2019 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { html, LitElement } from 'lit';
|
|
7
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
9
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
|
-
import { CustomFieldMixin } from './vaadin-custom-field-mixin.js';
|
|
12
|
-
import { customFieldStyles } from './vaadin-custom-field-styles.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* LitElement based version of `<vaadin-custom-field>` web component.
|
|
16
|
-
*
|
|
17
|
-
* ## Disclaimer
|
|
18
|
-
*
|
|
19
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
20
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
21
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
22
|
-
*/
|
|
23
|
-
class CustomField extends CustomFieldMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))) {
|
|
24
|
-
static get is() {
|
|
25
|
-
return 'vaadin-custom-field';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static get styles() {
|
|
29
|
-
return customFieldStyles;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/** @protected */
|
|
33
|
-
render() {
|
|
34
|
-
return html`
|
|
35
|
-
<div class="vaadin-custom-field-container">
|
|
36
|
-
<div part="label" @click="${this.focus}">
|
|
37
|
-
<slot name="label"></slot>
|
|
38
|
-
<span part="required-indicator" aria-hidden="true"></span>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<div class="inputs-wrapper" part="input-fields" @change="${this._onInputChange}">
|
|
42
|
-
<slot id="slot"></slot>
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
<div part="helper-text">
|
|
46
|
-
<slot name="helper"></slot>
|
|
47
|
-
</div>
|
|
48
|
-
|
|
49
|
-
<div part="error-message">
|
|
50
|
-
<slot name="error-message"></slot>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
<slot name="tooltip"></slot>
|
|
55
|
-
`;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Fired when the user commits a value change for any of the internal inputs.
|
|
60
|
-
*
|
|
61
|
-
* @event change
|
|
62
|
-
*/
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
defineCustomElement(CustomField);
|
|
66
|
-
|
|
67
|
-
export { CustomField };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2019 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import '@vaadin/vaadin-material-styles/color.js';
|
|
7
|
-
import '@vaadin/vaadin-material-styles/typography.js';
|
|
8
|
-
declare const customField: import("lit").CSSResult;
|
|
9
|
-
export { customField };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2019 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import '@vaadin/vaadin-material-styles/color.js';
|
|
7
|
-
import '@vaadin/vaadin-material-styles/typography.js';
|
|
8
|
-
import { helper } from '@vaadin/vaadin-material-styles/mixins/helper.js';
|
|
9
|
-
import { requiredField } from '@vaadin/vaadin-material-styles/mixins/required-field.js';
|
|
10
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
|
-
|
|
12
|
-
const customField = css`
|
|
13
|
-
:host {
|
|
14
|
-
display: inline-flex;
|
|
15
|
-
position: relative;
|
|
16
|
-
margin-bottom: 8px;
|
|
17
|
-
outline: none;
|
|
18
|
-
color: var(--material-body-text-color);
|
|
19
|
-
font-size: var(--material-body-font-size);
|
|
20
|
-
font-family: var(--material-font-family);
|
|
21
|
-
line-height: 48px;
|
|
22
|
-
-webkit-font-smoothing: antialiased;
|
|
23
|
-
-moz-osx-font-smoothing: grayscale;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/* align with text-field label */
|
|
27
|
-
:host([has-label]) {
|
|
28
|
-
padding-top: 16px;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/* align with text-field error message */
|
|
32
|
-
:host([has-error-message]) [part='error-message'],
|
|
33
|
-
:host([has-helper]) [part='helper-text'] {
|
|
34
|
-
margin-top: -8px;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
:host([disabled]) [part='label'] {
|
|
38
|
-
color: var(--material-disabled-text-color);
|
|
39
|
-
-webkit-text-fill-color: var(--material-disabled-text-color);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
:host([focused]:not([invalid])) [part='label'] {
|
|
43
|
-
color: var(--material-primary-text-color);
|
|
44
|
-
}
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
registerStyles('vaadin-custom-field', [requiredField, helper, customField], {
|
|
48
|
-
moduleId: 'material-custom-field',
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export { customField };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/vaadin-custom-field.js';
|
/package/src/{vaadin-custom-field-styles.d.ts → styles/vaadin-custom-field-base-styles.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|