@pine-ds/core 3.5.2 → 3.6.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.
Files changed (175) hide show
  1. package/components/mock-pds-modal.js +9 -4
  2. package/components/mock-pds-modal.js.map +1 -1
  3. package/components/pds-box2.js +132 -2
  4. package/components/pds-box2.js.map +1 -1
  5. package/components/pds-button2.js +51 -2
  6. package/components/pds-button2.js.map +1 -1
  7. package/components/pds-modal-content.js +128 -11
  8. package/components/pds-modal-content.js.map +1 -1
  9. package/components/pds-modal.js +13 -3
  10. package/components/pds-modal.js.map +1 -1
  11. package/components/pds-textarea.js +111 -7
  12. package/components/pds-textarea.js.map +1 -1
  13. package/components/pds-toast.js +3 -3
  14. package/components/pds-tooltip.js +2 -2
  15. package/dist/cjs/loader.cjs.js +1 -1
  16. package/dist/cjs/mock-pds-modal.cjs.entry.js +8 -4
  17. package/dist/cjs/mock-pds-modal.cjs.entry.js.map +1 -1
  18. package/dist/cjs/mock-pds-modal.entry.cjs.js.map +1 -1
  19. package/dist/cjs/pds-box.cjs.entry.js +67 -2
  20. package/dist/cjs/pds-box.cjs.entry.js.map +1 -1
  21. package/dist/cjs/pds-box.entry.cjs.js.map +1 -1
  22. package/dist/cjs/pds-button.cjs.entry.js +50 -1
  23. package/dist/cjs/pds-button.cjs.entry.js.map +1 -1
  24. package/dist/cjs/pds-button.entry.cjs.js.map +1 -1
  25. package/dist/cjs/pds-modal-content.cjs.entry.js +128 -11
  26. package/dist/cjs/pds-modal-content.cjs.entry.js.map +1 -1
  27. package/dist/cjs/pds-modal-content.entry.cjs.js.map +1 -1
  28. package/dist/cjs/pds-modal.cjs.entry.js +12 -3
  29. package/dist/cjs/pds-modal.cjs.entry.js.map +1 -1
  30. package/dist/cjs/pds-modal.entry.cjs.js.map +1 -1
  31. package/dist/cjs/pds-textarea.cjs.entry.js +108 -6
  32. package/dist/cjs/pds-textarea.cjs.entry.js.map +1 -1
  33. package/dist/cjs/pds-textarea.entry.cjs.js.map +1 -1
  34. package/dist/cjs/pds-toast.cjs.entry.js +3 -3
  35. package/dist/cjs/pds-tooltip.cjs.entry.js +2 -2
  36. package/dist/cjs/pine-core.cjs.js +1 -1
  37. package/dist/collection/components/pds-box/pds-box.css +1325 -0
  38. package/dist/collection/components/pds-box/pds-box.js +1913 -148
  39. package/dist/collection/components/pds-box/pds-box.js.map +1 -1
  40. package/dist/collection/components/pds-button/pds-button.js +59 -1
  41. package/dist/collection/components/pds-button/pds-button.js.map +1 -1
  42. package/dist/collection/components/pds-modal/pds-modal-content/pds-modal-content.css +4 -6
  43. package/dist/collection/components/pds-modal/pds-modal-content/pds-modal-content.js +128 -11
  44. package/dist/collection/components/pds-modal/pds-modal-content/pds-modal-content.js.map +1 -1
  45. package/dist/collection/components/pds-modal/pds-modal.css +42 -1
  46. package/dist/collection/components/pds-modal/pds-modal.js +34 -2
  47. package/dist/collection/components/pds-modal/pds-modal.js.map +1 -1
  48. package/dist/collection/components/pds-modal/stories/pds-modal.stories.js +245 -0
  49. package/dist/collection/components/pds-modal/test/mock-pds-modal.js +30 -3
  50. package/dist/collection/components/pds-modal/test/mock-pds-modal.js.map +1 -1
  51. package/dist/collection/components/pds-textarea/pds-textarea.css +51 -11
  52. package/dist/collection/components/pds-textarea/pds-textarea.js +127 -4
  53. package/dist/collection/components/pds-textarea/pds-textarea.js.map +1 -1
  54. package/dist/collection/components/pds-textarea/stories/pds-textarea.stories.js +13 -0
  55. package/dist/collection/components/pds-toast/pds-toast.js +3 -3
  56. package/dist/collection/components/pds-tooltip/pds-tooltip.js +2 -2
  57. package/dist/docs.json +3988 -380
  58. package/dist/esm/loader.js +1 -1
  59. package/dist/esm/mock-pds-modal.entry.js +8 -4
  60. package/dist/esm/mock-pds-modal.entry.js.map +1 -1
  61. package/dist/esm/pds-box.entry.js +67 -2
  62. package/dist/esm/pds-box.entry.js.map +1 -1
  63. package/dist/esm/pds-button.entry.js +50 -1
  64. package/dist/esm/pds-button.entry.js.map +1 -1
  65. package/dist/esm/pds-modal-content.entry.js +128 -11
  66. package/dist/esm/pds-modal-content.entry.js.map +1 -1
  67. package/dist/esm/pds-modal.entry.js +12 -3
  68. package/dist/esm/pds-modal.entry.js.map +1 -1
  69. package/dist/esm/pds-textarea.entry.js +108 -6
  70. package/dist/esm/pds-textarea.entry.js.map +1 -1
  71. package/dist/esm/pds-toast.entry.js +3 -3
  72. package/dist/esm/pds-tooltip.entry.js +2 -2
  73. package/dist/esm/pine-core.js +1 -1
  74. package/dist/esm-es5/loader.js +1 -1
  75. package/dist/esm-es5/mock-pds-modal.entry.js +1 -1
  76. package/dist/esm-es5/mock-pds-modal.entry.js.map +1 -1
  77. package/dist/esm-es5/pds-box.entry.js +1 -1
  78. package/dist/esm-es5/pds-box.entry.js.map +1 -1
  79. package/dist/esm-es5/pds-button.entry.js +1 -1
  80. package/dist/esm-es5/pds-button.entry.js.map +1 -1
  81. package/dist/esm-es5/pds-modal-content.entry.js +1 -1
  82. package/dist/esm-es5/pds-modal-content.entry.js.map +1 -1
  83. package/dist/esm-es5/pds-modal.entry.js +1 -1
  84. package/dist/esm-es5/pds-modal.entry.js.map +1 -1
  85. package/dist/esm-es5/pds-textarea.entry.js +1 -1
  86. package/dist/esm-es5/pds-textarea.entry.js.map +1 -1
  87. package/dist/esm-es5/pds-toast.entry.js +1 -1
  88. package/dist/esm-es5/pds-tooltip.entry.js +1 -1
  89. package/dist/esm-es5/pine-core.js +1 -1
  90. package/dist/pine-core/mock-pds-modal.entry.esm.js.map +1 -1
  91. package/dist/pine-core/p-318fd0cf.entry.js +2 -0
  92. package/dist/pine-core/p-318fd0cf.entry.js.map +1 -0
  93. package/dist/pine-core/{p-c4d6fe50.system.entry.js → p-346561a6.system.entry.js} +2 -2
  94. package/dist/pine-core/p-346561a6.system.entry.js.map +1 -0
  95. package/dist/pine-core/p-3gYSFJIn.system.js.map +1 -0
  96. package/dist/pine-core/{p-IG5YumI3.system.js.map → p-3pEJO0vO.system.js.map} +1 -1
  97. package/dist/pine-core/p-41d1b164.entry.js +2 -0
  98. package/dist/pine-core/p-41d1b164.entry.js.map +1 -0
  99. package/dist/pine-core/{p-02326ac3.entry.js → p-4c81420c.entry.js} +2 -2
  100. package/dist/pine-core/p-52cb152b.system.entry.js +2 -0
  101. package/dist/pine-core/p-52cb152b.system.entry.js.map +1 -0
  102. package/dist/pine-core/p-540cfd70.entry.js +2 -0
  103. package/dist/pine-core/p-540cfd70.entry.js.map +1 -0
  104. package/dist/pine-core/{p-11d4036e.entry.js → p-5f5b19f4.entry.js} +2 -2
  105. package/dist/pine-core/p-6d4d4705.system.entry.js +2 -0
  106. package/dist/pine-core/p-6d4d4705.system.entry.js.map +1 -0
  107. package/dist/pine-core/{p-68b5665a.entry.js → p-84949a12.entry.js} +2 -2
  108. package/dist/pine-core/p-84949a12.entry.js.map +1 -0
  109. package/dist/pine-core/{p-7a95a90f.system.entry.js → p-8726c99d.system.entry.js} +2 -2
  110. package/dist/pine-core/{p-2kXtbFXu.system.js.map → p-BZoPY2dP.system.js.map} +1 -1
  111. package/dist/pine-core/p-C0zqu7Gr.system.js.map +1 -0
  112. package/dist/pine-core/p-CHJgq_z7.system.js.map +1 -0
  113. package/dist/pine-core/p-Co5XZmTN.system.js.map +1 -0
  114. package/dist/pine-core/p-Czoq9yJM.system.js.map +1 -0
  115. package/dist/pine-core/p-De9tROL-.system.js +1 -1
  116. package/dist/pine-core/p-WkrM7Vv0.system.js.map +1 -0
  117. package/dist/pine-core/p-a9895385.system.entry.js +2 -0
  118. package/dist/pine-core/p-a9895385.system.entry.js.map +1 -0
  119. package/dist/pine-core/p-c0df3222.entry.js +2 -0
  120. package/dist/pine-core/p-c0df3222.entry.js.map +1 -0
  121. package/dist/pine-core/{p-884b9ae6.system.entry.js → p-d8d8fe07.system.entry.js} +2 -2
  122. package/dist/pine-core/p-dc19ce6c.system.entry.js +2 -0
  123. package/dist/pine-core/p-dc19ce6c.system.entry.js.map +1 -0
  124. package/dist/pine-core/p-e08f492a.entry.js +2 -0
  125. package/dist/pine-core/p-e08f492a.entry.js.map +1 -0
  126. package/dist/pine-core/p-fcb39155.system.entry.js +2 -0
  127. package/dist/pine-core/p-fcb39155.system.entry.js.map +1 -0
  128. package/dist/pine-core/pds-box.entry.esm.js.map +1 -1
  129. package/dist/pine-core/pds-button.entry.esm.js.map +1 -1
  130. package/dist/pine-core/pds-modal-content.entry.esm.js.map +1 -1
  131. package/dist/pine-core/pds-modal.entry.esm.js.map +1 -1
  132. package/dist/pine-core/pds-textarea.entry.esm.js.map +1 -1
  133. package/dist/pine-core/pine-core.esm.js +1 -1
  134. package/dist/types/components/pds-box/pds-box.d.ts +315 -0
  135. package/dist/types/components/pds-button/pds-button.d.ts +4 -0
  136. package/dist/types/components/pds-modal/pds-modal-content/pds-modal-content.d.ts +18 -1
  137. package/dist/types/components/pds-modal/pds-modal.d.ts +5 -0
  138. package/dist/types/components/pds-modal/test/mock-pds-modal.d.ts +5 -0
  139. package/dist/types/components/pds-textarea/pds-textarea.d.ts +20 -0
  140. package/dist/types/components.d.ts +660 -2
  141. package/hydrate/index.js +448 -34
  142. package/hydrate/index.mjs +448 -34
  143. package/package.json +2 -2
  144. package/dist/pine-core/p-007b61e9.system.entry.js +0 -2
  145. package/dist/pine-core/p-007b61e9.system.entry.js.map +0 -1
  146. package/dist/pine-core/p-0485aa93.system.entry.js +0 -2
  147. package/dist/pine-core/p-0485aa93.system.entry.js.map +0 -1
  148. package/dist/pine-core/p-2186e5d4.system.entry.js +0 -2
  149. package/dist/pine-core/p-2186e5d4.system.entry.js.map +0 -1
  150. package/dist/pine-core/p-54061a33.entry.js +0 -2
  151. package/dist/pine-core/p-54061a33.entry.js.map +0 -1
  152. package/dist/pine-core/p-68b5665a.entry.js.map +0 -1
  153. package/dist/pine-core/p-96a89cd5.system.entry.js +0 -2
  154. package/dist/pine-core/p-96a89cd5.system.entry.js.map +0 -1
  155. package/dist/pine-core/p-Bv5PJxD8.system.js.map +0 -1
  156. package/dist/pine-core/p-CD_nPb2F.system.js.map +0 -1
  157. package/dist/pine-core/p-DJekRkSL.system.js.map +0 -1
  158. package/dist/pine-core/p-DNYl_6t_.system.js.map +0 -1
  159. package/dist/pine-core/p-Dt10r3RZ.system.js.map +0 -1
  160. package/dist/pine-core/p-IIl2cTlj.system.js.map +0 -1
  161. package/dist/pine-core/p-a24c46e4.entry.js +0 -2
  162. package/dist/pine-core/p-a24c46e4.entry.js.map +0 -1
  163. package/dist/pine-core/p-c4d6fe50.system.entry.js.map +0 -1
  164. package/dist/pine-core/p-c6badcf8.entry.js +0 -2
  165. package/dist/pine-core/p-c6badcf8.entry.js.map +0 -1
  166. package/dist/pine-core/p-d714f68f.system.entry.js +0 -2
  167. package/dist/pine-core/p-d714f68f.system.entry.js.map +0 -1
  168. package/dist/pine-core/p-e5ca5b8e.entry.js +0 -2
  169. package/dist/pine-core/p-e5ca5b8e.entry.js.map +0 -1
  170. package/dist/pine-core/p-fb4058e6.entry.js +0 -2
  171. package/dist/pine-core/p-fb4058e6.entry.js.map +0 -1
  172. /package/dist/pine-core/{p-02326ac3.entry.js.map → p-4c81420c.entry.js.map} +0 -0
  173. /package/dist/pine-core/{p-11d4036e.entry.js.map → p-5f5b19f4.entry.js.map} +0 -0
  174. /package/dist/pine-core/{p-7a95a90f.system.entry.js.map → p-8726c99d.system.entry.js.map} +0 -0
  175. /package/dist/pine-core/{p-884b9ae6.system.entry.js.map → p-d8d8fe07.system.entry.js.map} +0 -0
@@ -57,9 +57,21 @@ export class PdsTextarea {
57
57
  this.onInput = (ev) => {
58
58
  const input = ev.target;
59
59
  if (input) {
60
+ // Handle maxLength validation
61
+ if (this.maxLength && input.value.length > this.maxLength) {
62
+ // Prevent input beyond maxLength
63
+ input.value = input.value.substring(0, this.maxLength);
64
+ }
60
65
  this.value = input.value || '';
61
66
  }
62
67
  this.emitInputChange(ev);
68
+ // Update counter position when content changes
69
+ if (this.maxLength && typeof ResizeObserver !== 'undefined') {
70
+ // Use requestAnimationFrame to ensure DOM is updated
71
+ requestAnimationFrame(() => {
72
+ this.updateCharacterCounterPosition();
73
+ });
74
+ }
63
75
  };
64
76
  this.onTextareaChange = (ev) => {
65
77
  this.emitValueChange(ev);
@@ -89,6 +101,24 @@ export class PdsTextarea {
89
101
  }
90
102
  // Update form value for Form Associated Custom Elements API
91
103
  this.updateFormValue();
104
+ // Update character counter position in case content changes affect sizing
105
+ if (this.maxLength && typeof ResizeObserver !== 'undefined') {
106
+ this.updateCharacterCounterPosition();
107
+ }
108
+ }
109
+ maxLengthChanged() {
110
+ // Setup or teardown ResizeObserver based on maxLength
111
+ if (this.resizeObserver) {
112
+ this.resizeObserver.disconnect();
113
+ }
114
+ if (this.maxLength && this.nativeTextarea) {
115
+ this.setupResizeObserver();
116
+ }
117
+ // Update ElementInternals validity when maxLength changes
118
+ if (this.internals && this.internals.setValidity && this.nativeTextarea) {
119
+ const isTooLong = this.nativeTextarea.value.length > (this.maxLength || 0);
120
+ this.internals.setValidity({ tooLong: isTooLong }, isTooLong ? 'Value exceeds maxLength' : '', this.nativeTextarea);
121
+ }
92
122
  }
93
123
  /**
94
124
  * Emits an `pdsInput` event.
@@ -126,6 +156,12 @@ export class PdsTextarea {
126
156
  this.internals = this.el.attachInternals();
127
157
  }
128
158
  }
159
+ disconnectedCallback() {
160
+ // Clean up ResizeObserver
161
+ if (this.resizeObserver) {
162
+ this.resizeObserver.disconnect();
163
+ }
164
+ }
129
165
  componentWillLoad() {
130
166
  this.inheritedAttributes = Object.assign(Object.assign({}, inheritAriaAttributes(this.el)), inheritAttributes(this.el));
131
167
  this.hasAction = this.el.querySelector('[slot="action"]') !== null;
@@ -134,6 +170,71 @@ export class PdsTextarea {
134
170
  this.originalPdsInput = this.pdsInput;
135
171
  // Set initial form value
136
172
  this.updateFormValue();
173
+ // Setup ResizeObserver for character counter positioning
174
+ this.setupResizeObserver();
175
+ }
176
+ /**
177
+ * Sets up ResizeObserver to track textarea resize for character counter positioning
178
+ */
179
+ setupResizeObserver() {
180
+ if (!this.maxLength || !this.nativeTextarea)
181
+ return;
182
+ // ResizeObserver may not be available in test environments
183
+ if (typeof ResizeObserver !== 'undefined') {
184
+ this.resizeObserver = new ResizeObserver(() => {
185
+ // Use requestAnimationFrame to ensure DOM updates are complete
186
+ requestAnimationFrame(() => {
187
+ this.updateCharacterCounterPosition();
188
+ });
189
+ });
190
+ this.resizeObserver.observe(this.nativeTextarea);
191
+ // Initial positioning with a small delay to ensure counter is rendered
192
+ requestAnimationFrame(() => {
193
+ this.updateCharacterCounterPosition();
194
+ });
195
+ }
196
+ }
197
+ /**
198
+ * Updates character counter position to stay within textarea boundaries during resize
199
+ */
200
+ updateCharacterCounterPosition() {
201
+ if (!this.characterCounter || !this.nativeTextarea)
202
+ return;
203
+ // Skip positioning in test environments where ResizeObserver isn't available
204
+ if (typeof ResizeObserver === 'undefined')
205
+ return;
206
+ // Ensure the character counter has been rendered and has dimensions
207
+ if (this.characterCounter.offsetWidth === 0 || this.characterCounter.offsetHeight === 0) {
208
+ // Counter not ready or component hidden - return and let resize/input observers handle positioning later
209
+ return;
210
+ }
211
+ // Position based on textarea's actual dimensions (which change during manual resize)
212
+ const textareaWidth = this.nativeTextarea.offsetWidth;
213
+ const textareaHeight = this.nativeTextarea.offsetHeight;
214
+ const counterWidth = this.characterCounter.offsetWidth;
215
+ const counterHeight = this.characterCounter.offsetHeight;
216
+ // Calculate position within textarea boundaries with padding from edges
217
+ const rightPosition = textareaWidth - counterWidth - 8;
218
+ const bottomPosition = textareaHeight - counterHeight - 8;
219
+ // Ensure counter stays within textarea boundaries even when resized very small
220
+ const finalLeft = Math.max(8, Math.min(rightPosition, textareaWidth - counterWidth - 8));
221
+ const finalTop = Math.max(8, Math.min(bottomPosition, textareaHeight - counterHeight - 8));
222
+ // Apply absolute positioning within the field wrapper
223
+ this.characterCounter.style.position = 'absolute';
224
+ this.characterCounter.style.left = `${finalLeft}px`;
225
+ this.characterCounter.style.top = `${finalTop}px`;
226
+ this.characterCounter.style.right = 'auto';
227
+ this.characterCounter.style.bottom = 'auto';
228
+ }
229
+ /**
230
+ * Renders the character counter when maxLength is set
231
+ */
232
+ renderCharacterCounter() {
233
+ if (!this.maxLength) {
234
+ return null;
235
+ }
236
+ const currentLength = this.getValue().length;
237
+ return (h("div", { class: "pds-textarea__character-counter", ref: (el) => this.characterCounter = el, role: "status", "aria-live": "polite", "aria-label": `${currentLength} of ${this.maxLength} characters` }, currentLength, " / ", this.maxLength));
137
238
  }
138
239
  renderAction() {
139
240
  const hasAction = this.el.querySelector('[slot="action"]') !== null;
@@ -185,10 +286,10 @@ export class PdsTextarea {
185
286
  }
186
287
  render() {
187
288
  const value = this.getValue();
188
- return (h(Host, { key: 'a1a70451b8987a1d152c5e440a672267b3ee325e', "aria-disabled": this.disabled ? 'true' : null, "aria-readonly": this.readonly ? 'true' : null, "has-action": this.hasAction && !this.hideLabel ? 'true' : null }, h("div", { key: 'c28061e7848a58995c0883a99af04170bbdd2ba0', class: "pds-textarea" }, this.label &&
189
- h("div", { key: '53bf7022550e51bc63decb0595c2e01c0bf7051c', class: "pds-textarea__label-wrapper" }, h("label", { key: 'ac1152cfb3f096a7861c6db9779f4bde3d117522', htmlFor: this.componentId }, h("span", { key: '0d664943f7fd9490879d0a8349743d535103608c', class: this.hideLabel ? 'visually-hidden' : '' }, this.label)), !this.hideLabel && this.renderAction()), h("textarea", Object.assign({ key: 'a7374006831ab8f0cda0a9b3bf999abc7485a16d', ref: (el) => this.nativeTextarea = el, "aria-describedby": assignDescription(this.componentId, this.invalid, this.helperMessage), "aria-invalid": this.invalid ? "true" : undefined, autocomplete: this.autocomplete, class: this.textareaClassNames(), disabled: this.disabled, id: this.componentId, name: this.name, placeholder: this.placeholder, readOnly: this.readonly, required: this.required, rows: this.rows, onBlur: this.onBlur, onChange: this.onTextareaChange, onFocus: this.onFocus, onInput: this.onInput }, this.inheritedAttributes), value), this.helperMessage &&
190
- h("p", { key: '4ca62e53a085acde9b8550c123ea1ee5a8723581', class: "pds-textarea__helper-message", id: messageId(this.componentId, 'helper') }, this.helperMessage), this.invalid &&
191
- h("p", { key: 'f70e70f4588d0d9f1e7cc570bc5db1b6f6f27f0b', "aria-live": "assertive", class: "pds-textarea__error-message", id: messageId(this.componentId, 'error') }, h("pds-icon", { key: '7a91bdea1bd0ac2a477b41d6eec3dc6369119ab0', icon: danger, size: "small" }), this.errorMessage))));
289
+ return (h(Host, { key: 'e1e17543442fcd240498b7f56ddb86e35ac1d770', "aria-disabled": this.disabled ? 'true' : null, "aria-readonly": this.readonly ? 'true' : null, "has-action": this.hasAction && !this.hideLabel ? 'true' : null }, h("div", { key: '5a69f6b67dcba5107aa9150fc87543e7638933bb', class: "pds-textarea" }, this.label &&
290
+ h("div", { key: '027592bca1595a85cdf24e8ab4201e6483fee80c', class: "pds-textarea__label-wrapper" }, h("label", { key: '815f18177b34893b9e76d8c0db7baa6b0f3400c5', htmlFor: this.componentId }, h("span", { key: '5fe5e5f984558c409d3a1c3e9fdb966038fcd4c4', class: this.hideLabel ? 'visually-hidden' : '' }, this.label)), !this.hideLabel && this.renderAction()), h("div", { key: 'd1d95ef8becd9648c8becc2fe6797432ed53ca81', class: "pds-textarea__field-wrapper" }, h("textarea", Object.assign({ key: 'd307adc2e75a381aae4dda4ad207bf3a670b7678', ref: (el) => this.nativeTextarea = el, "aria-describedby": assignDescription(this.componentId, this.invalid, this.helperMessage), "aria-invalid": this.invalid ? "true" : undefined, autocomplete: this.autocomplete, class: this.textareaClassNames(), disabled: this.disabled, id: this.componentId, maxlength: this.maxLength, name: this.name, placeholder: this.placeholder, readOnly: this.readonly, required: this.required, rows: this.rows, onBlur: this.onBlur, onChange: this.onTextareaChange, onFocus: this.onFocus, onInput: this.onInput }, this.inheritedAttributes), value), this.renderCharacterCounter()), this.helperMessage &&
291
+ h("p", { key: 'c7b68b10f0362025d90a902cbc6d2d741e579935', class: "pds-textarea__helper-message", id: messageId(this.componentId, 'helper') }, this.helperMessage), this.invalid &&
292
+ h("p", { key: '8fd179c3c8cf9c9d5ee7252d30357072a2f55090', "aria-live": "assertive", class: "pds-textarea__error-message", id: messageId(this.componentId, 'error') }, h("pds-icon", { key: '3e3de603c035ae3d71be28132d55992eadda9a54', icon: danger, size: "small" }), this.errorMessage))));
192
293
  }
193
294
  static get is() { return "pds-textarea"; }
194
295
  static get encapsulation() { return "shadow"; }
@@ -488,6 +589,25 @@ export class PdsTextarea {
488
589
  "attribute": "rows",
489
590
  "reflect": false
490
591
  },
592
+ "maxLength": {
593
+ "type": "number",
594
+ "mutable": false,
595
+ "complexType": {
596
+ "original": "number",
597
+ "resolved": "number",
598
+ "references": {}
599
+ },
600
+ "required": false,
601
+ "optional": true,
602
+ "docs": {
603
+ "tags": [],
604
+ "text": "Specifies the maximum number of characters allowed in the textarea. When set, displays a character counter."
605
+ },
606
+ "getter": false,
607
+ "setter": false,
608
+ "attribute": "max-length",
609
+ "reflect": true
610
+ },
491
611
  "value": {
492
612
  "type": "string",
493
613
  "mutable": true,
@@ -630,6 +750,9 @@ export class PdsTextarea {
630
750
  }, {
631
751
  "propName": "value",
632
752
  "methodName": "valueChanged"
753
+ }, {
754
+ "propName": "maxLength",
755
+ "methodName": "maxLengthChanged"
633
756
  }];
634
757
  }
635
758
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pds-textarea.js","sourceRoot":"","sources":["../../../src/components/pds-textarea/pds-textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, Host, h, Method, Prop, State, Watch } from '@stencil/core';\nimport { assignDescription, isRequired, messageId } from '../../utils/form';\nimport { TextareaChangeEventDetail, TextareaInputEventDetail } from './textarea-interface';\nimport { debounceEvent } from '@utils/utils';\nimport type { Attributes } from '@utils/attributes';\nimport { inheritAttributes, inheritAriaAttributes } from '@utils/attributes';\nimport { danger } from '@pine-ds/icons/icons';\n\n/**\n * @slot action - Content to be displayed in the label area, typically for help icons or links\n */\n@Component({\n tag: 'pds-textarea',\n styleUrls: [\n '../../global/styles/utils/label.scss',\n '../pds-input/pds-input.tokens.scss',\n 'pds-textarea.scss'\n ],\n shadow: true,\n formAssociated: true,\n})\nexport class PdsTextarea {\n\n private nativeTextarea?: HTMLTextAreaElement\n private focusedValue?: string | null;\n private inheritedAttributes: Attributes = {};\n private originalPdsInput?: EventEmitter<TextareaInputEventDetail>;\n private internals?: ElementInternals;\n\n @Element() el: HTMLPdsTextareaElement;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() pdsBlur!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input has focus.\n */\n @Event() pdsFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when a keyboard input occurs.\n *\n * For elements that accept text input (`type=text`, `type=tel`, etc.), the interface\n * is [`InputEvent`](https://developer.mozilla.org/en-US/docs/Web/API/InputEvent); for others,\n * the interface is [`Event`](https://developer.mozilla.org/en-US/docs/Web/API/Event). If\n * the input is cleared on edit, the type is `null`.\n */\n @Event() pdsInput: EventEmitter<TextareaInputEventDetail>;\n\n /**\n * Event emitted whenever the value of the textarea changes.\n *\n * This event will not emit when programmatically setting the `value` property.\n */\n @Event() pdsTextareaChange: EventEmitter<TextareaChangeEventDetail>;\n\n /**\n * Sets focus on the native `textarea` in the `pds-textarea`. Use this method instead of the global\n * `textarea.focus()`.\n */\n @Method()\n async setFocus() {\n if (this.nativeTextarea) {\n this.nativeTextarea.focus();\n }\n }\n\n /**\n * Specifies if and how the browser provides `autocomplete` assistance for the field.\n */\n @Prop() autocomplete: string;\n\n /**\n * A unique identifier used for the underlying component `id` attribute.\n */\n @Prop() componentId!: string;\n\n /**\n * Determines whether or not the textarea is disabled.\n * @defaultValue false\n */\n @Prop() disabled = false;\n\n /**\n * The amount of time, in milliseconds, to wait to trigger the event after each keystroke.\n */\n @Prop() debounce?: number;\n\n /**\n * Displays an error message below the textarea field.\n */\n @Prop() errorMessage?: string;\n\n /**\n * Displays a message or hint below the textarea field.\n */\n @Prop() helperMessage?: string;\n\n /**\n * Determines whether or not the textarea is invalid or throws an error.\n * @defaultValue false\n */\n @Prop({mutable: true}) invalid = false; // eslint-disable-line @stencil-community/strict-mutable\n\n /**\n * Text to be displayed as the textarea label.\n */\n @Prop() label?: string;\n\n /**\n * Visually hides the label text for instances where only the textarea should be displayed. Label remains accessible to assistive technology such as screen readers.\n * Note: When true, the action slot is also hidden to maintain a minimal UI.\n */\n @Prop() hideLabel: boolean;\n\n /**\n * Specifies the name. Submitted with the form name/value pair. This value will mirror the componentId.\n */\n @Prop() name: string = this.componentId;\n\n /**\n * Specifies a short hint that describes the expected value of the textarea.\n */\n @Prop() placeholder?: string;\n\n /**\n * Determines whether or not the textarea is readonly.\n * @defaultValue false\n */\n @Prop() readonly = false;\n\n /**\n * Determines whether or not the textarea is required.\n * @defaultValue false\n */\n @Prop() required = false;\n\n /**\n * Sets number of rows of text visible without needing to scroll in the textarea.\n */\n @Prop() rows?: number;\n\n /**\n * The value of the textarea.\n */\n @Prop({mutable: true}) value?: string | null = '';\n\n @State() hasFocus = false;\n\n /**\n * If true, the textarea has action content in the label area\n */\n @State() hasAction = false;\n\n @Watch('debounce')\n protected debounceChanged() {\n const { pdsInput, debounce, originalPdsInput } = this;\n\n this.pdsInput = debounce === undefined ? originalPdsInput ?? pdsInput : debounceEvent(pdsInput, debounce);\n }\n\n /**\n * Update the native input element when the value changes\n */\n @Watch('value')\n protected valueChanged() {\n const nativeTextarea = this.nativeTextarea;\n const value = this.getValue();\n\n if (nativeTextarea && nativeTextarea.value !== value) {\n nativeTextarea.value = value;\n }\n\n // Update form value for Form Associated Custom Elements API\n this.updateFormValue();\n }\n\n /**\n * Emits an `pdsInput` event.\n */\n private emitInputChange(event?: Event) {\n const { value } = this;\n this.pdsInput.emit({ value, event });\n }\n\n /**\n * Emits an `pdsTextareaChange` event.\n */\n private emitValueChange(event?: Event) {\n const textarea = event.target as HTMLTextAreaElement;\n isRequired(textarea, this);\n\n const { value } = textarea;\n\n // Checks for both null and undefined values\n const newValue = value == null ? value : value.toString();\n this.focusedValue = newValue;\n this.pdsTextareaChange.emit({ value: newValue, event });\n }\n\n private getValue(): string {\n return this.value || '';\n }\n\n private onBlur = (ev: FocusEvent) => {\n this.hasFocus = false;\n\n if (this.focusedValue !== this.value) {\n this.emitValueChange(ev);\n }\n\n this.pdsBlur.emit(ev);\n };\n\n private onFocus = (ev: FocusEvent) => {\n this.hasFocus = true;\n this.focusedValue = this.value;\n\n this.pdsFocus.emit(ev);\n };\n\n private onInput = (ev: Event) => {\n const input = ev.target as HTMLTextAreaElement | null;\n if (input) {\n this.value = input.value || '';\n }\n this.emitInputChange(ev);\n };\n\n private onTextareaChange = (ev: Event) => {\n this.emitValueChange(ev);\n };\n\n private textareaClassNames() {\n const classNames = ['pds-textarea__field'];\n\n if (this.invalid && this.invalid === true) {\n classNames.push('is-invalid');\n }\n\n return classNames.join(' ');\n }\n\n connectedCallback() {\n this.debounceChanged();\n // Initialize ElementInternals for form association\n if (this.el.attachInternals) {\n this.internals = this.el.attachInternals();\n }\n }\n\n componentWillLoad() {\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.el),\n ...inheritAttributes(this.el),\n };\n this.hasAction = this.el.querySelector('[slot=\"action\"]') !== null;\n }\n\n componentDidLoad() {\n this.originalPdsInput = this.pdsInput;\n // Set initial form value\n this.updateFormValue();\n }\n\n private renderAction() {\n const hasAction = this.el.querySelector('[slot=\"action\"]') !== null;\n if (hasAction) {\n return (\n <div class=\"pds-textarea__action\" part=\"action\">\n <slot name=\"action\"></slot>\n </div>\n );\n }\n return null;\n }\n\n /**\n * Updates the form value using ElementInternals API\n */\n private updateFormValue() {\n if (this.internals && this.internals.setFormValue) {\n const value = this.getValue();\n this.internals.setFormValue(value || null);\n\n // Set validity based on native textarea validation\n if (this.nativeTextarea && this.internals && this.internals.setValidity) {\n this.internals.setValidity(\n this.nativeTextarea.validity,\n this.nativeTextarea.validationMessage,\n this.nativeTextarea\n );\n }\n }\n }\n\n /**\n * Form Associated Custom Elements API: Called when the form is reset\n */\n formResetCallback() {\n this.value = '';\n this.updateFormValue();\n }\n\n /**\n * Form Associated Custom Elements API: Called when the form is disabled\n */\n formDisabledCallback(disabled: boolean) {\n this.disabled = disabled;\n }\n\n /**\n * Form Associated Custom Elements API: Called to restore form state\n */\n formStateRestoreCallback(state: string | FormData | null) {\n if (typeof state === 'string') {\n this.value = state;\n } else if (state instanceof FormData && this.name) {\n // Extract value from FormData using the textarea's name\n const value = state.get(this.name);\n if (typeof value === 'string') {\n this.value = value;\n }\n }\n }\n\n render() {\n const value = this.getValue();\n\n return (\n <Host\n aria-disabled={this.disabled ? 'true' : null}\n aria-readonly={this.readonly ? 'true' : null}\n has-action={this.hasAction && !this.hideLabel ? 'true' : null}\n >\n <div class=\"pds-textarea\">\n {this.label &&\n <div class=\"pds-textarea__label-wrapper\">\n <label htmlFor={this.componentId}>\n <span class={this.hideLabel ? 'visually-hidden' : ''}>\n {this.label}\n </span>\n </label>\n {!this.hideLabel && this.renderAction()}\n </div>\n }\n <textarea\n ref={(el) => this.nativeTextarea = el }\n aria-describedby={assignDescription(this.componentId, this.invalid, this.helperMessage)}\n aria-invalid={this.invalid ? \"true\" : undefined}\n autocomplete={this.autocomplete}\n class={this.textareaClassNames()}\n disabled={this.disabled}\n id={this.componentId}\n name={this.name}\n placeholder={this.placeholder}\n readOnly={this.readonly}\n required={this.required}\n rows={this.rows}\n onBlur={this.onBlur}\n onChange={this.onTextareaChange}\n onFocus={this.onFocus}\n onInput={this.onInput}\n {...this.inheritedAttributes}\n >\n {value}\n </textarea>\n {this.helperMessage &&\n <p\n class=\"pds-textarea__helper-message\"\n id={messageId(this.componentId, 'helper')}\n >\n {this.helperMessage}\n </p>\n }\n {this.invalid &&\n <p\n aria-live=\"assertive\"\n class=\"pds-textarea__error-message\"\n id={messageId(this.componentId, 'error')}\n >\n <pds-icon icon={danger} size=\"small\" />\n {this.errorMessage}\n </p>\n }\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"pds-textarea.js","sourceRoot":"","sources":["../../../src/components/pds-textarea/pds-textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C;;GAEG;AAWH,MAAM,OAAO,WAAW;IAVxB;QAcU,wBAAmB,GAAe,EAAE,CAAC;QAwD7C;;;WAGG;QACK,aAAQ,GAAG,KAAK,CAAC;QAiBzB;;;WAGG;QACoB,YAAO,GAAG,KAAK,CAAC,CAAO,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, Host, h, Method, Prop, State, Watch } from '@stencil/core';\nimport { assignDescription, isRequired, messageId } from '../../utils/form';\nimport { TextareaChangeEventDetail, TextareaInputEventDetail } from './textarea-interface';\nimport { debounceEvent } from '@utils/utils';\nimport type { Attributes } from '@utils/attributes';\nimport { inheritAttributes, inheritAriaAttributes } from '@utils/attributes';\nimport { danger } from '@pine-ds/icons/icons';\n\n/**\n * @slot action - Content to be displayed in the label area, typically for help icons or links\n */\n@Component({\n tag: 'pds-textarea',\n styleUrls: [\n '../../global/styles/utils/label.scss',\n '../pds-input/pds-input.tokens.scss',\n 'pds-textarea.scss'\n ],\n shadow: true,\n formAssociated: true,\n})\nexport class PdsTextarea {\n\n private nativeTextarea?: HTMLTextAreaElement\n private focusedValue?: string | null;\n private inheritedAttributes: Attributes = {};\n private originalPdsInput?: EventEmitter<TextareaInputEventDetail>;\n private internals?: ElementInternals;\n private resizeObserver?: ResizeObserver;\n private characterCounter?: HTMLElement;\n\n @Element() el: HTMLPdsTextareaElement;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() pdsBlur!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input has focus.\n */\n @Event() pdsFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when a keyboard input occurs.\n *\n * For elements that accept text input (`type=text`, `type=tel`, etc.), the interface\n * is [`InputEvent`](https://developer.mozilla.org/en-US/docs/Web/API/InputEvent); for others,\n * the interface is [`Event`](https://developer.mozilla.org/en-US/docs/Web/API/Event). If\n * the input is cleared on edit, the type is `null`.\n */\n @Event() pdsInput: EventEmitter<TextareaInputEventDetail>;\n\n /**\n * Event emitted whenever the value of the textarea changes.\n *\n * This event will not emit when programmatically setting the `value` property.\n */\n @Event() pdsTextareaChange: EventEmitter<TextareaChangeEventDetail>;\n\n /**\n * Sets focus on the native `textarea` in the `pds-textarea`. Use this method instead of the global\n * `textarea.focus()`.\n */\n @Method()\n async setFocus() {\n if (this.nativeTextarea) {\n this.nativeTextarea.focus();\n }\n }\n\n /**\n * Specifies if and how the browser provides `autocomplete` assistance for the field.\n */\n @Prop() autocomplete: string;\n\n /**\n * A unique identifier used for the underlying component `id` attribute.\n */\n @Prop() componentId!: string;\n\n /**\n * Determines whether or not the textarea is disabled.\n * @defaultValue false\n */\n @Prop() disabled = false;\n\n /**\n * The amount of time, in milliseconds, to wait to trigger the event after each keystroke.\n */\n @Prop() debounce?: number;\n\n /**\n * Displays an error message below the textarea field.\n */\n @Prop() errorMessage?: string;\n\n /**\n * Displays a message or hint below the textarea field.\n */\n @Prop() helperMessage?: string;\n\n /**\n * Determines whether or not the textarea is invalid or throws an error.\n * @defaultValue false\n */\n @Prop({mutable: true}) invalid = false; // eslint-disable-line @stencil-community/strict-mutable\n\n /**\n * Text to be displayed as the textarea label.\n */\n @Prop() label?: string;\n\n /**\n * Visually hides the label text for instances where only the textarea should be displayed. Label remains accessible to assistive technology such as screen readers.\n * Note: When true, the action slot is also hidden to maintain a minimal UI.\n */\n @Prop() hideLabel: boolean;\n\n /**\n * Specifies the name. Submitted with the form name/value pair. This value will mirror the componentId.\n */\n @Prop() name: string = this.componentId;\n\n /**\n * Specifies a short hint that describes the expected value of the textarea.\n */\n @Prop() placeholder?: string;\n\n /**\n * Determines whether or not the textarea is readonly.\n * @defaultValue false\n */\n @Prop() readonly = false;\n\n /**\n * Determines whether or not the textarea is required.\n * @defaultValue false\n */\n @Prop() required = false;\n\n /**\n * Sets number of rows of text visible without needing to scroll in the textarea.\n */\n @Prop() rows?: number;\n\n /**\n * Specifies the maximum number of characters allowed in the textarea. When set, displays a character counter.\n */\n @Prop({ reflect: true }) maxLength?: number;\n\n /**\n * The value of the textarea.\n */\n @Prop({mutable: true}) value?: string | null = '';\n\n @State() hasFocus = false;\n\n /**\n * If true, the textarea has action content in the label area\n */\n @State() hasAction = false;\n\n @Watch('debounce')\n protected debounceChanged() {\n const { pdsInput, debounce, originalPdsInput } = this;\n\n this.pdsInput = debounce === undefined ? originalPdsInput ?? pdsInput : debounceEvent(pdsInput, debounce);\n }\n\n /**\n * Update the native input element when the value changes\n */\n @Watch('value')\n protected valueChanged() {\n const nativeTextarea = this.nativeTextarea;\n const value = this.getValue();\n\n if (nativeTextarea && nativeTextarea.value !== value) {\n nativeTextarea.value = value;\n }\n\n // Update form value for Form Associated Custom Elements API\n this.updateFormValue();\n\n // Update character counter position in case content changes affect sizing\n if (this.maxLength && typeof ResizeObserver !== 'undefined') {\n this.updateCharacterCounterPosition();\n }\n }\n\n @Watch('maxLength')\n protected maxLengthChanged() {\n // Setup or teardown ResizeObserver based on maxLength\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n }\n\n if (this.maxLength && this.nativeTextarea) {\n this.setupResizeObserver();\n }\n\n // Update ElementInternals validity when maxLength changes\n if (this.internals && this.internals.setValidity && this.nativeTextarea) {\n const isTooLong = this.nativeTextarea.value.length > (this.maxLength || 0);\n this.internals.setValidity(\n { tooLong: isTooLong },\n isTooLong ? 'Value exceeds maxLength' : '',\n this.nativeTextarea\n );\n }\n }\n\n /**\n * Emits an `pdsInput` event.\n */\n private emitInputChange(event?: Event) {\n const { value } = this;\n this.pdsInput.emit({ value, event });\n }\n\n /**\n * Emits an `pdsTextareaChange` event.\n */\n private emitValueChange(event?: Event) {\n const textarea = event.target as HTMLTextAreaElement;\n isRequired(textarea, this);\n\n const { value } = textarea;\n\n // Checks for both null and undefined values\n const newValue = value == null ? value : value.toString();\n this.focusedValue = newValue;\n this.pdsTextareaChange.emit({ value: newValue, event });\n }\n\n private getValue(): string {\n return this.value || '';\n }\n\n private onBlur = (ev: FocusEvent) => {\n this.hasFocus = false;\n\n if (this.focusedValue !== this.value) {\n this.emitValueChange(ev);\n }\n\n this.pdsBlur.emit(ev);\n };\n\n private onFocus = (ev: FocusEvent) => {\n this.hasFocus = true;\n this.focusedValue = this.value;\n\n this.pdsFocus.emit(ev);\n };\n\n private onInput = (ev: Event) => {\n const input = ev.target as HTMLTextAreaElement | null;\n if (input) {\n // Handle maxLength validation\n if (this.maxLength && input.value.length > this.maxLength) {\n // Prevent input beyond maxLength\n input.value = input.value.substring(0, this.maxLength);\n }\n this.value = input.value || '';\n }\n this.emitInputChange(ev);\n\n // Update counter position when content changes\n if (this.maxLength && typeof ResizeObserver !== 'undefined') {\n // Use requestAnimationFrame to ensure DOM is updated\n requestAnimationFrame(() => {\n this.updateCharacterCounterPosition();\n });\n }\n };\n\n private onTextareaChange = (ev: Event) => {\n this.emitValueChange(ev);\n };\n\n private textareaClassNames() {\n const classNames = ['pds-textarea__field'];\n\n if (this.invalid && this.invalid === true) {\n classNames.push('is-invalid');\n }\n\n return classNames.join(' ');\n }\n\n connectedCallback() {\n this.debounceChanged();\n // Initialize ElementInternals for form association\n if (this.el.attachInternals) {\n this.internals = this.el.attachInternals();\n }\n }\n\n disconnectedCallback() {\n // Clean up ResizeObserver\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n }\n }\n\n componentWillLoad() {\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.el),\n ...inheritAttributes(this.el),\n };\n this.hasAction = this.el.querySelector('[slot=\"action\"]') !== null;\n }\n\n componentDidLoad() {\n this.originalPdsInput = this.pdsInput;\n // Set initial form value\n this.updateFormValue();\n\n // Setup ResizeObserver for character counter positioning\n this.setupResizeObserver();\n }\n\n /**\n * Sets up ResizeObserver to track textarea resize for character counter positioning\n */\n private setupResizeObserver() {\n if (!this.maxLength || !this.nativeTextarea) return;\n\n // ResizeObserver may not be available in test environments\n if (typeof ResizeObserver !== 'undefined') {\n this.resizeObserver = new ResizeObserver(() => {\n // Use requestAnimationFrame to ensure DOM updates are complete\n requestAnimationFrame(() => {\n this.updateCharacterCounterPosition();\n });\n });\n\n this.resizeObserver.observe(this.nativeTextarea);\n\n // Initial positioning with a small delay to ensure counter is rendered\n requestAnimationFrame(() => {\n this.updateCharacterCounterPosition();\n });\n }\n }\n\n /**\n * Updates character counter position to stay within textarea boundaries during resize\n */\n private updateCharacterCounterPosition() {\n if (!this.characterCounter || !this.nativeTextarea) return;\n\n // Skip positioning in test environments where ResizeObserver isn't available\n if (typeof ResizeObserver === 'undefined') return;\n\n // Ensure the character counter has been rendered and has dimensions\n if (this.characterCounter.offsetWidth === 0 || this.characterCounter.offsetHeight === 0) {\n // Counter not ready or component hidden - return and let resize/input observers handle positioning later\n return;\n }\n\n // Position based on textarea's actual dimensions (which change during manual resize)\n const textareaWidth = this.nativeTextarea.offsetWidth;\n const textareaHeight = this.nativeTextarea.offsetHeight;\n const counterWidth = this.characterCounter.offsetWidth;\n const counterHeight = this.characterCounter.offsetHeight;\n\n // Calculate position within textarea boundaries with padding from edges\n const rightPosition = textareaWidth - counterWidth - 8;\n const bottomPosition = textareaHeight - counterHeight - 8;\n\n // Ensure counter stays within textarea boundaries even when resized very small\n const finalLeft = Math.max(8, Math.min(rightPosition, textareaWidth - counterWidth - 8));\n const finalTop = Math.max(8, Math.min(bottomPosition, textareaHeight - counterHeight - 8));\n\n // Apply absolute positioning within the field wrapper\n this.characterCounter.style.position = 'absolute';\n this.characterCounter.style.left = `${finalLeft}px`;\n this.characterCounter.style.top = `${finalTop}px`;\n this.characterCounter.style.right = 'auto';\n this.characterCounter.style.bottom = 'auto';\n }\n\n /**\n * Renders the character counter when maxLength is set\n */\n private renderCharacterCounter() {\n if (!this.maxLength) {\n return null;\n }\n\n const currentLength = this.getValue().length;\n return (\n <div\n class=\"pds-textarea__character-counter\"\n ref={(el) => this.characterCounter = el}\n role=\"status\"\n aria-live=\"polite\"\n aria-label={`${currentLength} of ${this.maxLength} characters`}\n >\n {currentLength} / {this.maxLength}\n </div>\n );\n }\n\n private renderAction() {\n const hasAction = this.el.querySelector('[slot=\"action\"]') !== null;\n if (hasAction) {\n return (\n <div class=\"pds-textarea__action\" part=\"action\">\n <slot name=\"action\"></slot>\n </div>\n );\n }\n return null;\n }\n\n /**\n * Updates the form value using ElementInternals API\n */\n private updateFormValue() {\n if (this.internals && this.internals.setFormValue) {\n const value = this.getValue();\n this.internals.setFormValue(value || null);\n\n // Set validity based on native textarea validation\n if (this.nativeTextarea && this.internals && this.internals.setValidity) {\n this.internals.setValidity(\n this.nativeTextarea.validity,\n this.nativeTextarea.validationMessage,\n this.nativeTextarea\n );\n }\n }\n }\n\n\n /**\n * Form Associated Custom Elements API: Called when the form is reset\n */\n formResetCallback() {\n this.value = '';\n this.updateFormValue();\n }\n\n /**\n * Form Associated Custom Elements API: Called when the form is disabled\n */\n formDisabledCallback(disabled: boolean) {\n this.disabled = disabled;\n }\n\n /**\n * Form Associated Custom Elements API: Called to restore form state\n */\n formStateRestoreCallback(state: string | FormData | null) {\n if (typeof state === 'string') {\n this.value = state;\n } else if (state instanceof FormData && this.name) {\n // Extract value from FormData using the textarea's name\n const value = state.get(this.name);\n if (typeof value === 'string') {\n this.value = value;\n }\n }\n }\n\n render() {\n const value = this.getValue();\n\n return (\n <Host\n aria-disabled={this.disabled ? 'true' : null}\n aria-readonly={this.readonly ? 'true' : null}\n has-action={this.hasAction && !this.hideLabel ? 'true' : null}\n >\n <div class=\"pds-textarea\">\n {this.label &&\n <div class=\"pds-textarea__label-wrapper\">\n <label htmlFor={this.componentId}>\n <span class={this.hideLabel ? 'visually-hidden' : ''}>\n {this.label}\n </span>\n </label>\n {!this.hideLabel && this.renderAction()}\n </div>\n }\n <div class=\"pds-textarea__field-wrapper\">\n <textarea\n ref={(el) => this.nativeTextarea = el }\n aria-describedby={assignDescription(this.componentId, this.invalid, this.helperMessage)}\n aria-invalid={this.invalid ? \"true\" : undefined}\n autocomplete={this.autocomplete}\n class={this.textareaClassNames()}\n disabled={this.disabled}\n id={this.componentId}\n maxlength={this.maxLength}\n name={this.name}\n placeholder={this.placeholder}\n readOnly={this.readonly}\n required={this.required}\n rows={this.rows}\n onBlur={this.onBlur}\n onChange={this.onTextareaChange}\n onFocus={this.onFocus}\n onInput={this.onInput}\n {...this.inheritedAttributes}\n >\n {value}\n </textarea>\n {this.renderCharacterCounter()}\n </div>\n {this.helperMessage &&\n <p\n class=\"pds-textarea__helper-message\"\n id={messageId(this.componentId, 'helper')}\n >\n {this.helperMessage}\n </p>\n }\n {this.invalid &&\n <p\n aria-live=\"assertive\"\n class=\"pds-textarea__error-message\"\n id={messageId(this.componentId, 'error')}\n >\n <pds-icon icon={danger} size=\"small\" />\n {this.errorMessage}\n </p>\n }\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -14,6 +14,7 @@ export default {
14
14
  hideLabel: false,
15
15
  invalid: false,
16
16
  label: null,
17
+ maxLength: null,
17
18
  name: null,
18
19
  placeholder: null,
19
20
  readonly: false,
@@ -46,6 +47,7 @@ const BaseTemplate = (args) => html`<pds-textarea
46
47
  ?hide-label=${args.hideLabel}
47
48
  ?invalid=${args.invalid}
48
49
  label="${args.label}"
50
+ max-length="${args.maxLength}"
49
51
  name="${args.name}"
50
52
  onChange="${args.onChange}"
51
53
  placeholder="${args.placeholder}"
@@ -181,3 +183,14 @@ export const withActionButton = (args) => html`<pds-textarea
181
183
  <pds-icon name="question-circle"></pds-icon>
182
184
  </pds-button>
183
185
  </pds-textarea>`;
186
+
187
+ export const MaxLength = BaseTemplate.bind({});
188
+ MaxLength.args = {
189
+ componentId: 'pds-textarea-maxlength-example',
190
+ label: 'Bio',
191
+ name: 'MaxLength',
192
+ maxLength: 120,
193
+ placeholder: 'Tell us about yourself...',
194
+ rows: 4,
195
+ value: 'Value',
196
+ };
@@ -77,13 +77,13 @@ export class PdsToast {
77
77
  return this.icon && h("pds-icon", { name: this.icon, class: "pds-toast__icon" });
78
78
  }
79
79
  render() {
80
- return (h(Host, { key: '3fb4b7b3600555959e9ed09f9dfd3a725d4a2de7', hidden: !this.isVisible }, h("div", { key: '4f8d554fc30a5e4fb3c498b8fa5a2972a60eb0ab', class: {
80
+ return (h(Host, { key: 'cf3944ff76627caaa30bc38fdfa44357488a6194', hidden: !this.isVisible }, h("div", { key: '39ce25ec4ffcaf23f565ece7e54fd4ef8a08abb5', class: {
81
81
  'pds-toast': true,
82
82
  [`pds-toast--${this.type}`]: this.type !== 'default',
83
83
  'pds-toast--animating-out': this.isAnimatingOut
84
- }, role: "alert", "aria-live": "polite" }, this.renderIcon(), h("span", { key: 'a70883e76524ce76e562f48d62df1a42fb65659c', class: "pds-toast__message" }, h("slot", { key: '3e2fd182b97d1cd89c59ca109404d77e9f834806' })), this.dismissible && (h("button", { key: '945b766572831b259f2ff36fdf628b254189d334', type: "button", class: "pds-toast__button", onClick: () => {
84
+ }, role: "alert", "aria-live": "polite" }, this.renderIcon(), h("span", { key: 'cc637017d922c88a2f025e01a55294c7abbbd0da', class: "pds-toast__message" }, h("slot", { key: 'e0dbea12cefc01a377fc4f9f8ec6898d2f10ea99' })), this.dismissible && (h("button", { key: 'e3293bd0d9678052320f0261ed95084400789804', type: "button", class: "pds-toast__button", onClick: () => {
85
85
  this.dismiss();
86
- }, "aria-label": "Dismiss message" }, h("pds-icon", { key: '9492720d544270179ae43bd3d1ecb4b1f6c0882b', name: "remove" }))))));
86
+ }, "aria-label": "Dismiss message" }, h("pds-icon", { key: '8a41d2c7fc123d5cd854212fca42eae344834d92', name: "remove" }))))));
87
87
  }
88
88
  static get is() { return "pds-toast"; }
89
89
  static get encapsulation() { return "shadow"; }
@@ -312,9 +312,9 @@ export class PdsTooltip {
312
312
  }
313
313
  render() {
314
314
  const hostId = this.componentId || undefined;
315
- return (h(Host, { key: '71fb8114cbf8db309eba0c19c0d9bd491d250157', id: hostId, class: { 'pds-tooltip--is-open': this.opened } }, h("span", { key: '9df511e60bc96c462a80f6bf6431f695e2effa3c', class: "pds-tooltip__trigger", onMouseEnter: this.handleShow, onMouseLeave: this.handleHide,
315
+ return (h(Host, { key: '6741acebcb973fd24d59a95d75aefd51fe653426', id: hostId, class: { 'pds-tooltip--is-open': this.opened } }, h("span", { key: 'f1a51aa6a9333e899d4eb8168b9ff171a463651f', class: "pds-tooltip__trigger", onMouseEnter: this.handleShow, onMouseLeave: this.handleHide,
316
316
  /* focusin/out bubble; ensure keyboard users see tooltips */
317
- onFocusin: this.handleShow, onFocusout: this.handleHide, ref: el => this.triggerEl = el }, h("slot", { key: 'eae36227df5fd93edf1af61e58b6369c0162944f' })), h("div", { key: '4c3a3f86d7e24aeff9299a9ef19396e078421467', class: "pds-tooltip__content-slot-wrapper", hidden: true }, h("slot", { key: 'babfdd5793e8007015dab364985c1451d976383f', name: "content" }))));
317
+ onFocusin: this.handleShow, onFocusout: this.handleHide, ref: el => this.triggerEl = el }, h("slot", { key: 'e48e5fb75d6156d13e3872b8ee12699139cef576' })), h("div", { key: 'ed38389bf634be3014b26c9381a389482cee2f80', class: "pds-tooltip__content-slot-wrapper", hidden: true }, h("slot", { key: '2e3d2a800aba9959c5b7fc3ed4397f7789b6f383', name: "content" }))));
318
318
  }
319
319
  static get is() { return "pds-tooltip"; }
320
320
  static get originalStyleUrls() {