@mono-lit/helper 0.0.9 → 0.1.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 (164) hide show
  1. package/dist/accordion-core-DaNyPWRr.js +277 -0
  2. package/dist/alert-core-DWtHbX_-.js +134 -0
  3. package/dist/breadcrumb-list-core-Dh68T8Cf.js +747 -0
  4. package/dist/{mono-button-CLkHg3WW.js → button-core-DerXg84Q.js} +3 -276
  5. package/dist/button-dropdown-core-DKYEOyjy.js +654 -0
  6. package/dist/button-utils-D5-66M02.js +63 -0
  7. package/dist/card-utils-l80qAmrN.js +312 -0
  8. package/dist/chart-core-DV7hD3ZY.js +801 -0
  9. package/dist/checkbox-utils-DKdrhAzF.js +337 -0
  10. package/dist/chip-utils-DpRrd7Zj.js +403 -0
  11. package/dist/{data-source-controller-C6C4ej_M.js → data-source-controller-DS_JLrmS.js} +1 -1
  12. package/dist/{data-source-options-fxT5QIX4.js → data-source-options-DJUNU26C.js} +6 -6
  13. package/dist/{data-source-read-BL266IW0.js → data-source-read-uKJpRAzx.js} +2 -2
  14. package/dist/date-core-CyuSyvvG.js +734 -0
  15. package/dist/drawer-core-DbFWvNln.js +759 -0
  16. package/dist/dropdown-core-BCH1pK14.js +511 -0
  17. package/dist/dropdown-table-core-SfHUJVFq.js +1342 -0
  18. package/dist/export.js +1 -1
  19. package/dist/{field-path-BabiMrrA.js → field-path-DK2VBWHl.js} +1 -1
  20. package/dist/field-tooltip.css_raw-DVblekCl.js +5 -0
  21. package/dist/{field-validation.css_raw-Cx6SGrfP.js → field-validation.css_raw-BU7C6173.js} +1 -170
  22. package/dist/file-upload-core-Cz_dBQMx.js +624 -0
  23. package/dist/filter-builder-core-DyWjbBP7.js +381 -0
  24. package/dist/{filter-builder-B6Y2mmbM.js → filter-builder-vbqIuPhX.js} +1 -1
  25. package/dist/{filter-eval-ChDSaAUH.js → filter-eval-CqeBnMYh.js} +1 -1
  26. package/dist/{filter-odata-Bi27XUpQ.js → filter-odata-GsczYKNC.js} +1 -1
  27. package/dist/{hydration-flush-BaE9gN3C.js → hydration-flush-Volt9X7Q.js} +2 -1071
  28. package/dist/index.js +11 -11
  29. package/dist/{index.node-DTqDBca7.js → index.node-Csy9zrr1.js} +4 -4
  30. package/dist/index.node.js +11 -11
  31. package/dist/input-utils-BglY-k0H.js +1145 -0
  32. package/dist/menu-core-DkAYuCZ2.js +831 -0
  33. package/dist/modal-core-CSBSPN_m.js +844 -0
  34. package/dist/mono-button-DVvZ03P-.js +280 -0
  35. package/dist/{mono-button.shadow-DqZMpcqY.js → mono-button.shadow-BANxMGln.js} +6 -594
  36. package/dist/{mono-data-chart-NKPdAgVq.js → mono-data-chart-ChF4J9RT.js} +6 -6
  37. package/dist/{mono-data-dropdown-B2iRpJuI.js → mono-data-dropdown-Bgj2PDfm.js} +1 -1
  38. package/dist/{mono-data-grid-llJCX9MC.js → mono-data-grid-DJkp96N-.js} +144 -46
  39. package/dist/{mono-event-BPku9HpS.js → mono-event-CAZf0F_k.js} +14 -9
  40. package/dist/{mono-form-controller-BrA10erm.js → mono-form-controller-DxZLvyg6.js} +2 -1
  41. package/dist/mono-table-checkbox-core-BKOMx8R5.js +5288 -0
  42. package/dist/nav-core-B5qU2dzn.js +225 -0
  43. package/dist/{normalize-error-D93O4q8g.js → normalize-error-BEcd1tmS.js} +2 -2
  44. package/dist/nuxt.js +1 -1
  45. package/dist/otp-core-DXg3vFLh.js +758 -0
  46. package/dist/radio-utils-Dk9Tl1jz.js +319 -0
  47. package/dist/rich-text-editor-core-Ddd_QaLn.js +1280 -0
  48. package/dist/select-utils-BgArYHk8.js +2140 -0
  49. package/dist/sidebar-core-CD6txDo3.js +583 -0
  50. package/dist/slider-core-vcWr321-.js +1014 -0
  51. package/dist/src/components/dropdown-table/dropdown-table-core.d.ts +2 -2
  52. package/dist/src/components/dropdown-table/dropdown-table-types.d.ts +1 -1
  53. package/dist/src/components/dropdown-table/index.d.ts +1 -1
  54. package/dist/src/components/dropdown-table/index.shadow.d.ts +1 -1
  55. package/dist/src/components/dropdown-table/mono-data-dropdown.d.ts +1 -1
  56. package/dist/src/components/form/form-types.d.ts +9 -3
  57. package/dist/src/components/input/input-core.d.ts +1 -1
  58. package/dist/src/components/input/input-types.d.ts +1 -1
  59. package/dist/src/components/otp/otp-core.d.ts +1 -1
  60. package/dist/src/components/select/select-core.d.ts +1 -1
  61. package/dist/src/components/select/select-types.d.ts +1 -1
  62. package/dist/src/components/slider/slider-core.d.ts +1 -1
  63. package/dist/src/components/slider/slider-types.d.ts +1 -1
  64. package/dist/src/components/table/filter-suggestion.d.ts +171 -0
  65. package/dist/src/components/table/index.d.ts +5 -4
  66. package/dist/src/components/table/index.shadow.d.ts +5 -4
  67. package/dist/src/components/table/mono-data-grid.d.ts +22 -3
  68. package/dist/src/components/table/mono-table-empty-core.d.ts +37 -0
  69. package/dist/src/components/table/mono-table-search-core.d.ts +22 -3
  70. package/dist/src/components/table/table-types.d.ts +74 -4
  71. package/dist/src/components/tag-input/tag-input-core.d.ts +1 -1
  72. package/dist/src/components/tag-input/tag-input-types.d.ts +1 -1
  73. package/dist/src/components/textarea/textarea-core.d.ts +1 -1
  74. package/dist/src/composables/mono-event.d.ts +7 -1
  75. package/dist/src/entries/index.d.ts +8 -6
  76. package/dist/src/entries/index.node.d.ts +8 -6
  77. package/dist/src/search/index.d.ts +1 -1
  78. package/dist/src/utils/group-count.d.ts +36 -0
  79. package/dist/switch-utils-CTZ4id2V.js +338 -0
  80. package/dist/tabs-core-r5-B8k_N.js +317 -0
  81. package/dist/tag-input-utils-D2JA90DQ.js +3060 -0
  82. package/dist/textarea-utils-VU1KeXm8.js +821 -0
  83. package/dist/ui/accordion.js +2 -274
  84. package/dist/ui/alert.js +2 -131
  85. package/dist/ui/breadcrumb.js +4 -745
  86. package/dist/ui/button-dropdown.js +4 -652
  87. package/dist/ui/button.js +2 -63
  88. package/dist/ui/card.js +2 -310
  89. package/dist/ui/chart.js +4 -800
  90. package/dist/ui/checkbox.js +4 -335
  91. package/dist/ui/chip.js +4 -402
  92. package/dist/ui/date.js +3 -732
  93. package/dist/ui/drawer.js +3 -757
  94. package/dist/ui/dropdown-table.js +5 -1341
  95. package/dist/ui/dropdown.js +4 -509
  96. package/dist/ui/file-upload.js +3 -622
  97. package/dist/ui/filter.js +5 -380
  98. package/dist/ui/form.js +1 -1
  99. package/dist/ui/index.css +118 -1
  100. package/dist/ui/input.js +3 -1141
  101. package/dist/ui/menu.js +4 -828
  102. package/dist/ui/modal.js +4 -843
  103. package/dist/ui/nav.js +4 -223
  104. package/dist/ui/otp.js +4 -756
  105. package/dist/ui/radio.js +4 -317
  106. package/dist/ui/rich-text-editor.js +4 -1278
  107. package/dist/ui/select.js +5 -2138
  108. package/dist/ui/shadow/accordion.js +4 -273
  109. package/dist/ui/shadow/alert.js +4 -130
  110. package/dist/ui/shadow/breadcrumb.js +5 -744
  111. package/dist/ui/shadow/button-dropdown.js +6 -652
  112. package/dist/ui/shadow/button.js +3 -63
  113. package/dist/ui/shadow/card.js +4 -309
  114. package/dist/ui/shadow/chart.js +6 -1576
  115. package/dist/ui/shadow/checkbox.js +4 -334
  116. package/dist/ui/shadow/chip.js +4 -396
  117. package/dist/ui/shadow/date.js +7 -731
  118. package/dist/ui/shadow/drawer.js +4 -756
  119. package/dist/ui/shadow/dropdown-table.js +8 -1762
  120. package/dist/ui/shadow/dropdown.js +4 -508
  121. package/dist/ui/shadow/file-upload.js +4 -620
  122. package/dist/ui/shadow/filter.js +7 -379
  123. package/dist/ui/shadow/input.js +6 -1140
  124. package/dist/ui/shadow/menu.js +5 -828
  125. package/dist/ui/shadow/modal.js +6 -1063
  126. package/dist/ui/shadow/nav.js +5 -223
  127. package/dist/ui/shadow/otp.js +6 -754
  128. package/dist/ui/shadow/radio.js +4 -316
  129. package/dist/ui/shadow/rich-text-editor.js +4 -1276
  130. package/dist/ui/shadow/select.js +6 -2136
  131. package/dist/ui/shadow/sidebar.js +5 -581
  132. package/dist/ui/shadow/slider.js +5 -1010
  133. package/dist/ui/shadow/switch.js +4 -335
  134. package/dist/ui/shadow/table.js +10 -4501
  135. package/dist/ui/shadow/tabs.js +6 -315
  136. package/dist/ui/shadow/tag-input.js +7 -3057
  137. package/dist/ui/shadow/textarea.js +6 -817
  138. package/dist/ui/sidebar.js +3 -581
  139. package/dist/ui/slider.js +4 -1012
  140. package/dist/ui/switch.js +4 -336
  141. package/dist/ui/table.js +9 -4502
  142. package/dist/ui/tabs.js +4 -315
  143. package/dist/ui/tag-input.js +5 -3058
  144. package/dist/ui/textarea.js +4 -819
  145. package/dist/{vite-CivRCJaf.js → vite-CfW7z2wn.js} +21 -14
  146. package/dist/vite.js +1 -1
  147. package/dist/vue.d.ts +3 -2
  148. package/package.json +10 -11
  149. package/dist/chip-strip-bNfLn52Z.js +0 -215
  150. package/dist/data-source-controller-Dx6IQ2CN.js +0 -243
  151. package/dist/data-source-options-BM4r4PRw.js +0 -558
  152. package/dist/data-source-read-HyBCRg1t.js +0 -242
  153. package/dist/excel-BXzr3uI1.js +0 -784
  154. package/dist/export-ixRdCS2y.js +0 -2388
  155. package/dist/field-tooltip-addon-CWCp19mJ.js +0 -702
  156. package/dist/field-tooltip.css_raw-U5UeTa2d.js +0 -269
  157. package/dist/filter-builder-C0T3pMx2.js +0 -208
  158. package/dist/form-control-core-BbiACMtL.js +0 -226
  159. package/dist/icon-ClxnYhBG.js +0 -19
  160. package/dist/import-Dc4eXC02.js +0 -612
  161. package/dist/light-slots-_no0r2Z-.js +0 -246
  162. package/dist/markdown-uGlE_OfJ.js +0 -20191
  163. package/dist/mono-data-grid-e9ZVBlNN.js +0 -4240
  164. package/dist/normalize-error-BmLbgANw.js +0 -1048
@@ -0,0 +1,821 @@
1
+ import { d as buildSizeStyle } from "./mono-ui-kvLVIf1V.js";
2
+ import { a as defineHybridPropAliases, r as booleanStringConverter, t as __decorate } from "./decorate-DbYFpi8R.js";
3
+ import { t as dispatchMonoEvent } from "./mono-event-CAZf0F_k.js";
4
+ import { t as MonoFormControlCore } from "./form-control-core-CRZPZ1ru.js";
5
+ import { t as FieldTooltipController } from "./field-tooltip-Csk4s2ve.js";
6
+ import { t as FieldValidationController } from "./field-validation-CFmUmuDx.js";
7
+ import { html, isServer, nothing } from "lit";
8
+ import { property, query, state } from "lit/decorators.js";
9
+ import { ifDefined } from "lit/directives/if-defined.js";
10
+ import { styleMap } from "lit/directives/style-map.js";
11
+
12
+ //#region src/components/textarea/textarea-core.ts
13
+ const numberStringConverter = {
14
+ fromAttribute(value) {
15
+ if (value === null || value === "") return void 0;
16
+ const parsed = Number(value);
17
+ return Number.isFinite(parsed) ? parsed : void 0;
18
+ },
19
+ toAttribute(value) {
20
+ if (value === void 0 || value === null) return null;
21
+ return String(value);
22
+ }
23
+ };
24
+ /**
25
+ * `MonoTextareaCore` — render-mode-agnostic logic for `mono-textarea` (props,
26
+ * hybrid aliases, value/model sync, validation, char counter, auto-resize, and
27
+ * the full `render()`). SSR-safe: the only DOM/`window` access (`_syncAutoResize`)
28
+ * is `isServer`-guarded. Each build supplies `createRenderRoot()` + `static styles`
29
+ * and the slot strategy via the `_slotOutlet` hook (light: `data-mono-slot`
30
+ * placeholders; shadow: native `<slot>`). Mirrors `switch-core`/`select-core`.
31
+ */
32
+ const MonoTextareaCore = (superClass) => {
33
+ class MonoTextareaCoreClass extends MonoFormControlCore(superClass) {
34
+ constructor(...args) {
35
+ super(...args);
36
+ this.size = "md";
37
+ this.color = "primary";
38
+ this.variant = "outlined";
39
+ this.labelPosition = "top";
40
+ this.validationPosition = "bottom";
41
+ this.modelValue = "";
42
+ this.value = "";
43
+ this.name = "";
44
+ this.placeholder = "";
45
+ this.label = "";
46
+ this.helperText = "";
47
+ this.tooltip = null;
48
+ this._tooltip = new FieldTooltipController(this, () => this.tooltip);
49
+ this._validation = new FieldValidationController(this, () => ({
50
+ position: this.validationPosition,
51
+ ...this._validationNotice ?? {
52
+ state: void 0,
53
+ text: void 0
54
+ },
55
+ suppressed: false
56
+ }), () => this.renderRoot?.querySelector?.("[mono-textarea] > textarea[mono-native]"));
57
+ this.validationState = "default";
58
+ this.validationMessage = "";
59
+ this.errorMessage = "";
60
+ this.successMessage = "";
61
+ this.disabled = false;
62
+ this.readonly = false;
63
+ this.required = false;
64
+ this.autofocus = false;
65
+ this.autoResize = false;
66
+ this.showCounter = false;
67
+ this.cssClass = {};
68
+ this.cssClassName = "";
69
+ this._hasLabelSlotState = false;
70
+ this._hasHelperSlotState = false;
71
+ this._textareaId = `mono-textarea-${Math.random().toString(36).slice(2)}`;
72
+ this._messageId = `${this._textareaId}-message`;
73
+ this._lastAutoResizeWidth = -1;
74
+ defineHybridPropAliases(this, [
75
+ "labelPosition",
76
+ "validationPosition",
77
+ "modelValue",
78
+ "helperText",
79
+ "validationState",
80
+ "validationMessage",
81
+ "errorMessage",
82
+ "successMessage",
83
+ "autoResize",
84
+ "minRows",
85
+ "maxRows",
86
+ "minLength",
87
+ "maxLength",
88
+ "showCounter",
89
+ "ariaLabelText",
90
+ "cssClass",
91
+ "minWidth",
92
+ "maxWidth",
93
+ "minHeight",
94
+ "maxHeight"
95
+ ]);
96
+ /**
97
+ * Vue support:
98
+ *
99
+ * <mono-textarea :cssClass="{}" />
100
+ * <mono-textarea :css-class="{}" />
101
+ * <mono-textarea :cssclass="{}" />
102
+ */
103
+ Object.defineProperty(this, "css-class", {
104
+ get: () => this.cssClass,
105
+ set: (value) => {
106
+ this._setCssClass(value);
107
+ },
108
+ configurable: true,
109
+ enumerable: false
110
+ });
111
+ Object.defineProperty(this, "cssclass", {
112
+ get: () => this.cssClass,
113
+ set: (value) => {
114
+ this._setCssClass(value);
115
+ },
116
+ configurable: true,
117
+ enumerable: false
118
+ });
119
+ Object.defineProperty(this, "ariaLabel", {
120
+ get: () => this.ariaLabelText,
121
+ set: (value) => {
122
+ this.ariaLabelText = value == null ? void 0 : String(value);
123
+ },
124
+ configurable: true,
125
+ enumerable: false
126
+ });
127
+ Object.defineProperty(this, "aria-label", {
128
+ get: () => this.ariaLabelText,
129
+ set: (value) => {
130
+ this.ariaLabelText = value == null ? void 0 : String(value);
131
+ },
132
+ configurable: true,
133
+ enumerable: false
134
+ });
135
+ Object.defineProperty(this, "arialabel", {
136
+ get: () => this.ariaLabelText,
137
+ set: (value) => {
138
+ this.ariaLabelText = value == null ? void 0 : String(value);
139
+ },
140
+ configurable: true,
141
+ enumerable: false
142
+ });
143
+ Object.defineProperty(this, "maxlength", {
144
+ get: () => this.maxLength,
145
+ set: (value) => {
146
+ this.maxLength = this._toOptionalNumber(value);
147
+ },
148
+ configurable: true,
149
+ enumerable: false
150
+ });
151
+ Object.defineProperty(this, "minlength", {
152
+ get: () => this.minLength,
153
+ set: (value) => {
154
+ this.minLength = this._toOptionalNumber(value);
155
+ },
156
+ configurable: true,
157
+ enumerable: false
158
+ });
159
+ }
160
+ static get observedAttributes() {
161
+ return [
162
+ ...super.observedAttributes ?? [],
163
+ "modelvalue",
164
+ "helpertext",
165
+ "validationstate",
166
+ "validationmessage",
167
+ "errormessage",
168
+ "successmessage",
169
+ "autoresize",
170
+ "minrows",
171
+ "maxrows",
172
+ "minlength",
173
+ "maxlength",
174
+ "showcounter",
175
+ "arialabeltext",
176
+ "arialabel",
177
+ "css-class",
178
+ "cssclass"
179
+ ];
180
+ }
181
+ attributeChangedCallback(name, oldValue, newValue) {
182
+ super.attributeChangedCallback(name, oldValue, newValue);
183
+ if (oldValue === newValue) return;
184
+ if (name === "modelvalue") {
185
+ this.modelValue = newValue ?? "";
186
+ return;
187
+ }
188
+ if (name === "helpertext") {
189
+ this.helperText = newValue ?? "";
190
+ return;
191
+ }
192
+ if (name === "validationstate") {
193
+ this.validationState = newValue ?? "default";
194
+ return;
195
+ }
196
+ if (name === "validationmessage") {
197
+ this.validationMessage = newValue ?? "";
198
+ return;
199
+ }
200
+ if (name === "errormessage") {
201
+ this.errorMessage = newValue ?? "";
202
+ return;
203
+ }
204
+ if (name === "successmessage") {
205
+ this.successMessage = newValue ?? "";
206
+ return;
207
+ }
208
+ if (name === "autoresize") {
209
+ this.autoResize = this._toBoolean(newValue);
210
+ return;
211
+ }
212
+ if (name === "minrows") {
213
+ this.minRows = this._toOptionalNumber(newValue);
214
+ return;
215
+ }
216
+ if (name === "maxrows") {
217
+ this.maxRows = this._toOptionalNumber(newValue);
218
+ return;
219
+ }
220
+ if (name === "minlength") {
221
+ this.minLength = this._toOptionalNumber(newValue);
222
+ return;
223
+ }
224
+ if (name === "maxlength") {
225
+ this.maxLength = this._toOptionalNumber(newValue);
226
+ return;
227
+ }
228
+ if (name === "showcounter") {
229
+ this.showCounter = this._toBoolean(newValue);
230
+ return;
231
+ }
232
+ if (name === "arialabeltext" || name === "arialabel") {
233
+ this.ariaLabelText = newValue ?? void 0;
234
+ return;
235
+ }
236
+ if (name === "css-class" || name === "cssclass") this._setCssClass(newValue);
237
+ }
238
+ /** The validation message and its state — the same precedence the message row uses. */
239
+ get _validationNotice() {
240
+ if (this.validationMessage) return {
241
+ state: this._resolvedValidationState,
242
+ text: this.validationMessage
243
+ };
244
+ if (this.errorMessage) return {
245
+ state: "invalid",
246
+ text: this.errorMessage
247
+ };
248
+ if (this.successMessage) return {
249
+ state: "valid",
250
+ text: this.successMessage
251
+ };
252
+ return null;
253
+ }
254
+ /** The message that moved to the icon / float bubble, kept for assistive tech only. */
255
+ _renderMovedMessage() {
256
+ const notice = this._validationNotice;
257
+ return html`<div
258
+ class=${`${this._cls("mono-textarea-message", "message")} ${notice.state}`}
259
+ mono-message=${notice.state}
260
+ mono-sr-only
261
+ role=${notice.state === "invalid" ? "alert" : nothing}
262
+ >${notice.text}</div>`;
263
+ }
264
+ willUpdate(changed) {
265
+ for (const key of [
266
+ "disabled",
267
+ "readonly",
268
+ "required",
269
+ "autofocus",
270
+ "autoResize",
271
+ "showCounter"
272
+ ]) {
273
+ const v = this[key];
274
+ if (typeof v !== "boolean") this[key] = this._toBoolean(v);
275
+ }
276
+ if (changed.has("modelValue") && this.value !== this.modelValue) this.value = this.modelValue ?? "";
277
+ if (changed.has("value") && this.modelValue !== this.value) this.modelValue = String(this.value ?? "");
278
+ }
279
+ connectedCallback() {
280
+ super.connectedCallback();
281
+ if (isServer) return;
282
+ this._setupAutoResizeObserver();
283
+ this._syncAutoResize();
284
+ }
285
+ disconnectedCallback() {
286
+ this._teardownAutoResizeObserver();
287
+ super.disconnectedCallback();
288
+ }
289
+ firstUpdated() {
290
+ if (isServer) return;
291
+ if (this.autofocus) this.focus();
292
+ this._syncAutoResize();
293
+ }
294
+ /**
295
+ * Recompute the height when the element's WIDTH changes.
296
+ *
297
+ * The reconnect hook above only covers being moved; the same staleness happens on a
298
+ * window resize, a sidebar opening, or any layout shift that renarrows the column.
299
+ * Width is the real input to the height calculation, so watch it directly.
300
+ */
301
+ _setupAutoResizeObserver() {
302
+ if (isServer || this._autoResizeRo) return;
303
+ if (typeof ResizeObserver === "undefined") return;
304
+ this._autoResizeRo = new ResizeObserver(() => {
305
+ if (!this.autoResize) return;
306
+ const width = this.getBoundingClientRect().width;
307
+ if (width === this._lastAutoResizeWidth) return;
308
+ this._lastAutoResizeWidth = width;
309
+ this._syncAutoResize();
310
+ });
311
+ this._autoResizeRo.observe(this);
312
+ }
313
+ _teardownAutoResizeObserver() {
314
+ this._autoResizeRo?.disconnect();
315
+ this._autoResizeRo = void 0;
316
+ this._lastAutoResizeWidth = -1;
317
+ }
318
+ updated(changed) {
319
+ super.updated(changed);
320
+ if (isServer) return;
321
+ if (changed.has("value") || changed.has("modelValue") || changed.has("autoResize") || changed.has("minRows") || changed.has("maxRows")) this._syncAutoResize();
322
+ }
323
+ _setCssClass(value) {
324
+ if (value == null) {
325
+ this.cssClass = {};
326
+ this.cssClassName = "";
327
+ return;
328
+ }
329
+ if (typeof value === "object") {
330
+ this.cssClass = value;
331
+ return;
332
+ }
333
+ if (typeof value === "string") {
334
+ const trimmed = value.trim();
335
+ if (!trimmed) {
336
+ this.cssClass = {};
337
+ this.cssClassName = "";
338
+ return;
339
+ }
340
+ /**
341
+ * Optional HTML object support:
342
+ *
343
+ * <mono-textarea css-class='{"root":"...", "field":"..."}'></mono-textarea>
344
+ */
345
+ if (trimmed.startsWith("{") && trimmed.endsWith("}")) try {
346
+ this.cssClass = JSON.parse(trimmed);
347
+ return;
348
+ } catch {}
349
+ this.cssClassName = trimmed;
350
+ }
351
+ }
352
+ _toBoolean(value) {
353
+ if (typeof value === "boolean") return value;
354
+ if (typeof value === "string") {
355
+ const normalized = value.toLowerCase().trim();
356
+ return normalized === "" || normalized === "true";
357
+ }
358
+ return Boolean(value);
359
+ }
360
+ _toOptionalNumber(value) {
361
+ if (value === void 0 || value === null || value === "") return void 0;
362
+ const parsed = Number(value);
363
+ return Number.isFinite(parsed) ? parsed : void 0;
364
+ }
365
+ _cls(base, key) {
366
+ const extra = this.cssClass?.[key];
367
+ return extra ? `${base} ${extra}` : base;
368
+ }
369
+ get _hasLabelSlot() {
370
+ return this._hasLabelSlotState;
371
+ }
372
+ get _hasHelperSlot() {
373
+ return this._hasHelperSlotState;
374
+ }
375
+ get _resolvedValidationState() {
376
+ if (this.validationState && this.validationState !== "default") return this.validationState;
377
+ if (this.errorMessage) return "invalid";
378
+ if (this.successMessage) return "valid";
379
+ return "default";
380
+ }
381
+ get _wrapperClasses() {
382
+ return [
383
+ "mono-textarea",
384
+ this.size,
385
+ this.color,
386
+ this.variant,
387
+ this.disabled ? "disabled" : "",
388
+ this.readonly ? "readonly" : "",
389
+ this._resolvedValidationState !== "default" ? `is-${this._resolvedValidationState}` : "",
390
+ this.value ? "has-value" : "",
391
+ this.autoResize ? "auto-resize" : "",
392
+ this.cssClassName,
393
+ this.cssClass?.root
394
+ ].filter(Boolean).join(" ");
395
+ }
396
+ get _fieldClasses() {
397
+ return [
398
+ this._cls("mono-textarea-field", "field"),
399
+ this.size,
400
+ this.color,
401
+ this.variant
402
+ ].filter(Boolean).join(" ");
403
+ }
404
+ /** `near` at 85% of the cap, `over` past it — the attribute twin of the class. */
405
+ get _counterState() {
406
+ const max = this.maxLength;
407
+ if (max === void 0) return "default";
408
+ const length = this.value.length;
409
+ if (length > max) return "over";
410
+ if (length >= Math.floor(max * .85)) return "near";
411
+ return "default";
412
+ }
413
+ get _counterClass() {
414
+ const length = this.value.length;
415
+ const max = this.maxLength;
416
+ if (max !== void 0 && length > max) return `${this._cls("mono-textarea-counter", "counter")} over`;
417
+ if (max !== void 0 && length >= Math.floor(max * .85)) return `${this._cls("mono-textarea-counter", "counter")} near`;
418
+ return this._cls("mono-textarea-counter", "counter");
419
+ }
420
+ get _shouldShowFooter() {
421
+ return Boolean(this.validationMessage || this.errorMessage || this.successMessage || this.helperText || this._hasHelperSlot || this.showCounter);
422
+ }
423
+ _createModelDetail(args) {
424
+ return {
425
+ modelValue: args.modelValue,
426
+ currentValue: args.modelValue,
427
+ oldValue: args.oldValue,
428
+ value: args.modelValue,
429
+ name: this.name,
430
+ sourceEvent: args.sourceEvent
431
+ };
432
+ }
433
+ _emitInput(detail) {
434
+ dispatchMonoEvent(this, "input", detail);
435
+ }
436
+ _emitChange(detail) {
437
+ dispatchMonoEvent(this, "change", detail);
438
+ }
439
+ _handleInput(event) {
440
+ if (this.disabled || this.readonly) return;
441
+ const textarea = event.currentTarget;
442
+ const oldValue = this.modelValue;
443
+ const nextValue = textarea.value;
444
+ this.value = nextValue;
445
+ this.modelValue = nextValue;
446
+ const detail = this._createModelDetail({
447
+ modelValue: nextValue,
448
+ oldValue,
449
+ sourceEvent: event
450
+ });
451
+ this._emitInput(detail);
452
+ this._syncAutoResize();
453
+ }
454
+ _handleChange(event) {
455
+ if (this.disabled || this.readonly) return;
456
+ const textarea = event.currentTarget;
457
+ const oldValue = this.modelValue;
458
+ const nextValue = textarea.value;
459
+ this.value = nextValue;
460
+ this.modelValue = nextValue;
461
+ const detail = this._createModelDetail({
462
+ modelValue: nextValue,
463
+ oldValue,
464
+ sourceEvent: event
465
+ });
466
+ this._emitChange(detail);
467
+ }
468
+ _syncAutoResize() {
469
+ if (isServer) return;
470
+ if (!this.autoResize || !this._textareaEl) return;
471
+ const textarea = this._textareaEl;
472
+ const computed = window.getComputedStyle(textarea);
473
+ const lineHeight = Number.parseFloat(computed.lineHeight) || 20;
474
+ const paddingTop = Number.parseFloat(computed.paddingTop) || 0;
475
+ const paddingBottom = Number.parseFloat(computed.paddingBottom) || 0;
476
+ const borderTop = Number.parseFloat(computed.borderTopWidth) || 0;
477
+ const borderBottom = Number.parseFloat(computed.borderBottomWidth) || 0;
478
+ const minRows = this.minRows ?? this.rows;
479
+ const maxRows = this.maxRows;
480
+ const minHeight = minRows !== void 0 ? lineHeight * minRows + paddingTop + paddingBottom + borderTop + borderBottom : void 0;
481
+ const maxHeight = maxRows !== void 0 ? lineHeight * maxRows + paddingTop + paddingBottom + borderTop + borderBottom : void 0;
482
+ textarea.style.height = "auto";
483
+ let nextHeight = textarea.scrollHeight;
484
+ if (minHeight !== void 0) nextHeight = Math.max(nextHeight, minHeight);
485
+ if (maxHeight !== void 0) {
486
+ nextHeight = Math.min(nextHeight, maxHeight);
487
+ textarea.style.overflowY = textarea.scrollHeight > maxHeight ? "auto" : "hidden";
488
+ } else textarea.style.overflowY = "hidden";
489
+ textarea.style.height = `${nextHeight}px`;
490
+ }
491
+ _renderLabel() {
492
+ const hasContent = !!this.label || this._hasLabelSlotState;
493
+ if (!hasContent && !this._slotsAlwaysRender) return nothing;
494
+ return html`
495
+ <label
496
+ class=${this._cls("mono-textarea-label", "label")}
497
+ mono-label
498
+ for=${this._textareaId}
499
+ ?mono-empty=${!hasContent}
500
+ >
501
+ ${this._slotOutlet("label", this.label)}
502
+
503
+ ${this.required ? html`
504
+ <span class=${this._cls("mono-textarea-required", "required")} mono-required-mark>
505
+ *
506
+ </span>
507
+ ` : nothing}
508
+ ${this._tooltip.render()}
509
+ </label>
510
+ `;
511
+ }
512
+ _renderMessage() {
513
+ if (this._validation.moved) return html`${this._renderHelperText()}${this._renderMovedMessage()}`;
514
+ if (this.validationMessage) return html`
515
+ <div
516
+ class=${`${this._cls("mono-textarea-message", "message")} ${this._resolvedValidationState}`}
517
+ mono-message=${this._resolvedValidationState}
518
+ >
519
+ ${this.validationMessage}
520
+ </div>
521
+ `;
522
+ if (this.errorMessage) return html`
523
+ <div class=${`${this._cls("mono-textarea-message", "message")} invalid`} mono-message="invalid">
524
+ ${this.errorMessage}
525
+ </div>
526
+ `;
527
+ if (this.successMessage) return html`
528
+ <div class=${`${this._cls("mono-textarea-message", "message")} valid`} mono-message="valid">
529
+ ${this.successMessage}
530
+ </div>
531
+ `;
532
+ return this._renderHelperText();
533
+ }
534
+ _renderHelperText() {
535
+ if (this.helperText || this._hasHelperSlot || this._slotsAlwaysRender) return html`
536
+ <div
537
+ class=${`${this._cls("mono-textarea-message", "message")} helper`}
538
+ mono-message="helper"
539
+ ?mono-empty=${!this.helperText && !this._hasHelperSlot}
540
+ >
541
+ ${this._slotOutlet("helper", this.helperText)}
542
+ </div>
543
+ `;
544
+ return nothing;
545
+ }
546
+ _renderCounter() {
547
+ if (!this.showCounter) return nothing;
548
+ const max = this.maxLength;
549
+ const length = this.value.length;
550
+ return html`
551
+ <div
552
+ class=${this._counterClass}
553
+ mono-counter
554
+ ?mono-near=${this._counterState === "near"}
555
+ ?mono-over=${this._counterState === "over"}
556
+ >
557
+ ${max !== void 0 ? `${length}/${max}` : length}
558
+ </div>
559
+ `;
560
+ }
561
+ _renderFooter() {
562
+ if (!this._shouldShowFooter && !this._slotsAlwaysRender) return nothing;
563
+ return html`
564
+ <div
565
+ class=${this._cls("mono-textarea-footer", "footer")}
566
+ mono-footer
567
+ ?mono-empty=${!this._shouldShowFooter}
568
+ >
569
+ <div class=${this.cssClass?.messageWrap ?? ""} mono-message-wrap>
570
+ ${this._renderMessage()}
571
+ </div>
572
+
573
+ ${this._renderCounter()}
574
+ </div>
575
+ `;
576
+ }
577
+ /** Inline sizing applied to the root wrapper. */
578
+ _sizeStyle() {
579
+ return buildSizeStyle(this);
580
+ }
581
+ render() {
582
+ const describedBy = this._shouldShowFooter ? this._messageId : void 0;
583
+ const ariaLabel = this.ariaLabelText || this.label || this.placeholder || void 0;
584
+ return html`
585
+ <div
586
+ class=${this._wrapperClasses}
587
+ style=${styleMap(this._sizeStyle())}
588
+ mono-textarea
589
+ mono-size=${this.size === "md" ? nothing : this.size}
590
+ mono-color=${this.color === "primary" ? nothing : this.color}
591
+ mono-variant=${this.variant === "outlined" ? nothing : this.variant}
592
+ mono-label-position=${this.labelPosition === "top" ? nothing : this.labelPosition}
593
+ mono-validation-position=${this.validationPosition === "bottom" ? nothing : this.validationPosition}
594
+ mono-validation-state=${this._resolvedValidationState === "default" ? nothing : this._resolvedValidationState}
595
+ ?mono-disabled=${this.disabled}
596
+ ?mono-readonly=${this.readonly}
597
+ ?mono-required=${this.required}
598
+ ?mono-auto-resize=${this.autoResize}
599
+ >
600
+ ${this._renderLabel()}
601
+
602
+ ${this._validation.renderIcon({ anchored: true })}
603
+ <textarea
604
+ id=${this._textareaId}
605
+ class=${this._fieldClasses}
606
+ mono-native
607
+ .value=${this.value}
608
+ name=${ifDefined(this.name || void 0)}
609
+ placeholder=${ifDefined(this.placeholder || void 0)}
610
+ rows=${ifDefined(this.rows)}
611
+ minlength=${ifDefined(this.minLength)}
612
+ maxlength=${ifDefined(this.maxLength)}
613
+ ?disabled=${this.disabled}
614
+ ?readonly=${this.readonly}
615
+ ?required=${this.required}
616
+ aria-label=${ifDefined(ariaLabel)}
617
+ aria-invalid=${this._resolvedValidationState === "invalid" ? "true" : "false"}
618
+ aria-describedby=${ifDefined(describedBy)}
619
+ @input=${this._handleInput}
620
+ @change=${this._handleChange}
621
+ ></textarea>
622
+
623
+ <div id=${this._messageId} mono-message-outlet>
624
+ ${this._renderFooter()}
625
+ </div>
626
+
627
+ ${this._validation.renderFloat()}
628
+ </div>
629
+ `;
630
+ }
631
+ focus(options) {
632
+ this._textareaEl?.focus(options);
633
+ }
634
+ blur() {
635
+ this._textareaEl?.blur();
636
+ }
637
+ select() {
638
+ this._textareaEl?.select();
639
+ }
640
+ setSelectionRange(start, end, direction) {
641
+ this._textareaEl?.setSelectionRange(start, end, direction);
642
+ }
643
+ /** Whether the slot regions render even when empty. Light: no. Shadow: yes —
644
+ * the native `<slot>`s must exist to project DSD content + be scanned
645
+ * (hidden via `[data-empty]` when empty). */
646
+ get _slotsAlwaysRender() {
647
+ return false;
648
+ }
649
+ _hasSlot(name) {
650
+ return name === "label" ? this._hasLabelSlotState : this._hasHelperSlotState;
651
+ }
652
+ _setSlotState(name, has) {
653
+ if (name === "label") this._hasLabelSlotState = has;
654
+ else this._hasHelperSlotState = has;
655
+ }
656
+ /**
657
+ * Slot outlet. Light build (default): a `data-mono-slot` placeholder the
658
+ * captured light-DOM nodes are re-parented into when present, else the prop
659
+ * `fallback`. Shadow build overrides this with a native `<slot name>`.
660
+ */
661
+ _slotOutlet(name, fallback = nothing) {
662
+ return this._hasSlot(name) ? html`<span data-mono-slot=${name}></span>` : html`${fallback}`;
663
+ }
664
+ }
665
+ __decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "size", void 0);
666
+ __decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "color", void 0);
667
+ __decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "variant", void 0);
668
+ __decorate([property({
669
+ type: String,
670
+ attribute: "label-position"
671
+ })], MonoTextareaCoreClass.prototype, "labelPosition", void 0);
672
+ __decorate([property({
673
+ type: String,
674
+ attribute: "validation-position"
675
+ })], MonoTextareaCoreClass.prototype, "validationPosition", void 0);
676
+ __decorate([property({
677
+ type: String,
678
+ attribute: "model-value",
679
+ reflect: true
680
+ })], MonoTextareaCoreClass.prototype, "modelValue", void 0);
681
+ __decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "value", void 0);
682
+ __decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "name", void 0);
683
+ __decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "placeholder", void 0);
684
+ __decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "label", void 0);
685
+ __decorate([property({
686
+ type: String,
687
+ attribute: "helper-text"
688
+ })], MonoTextareaCoreClass.prototype, "helperText", void 0);
689
+ __decorate([property()], MonoTextareaCoreClass.prototype, "tooltip", void 0);
690
+ __decorate([property({
691
+ type: String,
692
+ attribute: "validation-state"
693
+ })], MonoTextareaCoreClass.prototype, "validationState", void 0);
694
+ __decorate([property({
695
+ type: String,
696
+ attribute: "validation-message"
697
+ })], MonoTextareaCoreClass.prototype, "validationMessage", void 0);
698
+ __decorate([property({
699
+ type: String,
700
+ attribute: "error-message"
701
+ })], MonoTextareaCoreClass.prototype, "errorMessage", void 0);
702
+ __decorate([property({
703
+ type: String,
704
+ attribute: "success-message"
705
+ })], MonoTextareaCoreClass.prototype, "successMessage", void 0);
706
+ __decorate([property({
707
+ type: String,
708
+ attribute: "aria-label"
709
+ })], MonoTextareaCoreClass.prototype, "ariaLabelText", void 0);
710
+ __decorate([property({
711
+ reflect: true,
712
+ converter: booleanStringConverter
713
+ })], MonoTextareaCoreClass.prototype, "disabled", void 0);
714
+ __decorate([property({
715
+ reflect: true,
716
+ converter: booleanStringConverter
717
+ })], MonoTextareaCoreClass.prototype, "readonly", void 0);
718
+ __decorate([property({
719
+ reflect: true,
720
+ converter: booleanStringConverter
721
+ })], MonoTextareaCoreClass.prototype, "required", void 0);
722
+ __decorate([property({
723
+ reflect: true,
724
+ converter: booleanStringConverter
725
+ })], MonoTextareaCoreClass.prototype, "autofocus", void 0);
726
+ __decorate([property({
727
+ attribute: "auto-resize",
728
+ reflect: true,
729
+ converter: booleanStringConverter
730
+ })], MonoTextareaCoreClass.prototype, "autoResize", void 0);
731
+ __decorate([property({
732
+ attribute: "show-counter",
733
+ reflect: true,
734
+ converter: booleanStringConverter
735
+ })], MonoTextareaCoreClass.prototype, "showCounter", void 0);
736
+ __decorate([property({ converter: numberStringConverter })], MonoTextareaCoreClass.prototype, "rows", void 0);
737
+ __decorate([property({
738
+ attribute: "min-rows",
739
+ converter: numberStringConverter
740
+ })], MonoTextareaCoreClass.prototype, "minRows", void 0);
741
+ __decorate([property({
742
+ attribute: "max-rows",
743
+ converter: numberStringConverter
744
+ })], MonoTextareaCoreClass.prototype, "maxRows", void 0);
745
+ __decorate([property({
746
+ attribute: "min-length",
747
+ converter: numberStringConverter
748
+ })], MonoTextareaCoreClass.prototype, "minLength", void 0);
749
+ __decorate([property({
750
+ attribute: "max-length",
751
+ converter: numberStringConverter
752
+ })], MonoTextareaCoreClass.prototype, "maxLength", void 0);
753
+ __decorate([property({ attribute: false })], MonoTextareaCoreClass.prototype, "cssClass", void 0);
754
+ __decorate([property({ attribute: false })], MonoTextareaCoreClass.prototype, "cssClassName", void 0);
755
+ __decorate([state()], MonoTextareaCoreClass.prototype, "_hasLabelSlotState", void 0);
756
+ __decorate([state()], MonoTextareaCoreClass.prototype, "_hasHelperSlotState", void 0);
757
+ __decorate([query(".mono-textarea-field")], MonoTextareaCoreClass.prototype, "_textareaEl", void 0);
758
+ __decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "width", void 0);
759
+ __decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "height", void 0);
760
+ __decorate([property({
761
+ type: String,
762
+ attribute: "min-width"
763
+ })], MonoTextareaCoreClass.prototype, "minWidth", void 0);
764
+ __decorate([property({
765
+ type: String,
766
+ attribute: "max-width"
767
+ })], MonoTextareaCoreClass.prototype, "maxWidth", void 0);
768
+ __decorate([property({
769
+ type: String,
770
+ attribute: "min-height"
771
+ })], MonoTextareaCoreClass.prototype, "minHeight", void 0);
772
+ __decorate([property({
773
+ type: String,
774
+ attribute: "max-height"
775
+ })], MonoTextareaCoreClass.prototype, "maxHeight", void 0);
776
+ return MonoTextareaCoreClass;
777
+ };
778
+
779
+ //#endregion
780
+ //#region src/components/textarea/textarea-utils.ts
781
+ function validateTextareaProps(props) {
782
+ const validSizes = [
783
+ "xs",
784
+ "sm",
785
+ "md",
786
+ "lg",
787
+ "xl",
788
+ "xxl"
789
+ ];
790
+ const validColors = [
791
+ "primary",
792
+ "secondary",
793
+ "success",
794
+ "danger",
795
+ "warning",
796
+ "info",
797
+ "teal",
798
+ "purple",
799
+ "neutral",
800
+ "dark"
801
+ ];
802
+ const validVariants = [
803
+ "outlined",
804
+ "filled",
805
+ "underlined"
806
+ ];
807
+ const validStates = [
808
+ "default",
809
+ "valid",
810
+ "invalid",
811
+ "warning"
812
+ ];
813
+ if (props.size && !validSizes.includes(props.size)) return false;
814
+ if (props.color && !validColors.includes(props.color)) return false;
815
+ if (props.variant && !validVariants.includes(props.variant)) return false;
816
+ if (props.validationState && !validStates.includes(props.validationState)) return false;
817
+ return true;
818
+ }
819
+
820
+ //#endregion
821
+ export { MonoTextareaCore as n, validateTextareaProps as t };