New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vaadin/text-area

Package Overview
Dependencies
Maintainers
0
Versions
428
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vaadin/text-area - npm Package Compare versions

Comparing version 24.6.0-alpha8 to 24.6.0-alpha9

20

package.json
{
"name": "@vaadin/text-area",
"version": "24.6.0-alpha8",
"version": "24.6.0-alpha9",
"publishConfig": {

@@ -39,13 +39,13 @@ "access": "public"

"@polymer/polymer": "^3.0.0",
"@vaadin/a11y-base": "24.6.0-alpha8",
"@vaadin/component-base": "24.6.0-alpha8",
"@vaadin/field-base": "24.6.0-alpha8",
"@vaadin/input-container": "24.6.0-alpha8",
"@vaadin/vaadin-lumo-styles": "24.6.0-alpha8",
"@vaadin/vaadin-material-styles": "24.6.0-alpha8",
"@vaadin/vaadin-themable-mixin": "24.6.0-alpha8",
"@vaadin/a11y-base": "24.6.0-alpha9",
"@vaadin/component-base": "24.6.0-alpha9",
"@vaadin/field-base": "24.6.0-alpha9",
"@vaadin/input-container": "24.6.0-alpha9",
"@vaadin/vaadin-lumo-styles": "24.6.0-alpha9",
"@vaadin/vaadin-material-styles": "24.6.0-alpha9",
"@vaadin/vaadin-themable-mixin": "24.6.0-alpha9",
"lit": "^3.0.0"
},
"devDependencies": {
"@vaadin/chai-plugins": "24.6.0-alpha8",
"@vaadin/chai-plugins": "24.6.0-alpha9",
"@vaadin/testing-helpers": "^1.0.0",

@@ -58,3 +58,3 @@ "sinon": "^18.0.0"

],
"gitHead": "a11e1510c4caa08775b202714f5fc1198c22132a"
"gitHead": "e303d77ba20c3089c9998be9a318733d9ec5b53c"
}

@@ -66,2 +66,19 @@ /**

/**
* Minimum number of rows to show. Default is two rows, which is also the minimum value.
*
* When using a custom slotted textarea, the minimum number of rows are not applied for backwards compatibility.
*
* @attr {number} min-rows
*/
minRows: number;
/**
* Maximum number of rows to expand to before the text area starts scrolling. This effectively sets a max-height
* on the `input-field` part. By default, it is not set, and the text area grows with the content without
* constraints.
* @attr {number} max-rows
*/
maxRows: number | null | undefined;
/**
* Scrolls the textarea to the start if it has a vertical scrollbar.

@@ -68,0 +85,0 @@ */

@@ -43,2 +43,25 @@ /**

},
/**
* Minimum number of rows to show. Default is two rows, which is also the minimum value.
*
* When using a custom slotted textarea, the minimum number of rows are not applied for backwards compatibility.
*
* @attr {number} min-rows
*/
minRows: {
type: Number,
value: 2,
observer: '__minRowsChanged',
},
/**
* Maximum number of rows to expand to before the text area starts scrolling. This effectively sets a max-height
* on the `input-field` part. By default, it is not set, and the text area grows with the content without
* constraints.
* @attr {number} max-rows
*/
maxRows: {
type: Number,
},
};

@@ -55,2 +78,6 @@ }

static get observers() {
return ['__updateMinHeight(minRows, inputElement)', '__updateMaxHeight(maxRows, inputElement, _inputField)'];
}
/**

@@ -82,10 +109,9 @@ * Used by `InputControlMixin` as a reference to the clear button element.

this.addController(
new TextAreaController(this, (input) => {
this._setInputElement(input);
this._setFocusElement(input);
this.stateTarget = input;
this.ariaTarget = input;
}),
);
this.__textAreaController = new TextAreaController(this, (input) => {
this._setInputElement(input);
this._setFocusElement(input);
this.stateTarget = input;
this.ariaTarget = input;
});
this.addController(this.__textAreaController);
this.addController(new LabelledInputController(this.inputElement, this._labelController));

@@ -182,5 +208,63 @@

inputField.scrollTop = scrollTop;
// Update max height in case this update was triggered by style changes
// affecting line height, paddings or margins.
this.__updateMaxHeight(this.maxRows);
}
/** @private */
__updateMinHeight(minRows) {
if (!this.inputElement) {
return;
}
// For minimum height, just set the number of rows on the native textarea,
// which causes the input container to grow as well.
// Do not override this on custom slotted textarea as number of rows may
// have been configured there.
if (this.inputElement === this.__textAreaController.defaultNode) {
this.inputElement.rows = Math.max(minRows, 2);
}
}
/** @private */
__updateMaxHeight(maxRows) {
if (!this._inputField || !this.inputElement) {
return;
}
if (maxRows) {
// For maximum height, we need to constrain the height of the input
// container to prevent it from growing further. For this we take the
// line height of the native textarea times the number of rows, and add
// other properties affecting the height of the input container.
const inputStyle = getComputedStyle(this.inputElement);
const inputFieldStyle = getComputedStyle(this._inputField);
const lineHeight = parseFloat(inputStyle.lineHeight);
const contentHeight = lineHeight * maxRows;
const marginsAndPaddings =
parseFloat(inputStyle.paddingTop) +
parseFloat(inputStyle.paddingBottom) +
parseFloat(inputStyle.marginTop) +
parseFloat(inputStyle.marginBottom) +
parseFloat(inputFieldStyle.paddingTop) +
parseFloat(inputFieldStyle.paddingBottom);
const maxHeight = Math.ceil(contentHeight + marginsAndPaddings);
this._inputField.style.setProperty('max-height', `${maxHeight}px`);
} else {
this._inputField.style.removeProperty('max-height');
}
}
/**
* @private
*/
__minRowsChanged(minRows) {
if (minRows < 2) {
console.warn('<vaadin-text-area> minRows must be at least 2.');
}
}
/**
* Scrolls the textarea to the start if it has a vertical scrollbar.

@@ -187,0 +271,0 @@ */

@@ -57,2 +57,3 @@ /**

white-space: pre-wrap;
box-sizing: border-box;
}

@@ -59,0 +60,0 @@

{
"$schema": "https://json.schemastore.org/web-types",
"name": "@vaadin/text-area",
"version": "24.6.0-alpha8",
"version": "24.6.0-alpha9",
"description-markup": "markdown",

@@ -11,3 +11,3 @@ "contributions": {

"name": "vaadin-text-area",
"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.6.0-alpha8/#/elements/vaadin-text-field) for the styling documentation.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
"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.6.0-alpha9/#/elements/vaadin-text-field) for the styling documentation.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
"attributes": [

@@ -279,2 +279,24 @@ {

{
"name": "min-rows",
"description": "Minimum number of rows to show. Default is two rows, which is also the minimum value.\n\nWhen using a custom slotted textarea, the minimum number of rows are not applied for backwards compatibility.",
"value": {
"type": [
"number",
"null",
"undefined"
]
}
},
{
"name": "max-rows",
"description": "Maximum number of rows to expand to before the text area starts scrolling. This effectively sets a max-height\non the `input-field` part. By default, it is not set, and the text area grows with the content without\nconstraints.",
"value": {
"type": [
"number",
"null",
"undefined"
]
}
},
{
"name": "theme",

@@ -556,2 +578,24 @@ "description": "The theme variants to apply to the component.",

}
},
{
"name": "minRows",
"description": "Minimum number of rows to show. Default is two rows, which is also the minimum value.\n\nWhen using a custom slotted textarea, the minimum number of rows are not applied for backwards compatibility.",
"value": {
"type": [
"number",
"null",
"undefined"
]
}
},
{
"name": "maxRows",
"description": "Maximum number of rows to expand to before the text area starts scrolling. This effectively sets a max-height\non the `input-field` part. By default, it is not set, and the text area grows with the content without\nconstraints.",
"value": {
"type": [
"number",
"null",
"undefined"
]
}
}

@@ -558,0 +602,0 @@ ],

{
"$schema": "https://json.schemastore.org/web-types",
"name": "@vaadin/text-area",
"version": "24.6.0-alpha8",
"version": "24.6.0-alpha9",
"description-markup": "markdown",

@@ -19,3 +19,3 @@ "framework": "lit",

"name": "vaadin-text-area",
"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.6.0-alpha8/#/elements/vaadin-text-field) for the styling documentation.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
"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.6.0-alpha9/#/elements/vaadin-text-field) for the styling documentation.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
"extension": true,

@@ -192,2 +192,16 @@ "attributes": [

{
"name": ".minRows",
"description": "Minimum number of rows to show. Default is two rows, which is also the minimum value.\n\nWhen using a custom slotted textarea, the minimum number of rows are not applied for backwards compatibility.",
"value": {
"kind": "expression"
}
},
{
"name": ".maxRows",
"description": "Maximum number of rows to expand to before the text area starts scrolling. This effectively sets a max-height\non the `input-field` part. By default, it is not set, and the text area grows with the content without\nconstraints.",
"value": {
"kind": "expression"
}
},
{
"name": "@validated",

@@ -194,0 +208,0 @@ "description": "Fired whenever the field is validated.",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc