@nectary/components 5.11.1 → 5.12.0

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/bundle.js CHANGED
@@ -12389,6 +12389,7 @@ class Textarea extends NectaryElement {
12389
12389
  this.#sizeContext.listen(this.#controller.signal);
12390
12390
  this.#onBottomSlotChange();
12391
12391
  this.#updateMinRows();
12392
+ this.#updateMaxRows();
12392
12393
  this.#onSizeUpdate();
12393
12394
  }
12394
12395
  disconnectedCallback() {
@@ -12484,6 +12485,10 @@ class Textarea extends NectaryElement {
12484
12485
  updateAttribute(this.#$input, "rows", newVal);
12485
12486
  break;
12486
12487
  }
12488
+ case "maxrows": {
12489
+ this.#updateMaxRows();
12490
+ break;
12491
+ }
12487
12492
  case "minrows": {
12488
12493
  this.#updateMinRows();
12489
12494
  break;
@@ -12549,6 +12554,12 @@ class Textarea extends NectaryElement {
12549
12554
  get minRows() {
12550
12555
  return getIntegerAttribute(this, "minrows", 0);
12551
12556
  }
12557
+ get maxRows() {
12558
+ return getIntegerAttribute(this, "maxrows", 0);
12559
+ }
12560
+ set maxRows(value) {
12561
+ updateAttribute(this, "maxRows", value);
12562
+ }
12552
12563
  get selectionStart() {
12553
12564
  return this.#$input.selectionStart;
12554
12565
  }
@@ -12576,6 +12587,15 @@ class Textarea extends NectaryElement {
12576
12587
  blur() {
12577
12588
  this.#$input.blur();
12578
12589
  }
12590
+ #updateMaxRows() {
12591
+ if (this.maxRows === 0) {
12592
+ this.#$input.style.removeProperty("max-height");
12593
+ return;
12594
+ }
12595
+ if (this.isDomConnected) {
12596
+ this.#calcMaxRows();
12597
+ }
12598
+ }
12579
12599
  #updateMinRows() {
12580
12600
  const minRows = this.minRows;
12581
12601
  if (minRows <= 0) {
@@ -12599,6 +12619,14 @@ class Textarea extends NectaryElement {
12599
12619
  this.#calcMinRows();
12600
12620
  }
12601
12621
  };
12622
+ #calcMaxRows() {
12623
+ if (this.maxRows === 0) {
12624
+ return;
12625
+ }
12626
+ this.#$input.rows = this.maxRows;
12627
+ this.#$input.style.setProperty("max-height", `${getRect(this.#$input).height}px`);
12628
+ this.#$input.rows = this.rows;
12629
+ }
12602
12630
  #calcMinRows() {
12603
12631
  this.#$input.rows = this.minRows;
12604
12632
  this.#$input.style.setProperty("min-height", `${getRect(this.#$input).height}px`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "5.11.1",
3
+ "version": "5.12.0",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",
@@ -27,6 +27,8 @@ export declare class Textarea extends NectaryElement {
27
27
  get rows(): HTMLTextAreaElement['rows'];
28
28
  set minRows(value: number);
29
29
  get minRows(): number;
30
+ get maxRows(): number;
31
+ set maxRows(value: number);
30
32
  get selectionStart(): HTMLTextAreaElement['selectionStart'];
31
33
  set selectionStart(value: HTMLTextAreaElement['selectionStart']);
32
34
  get selectionEnd(): HTMLTextAreaElement['selectionEnd'];
package/textarea/index.js CHANGED
@@ -57,6 +57,7 @@ class Textarea extends NectaryElement {
57
57
  this.#sizeContext.listen(this.#controller.signal);
58
58
  this.#onBottomSlotChange();
59
59
  this.#updateMinRows();
60
+ this.#updateMaxRows();
60
61
  this.#onSizeUpdate();
61
62
  }
62
63
  disconnectedCallback() {
@@ -152,6 +153,10 @@ class Textarea extends NectaryElement {
152
153
  updateAttribute(this.#$input, "rows", newVal);
153
154
  break;
154
155
  }
156
+ case "maxrows": {
157
+ this.#updateMaxRows();
158
+ break;
159
+ }
155
160
  case "minrows": {
156
161
  this.#updateMinRows();
157
162
  break;
@@ -217,6 +222,12 @@ class Textarea extends NectaryElement {
217
222
  get minRows() {
218
223
  return getIntegerAttribute(this, "minrows", 0);
219
224
  }
225
+ get maxRows() {
226
+ return getIntegerAttribute(this, "maxrows", 0);
227
+ }
228
+ set maxRows(value) {
229
+ updateAttribute(this, "maxRows", value);
230
+ }
220
231
  get selectionStart() {
221
232
  return this.#$input.selectionStart;
222
233
  }
@@ -244,6 +255,15 @@ class Textarea extends NectaryElement {
244
255
  blur() {
245
256
  this.#$input.blur();
246
257
  }
258
+ #updateMaxRows() {
259
+ if (this.maxRows === 0) {
260
+ this.#$input.style.removeProperty("max-height");
261
+ return;
262
+ }
263
+ if (this.isDomConnected) {
264
+ this.#calcMaxRows();
265
+ }
266
+ }
247
267
  #updateMinRows() {
248
268
  const minRows = this.minRows;
249
269
  if (minRows <= 0) {
@@ -267,6 +287,14 @@ class Textarea extends NectaryElement {
267
287
  this.#calcMinRows();
268
288
  }
269
289
  };
290
+ #calcMaxRows() {
291
+ if (this.maxRows === 0) {
292
+ return;
293
+ }
294
+ this.#$input.rows = this.maxRows;
295
+ this.#$input.style.setProperty("max-height", `${getRect(this.#$input).height}px`);
296
+ this.#$input.rows = this.rows;
297
+ }
270
298
  #calcMinRows() {
271
299
  this.#$input.rows = this.minRows;
272
300
  this.#$input.style.setProperty("min-height", `${getRect(this.#$input).height}px`);
@@ -14,6 +14,7 @@ export type TSinchTextareaProps = {
14
14
  /** Number of rows */
15
15
  rows?: number;
16
16
  minRows?: number;
17
+ maxRows?: number;
17
18
  /** Whether the text field is resizable */
18
19
  resizable?: boolean;
19
20
  selectionStart?: number;