@sebgroup/green-core 3.17.4 → 3.18.0-rc.20260818070119654

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.
@@ -200,7 +200,10 @@ let Textarea = class extends GdsFormControlElement {
200
200
  connectedCallback() {
201
201
  super.connectedCallback();
202
202
  if (this.hasAttribute("rows")) {
203
- this._initialRows = this.rows;
203
+ const parsed = Number(this.rows);
204
+ if (Number.isFinite(parsed) && parsed > 0) {
205
+ this._initialRows = parsed;
206
+ }
204
207
  }
205
208
  this._setAutoHeight();
206
209
  this.addEventListener("slotchange", this._handleSlotChange);
@@ -274,18 +277,26 @@ let Textarea = class extends GdsFormControlElement {
274
277
  } else {
275
278
  const computedStyle = getComputedStyle(element);
276
279
  const lineHeight = parseFloat(computedStyle.lineHeight);
277
- const contentHeight = element.scrollHeight;
278
- const requiredRows = Math.ceil(contentHeight / lineHeight);
279
280
  const minRows = this._initialRows ?? this._defaultRows;
280
- this.rows = Math.max(minRows, requiredRows);
281
- element.style.setProperty("--_lines", this.rows.toString());
281
+ if (!Number.isFinite(lineHeight) || lineHeight <= 0) {
282
+ this.rows = minRows;
283
+ element.style.setProperty("--_lines", minRows.toString());
284
+ } else {
285
+ const contentHeight = element.scrollHeight;
286
+ const requiredRows = Math.ceil(contentHeight / lineHeight);
287
+ this.rows = Math.max(minRows, requiredRows);
288
+ element.style.setProperty("--_lines", this.rows.toString());
289
+ }
282
290
  }
283
291
  }
284
292
  });
285
293
  }
286
294
  _handleRowsChange() {
287
295
  if (this.hasAttribute("rows")) {
288
- this._initialRows = this.rows;
296
+ const parsed = Number(this.rows);
297
+ if (Number.isFinite(parsed) && parsed > 0) {
298
+ this._initialRows = parsed;
299
+ }
289
300
  }
290
301
  this.elTextareaAsync.then((element) => {
291
302
  if (this.resizable === "false") {