@vaadin/text-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 CHANGED
@@ -24,29 +24,6 @@ Once installed, import the component in your application:
24
24
  import '@vaadin/text-field';
25
25
  ```
26
26
 
27
- ## Themes
28
-
29
- Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
30
- The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/text-field/vaadin-text-field.js) of the package uses Lumo theme.
31
-
32
- To use the Material theme, import the component from the `theme/material` folder:
33
-
34
- ```js
35
- import '@vaadin/text-field/theme/material/vaadin-text-field.js';
36
- ```
37
-
38
- You can also import the Lumo version of the component explicitly:
39
-
40
- ```js
41
- import '@vaadin/text-field/theme/lumo/vaadin-text-field.js';
42
- ```
43
-
44
- Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
45
-
46
- ```js
47
- import '@vaadin/text-field/src/vaadin-text-field.js';
48
- ```
49
-
50
27
  ## Contributing
51
28
 
52
29
  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/text-field",
3
- "version": "24.8.4",
3
+ "version": "25.0.0-alpha10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,25 +35,23 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@open-wc/dedupe-mixin": "^1.3.0",
38
- "@polymer/polymer": "^3.0.0",
39
- "@vaadin/a11y-base": "~24.8.4",
40
- "@vaadin/component-base": "~24.8.4",
41
- "@vaadin/field-base": "~24.8.4",
42
- "@vaadin/input-container": "~24.8.4",
43
- "@vaadin/vaadin-lumo-styles": "~24.8.4",
44
- "@vaadin/vaadin-material-styles": "~24.8.4",
45
- "@vaadin/vaadin-themable-mixin": "~24.8.4",
38
+ "@vaadin/a11y-base": "25.0.0-alpha10",
39
+ "@vaadin/component-base": "25.0.0-alpha10",
40
+ "@vaadin/field-base": "25.0.0-alpha10",
41
+ "@vaadin/input-container": "25.0.0-alpha10",
42
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha10",
43
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha10",
46
44
  "lit": "^3.0.0"
47
45
  },
48
46
  "devDependencies": {
49
- "@vaadin/chai-plugins": "~24.8.4",
50
- "@vaadin/test-runner-commands": "~24.8.4",
51
- "@vaadin/testing-helpers": "^1.1.0",
47
+ "@vaadin/chai-plugins": "25.0.0-alpha10",
48
+ "@vaadin/test-runner-commands": "25.0.0-alpha10",
49
+ "@vaadin/testing-helpers": "^2.0.0",
52
50
  "sinon": "^18.0.0"
53
51
  },
54
52
  "web-types": [
55
53
  "web-types.json",
56
54
  "web-types.lit.json"
57
55
  ],
58
- "gitHead": "849e54e967563080a685965e2dced02060b3ab23"
56
+ "gitHead": "6cc6c94079e805fa5b2f0af4dbf3b2a7485e57d0"
59
57
  }
@@ -8,7 +8,6 @@ import type { DelegateFocusMixinClass } from '@vaadin/a11y-base/src/delegate-foc
8
8
  import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js';
9
9
  import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
10
10
  import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js';
11
- import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
12
11
  import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
13
12
  import type { SlotStylesMixinClass } from '@vaadin/component-base/src/slot-styles-mixin.js';
14
13
  import type { ClearButtonMixinClass } from '@vaadin/field-base/src/clear-button-mixin.js';
@@ -26,7 +25,6 @@ import type { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.j
26
25
  export declare function TextFieldMixin<T extends Constructor<HTMLElement>>(
27
26
  base: T,
28
27
  ): Constructor<ClearButtonMixinClass> &
29
- Constructor<ControllerMixinClass> &
30
28
  Constructor<DelegateFocusMixinClass> &
31
29
  Constructor<DelegateStateMixinClass> &
32
30
  Constructor<DisabledMixinClass> &
@@ -4,16 +4,17 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/input-container/src/vaadin-input-container.js';
7
- import { html, PolymerElement } from '@polymer/polymer';
7
+ import { html, LitElement } from 'lit';
8
+ import { ifDefined } from 'lit/directives/if-defined.js';
8
9
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
9
10
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
11
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
12
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
11
13
  import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
12
- import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
14
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
15
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
13
16
  import { TextFieldMixin } from './vaadin-text-field-mixin.js';
14
17
 
15
- registerStyles('vaadin-text-field', inputFieldShared, { moduleId: 'vaadin-text-field-styles' });
16
-
17
18
  /**
18
19
  * `<vaadin-text-field>` is a web component that allows the user to input and edit text.
19
20
  *
@@ -83,30 +84,36 @@ registerStyles('vaadin-text-field', inputFieldShared, { moduleId: 'vaadin-text-f
83
84
  * @mixes ThemableMixin
84
85
  * @mixes TextFieldMixin
85
86
  */
86
- export class TextField extends TextFieldMixin(ThemableMixin(ElementMixin(PolymerElement))) {
87
+ export class TextField extends TextFieldMixin(
88
+ ThemableMixin(ElementMixin(PolylitMixin(LumoInjectionMixin(LitElement)))),
89
+ ) {
87
90
  static get is() {
88
91
  return 'vaadin-text-field';
89
92
  }
90
93
 
91
- static get template() {
94
+ static get styles() {
95
+ return [inputFieldShared];
96
+ }
97
+
98
+ /** @protected */
99
+ render() {
92
100
  return html`
93
101
  <div class="vaadin-field-container">
94
102
  <div part="label">
95
103
  <slot name="label"></slot>
96
- <span part="required-indicator" aria-hidden="true" on-click="focus"></span>
104
+ <span part="required-indicator" aria-hidden="true" @click="${this.focus}"></span>
97
105
  </div>
98
106
 
99
107
  <vaadin-input-container
100
108
  part="input-field"
101
- readonly="[[readonly]]"
102
- disabled="[[disabled]]"
103
- invalid="[[invalid]]"
104
- theme$="[[_theme]]"
109
+ .readonly="${this.readonly}"
110
+ .disabled="${this.disabled}"
111
+ .invalid="${this.invalid}"
112
+ theme="${ifDefined(this._theme)}"
105
113
  >
106
114
  <slot name="prefix" slot="prefix"></slot>
107
115
  <slot name="input"></slot>
108
- <slot name="suffix" slot="suffix"></slot>
109
- <div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
116
+ ${this._renderSuffix()}
110
117
  </vaadin-input-container>
111
118
 
112
119
  <div part="helper-text">
@@ -130,6 +137,14 @@ export class TextField extends TextFieldMixin(ThemableMixin(ElementMixin(Polymer
130
137
  this._tooltipController.setAriaTarget(this.inputElement);
131
138
  this.addController(this._tooltipController);
132
139
  }
140
+
141
+ /** @protected */
142
+ _renderSuffix() {
143
+ return html`
144
+ <slot name="suffix" slot="suffix"></slot>
145
+ <div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
146
+ `;
147
+ }
133
148
  }
134
149
 
135
150
  defineCustomElement(TextField);
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/text-field",
4
- "version": "24.8.4",
4
+ "version": "25.0.0-alpha10",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/text-field",
4
- "version": "24.8.4",
4
+ "version": "25.0.0-alpha10",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -1,88 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import '@vaadin/input-container/src/vaadin-lit-input-container.js';
7
- import { html, LitElement } from 'lit';
8
- import { ifDefined } from 'lit/directives/if-defined.js';
9
- import { defineCustomElement } from '@vaadin/component-base/src/define.js';
10
- import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
11
- import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
12
- import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
13
- import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
14
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
15
- import { TextFieldMixin } from './vaadin-text-field-mixin.js';
16
-
17
- /**
18
- * LitElement based version of `<vaadin-text-field>` web component.
19
- *
20
- * ## Disclaimer
21
- *
22
- * This component is an experiment and not yet a part of Vaadin platform.
23
- * There is no ETA regarding specific Vaadin version where it'll land.
24
- * Feel free to try this code in your apps as per Apache 2.0 license.
25
- */
26
- export class TextField extends TextFieldMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))) {
27
- static get is() {
28
- return 'vaadin-text-field';
29
- }
30
-
31
- static get styles() {
32
- return [inputFieldShared];
33
- }
34
-
35
- /** @protected */
36
- render() {
37
- return html`
38
- <div class="vaadin-field-container">
39
- <div part="label">
40
- <slot name="label"></slot>
41
- <span part="required-indicator" aria-hidden="true" @click="${this.focus}"></span>
42
- </div>
43
-
44
- <vaadin-input-container
45
- part="input-field"
46
- .readonly="${this.readonly}"
47
- .disabled="${this.disabled}"
48
- .invalid="${this.invalid}"
49
- theme="${ifDefined(this._theme)}"
50
- >
51
- <slot name="prefix" slot="prefix"></slot>
52
- <slot name="input"></slot>
53
- ${this._renderSuffix()}
54
- </vaadin-input-container>
55
-
56
- <div part="helper-text">
57
- <slot name="helper"></slot>
58
- </div>
59
-
60
- <div part="error-message">
61
- <slot name="error-message"></slot>
62
- </div>
63
- </div>
64
-
65
- <slot name="tooltip"></slot>
66
- `;
67
- }
68
-
69
- /** @protected */
70
- ready() {
71
- super.ready();
72
-
73
- this._tooltipController = new TooltipController(this);
74
- this._tooltipController.setPosition('top');
75
- this._tooltipController.setAriaTarget(this.inputElement);
76
- this.addController(this._tooltipController);
77
- }
78
-
79
- /** @protected */
80
- _renderSuffix() {
81
- return html`
82
- <slot name="suffix" slot="suffix"></slot>
83
- <div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
84
- `;
85
- }
86
- }
87
-
88
- defineCustomElement(TextField);
@@ -1,7 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import './vaadin-text-field-styles.js';
7
- import '../../src/vaadin-lit-text-field.js';
@@ -1,7 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import './vaadin-text-field-styles.js';
7
- import '../../src/vaadin-lit-text-field.js';
@@ -1,7 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import './vaadin-text-field-styles.js';
7
- import '../../src/vaadin-lit-text-field.js';
@@ -1,7 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import './vaadin-text-field-styles.js';
7
- import '../../src/vaadin-lit-text-field.js';
@@ -1,6 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import '@vaadin/input-container/theme/material/vaadin-input-container-styles.js';
@@ -1,12 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import '@vaadin/input-container/theme/material/vaadin-input-container-styles.js';
7
- import { inputFieldShared } from '@vaadin/vaadin-material-styles/mixins/input-field-shared.js';
8
- import { registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
-
10
- registerStyles('vaadin-text-field', inputFieldShared, {
11
- moduleId: 'material-text-field-styles',
12
- });
@@ -1,7 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import './vaadin-text-field-styles.js';
7
- import '../../src/vaadin-text-field.js';
@@ -1,7 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import './vaadin-text-field-styles.js';
7
- import '../../src/vaadin-text-field.js';
@@ -1 +0,0 @@
1
- export * from './src/vaadin-text-field.js';
@@ -1,3 +0,0 @@
1
- import './theme/lumo/vaadin-lit-text-field.js';
2
-
3
- export * from './src/vaadin-lit-text-field.js';