@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.
- package/dist/accordion-core-DaNyPWRr.js +277 -0
- package/dist/alert-core-DWtHbX_-.js +134 -0
- package/dist/breadcrumb-list-core-Dh68T8Cf.js +747 -0
- package/dist/{mono-button-CLkHg3WW.js → button-core-DerXg84Q.js} +3 -276
- package/dist/button-dropdown-core-DKYEOyjy.js +654 -0
- package/dist/button-utils-D5-66M02.js +63 -0
- package/dist/card-utils-l80qAmrN.js +312 -0
- package/dist/chart-core-DV7hD3ZY.js +801 -0
- package/dist/checkbox-utils-DKdrhAzF.js +337 -0
- package/dist/chip-utils-DpRrd7Zj.js +403 -0
- package/dist/{data-source-controller-C6C4ej_M.js → data-source-controller-DS_JLrmS.js} +1 -1
- package/dist/{data-source-options-fxT5QIX4.js → data-source-options-DJUNU26C.js} +6 -6
- package/dist/{data-source-read-BL266IW0.js → data-source-read-uKJpRAzx.js} +2 -2
- package/dist/date-core-CyuSyvvG.js +734 -0
- package/dist/drawer-core-DbFWvNln.js +759 -0
- package/dist/dropdown-core-BCH1pK14.js +511 -0
- package/dist/dropdown-table-core-SfHUJVFq.js +1342 -0
- package/dist/export.js +1 -1
- package/dist/{field-path-BabiMrrA.js → field-path-DK2VBWHl.js} +1 -1
- package/dist/field-tooltip.css_raw-DVblekCl.js +5 -0
- package/dist/{field-validation.css_raw-Cx6SGrfP.js → field-validation.css_raw-BU7C6173.js} +1 -170
- package/dist/file-upload-core-Cz_dBQMx.js +624 -0
- package/dist/filter-builder-core-DyWjbBP7.js +381 -0
- package/dist/{filter-builder-B6Y2mmbM.js → filter-builder-vbqIuPhX.js} +1 -1
- package/dist/{filter-eval-ChDSaAUH.js → filter-eval-CqeBnMYh.js} +1 -1
- package/dist/{filter-odata-Bi27XUpQ.js → filter-odata-GsczYKNC.js} +1 -1
- package/dist/{hydration-flush-BaE9gN3C.js → hydration-flush-Volt9X7Q.js} +2 -1071
- package/dist/index.js +11 -11
- package/dist/{index.node-DTqDBca7.js → index.node-Csy9zrr1.js} +4 -4
- package/dist/index.node.js +11 -11
- package/dist/input-utils-BglY-k0H.js +1145 -0
- package/dist/menu-core-DkAYuCZ2.js +831 -0
- package/dist/modal-core-CSBSPN_m.js +844 -0
- package/dist/mono-button-DVvZ03P-.js +280 -0
- package/dist/{mono-button.shadow-DqZMpcqY.js → mono-button.shadow-BANxMGln.js} +6 -594
- package/dist/{mono-data-chart-NKPdAgVq.js → mono-data-chart-ChF4J9RT.js} +6 -6
- package/dist/{mono-data-dropdown-B2iRpJuI.js → mono-data-dropdown-Bgj2PDfm.js} +1 -1
- package/dist/{mono-data-grid-llJCX9MC.js → mono-data-grid-DJkp96N-.js} +144 -46
- package/dist/{mono-event-BPku9HpS.js → mono-event-CAZf0F_k.js} +14 -9
- package/dist/{mono-form-controller-BrA10erm.js → mono-form-controller-DxZLvyg6.js} +2 -1
- package/dist/mono-table-checkbox-core-BKOMx8R5.js +5288 -0
- package/dist/nav-core-B5qU2dzn.js +225 -0
- package/dist/{normalize-error-D93O4q8g.js → normalize-error-BEcd1tmS.js} +2 -2
- package/dist/nuxt.js +1 -1
- package/dist/otp-core-DXg3vFLh.js +758 -0
- package/dist/radio-utils-Dk9Tl1jz.js +319 -0
- package/dist/rich-text-editor-core-Ddd_QaLn.js +1280 -0
- package/dist/select-utils-BgArYHk8.js +2140 -0
- package/dist/sidebar-core-CD6txDo3.js +583 -0
- package/dist/slider-core-vcWr321-.js +1014 -0
- package/dist/src/components/dropdown-table/dropdown-table-core.d.ts +2 -2
- package/dist/src/components/dropdown-table/dropdown-table-types.d.ts +1 -1
- package/dist/src/components/dropdown-table/index.d.ts +1 -1
- package/dist/src/components/dropdown-table/index.shadow.d.ts +1 -1
- package/dist/src/components/dropdown-table/mono-data-dropdown.d.ts +1 -1
- package/dist/src/components/form/form-types.d.ts +9 -3
- package/dist/src/components/input/input-core.d.ts +1 -1
- package/dist/src/components/input/input-types.d.ts +1 -1
- package/dist/src/components/otp/otp-core.d.ts +1 -1
- package/dist/src/components/select/select-core.d.ts +1 -1
- package/dist/src/components/select/select-types.d.ts +1 -1
- package/dist/src/components/slider/slider-core.d.ts +1 -1
- package/dist/src/components/slider/slider-types.d.ts +1 -1
- package/dist/src/components/table/filter-suggestion.d.ts +171 -0
- package/dist/src/components/table/index.d.ts +5 -4
- package/dist/src/components/table/index.shadow.d.ts +5 -4
- package/dist/src/components/table/mono-data-grid.d.ts +22 -3
- package/dist/src/components/table/mono-table-empty-core.d.ts +37 -0
- package/dist/src/components/table/mono-table-search-core.d.ts +22 -3
- package/dist/src/components/table/table-types.d.ts +74 -4
- package/dist/src/components/tag-input/tag-input-core.d.ts +1 -1
- package/dist/src/components/tag-input/tag-input-types.d.ts +1 -1
- package/dist/src/components/textarea/textarea-core.d.ts +1 -1
- package/dist/src/composables/mono-event.d.ts +7 -1
- package/dist/src/entries/index.d.ts +8 -6
- package/dist/src/entries/index.node.d.ts +8 -6
- package/dist/src/search/index.d.ts +1 -1
- package/dist/src/utils/group-count.d.ts +36 -0
- package/dist/switch-utils-CTZ4id2V.js +338 -0
- package/dist/tabs-core-r5-B8k_N.js +317 -0
- package/dist/tag-input-utils-D2JA90DQ.js +3060 -0
- package/dist/textarea-utils-VU1KeXm8.js +821 -0
- package/dist/ui/accordion.js +2 -274
- package/dist/ui/alert.js +2 -131
- package/dist/ui/breadcrumb.js +4 -745
- package/dist/ui/button-dropdown.js +4 -652
- package/dist/ui/button.js +2 -63
- package/dist/ui/card.js +2 -310
- package/dist/ui/chart.js +4 -800
- package/dist/ui/checkbox.js +4 -335
- package/dist/ui/chip.js +4 -402
- package/dist/ui/date.js +3 -732
- package/dist/ui/drawer.js +3 -757
- package/dist/ui/dropdown-table.js +5 -1341
- package/dist/ui/dropdown.js +4 -509
- package/dist/ui/file-upload.js +3 -622
- package/dist/ui/filter.js +5 -380
- package/dist/ui/form.js +1 -1
- package/dist/ui/index.css +118 -1
- package/dist/ui/input.js +3 -1141
- package/dist/ui/menu.js +4 -828
- package/dist/ui/modal.js +4 -843
- package/dist/ui/nav.js +4 -223
- package/dist/ui/otp.js +4 -756
- package/dist/ui/radio.js +4 -317
- package/dist/ui/rich-text-editor.js +4 -1278
- package/dist/ui/select.js +5 -2138
- package/dist/ui/shadow/accordion.js +4 -273
- package/dist/ui/shadow/alert.js +4 -130
- package/dist/ui/shadow/breadcrumb.js +5 -744
- package/dist/ui/shadow/button-dropdown.js +6 -652
- package/dist/ui/shadow/button.js +3 -63
- package/dist/ui/shadow/card.js +4 -309
- package/dist/ui/shadow/chart.js +6 -1576
- package/dist/ui/shadow/checkbox.js +4 -334
- package/dist/ui/shadow/chip.js +4 -396
- package/dist/ui/shadow/date.js +7 -731
- package/dist/ui/shadow/drawer.js +4 -756
- package/dist/ui/shadow/dropdown-table.js +8 -1762
- package/dist/ui/shadow/dropdown.js +4 -508
- package/dist/ui/shadow/file-upload.js +4 -620
- package/dist/ui/shadow/filter.js +7 -379
- package/dist/ui/shadow/input.js +6 -1140
- package/dist/ui/shadow/menu.js +5 -828
- package/dist/ui/shadow/modal.js +6 -1063
- package/dist/ui/shadow/nav.js +5 -223
- package/dist/ui/shadow/otp.js +6 -754
- package/dist/ui/shadow/radio.js +4 -316
- package/dist/ui/shadow/rich-text-editor.js +4 -1276
- package/dist/ui/shadow/select.js +6 -2136
- package/dist/ui/shadow/sidebar.js +5 -581
- package/dist/ui/shadow/slider.js +5 -1010
- package/dist/ui/shadow/switch.js +4 -335
- package/dist/ui/shadow/table.js +10 -4501
- package/dist/ui/shadow/tabs.js +6 -315
- package/dist/ui/shadow/tag-input.js +7 -3057
- package/dist/ui/shadow/textarea.js +6 -817
- package/dist/ui/sidebar.js +3 -581
- package/dist/ui/slider.js +4 -1012
- package/dist/ui/switch.js +4 -336
- package/dist/ui/table.js +9 -4502
- package/dist/ui/tabs.js +4 -315
- package/dist/ui/tag-input.js +5 -3058
- package/dist/ui/textarea.js +4 -819
- package/dist/{vite-CivRCJaf.js → vite-CfW7z2wn.js} +21 -14
- package/dist/vite.js +1 -1
- package/dist/vue.d.ts +3 -2
- package/package.json +10 -11
- package/dist/chip-strip-bNfLn52Z.js +0 -215
- package/dist/data-source-controller-Dx6IQ2CN.js +0 -243
- package/dist/data-source-options-BM4r4PRw.js +0 -558
- package/dist/data-source-read-HyBCRg1t.js +0 -242
- package/dist/excel-BXzr3uI1.js +0 -784
- package/dist/export-ixRdCS2y.js +0 -2388
- package/dist/field-tooltip-addon-CWCp19mJ.js +0 -702
- package/dist/field-tooltip.css_raw-U5UeTa2d.js +0 -269
- package/dist/filter-builder-C0T3pMx2.js +0 -208
- package/dist/form-control-core-BbiACMtL.js +0 -226
- package/dist/icon-ClxnYhBG.js +0 -19
- package/dist/import-Dc4eXC02.js +0 -612
- package/dist/light-slots-_no0r2Z-.js +0 -246
- package/dist/markdown-uGlE_OfJ.js +0 -20191
- package/dist/mono-data-grid-e9ZVBlNN.js +0 -4240
- package/dist/normalize-error-BmLbgANw.js +0 -1048
|
@@ -1,781 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
5
|
-
import { n as label_position_css_raw_default,
|
|
1
|
+
import { t as customElement } from "../../mono-element-CKcT0rwv.js";
|
|
2
|
+
import { t as __decorate } from "../../decorate-DbYFpi8R.js";
|
|
3
|
+
import { n as MonoTextareaCore, t as validateTextareaProps } from "../../textarea-utils-VU1KeXm8.js";
|
|
4
|
+
import { i as withShadowUtilityStyles, r as toShadowCss, t as flushSsrHydration } from "../../hydration-flush-Volt9X7Q.js";
|
|
5
|
+
import { n as label_position_css_raw_default, t as field_validation_css_raw_default } from "../../field-validation.css_raw-BU7C6173.js";
|
|
6
|
+
import { t as field_tooltip_css_raw_default } from "../../field-tooltip.css_raw-DVblekCl.js";
|
|
6
7
|
import { LitElement, html, isServer, nothing, unsafeCSS } from "lit";
|
|
7
|
-
import { property, query, state } from "lit/decorators.js";
|
|
8
|
-
import { ifDefined } from "lit/directives/if-defined.js";
|
|
9
|
-
import { styleMap } from "lit/directives/style-map.js";
|
|
10
8
|
|
|
11
|
-
//#region src/components/textarea/textarea-core.ts
|
|
12
|
-
const numberStringConverter = {
|
|
13
|
-
fromAttribute(value) {
|
|
14
|
-
if (value === null || value === "") return void 0;
|
|
15
|
-
const parsed = Number(value);
|
|
16
|
-
return Number.isFinite(parsed) ? parsed : void 0;
|
|
17
|
-
},
|
|
18
|
-
toAttribute(value) {
|
|
19
|
-
if (value === void 0 || value === null) return null;
|
|
20
|
-
return String(value);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* `MonoTextareaCore` — render-mode-agnostic logic for `mono-textarea` (props,
|
|
25
|
-
* hybrid aliases, value/model sync, validation, char counter, auto-resize, and
|
|
26
|
-
* the full `render()`). SSR-safe: the only DOM/`window` access (`_syncAutoResize`)
|
|
27
|
-
* is `isServer`-guarded. Each build supplies `createRenderRoot()` + `static styles`
|
|
28
|
-
* and the slot strategy via the `_slotOutlet` hook (light: `data-mono-slot`
|
|
29
|
-
* placeholders; shadow: native `<slot>`). Mirrors `switch-core`/`select-core`.
|
|
30
|
-
*/
|
|
31
|
-
const MonoTextareaCore = (superClass) => {
|
|
32
|
-
class MonoTextareaCoreClass extends MonoFormControlCore(superClass) {
|
|
33
|
-
constructor(...args) {
|
|
34
|
-
super(...args);
|
|
35
|
-
this.size = "md";
|
|
36
|
-
this.color = "primary";
|
|
37
|
-
this.variant = "outlined";
|
|
38
|
-
this.labelPosition = "top";
|
|
39
|
-
this.validationPosition = "bottom";
|
|
40
|
-
this.modelValue = "";
|
|
41
|
-
this.value = "";
|
|
42
|
-
this.name = "";
|
|
43
|
-
this.placeholder = "";
|
|
44
|
-
this.label = "";
|
|
45
|
-
this.helperText = "";
|
|
46
|
-
this.tooltip = null;
|
|
47
|
-
this._tooltip = new FieldTooltipController(this, () => this.tooltip);
|
|
48
|
-
this._validation = new FieldValidationController(this, () => ({
|
|
49
|
-
position: this.validationPosition,
|
|
50
|
-
...this._validationNotice ?? {
|
|
51
|
-
state: void 0,
|
|
52
|
-
text: void 0
|
|
53
|
-
},
|
|
54
|
-
suppressed: false
|
|
55
|
-
}), () => this.renderRoot?.querySelector?.("[mono-textarea] > textarea[mono-native]"));
|
|
56
|
-
this.validationState = "default";
|
|
57
|
-
this.validationMessage = "";
|
|
58
|
-
this.errorMessage = "";
|
|
59
|
-
this.successMessage = "";
|
|
60
|
-
this.disabled = false;
|
|
61
|
-
this.readonly = false;
|
|
62
|
-
this.required = false;
|
|
63
|
-
this.autofocus = false;
|
|
64
|
-
this.autoResize = false;
|
|
65
|
-
this.showCounter = false;
|
|
66
|
-
this.cssClass = {};
|
|
67
|
-
this.cssClassName = "";
|
|
68
|
-
this._hasLabelSlotState = false;
|
|
69
|
-
this._hasHelperSlotState = false;
|
|
70
|
-
this._textareaId = `mono-textarea-${Math.random().toString(36).slice(2)}`;
|
|
71
|
-
this._messageId = `${this._textareaId}-message`;
|
|
72
|
-
this._lastAutoResizeWidth = -1;
|
|
73
|
-
defineHybridPropAliases(this, [
|
|
74
|
-
"labelPosition",
|
|
75
|
-
"validationPosition",
|
|
76
|
-
"modelValue",
|
|
77
|
-
"helperText",
|
|
78
|
-
"validationState",
|
|
79
|
-
"validationMessage",
|
|
80
|
-
"errorMessage",
|
|
81
|
-
"successMessage",
|
|
82
|
-
"autoResize",
|
|
83
|
-
"minRows",
|
|
84
|
-
"maxRows",
|
|
85
|
-
"minLength",
|
|
86
|
-
"maxLength",
|
|
87
|
-
"showCounter",
|
|
88
|
-
"ariaLabelText",
|
|
89
|
-
"cssClass",
|
|
90
|
-
"minWidth",
|
|
91
|
-
"maxWidth",
|
|
92
|
-
"minHeight",
|
|
93
|
-
"maxHeight"
|
|
94
|
-
]);
|
|
95
|
-
/**
|
|
96
|
-
* Vue support:
|
|
97
|
-
*
|
|
98
|
-
* <mono-textarea :cssClass="{}" />
|
|
99
|
-
* <mono-textarea :css-class="{}" />
|
|
100
|
-
* <mono-textarea :cssclass="{}" />
|
|
101
|
-
*/
|
|
102
|
-
Object.defineProperty(this, "css-class", {
|
|
103
|
-
get: () => this.cssClass,
|
|
104
|
-
set: (value) => {
|
|
105
|
-
this._setCssClass(value);
|
|
106
|
-
},
|
|
107
|
-
configurable: true,
|
|
108
|
-
enumerable: false
|
|
109
|
-
});
|
|
110
|
-
Object.defineProperty(this, "cssclass", {
|
|
111
|
-
get: () => this.cssClass,
|
|
112
|
-
set: (value) => {
|
|
113
|
-
this._setCssClass(value);
|
|
114
|
-
},
|
|
115
|
-
configurable: true,
|
|
116
|
-
enumerable: false
|
|
117
|
-
});
|
|
118
|
-
Object.defineProperty(this, "ariaLabel", {
|
|
119
|
-
get: () => this.ariaLabelText,
|
|
120
|
-
set: (value) => {
|
|
121
|
-
this.ariaLabelText = value == null ? void 0 : String(value);
|
|
122
|
-
},
|
|
123
|
-
configurable: true,
|
|
124
|
-
enumerable: false
|
|
125
|
-
});
|
|
126
|
-
Object.defineProperty(this, "aria-label", {
|
|
127
|
-
get: () => this.ariaLabelText,
|
|
128
|
-
set: (value) => {
|
|
129
|
-
this.ariaLabelText = value == null ? void 0 : String(value);
|
|
130
|
-
},
|
|
131
|
-
configurable: true,
|
|
132
|
-
enumerable: false
|
|
133
|
-
});
|
|
134
|
-
Object.defineProperty(this, "arialabel", {
|
|
135
|
-
get: () => this.ariaLabelText,
|
|
136
|
-
set: (value) => {
|
|
137
|
-
this.ariaLabelText = value == null ? void 0 : String(value);
|
|
138
|
-
},
|
|
139
|
-
configurable: true,
|
|
140
|
-
enumerable: false
|
|
141
|
-
});
|
|
142
|
-
Object.defineProperty(this, "maxlength", {
|
|
143
|
-
get: () => this.maxLength,
|
|
144
|
-
set: (value) => {
|
|
145
|
-
this.maxLength = this._toOptionalNumber(value);
|
|
146
|
-
},
|
|
147
|
-
configurable: true,
|
|
148
|
-
enumerable: false
|
|
149
|
-
});
|
|
150
|
-
Object.defineProperty(this, "minlength", {
|
|
151
|
-
get: () => this.minLength,
|
|
152
|
-
set: (value) => {
|
|
153
|
-
this.minLength = this._toOptionalNumber(value);
|
|
154
|
-
},
|
|
155
|
-
configurable: true,
|
|
156
|
-
enumerable: false
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
static get observedAttributes() {
|
|
160
|
-
return [
|
|
161
|
-
...super.observedAttributes ?? [],
|
|
162
|
-
"modelvalue",
|
|
163
|
-
"helpertext",
|
|
164
|
-
"validationstate",
|
|
165
|
-
"validationmessage",
|
|
166
|
-
"errormessage",
|
|
167
|
-
"successmessage",
|
|
168
|
-
"autoresize",
|
|
169
|
-
"minrows",
|
|
170
|
-
"maxrows",
|
|
171
|
-
"minlength",
|
|
172
|
-
"maxlength",
|
|
173
|
-
"showcounter",
|
|
174
|
-
"arialabeltext",
|
|
175
|
-
"arialabel",
|
|
176
|
-
"css-class",
|
|
177
|
-
"cssclass"
|
|
178
|
-
];
|
|
179
|
-
}
|
|
180
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
181
|
-
super.attributeChangedCallback(name, oldValue, newValue);
|
|
182
|
-
if (oldValue === newValue) return;
|
|
183
|
-
if (name === "modelvalue") {
|
|
184
|
-
this.modelValue = newValue ?? "";
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
if (name === "helpertext") {
|
|
188
|
-
this.helperText = newValue ?? "";
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
if (name === "validationstate") {
|
|
192
|
-
this.validationState = newValue ?? "default";
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
if (name === "validationmessage") {
|
|
196
|
-
this.validationMessage = newValue ?? "";
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
if (name === "errormessage") {
|
|
200
|
-
this.errorMessage = newValue ?? "";
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
if (name === "successmessage") {
|
|
204
|
-
this.successMessage = newValue ?? "";
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
if (name === "autoresize") {
|
|
208
|
-
this.autoResize = this._toBoolean(newValue);
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
if (name === "minrows") {
|
|
212
|
-
this.minRows = this._toOptionalNumber(newValue);
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
if (name === "maxrows") {
|
|
216
|
-
this.maxRows = this._toOptionalNumber(newValue);
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
if (name === "minlength") {
|
|
220
|
-
this.minLength = this._toOptionalNumber(newValue);
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
if (name === "maxlength") {
|
|
224
|
-
this.maxLength = this._toOptionalNumber(newValue);
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
if (name === "showcounter") {
|
|
228
|
-
this.showCounter = this._toBoolean(newValue);
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
if (name === "arialabeltext" || name === "arialabel") {
|
|
232
|
-
this.ariaLabelText = newValue ?? void 0;
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
if (name === "css-class" || name === "cssclass") this._setCssClass(newValue);
|
|
236
|
-
}
|
|
237
|
-
/** The validation message and its state — the same precedence the message row uses. */
|
|
238
|
-
get _validationNotice() {
|
|
239
|
-
if (this.validationMessage) return {
|
|
240
|
-
state: this._resolvedValidationState,
|
|
241
|
-
text: this.validationMessage
|
|
242
|
-
};
|
|
243
|
-
if (this.errorMessage) return {
|
|
244
|
-
state: "invalid",
|
|
245
|
-
text: this.errorMessage
|
|
246
|
-
};
|
|
247
|
-
if (this.successMessage) return {
|
|
248
|
-
state: "valid",
|
|
249
|
-
text: this.successMessage
|
|
250
|
-
};
|
|
251
|
-
return null;
|
|
252
|
-
}
|
|
253
|
-
/** The message that moved to the icon / float bubble, kept for assistive tech only. */
|
|
254
|
-
_renderMovedMessage() {
|
|
255
|
-
const notice = this._validationNotice;
|
|
256
|
-
return html`<div
|
|
257
|
-
class=${`${this._cls("mono-textarea-message", "message")} ${notice.state}`}
|
|
258
|
-
mono-message=${notice.state}
|
|
259
|
-
mono-sr-only
|
|
260
|
-
role=${notice.state === "invalid" ? "alert" : nothing}
|
|
261
|
-
>${notice.text}</div>`;
|
|
262
|
-
}
|
|
263
|
-
willUpdate(changed) {
|
|
264
|
-
for (const key of [
|
|
265
|
-
"disabled",
|
|
266
|
-
"readonly",
|
|
267
|
-
"required",
|
|
268
|
-
"autofocus",
|
|
269
|
-
"autoResize",
|
|
270
|
-
"showCounter"
|
|
271
|
-
]) {
|
|
272
|
-
const v = this[key];
|
|
273
|
-
if (typeof v !== "boolean") this[key] = this._toBoolean(v);
|
|
274
|
-
}
|
|
275
|
-
if (changed.has("modelValue") && this.value !== this.modelValue) this.value = this.modelValue ?? "";
|
|
276
|
-
if (changed.has("value") && this.modelValue !== this.value) this.modelValue = String(this.value ?? "");
|
|
277
|
-
}
|
|
278
|
-
connectedCallback() {
|
|
279
|
-
super.connectedCallback();
|
|
280
|
-
if (isServer) return;
|
|
281
|
-
this._setupAutoResizeObserver();
|
|
282
|
-
this._syncAutoResize();
|
|
283
|
-
}
|
|
284
|
-
disconnectedCallback() {
|
|
285
|
-
this._teardownAutoResizeObserver();
|
|
286
|
-
super.disconnectedCallback();
|
|
287
|
-
}
|
|
288
|
-
firstUpdated() {
|
|
289
|
-
if (isServer) return;
|
|
290
|
-
if (this.autofocus) this.focus();
|
|
291
|
-
this._syncAutoResize();
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Recompute the height when the element's WIDTH changes.
|
|
295
|
-
*
|
|
296
|
-
* The reconnect hook above only covers being moved; the same staleness happens on a
|
|
297
|
-
* window resize, a sidebar opening, or any layout shift that renarrows the column.
|
|
298
|
-
* Width is the real input to the height calculation, so watch it directly.
|
|
299
|
-
*/
|
|
300
|
-
_setupAutoResizeObserver() {
|
|
301
|
-
if (isServer || this._autoResizeRo) return;
|
|
302
|
-
if (typeof ResizeObserver === "undefined") return;
|
|
303
|
-
this._autoResizeRo = new ResizeObserver(() => {
|
|
304
|
-
if (!this.autoResize) return;
|
|
305
|
-
const width = this.getBoundingClientRect().width;
|
|
306
|
-
if (width === this._lastAutoResizeWidth) return;
|
|
307
|
-
this._lastAutoResizeWidth = width;
|
|
308
|
-
this._syncAutoResize();
|
|
309
|
-
});
|
|
310
|
-
this._autoResizeRo.observe(this);
|
|
311
|
-
}
|
|
312
|
-
_teardownAutoResizeObserver() {
|
|
313
|
-
this._autoResizeRo?.disconnect();
|
|
314
|
-
this._autoResizeRo = void 0;
|
|
315
|
-
this._lastAutoResizeWidth = -1;
|
|
316
|
-
}
|
|
317
|
-
updated(changed) {
|
|
318
|
-
super.updated(changed);
|
|
319
|
-
if (isServer) return;
|
|
320
|
-
if (changed.has("value") || changed.has("modelValue") || changed.has("autoResize") || changed.has("minRows") || changed.has("maxRows")) this._syncAutoResize();
|
|
321
|
-
}
|
|
322
|
-
_setCssClass(value) {
|
|
323
|
-
if (value == null) {
|
|
324
|
-
this.cssClass = {};
|
|
325
|
-
this.cssClassName = "";
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
if (typeof value === "object") {
|
|
329
|
-
this.cssClass = value;
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
if (typeof value === "string") {
|
|
333
|
-
const trimmed = value.trim();
|
|
334
|
-
if (!trimmed) {
|
|
335
|
-
this.cssClass = {};
|
|
336
|
-
this.cssClassName = "";
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* Optional HTML object support:
|
|
341
|
-
*
|
|
342
|
-
* <mono-textarea css-class='{"root":"...", "field":"..."}'></mono-textarea>
|
|
343
|
-
*/
|
|
344
|
-
if (trimmed.startsWith("{") && trimmed.endsWith("}")) try {
|
|
345
|
-
this.cssClass = JSON.parse(trimmed);
|
|
346
|
-
return;
|
|
347
|
-
} catch {}
|
|
348
|
-
this.cssClassName = trimmed;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
_toBoolean(value) {
|
|
352
|
-
if (typeof value === "boolean") return value;
|
|
353
|
-
if (typeof value === "string") {
|
|
354
|
-
const normalized = value.toLowerCase().trim();
|
|
355
|
-
return normalized === "" || normalized === "true";
|
|
356
|
-
}
|
|
357
|
-
return Boolean(value);
|
|
358
|
-
}
|
|
359
|
-
_toOptionalNumber(value) {
|
|
360
|
-
if (value === void 0 || value === null || value === "") return void 0;
|
|
361
|
-
const parsed = Number(value);
|
|
362
|
-
return Number.isFinite(parsed) ? parsed : void 0;
|
|
363
|
-
}
|
|
364
|
-
_cls(base, key) {
|
|
365
|
-
const extra = this.cssClass?.[key];
|
|
366
|
-
return extra ? `${base} ${extra}` : base;
|
|
367
|
-
}
|
|
368
|
-
get _hasLabelSlot() {
|
|
369
|
-
return this._hasLabelSlotState;
|
|
370
|
-
}
|
|
371
|
-
get _hasHelperSlot() {
|
|
372
|
-
return this._hasHelperSlotState;
|
|
373
|
-
}
|
|
374
|
-
get _resolvedValidationState() {
|
|
375
|
-
if (this.validationState && this.validationState !== "default") return this.validationState;
|
|
376
|
-
if (this.errorMessage) return "invalid";
|
|
377
|
-
if (this.successMessage) return "valid";
|
|
378
|
-
return "default";
|
|
379
|
-
}
|
|
380
|
-
get _wrapperClasses() {
|
|
381
|
-
return [
|
|
382
|
-
"mono-textarea",
|
|
383
|
-
this.size,
|
|
384
|
-
this.color,
|
|
385
|
-
this.variant,
|
|
386
|
-
this.disabled ? "disabled" : "",
|
|
387
|
-
this.readonly ? "readonly" : "",
|
|
388
|
-
this._resolvedValidationState !== "default" ? `is-${this._resolvedValidationState}` : "",
|
|
389
|
-
this.value ? "has-value" : "",
|
|
390
|
-
this.autoResize ? "auto-resize" : "",
|
|
391
|
-
this.cssClassName,
|
|
392
|
-
this.cssClass?.root
|
|
393
|
-
].filter(Boolean).join(" ");
|
|
394
|
-
}
|
|
395
|
-
get _fieldClasses() {
|
|
396
|
-
return [
|
|
397
|
-
this._cls("mono-textarea-field", "field"),
|
|
398
|
-
this.size,
|
|
399
|
-
this.color,
|
|
400
|
-
this.variant
|
|
401
|
-
].filter(Boolean).join(" ");
|
|
402
|
-
}
|
|
403
|
-
/** `near` at 85% of the cap, `over` past it — the attribute twin of the class. */
|
|
404
|
-
get _counterState() {
|
|
405
|
-
const max = this.maxLength;
|
|
406
|
-
if (max === void 0) return "default";
|
|
407
|
-
const length = this.value.length;
|
|
408
|
-
if (length > max) return "over";
|
|
409
|
-
if (length >= Math.floor(max * .85)) return "near";
|
|
410
|
-
return "default";
|
|
411
|
-
}
|
|
412
|
-
get _counterClass() {
|
|
413
|
-
const length = this.value.length;
|
|
414
|
-
const max = this.maxLength;
|
|
415
|
-
if (max !== void 0 && length > max) return `${this._cls("mono-textarea-counter", "counter")} over`;
|
|
416
|
-
if (max !== void 0 && length >= Math.floor(max * .85)) return `${this._cls("mono-textarea-counter", "counter")} near`;
|
|
417
|
-
return this._cls("mono-textarea-counter", "counter");
|
|
418
|
-
}
|
|
419
|
-
get _shouldShowFooter() {
|
|
420
|
-
return Boolean(this.validationMessage || this.errorMessage || this.successMessage || this.helperText || this._hasHelperSlot || this.showCounter);
|
|
421
|
-
}
|
|
422
|
-
_createModelDetail(args) {
|
|
423
|
-
return {
|
|
424
|
-
modelValue: args.modelValue,
|
|
425
|
-
currentValue: args.modelValue,
|
|
426
|
-
oldValue: args.oldValue,
|
|
427
|
-
value: args.modelValue,
|
|
428
|
-
name: this.name,
|
|
429
|
-
sourceEvent: args.sourceEvent
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
|
-
_emitInput(detail) {
|
|
433
|
-
dispatchMonoEvent(this, "input", detail);
|
|
434
|
-
}
|
|
435
|
-
_emitChange(detail) {
|
|
436
|
-
dispatchMonoEvent(this, "change", detail);
|
|
437
|
-
}
|
|
438
|
-
_handleInput(event) {
|
|
439
|
-
if (this.disabled || this.readonly) return;
|
|
440
|
-
const textarea = event.currentTarget;
|
|
441
|
-
const oldValue = this.modelValue;
|
|
442
|
-
const nextValue = textarea.value;
|
|
443
|
-
this.value = nextValue;
|
|
444
|
-
this.modelValue = nextValue;
|
|
445
|
-
const detail = this._createModelDetail({
|
|
446
|
-
modelValue: nextValue,
|
|
447
|
-
oldValue,
|
|
448
|
-
sourceEvent: event
|
|
449
|
-
});
|
|
450
|
-
this._emitInput(detail);
|
|
451
|
-
this._syncAutoResize();
|
|
452
|
-
}
|
|
453
|
-
_handleChange(event) {
|
|
454
|
-
if (this.disabled || this.readonly) return;
|
|
455
|
-
const textarea = event.currentTarget;
|
|
456
|
-
const oldValue = this.modelValue;
|
|
457
|
-
const nextValue = textarea.value;
|
|
458
|
-
this.value = nextValue;
|
|
459
|
-
this.modelValue = nextValue;
|
|
460
|
-
const detail = this._createModelDetail({
|
|
461
|
-
modelValue: nextValue,
|
|
462
|
-
oldValue,
|
|
463
|
-
sourceEvent: event
|
|
464
|
-
});
|
|
465
|
-
this._emitChange(detail);
|
|
466
|
-
}
|
|
467
|
-
_syncAutoResize() {
|
|
468
|
-
if (isServer) return;
|
|
469
|
-
if (!this.autoResize || !this._textareaEl) return;
|
|
470
|
-
const textarea = this._textareaEl;
|
|
471
|
-
const computed = window.getComputedStyle(textarea);
|
|
472
|
-
const lineHeight = Number.parseFloat(computed.lineHeight) || 20;
|
|
473
|
-
const paddingTop = Number.parseFloat(computed.paddingTop) || 0;
|
|
474
|
-
const paddingBottom = Number.parseFloat(computed.paddingBottom) || 0;
|
|
475
|
-
const borderTop = Number.parseFloat(computed.borderTopWidth) || 0;
|
|
476
|
-
const borderBottom = Number.parseFloat(computed.borderBottomWidth) || 0;
|
|
477
|
-
const minRows = this.minRows ?? this.rows;
|
|
478
|
-
const maxRows = this.maxRows;
|
|
479
|
-
const minHeight = minRows !== void 0 ? lineHeight * minRows + paddingTop + paddingBottom + borderTop + borderBottom : void 0;
|
|
480
|
-
const maxHeight = maxRows !== void 0 ? lineHeight * maxRows + paddingTop + paddingBottom + borderTop + borderBottom : void 0;
|
|
481
|
-
textarea.style.height = "auto";
|
|
482
|
-
let nextHeight = textarea.scrollHeight;
|
|
483
|
-
if (minHeight !== void 0) nextHeight = Math.max(nextHeight, minHeight);
|
|
484
|
-
if (maxHeight !== void 0) {
|
|
485
|
-
nextHeight = Math.min(nextHeight, maxHeight);
|
|
486
|
-
textarea.style.overflowY = textarea.scrollHeight > maxHeight ? "auto" : "hidden";
|
|
487
|
-
} else textarea.style.overflowY = "hidden";
|
|
488
|
-
textarea.style.height = `${nextHeight}px`;
|
|
489
|
-
}
|
|
490
|
-
_renderLabel() {
|
|
491
|
-
const hasContent = !!this.label || this._hasLabelSlotState;
|
|
492
|
-
if (!hasContent && !this._slotsAlwaysRender) return nothing;
|
|
493
|
-
return html`
|
|
494
|
-
<label
|
|
495
|
-
class=${this._cls("mono-textarea-label", "label")}
|
|
496
|
-
mono-label
|
|
497
|
-
for=${this._textareaId}
|
|
498
|
-
?mono-empty=${!hasContent}
|
|
499
|
-
>
|
|
500
|
-
${this._slotOutlet("label", this.label)}
|
|
501
|
-
|
|
502
|
-
${this.required ? html`
|
|
503
|
-
<span class=${this._cls("mono-textarea-required", "required")} mono-required-mark>
|
|
504
|
-
*
|
|
505
|
-
</span>
|
|
506
|
-
` : nothing}
|
|
507
|
-
${this._tooltip.render()}
|
|
508
|
-
</label>
|
|
509
|
-
`;
|
|
510
|
-
}
|
|
511
|
-
_renderMessage() {
|
|
512
|
-
if (this._validation.moved) return html`${this._renderHelperText()}${this._renderMovedMessage()}`;
|
|
513
|
-
if (this.validationMessage) return html`
|
|
514
|
-
<div
|
|
515
|
-
class=${`${this._cls("mono-textarea-message", "message")} ${this._resolvedValidationState}`}
|
|
516
|
-
mono-message=${this._resolvedValidationState}
|
|
517
|
-
>
|
|
518
|
-
${this.validationMessage}
|
|
519
|
-
</div>
|
|
520
|
-
`;
|
|
521
|
-
if (this.errorMessage) return html`
|
|
522
|
-
<div class=${`${this._cls("mono-textarea-message", "message")} invalid`} mono-message="invalid">
|
|
523
|
-
${this.errorMessage}
|
|
524
|
-
</div>
|
|
525
|
-
`;
|
|
526
|
-
if (this.successMessage) return html`
|
|
527
|
-
<div class=${`${this._cls("mono-textarea-message", "message")} valid`} mono-message="valid">
|
|
528
|
-
${this.successMessage}
|
|
529
|
-
</div>
|
|
530
|
-
`;
|
|
531
|
-
return this._renderHelperText();
|
|
532
|
-
}
|
|
533
|
-
_renderHelperText() {
|
|
534
|
-
if (this.helperText || this._hasHelperSlot || this._slotsAlwaysRender) return html`
|
|
535
|
-
<div
|
|
536
|
-
class=${`${this._cls("mono-textarea-message", "message")} helper`}
|
|
537
|
-
mono-message="helper"
|
|
538
|
-
?mono-empty=${!this.helperText && !this._hasHelperSlot}
|
|
539
|
-
>
|
|
540
|
-
${this._slotOutlet("helper", this.helperText)}
|
|
541
|
-
</div>
|
|
542
|
-
`;
|
|
543
|
-
return nothing;
|
|
544
|
-
}
|
|
545
|
-
_renderCounter() {
|
|
546
|
-
if (!this.showCounter) return nothing;
|
|
547
|
-
const max = this.maxLength;
|
|
548
|
-
const length = this.value.length;
|
|
549
|
-
return html`
|
|
550
|
-
<div
|
|
551
|
-
class=${this._counterClass}
|
|
552
|
-
mono-counter
|
|
553
|
-
?mono-near=${this._counterState === "near"}
|
|
554
|
-
?mono-over=${this._counterState === "over"}
|
|
555
|
-
>
|
|
556
|
-
${max !== void 0 ? `${length}/${max}` : length}
|
|
557
|
-
</div>
|
|
558
|
-
`;
|
|
559
|
-
}
|
|
560
|
-
_renderFooter() {
|
|
561
|
-
if (!this._shouldShowFooter && !this._slotsAlwaysRender) return nothing;
|
|
562
|
-
return html`
|
|
563
|
-
<div
|
|
564
|
-
class=${this._cls("mono-textarea-footer", "footer")}
|
|
565
|
-
mono-footer
|
|
566
|
-
?mono-empty=${!this._shouldShowFooter}
|
|
567
|
-
>
|
|
568
|
-
<div class=${this.cssClass?.messageWrap ?? ""} mono-message-wrap>
|
|
569
|
-
${this._renderMessage()}
|
|
570
|
-
</div>
|
|
571
|
-
|
|
572
|
-
${this._renderCounter()}
|
|
573
|
-
</div>
|
|
574
|
-
`;
|
|
575
|
-
}
|
|
576
|
-
/** Inline sizing applied to the root wrapper. */
|
|
577
|
-
_sizeStyle() {
|
|
578
|
-
return buildSizeStyle(this);
|
|
579
|
-
}
|
|
580
|
-
render() {
|
|
581
|
-
const describedBy = this._shouldShowFooter ? this._messageId : void 0;
|
|
582
|
-
const ariaLabel = this.ariaLabelText || this.label || this.placeholder || void 0;
|
|
583
|
-
return html`
|
|
584
|
-
<div
|
|
585
|
-
class=${this._wrapperClasses}
|
|
586
|
-
style=${styleMap(this._sizeStyle())}
|
|
587
|
-
mono-textarea
|
|
588
|
-
mono-size=${this.size === "md" ? nothing : this.size}
|
|
589
|
-
mono-color=${this.color === "primary" ? nothing : this.color}
|
|
590
|
-
mono-variant=${this.variant === "outlined" ? nothing : this.variant}
|
|
591
|
-
mono-label-position=${this.labelPosition === "top" ? nothing : this.labelPosition}
|
|
592
|
-
mono-validation-position=${this.validationPosition === "bottom" ? nothing : this.validationPosition}
|
|
593
|
-
mono-validation-state=${this._resolvedValidationState === "default" ? nothing : this._resolvedValidationState}
|
|
594
|
-
?mono-disabled=${this.disabled}
|
|
595
|
-
?mono-readonly=${this.readonly}
|
|
596
|
-
?mono-required=${this.required}
|
|
597
|
-
?mono-auto-resize=${this.autoResize}
|
|
598
|
-
>
|
|
599
|
-
${this._renderLabel()}
|
|
600
|
-
|
|
601
|
-
${this._validation.renderIcon({ anchored: true })}
|
|
602
|
-
<textarea
|
|
603
|
-
id=${this._textareaId}
|
|
604
|
-
class=${this._fieldClasses}
|
|
605
|
-
mono-native
|
|
606
|
-
.value=${this.value}
|
|
607
|
-
name=${ifDefined(this.name || void 0)}
|
|
608
|
-
placeholder=${ifDefined(this.placeholder || void 0)}
|
|
609
|
-
rows=${ifDefined(this.rows)}
|
|
610
|
-
minlength=${ifDefined(this.minLength)}
|
|
611
|
-
maxlength=${ifDefined(this.maxLength)}
|
|
612
|
-
?disabled=${this.disabled}
|
|
613
|
-
?readonly=${this.readonly}
|
|
614
|
-
?required=${this.required}
|
|
615
|
-
aria-label=${ifDefined(ariaLabel)}
|
|
616
|
-
aria-invalid=${this._resolvedValidationState === "invalid" ? "true" : "false"}
|
|
617
|
-
aria-describedby=${ifDefined(describedBy)}
|
|
618
|
-
@input=${this._handleInput}
|
|
619
|
-
@change=${this._handleChange}
|
|
620
|
-
></textarea>
|
|
621
|
-
|
|
622
|
-
<div id=${this._messageId} mono-message-outlet>
|
|
623
|
-
${this._renderFooter()}
|
|
624
|
-
</div>
|
|
625
|
-
|
|
626
|
-
${this._validation.renderFloat()}
|
|
627
|
-
</div>
|
|
628
|
-
`;
|
|
629
|
-
}
|
|
630
|
-
focus(options) {
|
|
631
|
-
this._textareaEl?.focus(options);
|
|
632
|
-
}
|
|
633
|
-
blur() {
|
|
634
|
-
this._textareaEl?.blur();
|
|
635
|
-
}
|
|
636
|
-
select() {
|
|
637
|
-
this._textareaEl?.select();
|
|
638
|
-
}
|
|
639
|
-
setSelectionRange(start, end, direction) {
|
|
640
|
-
this._textareaEl?.setSelectionRange(start, end, direction);
|
|
641
|
-
}
|
|
642
|
-
/** Whether the slot regions render even when empty. Light: no. Shadow: yes —
|
|
643
|
-
* the native `<slot>`s must exist to project DSD content + be scanned
|
|
644
|
-
* (hidden via `[data-empty]` when empty). */
|
|
645
|
-
get _slotsAlwaysRender() {
|
|
646
|
-
return false;
|
|
647
|
-
}
|
|
648
|
-
_hasSlot(name) {
|
|
649
|
-
return name === "label" ? this._hasLabelSlotState : this._hasHelperSlotState;
|
|
650
|
-
}
|
|
651
|
-
_setSlotState(name, has) {
|
|
652
|
-
if (name === "label") this._hasLabelSlotState = has;
|
|
653
|
-
else this._hasHelperSlotState = has;
|
|
654
|
-
}
|
|
655
|
-
/**
|
|
656
|
-
* Slot outlet. Light build (default): a `data-mono-slot` placeholder the
|
|
657
|
-
* captured light-DOM nodes are re-parented into when present, else the prop
|
|
658
|
-
* `fallback`. Shadow build overrides this with a native `<slot name>`.
|
|
659
|
-
*/
|
|
660
|
-
_slotOutlet(name, fallback = nothing) {
|
|
661
|
-
return this._hasSlot(name) ? html`<span data-mono-slot=${name}></span>` : html`${fallback}`;
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
__decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "size", void 0);
|
|
665
|
-
__decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "color", void 0);
|
|
666
|
-
__decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "variant", void 0);
|
|
667
|
-
__decorate([property({
|
|
668
|
-
type: String,
|
|
669
|
-
attribute: "label-position"
|
|
670
|
-
})], MonoTextareaCoreClass.prototype, "labelPosition", void 0);
|
|
671
|
-
__decorate([property({
|
|
672
|
-
type: String,
|
|
673
|
-
attribute: "validation-position"
|
|
674
|
-
})], MonoTextareaCoreClass.prototype, "validationPosition", void 0);
|
|
675
|
-
__decorate([property({
|
|
676
|
-
type: String,
|
|
677
|
-
attribute: "model-value",
|
|
678
|
-
reflect: true
|
|
679
|
-
})], MonoTextareaCoreClass.prototype, "modelValue", void 0);
|
|
680
|
-
__decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "value", void 0);
|
|
681
|
-
__decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "name", void 0);
|
|
682
|
-
__decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "placeholder", void 0);
|
|
683
|
-
__decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "label", void 0);
|
|
684
|
-
__decorate([property({
|
|
685
|
-
type: String,
|
|
686
|
-
attribute: "helper-text"
|
|
687
|
-
})], MonoTextareaCoreClass.prototype, "helperText", void 0);
|
|
688
|
-
__decorate([property()], MonoTextareaCoreClass.prototype, "tooltip", void 0);
|
|
689
|
-
__decorate([property({
|
|
690
|
-
type: String,
|
|
691
|
-
attribute: "validation-state"
|
|
692
|
-
})], MonoTextareaCoreClass.prototype, "validationState", void 0);
|
|
693
|
-
__decorate([property({
|
|
694
|
-
type: String,
|
|
695
|
-
attribute: "validation-message"
|
|
696
|
-
})], MonoTextareaCoreClass.prototype, "validationMessage", void 0);
|
|
697
|
-
__decorate([property({
|
|
698
|
-
type: String,
|
|
699
|
-
attribute: "error-message"
|
|
700
|
-
})], MonoTextareaCoreClass.prototype, "errorMessage", void 0);
|
|
701
|
-
__decorate([property({
|
|
702
|
-
type: String,
|
|
703
|
-
attribute: "success-message"
|
|
704
|
-
})], MonoTextareaCoreClass.prototype, "successMessage", void 0);
|
|
705
|
-
__decorate([property({
|
|
706
|
-
type: String,
|
|
707
|
-
attribute: "aria-label"
|
|
708
|
-
})], MonoTextareaCoreClass.prototype, "ariaLabelText", void 0);
|
|
709
|
-
__decorate([property({
|
|
710
|
-
reflect: true,
|
|
711
|
-
converter: booleanStringConverter
|
|
712
|
-
})], MonoTextareaCoreClass.prototype, "disabled", void 0);
|
|
713
|
-
__decorate([property({
|
|
714
|
-
reflect: true,
|
|
715
|
-
converter: booleanStringConverter
|
|
716
|
-
})], MonoTextareaCoreClass.prototype, "readonly", void 0);
|
|
717
|
-
__decorate([property({
|
|
718
|
-
reflect: true,
|
|
719
|
-
converter: booleanStringConverter
|
|
720
|
-
})], MonoTextareaCoreClass.prototype, "required", void 0);
|
|
721
|
-
__decorate([property({
|
|
722
|
-
reflect: true,
|
|
723
|
-
converter: booleanStringConverter
|
|
724
|
-
})], MonoTextareaCoreClass.prototype, "autofocus", void 0);
|
|
725
|
-
__decorate([property({
|
|
726
|
-
attribute: "auto-resize",
|
|
727
|
-
reflect: true,
|
|
728
|
-
converter: booleanStringConverter
|
|
729
|
-
})], MonoTextareaCoreClass.prototype, "autoResize", void 0);
|
|
730
|
-
__decorate([property({
|
|
731
|
-
attribute: "show-counter",
|
|
732
|
-
reflect: true,
|
|
733
|
-
converter: booleanStringConverter
|
|
734
|
-
})], MonoTextareaCoreClass.prototype, "showCounter", void 0);
|
|
735
|
-
__decorate([property({ converter: numberStringConverter })], MonoTextareaCoreClass.prototype, "rows", void 0);
|
|
736
|
-
__decorate([property({
|
|
737
|
-
attribute: "min-rows",
|
|
738
|
-
converter: numberStringConverter
|
|
739
|
-
})], MonoTextareaCoreClass.prototype, "minRows", void 0);
|
|
740
|
-
__decorate([property({
|
|
741
|
-
attribute: "max-rows",
|
|
742
|
-
converter: numberStringConverter
|
|
743
|
-
})], MonoTextareaCoreClass.prototype, "maxRows", void 0);
|
|
744
|
-
__decorate([property({
|
|
745
|
-
attribute: "min-length",
|
|
746
|
-
converter: numberStringConverter
|
|
747
|
-
})], MonoTextareaCoreClass.prototype, "minLength", void 0);
|
|
748
|
-
__decorate([property({
|
|
749
|
-
attribute: "max-length",
|
|
750
|
-
converter: numberStringConverter
|
|
751
|
-
})], MonoTextareaCoreClass.prototype, "maxLength", void 0);
|
|
752
|
-
__decorate([property({ attribute: false })], MonoTextareaCoreClass.prototype, "cssClass", void 0);
|
|
753
|
-
__decorate([property({ attribute: false })], MonoTextareaCoreClass.prototype, "cssClassName", void 0);
|
|
754
|
-
__decorate([state()], MonoTextareaCoreClass.prototype, "_hasLabelSlotState", void 0);
|
|
755
|
-
__decorate([state()], MonoTextareaCoreClass.prototype, "_hasHelperSlotState", void 0);
|
|
756
|
-
__decorate([query(".mono-textarea-field")], MonoTextareaCoreClass.prototype, "_textareaEl", void 0);
|
|
757
|
-
__decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "width", void 0);
|
|
758
|
-
__decorate([property({ type: String })], MonoTextareaCoreClass.prototype, "height", void 0);
|
|
759
|
-
__decorate([property({
|
|
760
|
-
type: String,
|
|
761
|
-
attribute: "min-width"
|
|
762
|
-
})], MonoTextareaCoreClass.prototype, "minWidth", void 0);
|
|
763
|
-
__decorate([property({
|
|
764
|
-
type: String,
|
|
765
|
-
attribute: "max-width"
|
|
766
|
-
})], MonoTextareaCoreClass.prototype, "maxWidth", void 0);
|
|
767
|
-
__decorate([property({
|
|
768
|
-
type: String,
|
|
769
|
-
attribute: "min-height"
|
|
770
|
-
})], MonoTextareaCoreClass.prototype, "minHeight", void 0);
|
|
771
|
-
__decorate([property({
|
|
772
|
-
type: String,
|
|
773
|
-
attribute: "max-height"
|
|
774
|
-
})], MonoTextareaCoreClass.prototype, "maxHeight", void 0);
|
|
775
|
-
return MonoTextareaCoreClass;
|
|
776
|
-
};
|
|
777
|
-
|
|
778
|
-
//#endregion
|
|
779
9
|
//#region \0raw:C:\Users\VCT-DEV\Desktop\libs\packages\helper\src\components\textarea\textarea.css?raw.js
|
|
780
10
|
var textarea_css_raw_default = "/* =========================================================================\r\n mono-textarea — a port of Basecoat's `.textarea` inside a `.field`\r\n (basecoat-css@1.0.2, vega style).\r\n\r\n Styled by ATTRIBUTE, like Basecoat — and the attributes mirror the element's\r\n props one for one, so hand-written markup reads like the Lit / Vue tag:\r\n\r\n <mono-textarea size=\"sm\" color=\"danger\" label=\"Notes\" placeholder=\"…\">\r\n <div mono-textarea mono-size=\"sm\" mono-color=\"danger\">\r\n <label mono-label>Notes</label>\r\n <textarea mono-native placeholder=\"…\"></textarea>\r\n <div mono-message-wrap><div mono-message=\"helper\">…</div></div>\r\n </div>\r\n\r\n An absent attribute is the prop's default (`:not([mono-size])` = md,\r\n `:not([mono-color])` = primary, `:not([mono-variant])` = outlined). The\r\n element renders these on its root (both builds) plus the states\r\n `mono-disabled` / `mono-readonly` / `mono-required` / `mono-auto-resize` and\r\n `mono-validation-state=\"valid|invalid|warning\"`. The old classes\r\n (`.mono-textarea.md.primary.outlined`) are still emitted as inert hooks until\r\n 2.0 but no rule here reads them.\r\n\r\n Selector map (ours ≡ upstream):\r\n [mono-textarea] ≡ .field (flex w-full flex-col gap-3)\r\n [mono-textarea] > [mono-label] ≡ .field > label / .label\r\n [mono-native] ≡ .field > textarea / .textarea\r\n (field-sizing-content min-h-16 w-full rounded-md\r\n border-input bg-transparent px-2.5 py-2 shadow-xs\r\n text-base md:text-sm, focus ring-3 ring-ring/50)\r\n [mono-message-wrap] > [mono-message=\"…\"] ≡ .field > p / .field [role='alert']\r\n [mono-validation-state=\"invalid\"] ≡ aria-invalid:border-destructive aria-invalid:ring-destructive/20\r\n [mono-validation-state=\"valid|warning\"] ≡ EXTENSION (the same treatment in --success / --warning)\r\n [mono-size=\"xs|sm|lg|xl|xxl\"] ≡ EXTENSION (Basecoat sizes only the select; the\r\n ladder is --mono-control-height-*)\r\n [mono-variant=\"filled\"] ≡ EXTENSION (luma/mira/rhea's textarea: bg-input/50, no shadow)\r\n [mono-variant=\"underlined\"] ≡ EXTENSION (sera's: border-transparent border-b-input,\r\n rounded-none px-0, the ring on the bottom edge only)\r\n [mono-counter], [mono-footer] ≡ EXTENSION (the character counter row)\r\n\r\n A textarea must NOT be --mono-control-height-* tall — it is multi-line — but\r\n its metrics DERIVE from that token, or retuning the ladder leaves it behind:\r\n\r\n padY = (T - L) / 2 - B\r\n min-height = ROWS x L + 2*padY + 2*B = T + (ROWS - 1) x L\r\n\r\n with T the control height, L one text line (font x line-height) and B the\r\n border. The first puts the textarea's FIRST line box at the same offset as an\r\n input's single line, so the two start their text on the same baseline side by\r\n side; the second reads as \"one input tall, plus N-1 lines\". ROWS is the only\r\n per-size literal. (Upstream's own `min-h-16` is a flat 64px; the derivation is\r\n mono's, and `field-sizing: content` still grows the box from there.)\r\n\r\n Specificity contract (same as the pre-port class sheet): a part's RESTING rule\r\n is exactly one attribute strong — `:where([mono-textarea]) [mono-native]` =\r\n (0,1,0) — so a utility class handed in through `cssClass` wins by source\r\n order, while the prop and state rules stay heavier and win over it.\r\n\r\n Inner parts: [mono-label] (+ [mono-required-mark]), [mono-native],\r\n [mono-footer] > [mono-message-wrap] > [mono-message=\"helper|valid|invalid|\r\n warning\"] / [mono-counter] (+ [mono-near], [mono-over]). The shadow build\r\n marks an unassigned slot wrapper [mono-empty].\r\n\r\n FLAVORS set `--mono-textarea-{radius,padding-x-<size>,padding-y-<size>,\r\n font-<size>,line-height,ring-width,ring-alpha,gap,resize,bg,border-color,\r\n shadow}` and the outline-scoped `--mono-textarea-outline-*`; every fallback\r\n here is vega's value\r\n (`node scripts/basecoat-styles.mjs --varying \"textarea\"`).\r\n ========================================================================= */\r\n\r\nmono-textarea {\r\n display: block;\r\n}\r\n\r\n[mono-textarea] {\r\n /* ── palette: each slot is a public knob over a Basecoat token ─────────── */\r\n --_mono-textarea-text: var(--mono-textarea-color, var(--mono-textarea-text, var(--foreground)));\r\n --_mono-textarea-placeholder: var(--mono-textarea-placeholder, var(--muted-foreground));\r\n --_mono-textarea-muted: var(--mono-textarea-muted, var(--muted-foreground));\r\n /* the `color` prop picks the FOCUS colour; primary is Basecoat's `--ring` */\r\n --_mono-textarea-primary: var(--mono-textarea-primary, var(--ring));\r\n --_mono-textarea-secondary: var(--mono-textarea-secondary, var(--muted-foreground));\r\n --_mono-textarea-success: var(--mono-textarea-success, var(--success));\r\n --_mono-textarea-danger: var(--mono-textarea-danger, var(--destructive));\r\n --_mono-textarea-warning: var(--mono-textarea-warning, var(--warning));\r\n --_mono-textarea-info: var(--mono-textarea-info, var(--info));\r\n --_mono-textarea-teal: var(--mono-textarea-teal, var(--teal));\r\n --_mono-textarea-purple: var(--mono-textarea-purple, var(--purple));\r\n --_mono-textarea-neutral: var(--mono-textarea-neutral, var(--neutral));\r\n --_mono-textarea-dark: var(--mono-textarea-dark, var(--dark));\r\n --_mono-textarea-valid: var(--mono-textarea-valid, var(--success));\r\n --_mono-textarea-invalid: var(--mono-textarea-invalid, var(--destructive));\r\n\r\n /* ── the painted result — three tiers, base = vega's .textarea ─────────── */\r\n --_mono-textarea-ring-color: var(--mono-textarea-ring-color, var(--mono-textarea-focus-color, var(--_mono-textarea-ring-color-preset, var(--_mono-textarea-primary))));\r\n --_mono-textarea-ring-width: var(--mono-textarea-ring-width, var(--_mono-textarea-ring-width-preset, var(--mono-ring-width)));\r\n --_mono-textarea-ring-alpha: var(--mono-textarea-ring-alpha, var(--mono-ring-alpha));\r\n --_mono-textarea-border-color: var(--mono-textarea-rest-border, var(--mono-textarea-border-color, var(--_mono-textarea-border-color-preset, var(--input))));\r\n --_mono-textarea-side-border-color: var(--_mono-textarea-side-border-color-preset, var(--_mono-textarea-border-color));\r\n --_mono-textarea-bg: var(--mono-textarea-bg, var(--mono-textarea-surface, var(--_mono-textarea-bg-preset, var(--mono-mode-surface))));\r\n --_mono-textarea-shadow: var(--mono-textarea-shadow, var(--_mono-textarea-shadow-preset, var(--mono-shadow-xs)));\r\n --_mono-textarea-border-width: var(--mono-textarea-border-width, var(--mono-border-width));\r\n --_mono-textarea-radius: var(--mono-textarea-radius, var(--_mono-textarea-radius-preset, var(--mono-radius-md)));\r\n\r\n /* ── md metrics live on the unqualified root ON PURPOSE: hand-written\r\n `<div mono-textarea>` that names no size renders exactly like size=\"md\".\r\n basecoat@1.0.2 styles/vega.css .textarea — px-2.5 py-2 text-base md:text-sm ── */\r\n --_mono-textarea-height: var(--mono-textarea-height-md, var(--mono-control-height-md));\r\n --_mono-textarea-padding-x: var(--mono-textarea-padding-x-md, var(--_mono-textarea-padding-x-preset, calc(var(--mono-spacing) * 2.5)));\r\n --_mono-textarea-font-size: var(--mono-textarea-font-md, var(--mono-text-sm));\r\n --_mono-textarea-line-height: var(--mono-textarea-line-height, var(--mono-textarea-line-height-md, var(--mono-leading-normal)));\r\n --_mono-textarea-rows: var(--mono-textarea-rows, var(--mono-textarea-rows-md, 4));\r\n\r\n /* one text line, and the two derived metrics that hang off it */\r\n --_mono-textarea-line: calc(var(--_mono-textarea-font-size) * var(--_mono-textarea-line-height));\r\n --_mono-textarea-padding-y: var(\r\n --mono-textarea-padding-y,\r\n max(0px, calc((var(--_mono-textarea-height) - var(--_mono-textarea-line)) / 2 - var(--_mono-textarea-border-width)))\r\n );\r\n --_mono-textarea-min-height: var(\r\n --mono-textarea-min-height,\r\n calc(var(--_mono-textarea-height) + (var(--_mono-textarea-rows) - 1) * var(--_mono-textarea-line))\r\n );\r\n\r\n /* basecoat@1.0.2 styles/vega.css .field — flex w-full flex-col gap-3 */\r\n display: flex;\r\n flex-direction: column;\r\n gap: var(--mono-textarea-gap, calc(var(--mono-spacing) * 3));\r\n width: 100%;\r\n min-width: 0;\r\n color: var(--_mono-textarea-text);\r\n font-family: inherit;\r\n}\r\n\r\n[mono-textarea],\r\n:where([mono-textarea]) *,\r\n:where([mono-textarea]) *::before,\r\n:where([mono-textarea]) *::after {\r\n box-sizing: border-box;\r\n}\r\n\r\n/* The element wraps the footer in an aria-describedby outlet; hand-written markup\r\n has no such wrapper. It is a flex child either way, so an EMPTY outlet still\r\n paid the root's `gap` and made the element stand taller than the same raw\r\n markup. The shadow build always RENDERS the footer and marks it empty, so the\r\n test is for a footer that is actually showing. */\r\n[mono-textarea] > [mono-message-outlet]:not(:has([mono-footer]:not([mono-empty]))) {\r\n display: none;\r\n}\r\n\r\n/* the shadow build renders every region and marks the empty ones; the light\r\n build renders only what exists. Out-specifies the region rules on purpose —\r\n a zero-weight hide would tie with them and lose on source order. */\r\n[mono-textarea] :is([mono-label], [mono-message], [mono-footer], [mono-counter])[mono-empty] {\r\n display: none;\r\n}\r\n\r\n/* =========================================\r\n Sizes — EXTENSION: Basecoat sizes only the select, so the ladder is\r\n --mono-control-height-* and the derivation above\r\n ========================================= */\r\n\r\n[mono-textarea][mono-size=\"xs\"] {\r\n --_mono-textarea-height: var(--mono-textarea-height-xs, var(--mono-control-height-xs));\r\n --_mono-textarea-padding-x: var(--mono-textarea-padding-x-xs, var(--_mono-textarea-padding-x-preset, calc(var(--mono-spacing) * 2)));\r\n --_mono-textarea-font-size: var(--mono-textarea-font-xs, var(--mono-text-xs));\r\n --_mono-textarea-rows: var(--mono-textarea-rows, var(--mono-textarea-rows-xs, 3));\r\n}\r\n\r\n[mono-textarea][mono-size=\"sm\"] {\r\n --_mono-textarea-height: var(--mono-textarea-height-sm, var(--mono-control-height-sm));\r\n --_mono-textarea-padding-x: var(--mono-textarea-padding-x-sm, var(--_mono-textarea-padding-x-preset, calc(var(--mono-spacing) * 2.5)));\r\n --_mono-textarea-font-size: var(--mono-textarea-font-sm, var(--mono-textarea-font-md, var(--mono-text-sm)));\r\n --_mono-textarea-rows: var(--mono-textarea-rows, var(--mono-textarea-rows-sm, 3));\r\n}\r\n\r\n[mono-textarea][mono-size=\"lg\"] {\r\n --_mono-textarea-height: var(--mono-textarea-height-lg, var(--mono-control-height-lg));\r\n --_mono-textarea-padding-x: var(--mono-textarea-padding-x-lg, var(--_mono-textarea-padding-x-preset, calc(var(--mono-spacing) * 2.5)));\r\n --_mono-textarea-font-size: var(--mono-textarea-font-lg, var(--mono-textarea-font-md, var(--mono-text-sm)));\r\n --_mono-textarea-rows: var(--mono-textarea-rows, var(--mono-textarea-rows-lg, 4));\r\n}\r\n\r\n[mono-textarea][mono-size=\"xl\"] {\r\n --_mono-textarea-height: var(--mono-textarea-height-xl, var(--mono-control-height-xl));\r\n --_mono-textarea-padding-x: var(--mono-textarea-padding-x-xl, var(--_mono-textarea-padding-x-preset, calc(var(--mono-spacing) * 3)));\r\n --_mono-textarea-font-size: var(--mono-textarea-font-xl, var(--mono-text-base));\r\n --_mono-textarea-rows: var(--mono-textarea-rows, var(--mono-textarea-rows-xl, 5));\r\n}\r\n\r\n[mono-textarea][mono-size=\"xxl\"] {\r\n --_mono-textarea-height: var(--mono-textarea-height-xxl, var(--mono-control-height-xxl));\r\n --_mono-textarea-padding-x: var(--mono-textarea-padding-x-xxl, var(--_mono-textarea-padding-x-preset, calc(var(--mono-spacing) * 3)));\r\n --_mono-textarea-font-size: var(--mono-textarea-font-xxl, var(--mono-text-base));\r\n --_mono-textarea-rows: var(--mono-textarea-rows, var(--mono-textarea-rows-xxl, 5));\r\n}\r\n\r\n/* =========================================\r\n Colours — EXTENSION: the `color` prop is the FOCUS colour, nothing else\r\n ========================================= */\r\n\r\n[mono-textarea][mono-color=\"secondary\"] {\r\n --_mono-textarea-ring-color-preset: var(--_mono-textarea-secondary);\r\n}\r\n[mono-textarea][mono-color=\"success\"] {\r\n --_mono-textarea-ring-color-preset: var(--_mono-textarea-success);\r\n}\r\n[mono-textarea][mono-color=\"danger\"] {\r\n --_mono-textarea-ring-color-preset: var(--_mono-textarea-danger);\r\n}\r\n[mono-textarea][mono-color=\"warning\"] {\r\n --_mono-textarea-ring-color-preset: var(--_mono-textarea-warning);\r\n}\r\n[mono-textarea][mono-color=\"info\"] {\r\n --_mono-textarea-ring-color-preset: var(--_mono-textarea-info);\r\n}\r\n[mono-textarea][mono-color=\"teal\"] {\r\n --_mono-textarea-ring-color-preset: var(--_mono-textarea-teal);\r\n}\r\n[mono-textarea][mono-color=\"purple\"] {\r\n --_mono-textarea-ring-color-preset: var(--_mono-textarea-purple);\r\n}\r\n[mono-textarea][mono-color=\"neutral\"] {\r\n --_mono-textarea-ring-color-preset: var(--_mono-textarea-neutral);\r\n}\r\n[mono-textarea][mono-color=\"dark\"] {\r\n --_mono-textarea-ring-color-preset: var(--_mono-textarea-dark);\r\n}\r\n\r\n/* =========================================\r\n Label\r\n ========================================= */\r\n\r\n/* basecoat@1.0.2 styles/vega.css .field > label, .label\r\n — text-sm leading-snug font-medium */\r\n:where([mono-textarea]) > [mono-label] {\r\n display: flex;\r\n align-items: center;\r\n gap: calc(var(--mono-spacing) * 1);\r\n font-size: var(--mono-textarea-label-font-size, var(--mono-text-sm));\r\n line-height: var(--mono-textarea-label-line-height, var(--mono-leading-snug));\r\n font-weight: var(--mono-textarea-label-font-weight, var(--mono-label-font-weight, var(--mono-font-weight-medium)));\r\n color: var(--mono-textarea-label-color, var(--_mono-textarea-text));\r\n}\r\n\r\n[mono-textarea][mono-validation-state=\"invalid\"] > [mono-label] {\r\n color: var(--mono-textarea-label-color, var(--_mono-textarea-invalid));\r\n}\r\n\r\n:where([mono-textarea]) [mono-required-mark] {\r\n color: var(--mono-textarea-required-color, var(--destructive));\r\n}\r\n\r\n/* `tooltip` prop — the info icon at the end of the label row (the label's\r\n flex gap spaces it). `pointer-events` is restored because a disabled field\r\n switches its label's off, and a disabled field is exactly where the reason\r\n is worth a hover. Knobs: --mono-textarea-label-tooltip-size / -color / -opacity. */\r\n:where([mono-textarea]) > [mono-label] > [mono-label-tooltip] {\r\n display: inline-flex;\r\n flex: none;\r\n align-items: center;\r\n justify-content: center;\r\n font-size: var(--mono-textarea-label-tooltip-size, 1.1em);\r\n color: var(--mono-textarea-label-tooltip-color, currentColor);\r\n opacity: var(--mono-textarea-label-tooltip-opacity, 0.6);\r\n border-radius: 9999px;\r\n cursor: help;\r\n pointer-events: auto;\r\n outline: none;\r\n transition: opacity 150ms ease;\r\n}\r\n\r\n:where([mono-textarea]) > [mono-label] > [mono-label-tooltip]:is(:hover, :focus-visible) {\r\n opacity: 1;\r\n}\r\n\r\n:where([mono-textarea]) > [mono-label] > [mono-label-tooltip]:focus-visible {\r\n outline: 2px solid currentColor;\r\n outline-offset: 2px;\r\n}\r\n\r\n:where([mono-textarea]) > [mono-label] > [mono-label-tooltip] > [mono-icon] {\r\n width: 1em;\r\n height: 1em;\r\n}\r\n\r\n/* =========================================\r\n The field\r\n ========================================= */\r\n\r\n/* basecoat@1.0.2 components/textarea.css .field > textarea, .textarea\r\n — flex field-sizing-content min-h-16 w-full outline-none\r\n placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 */\r\n/* basecoat@1.0.2 styles/vega.css .field > textarea, .textarea\r\n — rounded-md border border-input bg-transparent px-2.5 py-2 text-base md:text-sm\r\n shadow-xs transition-[color,box-shadow] (dark:bg-input/30 via --mono-mode-surface);\r\n mono: `--tw-ring-*` flattened to the ring + shadow slots, and the height is\r\n derived from the control step rather than upstream's flat min-h-16 */\r\n:where([mono-textarea]) [mono-native] {\r\n --_mono-textarea-ring: 0 0 #0000;\r\n display: block;\r\n width: 100%;\r\n min-width: 0;\r\n min-height: var(--_mono-textarea-min-height);\r\n padding: var(--_mono-textarea-padding-y) var(--_mono-textarea-padding-x);\r\n border: var(--_mono-textarea-border-width) solid var(--_mono-textarea-border-color);\r\n border-radius: var(--_mono-textarea-radius);\r\n background-color: var(--_mono-textarea-bg);\r\n color: var(--_mono-textarea-text);\r\n font-family: inherit;\r\n font-size: var(--_mono-textarea-font-size);\r\n line-height: var(--_mono-textarea-line-height);\r\n resize: var(--mono-textarea-resize, vertical);\r\n outline: none;\r\n box-shadow: var(--_mono-textarea-ring), var(--_mono-textarea-shadow);\r\n transition-property: color, background-color, border-color, box-shadow;\r\n transition-timing-function: var(--mono-ease);\r\n transition-duration: var(--mono-duration);\r\n}\r\n\r\n/* Upstream grows the box with `field-sizing: content`, which has no ceiling.\r\n mono's `auto-resize` is a JS height instead, BECAUSE it honours `min-rows` and\r\n `max-rows` — so this rule must not hand the sizing back to the browser, or the\r\n two fight over the height. All the attribute does here is drop the manual grip:\r\n a box that resizes itself should not also offer one. */\r\n[mono-textarea][mono-auto-resize] > [mono-native] {\r\n resize: var(--mono-textarea-resize, none);\r\n}\r\n\r\n/* placeholder:text-muted-foreground */\r\n:where([mono-textarea]) [mono-native]::placeholder {\r\n color: var(--_mono-textarea-placeholder);\r\n opacity: 1;\r\n}\r\n\r\n/* focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 */\r\n:where([mono-textarea]) [mono-native]:focus-visible,\r\n:where([mono-textarea]) [mono-native]:focus {\r\n border-color: var(--_mono-textarea-ring-color);\r\n --_mono-textarea-ring: 0 0 0 var(--_mono-textarea-ring-width) color-mix(in oklab, var(--_mono-textarea-ring-color) var(--_mono-textarea-ring-alpha), transparent);\r\n}\r\n\r\n/* aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20\r\n (dark: /50 and /40, carried by the mode tokens) */\r\n[mono-textarea][mono-validation-state=\"invalid\"] > [mono-native],\r\n:where([mono-textarea]) [mono-native][aria-invalid=\"true\"] {\r\n --_mono-textarea-border-color: var(--mono-mode-invalid-border);\r\n --_mono-textarea-ring: 0 0 0 var(--_mono-textarea-ring-width) var(--mono-mode-invalid-ring);\r\n}\r\n\r\n/* EXTENSION — the same treatment in the success / warning roles */\r\n[mono-textarea][mono-validation-state=\"valid\"] > [mono-native] {\r\n --_mono-textarea-border-color: color-mix(in oklab, var(--_mono-textarea-valid) var(--mono-mode-state-border-alpha), transparent);\r\n --_mono-textarea-ring: 0 0 0 var(--_mono-textarea-ring-width) color-mix(in oklab, var(--_mono-textarea-valid) var(--mono-mode-state-ring-alpha), transparent);\r\n}\r\n\r\n[mono-textarea][mono-validation-state=\"warning\"] > [mono-native] {\r\n --_mono-textarea-border-color: color-mix(in oklab, var(--_mono-textarea-warning) var(--mono-mode-state-border-alpha), transparent);\r\n --_mono-textarea-ring: 0 0 0 var(--_mono-textarea-ring-width) color-mix(in oklab, var(--_mono-textarea-warning) var(--mono-mode-state-ring-alpha), transparent);\r\n}\r\n\r\n/* disabled:cursor-not-allowed disabled:opacity-50 */\r\n[mono-textarea][mono-disabled] > [mono-native],\r\n:where([mono-textarea]) [mono-native]:disabled {\r\n cursor: not-allowed;\r\n opacity: 0.5;\r\n background-color: var(--mono-textarea-disabled-bg, var(--_mono-textarea-bg));\r\n}\r\n\r\n/* EXTENSION — readonly is legible, not dimmed: a muted surface and no caret */\r\n[mono-textarea][mono-readonly] > [mono-native],\r\n:where([mono-textarea]) [mono-native]:read-only:not(:disabled) {\r\n background-color: var(--mono-textarea-readonly-bg, var(--muted));\r\n cursor: default;\r\n}\r\n\r\n/* =========================================\r\n Variants — EXTENSION: the two other looks Basecoat's styles ship\r\n ========================================= */\r\n\r\n/* `outlined` is the default and IS vega's textarea. The `--mono-textarea-outline-*`\r\n knobs are how a FLAVOR restyles this variant alone: writing the shared\r\n `--mono-textarea-bg` would repaint `filled` and `underlined` too (the public\r\n tier out-ranks a variant's preset), which is exactly what made every style's\r\n underlined textarea come out as a filled box. */\r\n[mono-textarea]:is(:not([mono-variant]), [mono-variant=\"outlined\"]) {\r\n --_mono-textarea-bg-preset: var(--mono-textarea-outline-bg);\r\n --_mono-textarea-border-color-preset: var(--mono-textarea-outline-border-color);\r\n --_mono-textarea-side-border-color-preset: var(--mono-textarea-outline-side-border-color);\r\n --_mono-textarea-shadow-preset: var(--mono-textarea-outline-shadow, var(--mono-shadow-xs));\r\n --_mono-textarea-radius-preset: var(--mono-textarea-outline-radius);\r\n --_mono-textarea-padding-x-preset: var(--mono-textarea-outline-padding-x);\r\n --_mono-textarea-ring-width-preset: var(--mono-textarea-outline-ring-width);\r\n}\r\n\r\n/* `filled` ≡ luma / mira / rhea's textarea: a tinted surface, no border, no shadow */\r\n[mono-textarea][mono-variant=\"filled\"] {\r\n --_mono-textarea-bg-preset: var(--mono-textarea-filled-bg, color-mix(in oklab, var(--input) 50%, transparent));\r\n --_mono-textarea-border-color-preset: transparent;\r\n --_mono-textarea-shadow-preset: 0 0 #0000;\r\n}\r\n\r\n/* `underlined` ≡ sera's: square, the bottom edge only, and the ring rides that\r\n edge instead of wrapping the box (never `box-shadow: none` — the resting slot\r\n is neutralised so a focus rule can still fill it) */\r\n[mono-textarea][mono-variant=\"underlined\"] {\r\n --_mono-textarea-radius-preset: 0;\r\n --_mono-textarea-bg-preset: transparent;\r\n /* the bottom edge keeps --_mono-textarea-border-color; only the other three\r\n sides are cleared, through the side slot */\r\n --_mono-textarea-side-border-color-preset: transparent;\r\n --_mono-textarea-shadow-preset: 0 0 #0000;\r\n --_mono-textarea-padding-x-preset: 0px;\r\n --_mono-textarea-ring-width-preset: 0px;\r\n}\r\n\r\n[mono-textarea][mono-variant=\"underlined\"] > [mono-native],\r\n[mono-textarea]:is(:not([mono-variant]), [mono-variant=\"outlined\"]) > [mono-native] {\r\n border-color: var(--_mono-textarea-side-border-color);\r\n border-bottom-color: var(--_mono-textarea-border-color);\r\n}\r\n\r\n[mono-textarea][mono-variant=\"underlined\"] > [mono-native]:is(:focus, :focus-visible) {\r\n border-color: var(--_mono-textarea-side-border-color);\r\n border-bottom-color: var(--_mono-textarea-ring-color);\r\n}\r\n\r\n/* =========================================\r\n Footer — EXTENSION: the message row and the character counter\r\n ========================================= */\r\n\r\n/* basecoat@1.0.2 styles/vega.css .fieldset legend + p, .field > p, .field section > p\r\n — text-sm text-muted-foreground leading-normal font-normal */\r\n:where([mono-textarea]) > [mono-footer] {\r\n display: flex;\r\n align-items: flex-start;\r\n justify-content: space-between;\r\n gap: calc(var(--mono-spacing) * 2);\r\n}\r\n\r\n:where([mono-textarea]) [mono-message-wrap] {\r\n flex: 1 1 auto;\r\n min-width: 0;\r\n}\r\n\r\n:where([mono-textarea]) [mono-message] {\r\n font-size: var(--mono-textarea-message-font-size, var(--mono-text-sm));\r\n line-height: var(--mono-textarea-message-line-height, var(--mono-leading-normal));\r\n color: var(--_mono-textarea-muted);\r\n}\r\n\r\n/* .field [role='alert'] — the invalid message is the destructive one */\r\n:where([mono-textarea]) [mono-message=\"invalid\"] {\r\n color: var(--_mono-textarea-invalid);\r\n}\r\n\r\n:where([mono-textarea]) [mono-message=\"valid\"] {\r\n color: var(--_mono-textarea-valid);\r\n}\r\n\r\n:where([mono-textarea]) [mono-message=\"warning\"] {\r\n color: var(--_mono-textarea-warning);\r\n}\r\n\r\n:where([mono-textarea]) [mono-counter] {\r\n flex: 0 0 auto;\r\n font-size: var(--mono-textarea-counter-font-size, var(--mono-text-xs));\r\n line-height: var(--mono-leading-normal);\r\n font-variant-numeric: tabular-nums;\r\n color: var(--_mono-textarea-muted);\r\n}\r\n\r\n:where([mono-textarea]) [mono-counter][mono-near] {\r\n color: var(--_mono-textarea-warning);\r\n}\r\n\r\n:where([mono-textarea]) [mono-counter][mono-over] {\r\n color: var(--_mono-textarea-invalid);\r\n font-weight: var(--mono-font-weight-medium);\r\n}\r\n\r\n@media (prefers-reduced-motion: reduce) {\r\n :where([mono-textarea]) [mono-native] {\r\n transition: none;\r\n }\r\n}\r\n\r\n/* =========================================\r\n label-position — the slots form/label-position.css reads\r\n (top / notched / left / right; public knobs: --mono-textarea-label-width,\r\n -label-side-gap, -label-notch-font-size, -label-notch-bg)\r\n ========================================= */\r\n\r\n[mono-textarea][mono-label-position] {\r\n --_mono-lp-width: var(--mono-textarea-label-width, auto);\r\n --_mono-lp-gap: var(--mono-textarea-label-side-gap, calc(var(--mono-spacing) * 3));\r\n --_mono-lp-height: var(--_mono-textarea-height);\r\n --_mono-lp-box-min: var(--_mono-textarea-min-height);\r\n --_mono-lp-padding-x: var(--_mono-textarea-padding-x);\r\n --_mono-lp-padding-y: var(--_mono-textarea-padding-y);\r\n --_mono-lp-font: var(--mono-textarea-label-notch-font-size, var(--mono-text-xs));\r\n --_mono-lp-notch-bg: var(--mono-textarea-label-notch-bg, var(--background));\r\n --_mono-lp-field-bg: var(--_mono-textarea-bg);\r\n}\r\n";
|
|
781
11
|
|
|
@@ -836,46 +66,5 @@ let MonoTextareaShadow = class MonoTextareaShadow extends withShadowUtilityStyle
|
|
|
836
66
|
};
|
|
837
67
|
MonoTextareaShadow = __decorate([customElement("mono-shadow-textarea")], MonoTextareaShadow);
|
|
838
68
|
|
|
839
|
-
//#endregion
|
|
840
|
-
//#region src/components/textarea/textarea-utils.ts
|
|
841
|
-
function validateTextareaProps(props) {
|
|
842
|
-
const validSizes = [
|
|
843
|
-
"xs",
|
|
844
|
-
"sm",
|
|
845
|
-
"md",
|
|
846
|
-
"lg",
|
|
847
|
-
"xl",
|
|
848
|
-
"xxl"
|
|
849
|
-
];
|
|
850
|
-
const validColors = [
|
|
851
|
-
"primary",
|
|
852
|
-
"secondary",
|
|
853
|
-
"success",
|
|
854
|
-
"danger",
|
|
855
|
-
"warning",
|
|
856
|
-
"info",
|
|
857
|
-
"teal",
|
|
858
|
-
"purple",
|
|
859
|
-
"neutral",
|
|
860
|
-
"dark"
|
|
861
|
-
];
|
|
862
|
-
const validVariants = [
|
|
863
|
-
"outlined",
|
|
864
|
-
"filled",
|
|
865
|
-
"underlined"
|
|
866
|
-
];
|
|
867
|
-
const validStates = [
|
|
868
|
-
"default",
|
|
869
|
-
"valid",
|
|
870
|
-
"invalid",
|
|
871
|
-
"warning"
|
|
872
|
-
];
|
|
873
|
-
if (props.size && !validSizes.includes(props.size)) return false;
|
|
874
|
-
if (props.color && !validColors.includes(props.color)) return false;
|
|
875
|
-
if (props.variant && !validVariants.includes(props.variant)) return false;
|
|
876
|
-
if (props.validationState && !validStates.includes(props.validationState)) return false;
|
|
877
|
-
return true;
|
|
878
|
-
}
|
|
879
|
-
|
|
880
69
|
//#endregion
|
|
881
70
|
export { MonoTextareaCore, MonoTextareaShadow, validateTextareaProps };
|