@vaadin/text-area 24.8.0-alpha9 → 25.0.0-alpha1

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-area';
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-area/vaadin-text-area.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-area/theme/material/vaadin-text-area.js';
36
- ```
37
-
38
- You can also import the Lumo version of the component explicitly:
39
-
40
- ```js
41
- import '@vaadin/text-area/theme/lumo/vaadin-text-area.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-area/src/vaadin-text-area.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-area",
3
- "version": "24.8.0-alpha9",
3
+ "version": "25.0.0-alpha1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,19 +35,17 @@
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.0-alpha9",
40
- "@vaadin/component-base": "24.8.0-alpha9",
41
- "@vaadin/field-base": "24.8.0-alpha9",
42
- "@vaadin/input-container": "24.8.0-alpha9",
43
- "@vaadin/vaadin-lumo-styles": "24.8.0-alpha9",
44
- "@vaadin/vaadin-material-styles": "24.8.0-alpha9",
45
- "@vaadin/vaadin-themable-mixin": "24.8.0-alpha9",
38
+ "@vaadin/a11y-base": "25.0.0-alpha1",
39
+ "@vaadin/component-base": "25.0.0-alpha1",
40
+ "@vaadin/field-base": "25.0.0-alpha1",
41
+ "@vaadin/input-container": "25.0.0-alpha1",
42
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha1",
43
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
46
44
  "lit": "^3.0.0"
47
45
  },
48
46
  "devDependencies": {
49
- "@vaadin/chai-plugins": "24.8.0-alpha9",
50
- "@vaadin/test-runner-commands": "24.8.0-alpha9",
47
+ "@vaadin/chai-plugins": "25.0.0-alpha1",
48
+ "@vaadin/test-runner-commands": "25.0.0-alpha1",
51
49
  "@vaadin/testing-helpers": "^1.1.0",
52
50
  "sinon": "^18.0.0"
53
51
  },
@@ -55,5 +53,5 @@
55
53
  "web-types.json",
56
54
  "web-types.lit.json"
57
55
  ],
58
- "gitHead": "4de3809275ddfd733b0d13fd02af8faf73eb6770"
56
+ "gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
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 { ResizeMixinClass } from '@vaadin/component-base/src/resize-mixin.js';
14
13
  import type { SlotStylesMixinClass } from '@vaadin/component-base/src/slot-styles-mixin.js';
@@ -27,7 +26,6 @@ import type { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.j
27
26
  export declare function TextAreaMixin<T extends Constructor<HTMLElement>>(
28
27
  base: T,
29
28
  ): Constructor<ClearButtonMixinClass> &
30
- Constructor<ControllerMixinClass> &
31
29
  Constructor<DelegateFocusMixinClass> &
32
30
  Constructor<DelegateStateMixinClass> &
33
31
  Constructor<DisabledMixinClass> &
@@ -235,6 +235,8 @@ export const TextAreaMixin = (superClass) =>
235
235
  parseFloat(inputStyle.paddingBottom) +
236
236
  parseFloat(inputStyle.marginTop) +
237
237
  parseFloat(inputStyle.marginBottom) +
238
+ parseFloat(inputFieldStyle.borderTopWidth) +
239
+ parseFloat(inputFieldStyle.borderBottomWidth) +
238
240
  parseFloat(inputFieldStyle.paddingTop) +
239
241
  parseFloat(inputFieldStyle.paddingBottom);
240
242
  const maxHeight = Math.ceil(contentHeight + marginsAndPaddings);
@@ -4,17 +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 { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
13
15
  import { TextAreaMixin } from './vaadin-text-area-mixin.js';
14
16
  import { textAreaStyles } from './vaadin-text-area-styles.js';
15
17
 
16
- registerStyles('vaadin-text-area', [inputFieldShared, textAreaStyles], { moduleId: 'vaadin-text-area-styles' });
17
-
18
18
  /**
19
19
  * `<vaadin-text-area>` is a web component for multi-line text input.
20
20
  *
@@ -61,26 +61,31 @@ registerStyles('vaadin-text-area', [inputFieldShared, textAreaStyles], { moduleI
61
61
  * @mixes TextAreaMixin
62
62
  * @mixes ThemableMixin
63
63
  */
64
- export class TextArea extends TextAreaMixin(ThemableMixin(ElementMixin(PolymerElement))) {
64
+ export class TextArea extends TextAreaMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))) {
65
65
  static get is() {
66
66
  return 'vaadin-text-area';
67
67
  }
68
68
 
69
- static get template() {
69
+ static get styles() {
70
+ return [inputFieldShared, textAreaStyles];
71
+ }
72
+
73
+ /** @protected */
74
+ render() {
70
75
  return html`
71
76
  <div class="vaadin-text-area-container">
72
77
  <div part="label">
73
78
  <slot name="label"></slot>
74
- <span part="required-indicator" aria-hidden="true" on-click="focus"></span>
79
+ <span part="required-indicator" aria-hidden="true" @click="${this.focus}"></span>
75
80
  </div>
76
81
 
77
82
  <vaadin-input-container
78
83
  part="input-field"
79
- readonly="[[readonly]]"
80
- disabled="[[disabled]]"
81
- invalid="[[invalid]]"
82
- theme$="[[_theme]]"
83
- on-scroll="_onScroll"
84
+ .readonly="${this.readonly}"
85
+ .disabled="${this.disabled}"
86
+ .invalid="${this.invalid}"
87
+ theme="${ifDefined(this._theme)}"
88
+ @scroll="${this._onScroll}"
84
89
  >
85
90
  <slot name="prefix" slot="prefix"></slot>
86
91
  <slot name="textarea"></slot>
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/text-area",
4
- "version": "24.8.0-alpha9",
4
+ "version": "25.0.0-alpha1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-text-area",
11
- "description": "`<vaadin-text-area>` is a web component for multi-line text input.\n\n```html\n<vaadin-text-area label=\"Comment\"></vaadin-text-area>\n```\n\n### Prefixes and suffixes\n\nThese are child elements of a `<vaadin-text-area>` that are displayed\ninline with the input, before or after.\nIn order for an element to be considered as a prefix, it must have the slot\nattribute set to `prefix` (and similarly for `suffix`).\n\n```html\n<vaadin-text-area label=\"Description\">\n <div slot=\"prefix\">Details:</div>\n <div slot=\"suffix\">The end!</div>\n</vaadin-text-area>\n```\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n\n`<vaadin-text-area>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha9/#/elements/vaadin-text-field) for the styling documentation.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
11
+ "description": "`<vaadin-text-area>` is a web component for multi-line text input.\n\n```html\n<vaadin-text-area label=\"Comment\"></vaadin-text-area>\n```\n\n### Prefixes and suffixes\n\nThese are child elements of a `<vaadin-text-area>` that are displayed\ninline with the input, before or after.\nIn order for an element to be considered as a prefix, it must have the slot\nattribute set to `prefix` (and similarly for `suffix`).\n\n```html\n<vaadin-text-area label=\"Description\">\n <div slot=\"prefix\">Details:</div>\n <div slot=\"suffix\">The end!</div>\n</vaadin-text-area>\n```\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n\n`<vaadin-text-area>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha1/#/elements/vaadin-text-field) for the styling documentation.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "disabled",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/text-area",
4
- "version": "24.8.0-alpha9",
4
+ "version": "25.0.0-alpha1",
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-text-area",
19
- "description": "`<vaadin-text-area>` is a web component for multi-line text input.\n\n```html\n<vaadin-text-area label=\"Comment\"></vaadin-text-area>\n```\n\n### Prefixes and suffixes\n\nThese are child elements of a `<vaadin-text-area>` that are displayed\ninline with the input, before or after.\nIn order for an element to be considered as a prefix, it must have the slot\nattribute set to `prefix` (and similarly for `suffix`).\n\n```html\n<vaadin-text-area label=\"Description\">\n <div slot=\"prefix\">Details:</div>\n <div slot=\"suffix\">The end!</div>\n</vaadin-text-area>\n```\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n\n`<vaadin-text-area>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha9/#/elements/vaadin-text-field) for the styling documentation.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
19
+ "description": "`<vaadin-text-area>` is a web component for multi-line text input.\n\n```html\n<vaadin-text-area label=\"Comment\"></vaadin-text-area>\n```\n\n### Prefixes and suffixes\n\nThese are child elements of a `<vaadin-text-area>` that are displayed\ninline with the input, before or after.\nIn order for an element to be considered as a prefix, it must have the slot\nattribute set to `prefix` (and similarly for `suffix`).\n\n```html\n<vaadin-text-area label=\"Description\">\n <div slot=\"prefix\">Details:</div>\n <div slot=\"suffix\">The end!</div>\n</vaadin-text-area>\n```\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n\n`<vaadin-text-area>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha1/#/elements/vaadin-text-field) for the styling documentation.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -1,6 +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
- export * from './vaadin-text-area.js';
@@ -1,83 +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 { TextAreaMixin } from './vaadin-text-area-mixin.js';
16
- import { textAreaStyles } from './vaadin-text-area-styles.js';
17
-
18
- /**
19
- * LitElement based version of `<vaadin-text-area>` web component.
20
- *
21
- * ## Disclaimer
22
- *
23
- * This component is an experiment and not yet a part of Vaadin platform.
24
- * There is no ETA regarding specific Vaadin version where it'll land.
25
- * Feel free to try this code in your apps as per Apache 2.0 license.
26
- */
27
- export class TextArea extends TextAreaMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))) {
28
- static get is() {
29
- return 'vaadin-text-area';
30
- }
31
-
32
- static get styles() {
33
- return [inputFieldShared, textAreaStyles];
34
- }
35
-
36
- /** @protected */
37
- render() {
38
- return html`
39
- <div class="vaadin-text-area-container">
40
- <div part="label">
41
- <slot name="label"></slot>
42
- <span part="required-indicator" aria-hidden="true" @click="${this.focus}"></span>
43
- </div>
44
-
45
- <vaadin-input-container
46
- part="input-field"
47
- .readonly="${this.readonly}"
48
- .disabled="${this.disabled}"
49
- .invalid="${this.invalid}"
50
- theme="${ifDefined(this._theme)}"
51
- @scroll="${this._onScroll}"
52
- >
53
- <slot name="prefix" slot="prefix"></slot>
54
- <slot name="textarea"></slot>
55
- <slot name="suffix" slot="suffix"></slot>
56
- <div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
57
- </vaadin-input-container>
58
-
59
- <div part="helper-text">
60
- <slot name="helper"></slot>
61
- </div>
62
-
63
- <div part="error-message">
64
- <slot name="error-message"></slot>
65
- </div>
66
- </div>
67
-
68
- <slot name="tooltip"></slot>
69
- `;
70
- }
71
-
72
- /** @protected */
73
- ready() {
74
- super.ready();
75
-
76
- this._tooltipController = new TooltipController(this);
77
- this._tooltipController.setPosition('top');
78
- this._tooltipController.setAriaTarget(this.inputElement);
79
- this.addController(this._tooltipController);
80
- }
81
- }
82
-
83
- defineCustomElement(TextArea);
@@ -1,2 +0,0 @@
1
- import './vaadin-text-area-styles.js';
2
- import '../../src/vaadin-lit-text-area.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-text-area-styles.js';
2
- import '../../src/vaadin-lit-text-area.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-text-area-styles.js';
2
- import '../../src/vaadin-lit-text-area.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-text-area-styles.js';
2
- import '../../src/vaadin-lit-text-area.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,42 +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 { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
-
10
- const textArea = css`
11
- [part='input-field'] {
12
- height: auto;
13
- box-sizing: border-box;
14
- }
15
-
16
- [part='input-field'] ::slotted(textarea) {
17
- padding-top: 0;
18
- padding-bottom: 4px;
19
- margin-top: 4px;
20
- }
21
-
22
- [part='input-field']::before,
23
- [part='input-field']::after {
24
- bottom: calc(var(--_text-area-vertical-scroll-position) * -1);
25
- }
26
-
27
- /* Use sticky positioning to keep prefix/suffix/clear button visible when scrolling textarea container */
28
- [part='input-field'] ::slotted([slot$='fix']),
29
- [part='clear-button'] {
30
- position: sticky;
31
- top: 0;
32
- align-self: flex-start;
33
- }
34
-
35
- /* Align prefix/suffix icon or text with native textarea */
36
- [part='input-field'] ::slotted([slot$='fix']) {
37
- top: 4px;
38
- margin-top: 4px;
39
- }
40
- `;
41
-
42
- registerStyles('vaadin-text-area', [inputFieldShared, textArea], { moduleId: 'material-text-area' });
@@ -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-area-styles.js';
7
- import '../../src/vaadin-text-area.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-area-styles.js';
7
- import '../../src/vaadin-text-area.js';
@@ -1 +0,0 @@
1
- export * from './src/vaadin-text-area.js';
@@ -1,3 +0,0 @@
1
- import './theme/lumo/vaadin-lit-text-area.js';
2
-
3
- export * from './src/vaadin-lit-text-area.js';