@mmlogic/components 0.3.6 → 0.3.8
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/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/index-BPj2cBXs.js +1570 -0
- package/dist/cjs/index.cjs.js +66 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/mosterdcomponents.cjs.js +25 -0
- package/dist/cjs/mrd-boolean-field_20.cjs.entry.js +3961 -0
- package/dist/cjs/quill-DmFfnC1f.js +16272 -0
- package/dist/collection/collection-manifest.json +32 -0
- package/dist/collection/components/mrd-boolean-field/mrd-boolean-field.js +199 -0
- package/dist/collection/components/mrd-boolean-field/mrd-boolean-field.scss +77 -0
- package/dist/collection/components/mrd-currency-field/mrd-currency-field.js +248 -0
- package/dist/collection/components/mrd-currency-field/mrd-currency-field.scss +100 -0
- package/dist/collection/components/mrd-date-field/mrd-date-field.js +206 -0
- package/dist/collection/components/mrd-date-field/mrd-date-field.scss +66 -0
- package/dist/collection/components/mrd-datetime-field/mrd-datetime-field.js +240 -0
- package/dist/collection/components/mrd-datetime-field/mrd-datetime-field.scss +66 -0
- package/dist/collection/components/mrd-email-field/mrd-email-field.js +230 -0
- package/dist/collection/components/mrd-email-field/mrd-email-field.scss +69 -0
- package/dist/{mosterdcomponents/mrd-field.entry.js → collection/components/mrd-field/mrd-field.js} +179 -28
- package/dist/collection/components/mrd-field/mrd-field.scss +118 -0
- package/dist/collection/components/mrd-file-field/mrd-file-field.js +341 -0
- package/dist/collection/components/mrd-file-field/mrd-file-field.scss +153 -0
- package/dist/{mosterdcomponents/mrd-form.entry.js → collection/components/mrd-form/mrd-form.js} +308 -31
- package/dist/collection/components/mrd-form/mrd-form.scss +148 -0
- package/dist/collection/components/mrd-hyperlink-field/mrd-hyperlink-field.js +291 -0
- package/dist/collection/components/mrd-hyperlink-field/mrd-hyperlink-field.scss +91 -0
- package/dist/collection/components/mrd-image-field/mrd-image-field.js +356 -0
- package/dist/collection/components/mrd-image-field/mrd-image-field.scss +190 -0
- package/dist/{mosterdcomponents/mrd-layout-section.entry.js → collection/components/mrd-layout-section/mrd-layout-section.js} +420 -33
- package/dist/collection/components/mrd-layout-section/mrd-layout-section.scss +445 -0
- package/dist/collection/components/mrd-list-field/mrd-list-field.js +313 -0
- package/dist/collection/components/mrd-list-field/mrd-list-field.scss +109 -0
- package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.js +227 -0
- package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.scss +78 -0
- package/dist/collection/components/mrd-number-field/mrd-number-field.js +316 -0
- package/dist/collection/components/mrd-number-field/mrd-number-field.scss +77 -0
- package/dist/collection/components/mrd-relation-field/mrd-relation-field.js +707 -0
- package/dist/collection/components/mrd-relation-field/mrd-relation-field.scss +266 -0
- package/dist/collection/components/mrd-secret-field/mrd-secret-field.js +229 -0
- package/dist/collection/components/mrd-secret-field/mrd-secret-field.scss +73 -0
- package/dist/{mosterdcomponents/mrd-table.entry.js → collection/components/mrd-table/mrd-table.js} +394 -32
- package/dist/collection/components/mrd-table/mrd-table.scss +809 -0
- package/dist/collection/components/mrd-text-field/mrd-text-field.js +227 -0
- package/dist/collection/components/mrd-text-field/mrd-text-field.scss +69 -0
- package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.js +267 -0
- package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.scss +79 -0
- package/dist/collection/components/mrd-time-field/mrd-time-field.js +206 -0
- package/dist/collection/components/mrd-time-field/mrd-time-field.scss +66 -0
- package/dist/collection/dev/api.js +145 -0
- package/dist/collection/dev/app.js +890 -0
- package/dist/collection/dev/auth.js +156 -0
- package/dist/collection/dev/example-data.js +403 -0
- package/dist/collection/dev/sprites.svg +55 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/types/client-layout.js +64 -0
- package/dist/collection/types/index.js +1 -0
- package/dist/{mosterdcomponents/cell-renderer-CbRwLOo8.js → collection/utils/cell-renderer.js} +3 -9
- package/dist/{mosterdcomponents/format-BAfsQfy1.js → collection/utils/format.js} +7 -12
- package/dist/{mosterdcomponents/i18n-hoGGKbKU.js → collection/utils/i18n.js} +1 -6
- package/dist/{mosterdcomponents/validation-ixb43cqU.js → collection/utils/validation.js} +5 -12
- package/dist/components/client-layout.js +1 -0
- package/dist/components/format.js +1 -0
- package/dist/components/i18n.js +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/mrd-boolean-field.js +1 -0
- package/dist/components/mrd-boolean-field2.js +1 -0
- package/dist/components/mrd-currency-field.js +1 -0
- package/dist/components/mrd-currency-field2.js +1 -0
- package/dist/components/mrd-date-field.js +1 -0
- package/dist/components/mrd-date-field2.js +1 -0
- package/dist/components/mrd-datetime-field.js +1 -0
- package/dist/components/mrd-datetime-field2.js +1 -0
- package/dist/components/mrd-email-field.js +1 -0
- package/dist/components/mrd-email-field2.js +1 -0
- package/dist/components/mrd-field.js +1 -0
- package/dist/components/mrd-field2.js +1 -0
- package/dist/components/mrd-file-field.js +1 -0
- package/dist/components/mrd-file-field2.js +1 -0
- package/dist/components/mrd-form.js +1 -0
- package/dist/components/mrd-hyperlink-field.js +1 -0
- package/dist/components/mrd-hyperlink-field2.js +1 -0
- package/dist/components/mrd-image-field.js +1 -0
- package/dist/components/mrd-image-field2.js +1 -0
- package/dist/components/mrd-layout-section.js +1 -0
- package/dist/components/mrd-list-field.js +1 -0
- package/dist/components/mrd-list-field2.js +1 -0
- package/dist/components/mrd-longtext-field.js +1 -0
- package/dist/components/mrd-longtext-field2.js +1 -0
- package/dist/components/mrd-number-field.js +1 -0
- package/dist/components/mrd-number-field2.js +1 -0
- package/dist/components/mrd-relation-field.js +1 -0
- package/dist/components/mrd-relation-field2.js +1 -0
- package/dist/components/mrd-secret-field.js +1 -0
- package/dist/components/mrd-secret-field2.js +1 -0
- package/dist/components/mrd-table.js +1 -0
- package/dist/components/mrd-table2.js +1 -0
- package/dist/components/mrd-text-field.js +1 -0
- package/dist/components/mrd-text-field2.js +1 -0
- package/dist/components/mrd-textarea-field.js +1 -0
- package/dist/components/mrd-textarea-field2.js +1 -0
- package/dist/components/mrd-time-field.js +1 -0
- package/dist/components/mrd-time-field2.js +1 -0
- package/dist/components/quill.js +1 -0
- package/dist/components/validation.js +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/index-_tsCCkAi.js +1561 -0
- package/dist/{mosterdcomponents/client-layout-D88nn5zf.js → esm/index.js} +1 -4
- package/dist/esm/loader.js +11 -0
- package/dist/esm/mosterdcomponents.js +21 -0
- package/dist/esm/mrd-boolean-field_20.entry.js +3940 -0
- package/dist/{mosterdcomponents/quill-C9pgw_k-.js → esm/quill-CiuCgGz_.js} +1347 -16232
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/mosterdcomponents/index-6yQUNVww.js.map +1 -0
- package/dist/mosterdcomponents/index.esm.js +1 -5
- package/dist/mosterdcomponents/mosterdcomponents.css +1 -180
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -50
- package/dist/mosterdcomponents/p-7bfaee51.entry.js +1 -0
- package/dist/mosterdcomponents/p-CiuCgGz_.js +1 -0
- package/dist/mosterdcomponents/p-DQuL1Twl.js +1 -0
- package/dist/mosterdcomponents/p-_tsCCkAi.js +2 -0
- package/package.json +1 -1
- package/dist/mosterdcomponents/index-B_tPFIvS.js +0 -4585
- package/dist/mosterdcomponents/index-B_tPFIvS.js.map +0 -1
- package/dist/mosterdcomponents/index-I5SuYv7a.js +0 -4
- package/dist/mosterdcomponents/mrd-boolean-field.entry.js +0 -37
- package/dist/mosterdcomponents/mrd-boolean-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-currency-field.entry.js +0 -67
- package/dist/mosterdcomponents/mrd-currency-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-date-field.entry.js +0 -46
- package/dist/mosterdcomponents/mrd-date-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-datetime-field.entry.js +0 -78
- package/dist/mosterdcomponents/mrd-datetime-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-email-field.entry.js +0 -50
- package/dist/mosterdcomponents/mrd-email-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-file-field.entry.js +0 -108
- package/dist/mosterdcomponents/mrd-file-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-form.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-hyperlink-field.entry.js +0 -87
- package/dist/mosterdcomponents/mrd-hyperlink-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-image-field.entry.js +0 -122
- package/dist/mosterdcomponents/mrd-image-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-layout-section.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-list-field.entry.js +0 -107
- package/dist/mosterdcomponents/mrd-list-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-longtext-field.entry.js +0 -47
- package/dist/mosterdcomponents/mrd-longtext-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-number-field.entry.js +0 -87
- package/dist/mosterdcomponents/mrd-number-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-relation-field.entry.js +0 -267
- package/dist/mosterdcomponents/mrd-relation-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-secret-field.entry.js +0 -49
- package/dist/mosterdcomponents/mrd-secret-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-table.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-text-field.entry.js +0 -47
- package/dist/mosterdcomponents/mrd-text-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-textarea-field.entry.js +0 -86
- package/dist/mosterdcomponents/mrd-textarea-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-time-field.entry.js +0 -46
- package/dist/mosterdcomponents/mrd-time-field.entry.js.map +0 -1
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { t } from "../../utils/i18n";
|
|
3
|
+
import { validateRequired } from "../../utils/validation";
|
|
4
|
+
export class MrdTextField {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = '';
|
|
7
|
+
this.label = '';
|
|
8
|
+
this.value = '';
|
|
9
|
+
this.placeholder = '';
|
|
10
|
+
this.required = false;
|
|
11
|
+
this.disabled = false;
|
|
12
|
+
this.locale = navigator.language;
|
|
13
|
+
this.error = '';
|
|
14
|
+
this.handleInput = (e) => {
|
|
15
|
+
const val = e.target.value;
|
|
16
|
+
this.mrdChange.emit({ name: this.name, value: val });
|
|
17
|
+
};
|
|
18
|
+
this.handleBlur = (e) => {
|
|
19
|
+
const val = e.target.value;
|
|
20
|
+
if (this.required && !validateRequired(val)) {
|
|
21
|
+
this.error = t('required', this.locale);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
this.error = '';
|
|
25
|
+
}
|
|
26
|
+
this.mrdBlur.emit({ name: this.name, value: val });
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
render() {
|
|
30
|
+
const hasError = !!this.error;
|
|
31
|
+
return (h(Host, { key: 'fd4e1f389cb452ab80a1e1c7295d884ca935999e' }, h("div", { key: '7b7bde7a18fcd9b8d5779daab88ddabb45dd8692', class: "mrd-text-field" }, this.label && (h("label", { key: '8e2ad4053473cfad4eae4c4634b863ac5ef32fea', class: `mrd-text-field__label${this.required ? ' mrd-text-field__label--required' : ''}` }, this.label)), h("input", { key: 'd32712a6dc2aee4691bc4a580d5ca2ad81e0ff9f', class: `mrd-text-field__input${hasError ? ' mrd-text-field__input--error' : ''}`, type: "text", name: this.name, value: this.value, placeholder: this.placeholder, required: this.required, disabled: this.disabled, onInput: this.handleInput, onBlur: this.handleBlur }), hasError && h("span", { key: '31585dbf82020c81834e1eeada5cd9907a5ead56', class: "mrd-text-field__error" }, this.error))));
|
|
32
|
+
}
|
|
33
|
+
static get is() { return "mrd-text-field"; }
|
|
34
|
+
static get encapsulation() { return "scoped"; }
|
|
35
|
+
static get originalStyleUrls() {
|
|
36
|
+
return {
|
|
37
|
+
"$": ["mrd-text-field.scss"]
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
static get styleUrls() {
|
|
41
|
+
return {
|
|
42
|
+
"$": ["mrd-text-field.css"]
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
static get properties() {
|
|
46
|
+
return {
|
|
47
|
+
"name": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"mutable": false,
|
|
50
|
+
"complexType": {
|
|
51
|
+
"original": "string",
|
|
52
|
+
"resolved": "string",
|
|
53
|
+
"references": {}
|
|
54
|
+
},
|
|
55
|
+
"required": false,
|
|
56
|
+
"optional": false,
|
|
57
|
+
"docs": {
|
|
58
|
+
"tags": [],
|
|
59
|
+
"text": ""
|
|
60
|
+
},
|
|
61
|
+
"getter": false,
|
|
62
|
+
"setter": false,
|
|
63
|
+
"reflect": false,
|
|
64
|
+
"attribute": "name",
|
|
65
|
+
"defaultValue": "''"
|
|
66
|
+
},
|
|
67
|
+
"label": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"mutable": false,
|
|
70
|
+
"complexType": {
|
|
71
|
+
"original": "string",
|
|
72
|
+
"resolved": "string",
|
|
73
|
+
"references": {}
|
|
74
|
+
},
|
|
75
|
+
"required": false,
|
|
76
|
+
"optional": false,
|
|
77
|
+
"docs": {
|
|
78
|
+
"tags": [],
|
|
79
|
+
"text": ""
|
|
80
|
+
},
|
|
81
|
+
"getter": false,
|
|
82
|
+
"setter": false,
|
|
83
|
+
"reflect": false,
|
|
84
|
+
"attribute": "label",
|
|
85
|
+
"defaultValue": "''"
|
|
86
|
+
},
|
|
87
|
+
"value": {
|
|
88
|
+
"type": "string",
|
|
89
|
+
"mutable": false,
|
|
90
|
+
"complexType": {
|
|
91
|
+
"original": "string",
|
|
92
|
+
"resolved": "string",
|
|
93
|
+
"references": {}
|
|
94
|
+
},
|
|
95
|
+
"required": false,
|
|
96
|
+
"optional": false,
|
|
97
|
+
"docs": {
|
|
98
|
+
"tags": [],
|
|
99
|
+
"text": ""
|
|
100
|
+
},
|
|
101
|
+
"getter": false,
|
|
102
|
+
"setter": false,
|
|
103
|
+
"reflect": false,
|
|
104
|
+
"attribute": "value",
|
|
105
|
+
"defaultValue": "''"
|
|
106
|
+
},
|
|
107
|
+
"placeholder": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"mutable": false,
|
|
110
|
+
"complexType": {
|
|
111
|
+
"original": "string",
|
|
112
|
+
"resolved": "string",
|
|
113
|
+
"references": {}
|
|
114
|
+
},
|
|
115
|
+
"required": false,
|
|
116
|
+
"optional": false,
|
|
117
|
+
"docs": {
|
|
118
|
+
"tags": [],
|
|
119
|
+
"text": ""
|
|
120
|
+
},
|
|
121
|
+
"getter": false,
|
|
122
|
+
"setter": false,
|
|
123
|
+
"reflect": false,
|
|
124
|
+
"attribute": "placeholder",
|
|
125
|
+
"defaultValue": "''"
|
|
126
|
+
},
|
|
127
|
+
"required": {
|
|
128
|
+
"type": "boolean",
|
|
129
|
+
"mutable": false,
|
|
130
|
+
"complexType": {
|
|
131
|
+
"original": "boolean",
|
|
132
|
+
"resolved": "boolean",
|
|
133
|
+
"references": {}
|
|
134
|
+
},
|
|
135
|
+
"required": false,
|
|
136
|
+
"optional": false,
|
|
137
|
+
"docs": {
|
|
138
|
+
"tags": [],
|
|
139
|
+
"text": ""
|
|
140
|
+
},
|
|
141
|
+
"getter": false,
|
|
142
|
+
"setter": false,
|
|
143
|
+
"reflect": false,
|
|
144
|
+
"attribute": "required",
|
|
145
|
+
"defaultValue": "false"
|
|
146
|
+
},
|
|
147
|
+
"disabled": {
|
|
148
|
+
"type": "boolean",
|
|
149
|
+
"mutable": false,
|
|
150
|
+
"complexType": {
|
|
151
|
+
"original": "boolean",
|
|
152
|
+
"resolved": "boolean",
|
|
153
|
+
"references": {}
|
|
154
|
+
},
|
|
155
|
+
"required": false,
|
|
156
|
+
"optional": false,
|
|
157
|
+
"docs": {
|
|
158
|
+
"tags": [],
|
|
159
|
+
"text": ""
|
|
160
|
+
},
|
|
161
|
+
"getter": false,
|
|
162
|
+
"setter": false,
|
|
163
|
+
"reflect": false,
|
|
164
|
+
"attribute": "disabled",
|
|
165
|
+
"defaultValue": "false"
|
|
166
|
+
},
|
|
167
|
+
"locale": {
|
|
168
|
+
"type": "string",
|
|
169
|
+
"mutable": false,
|
|
170
|
+
"complexType": {
|
|
171
|
+
"original": "string",
|
|
172
|
+
"resolved": "string",
|
|
173
|
+
"references": {}
|
|
174
|
+
},
|
|
175
|
+
"required": false,
|
|
176
|
+
"optional": false,
|
|
177
|
+
"docs": {
|
|
178
|
+
"tags": [],
|
|
179
|
+
"text": ""
|
|
180
|
+
},
|
|
181
|
+
"getter": false,
|
|
182
|
+
"setter": false,
|
|
183
|
+
"reflect": false,
|
|
184
|
+
"attribute": "locale",
|
|
185
|
+
"defaultValue": "navigator.language"
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
static get states() {
|
|
190
|
+
return {
|
|
191
|
+
"error": {}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
static get events() {
|
|
195
|
+
return [{
|
|
196
|
+
"method": "mrdChange",
|
|
197
|
+
"name": "mrdChange",
|
|
198
|
+
"bubbles": true,
|
|
199
|
+
"cancelable": true,
|
|
200
|
+
"composed": true,
|
|
201
|
+
"docs": {
|
|
202
|
+
"tags": [],
|
|
203
|
+
"text": ""
|
|
204
|
+
},
|
|
205
|
+
"complexType": {
|
|
206
|
+
"original": "{ name: string; value: string }",
|
|
207
|
+
"resolved": "{ name: string; value: string; }",
|
|
208
|
+
"references": {}
|
|
209
|
+
}
|
|
210
|
+
}, {
|
|
211
|
+
"method": "mrdBlur",
|
|
212
|
+
"name": "mrdBlur",
|
|
213
|
+
"bubbles": true,
|
|
214
|
+
"cancelable": true,
|
|
215
|
+
"composed": true,
|
|
216
|
+
"docs": {
|
|
217
|
+
"tags": [],
|
|
218
|
+
"text": ""
|
|
219
|
+
},
|
|
220
|
+
"complexType": {
|
|
221
|
+
"original": "{ name: string; value: string }",
|
|
222
|
+
"resolved": "{ name: string; value: string; }",
|
|
223
|
+
"references": {}
|
|
224
|
+
}
|
|
225
|
+
}];
|
|
226
|
+
}
|
|
227
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.mrd-text-field {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: var(--mrd-space-1);
|
|
9
|
+
width: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.mrd-text-field__label {
|
|
13
|
+
display: block;
|
|
14
|
+
font-family: var(--mrd-font-family);
|
|
15
|
+
font-size: var(--mrd-label-font-size);
|
|
16
|
+
font-weight: var(--mrd-label-font-weight);
|
|
17
|
+
color: var(--mrd-label-color);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.mrd-text-field__label--required::after {
|
|
21
|
+
content: ' *';
|
|
22
|
+
color: var(--mrd-color-danger);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.mrd-text-field__input {
|
|
26
|
+
display: block;
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: var(--mrd-input-height);
|
|
29
|
+
padding: var(--mrd-input-padding-y) var(--mrd-input-padding-x);
|
|
30
|
+
font-family: var(--mrd-font-family);
|
|
31
|
+
font-size: var(--mrd-font-size-base);
|
|
32
|
+
color: var(--mrd-input-color);
|
|
33
|
+
background-color: var(--mrd-input-bg);
|
|
34
|
+
border: var(--mrd-border-width) solid var(--mrd-border-color);
|
|
35
|
+
border-radius: var(--mrd-border-radius);
|
|
36
|
+
transition: border-color var(--mrd-transition), box-shadow var(--mrd-transition);
|
|
37
|
+
outline: none;
|
|
38
|
+
appearance: none;
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.mrd-text-field__input::placeholder {
|
|
43
|
+
color: var(--mrd-input-placeholder-color);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.mrd-text-field__input:focus {
|
|
47
|
+
border-color: var(--mrd-border-color-focus);
|
|
48
|
+
box-shadow: var(--mrd-shadow-focus);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.mrd-text-field__input:disabled {
|
|
52
|
+
background-color: var(--mrd-input-bg-disabled);
|
|
53
|
+
cursor: not-allowed;
|
|
54
|
+
opacity: 0.7;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.mrd-text-field__input--error {
|
|
58
|
+
border-color: var(--mrd-border-color-error);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.mrd-text-field__input--error:focus {
|
|
62
|
+
box-shadow: var(--mrd-shadow-focus-error);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.mrd-text-field__error {
|
|
66
|
+
font-family: var(--mrd-font-family);
|
|
67
|
+
font-size: var(--mrd-error-font-size);
|
|
68
|
+
color: var(--mrd-error-color);
|
|
69
|
+
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { t } from "../../utils/i18n";
|
|
3
|
+
import { validateRequired } from "../../utils/validation";
|
|
4
|
+
export class MrdTextareaField {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = '';
|
|
7
|
+
this.label = '';
|
|
8
|
+
this.value = '';
|
|
9
|
+
this.placeholder = '';
|
|
10
|
+
this.required = false;
|
|
11
|
+
this.disabled = false;
|
|
12
|
+
this.locale = navigator.language;
|
|
13
|
+
this.error = '';
|
|
14
|
+
this.editorReady = false;
|
|
15
|
+
}
|
|
16
|
+
componentDidLoad() {
|
|
17
|
+
this.initQuill();
|
|
18
|
+
}
|
|
19
|
+
async initQuill() {
|
|
20
|
+
try {
|
|
21
|
+
// Dynamically import Quill
|
|
22
|
+
const Quill = (await import('quill')).default;
|
|
23
|
+
this.editorEl = this.el.querySelector('.mrd-textarea-field__editor');
|
|
24
|
+
if (!this.editorEl)
|
|
25
|
+
return;
|
|
26
|
+
const quill = new Quill(this.editorEl, {
|
|
27
|
+
theme: 'snow',
|
|
28
|
+
placeholder: this.placeholder,
|
|
29
|
+
readOnly: this.disabled,
|
|
30
|
+
modules: {
|
|
31
|
+
toolbar: [
|
|
32
|
+
['bold', 'italic', 'underline', 'strike'],
|
|
33
|
+
[{ list: 'ordered' }, { list: 'bullet' }],
|
|
34
|
+
[{ header: [1, 2, 3, false] }],
|
|
35
|
+
['link'],
|
|
36
|
+
['clean'],
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
if (this.value) {
|
|
41
|
+
quill.clipboard.dangerouslyPasteHTML(this.value);
|
|
42
|
+
}
|
|
43
|
+
quill.on('text-change', () => {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
const html = (_b = (_a = this.editorEl.querySelector('.ql-editor')) === null || _a === void 0 ? void 0 : _a.innerHTML) !== null && _b !== void 0 ? _b : '';
|
|
46
|
+
this.mrdChange.emit({ name: this.name, value: html });
|
|
47
|
+
});
|
|
48
|
+
quill.on('selection-change', (range) => {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
if (!range) {
|
|
51
|
+
const html = (_b = (_a = this.editorEl.querySelector('.ql-editor')) === null || _a === void 0 ? void 0 : _a.innerHTML) !== null && _b !== void 0 ? _b : '';
|
|
52
|
+
if (this.required && !validateRequired(html)) {
|
|
53
|
+
this.error = t('required', this.locale);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
this.error = '';
|
|
57
|
+
}
|
|
58
|
+
this.mrdBlur.emit({ name: this.name, value: html });
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
void quill; // hold reference if needed later
|
|
62
|
+
this.editorReady = true;
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
console.error('Failed to load Quill editor:', err);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
render() {
|
|
69
|
+
return (h(Host, { key: 'e1fd819c598f01e3986946357ec18d608f2c7adc' }, h("div", { key: '20c28e54e61429655b2d4f297bd84e183ad7e971', class: "mrd-textarea-field" }, this.label && (h("label", { key: 'fa46a20badc35c931563600f24a32e0a8c8c07ad', class: `mrd-textarea-field__label${this.required ? ' mrd-textarea-field__label--required' : ''}` }, this.label)), h("div", { key: 'ee928eca0a1b85401b346b7fae8adbe9214a7664', class: `mrd-textarea-field__container${this.error ? ' mrd-textarea-field__container--error' : ''}` }, h("div", { key: '89b00f3c526623c47f0aff7ad862f70dfdc2fe15', class: "mrd-textarea-field__editor" })), this.error && h("span", { key: '458cf8fddee36ddbc384ce4d25765e5aacd3c9d5', class: "mrd-textarea-field__error" }, this.error))));
|
|
70
|
+
}
|
|
71
|
+
static get is() { return "mrd-textarea-field"; }
|
|
72
|
+
static get encapsulation() { return "scoped"; }
|
|
73
|
+
static get originalStyleUrls() {
|
|
74
|
+
return {
|
|
75
|
+
"$": ["mrd-textarea-field.scss"]
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
static get styleUrls() {
|
|
79
|
+
return {
|
|
80
|
+
"$": ["mrd-textarea-field.css"]
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
static get properties() {
|
|
84
|
+
return {
|
|
85
|
+
"name": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"mutable": false,
|
|
88
|
+
"complexType": {
|
|
89
|
+
"original": "string",
|
|
90
|
+
"resolved": "string",
|
|
91
|
+
"references": {}
|
|
92
|
+
},
|
|
93
|
+
"required": false,
|
|
94
|
+
"optional": false,
|
|
95
|
+
"docs": {
|
|
96
|
+
"tags": [],
|
|
97
|
+
"text": ""
|
|
98
|
+
},
|
|
99
|
+
"getter": false,
|
|
100
|
+
"setter": false,
|
|
101
|
+
"reflect": false,
|
|
102
|
+
"attribute": "name",
|
|
103
|
+
"defaultValue": "''"
|
|
104
|
+
},
|
|
105
|
+
"label": {
|
|
106
|
+
"type": "string",
|
|
107
|
+
"mutable": false,
|
|
108
|
+
"complexType": {
|
|
109
|
+
"original": "string",
|
|
110
|
+
"resolved": "string",
|
|
111
|
+
"references": {}
|
|
112
|
+
},
|
|
113
|
+
"required": false,
|
|
114
|
+
"optional": false,
|
|
115
|
+
"docs": {
|
|
116
|
+
"tags": [],
|
|
117
|
+
"text": ""
|
|
118
|
+
},
|
|
119
|
+
"getter": false,
|
|
120
|
+
"setter": false,
|
|
121
|
+
"reflect": false,
|
|
122
|
+
"attribute": "label",
|
|
123
|
+
"defaultValue": "''"
|
|
124
|
+
},
|
|
125
|
+
"value": {
|
|
126
|
+
"type": "string",
|
|
127
|
+
"mutable": false,
|
|
128
|
+
"complexType": {
|
|
129
|
+
"original": "string",
|
|
130
|
+
"resolved": "string",
|
|
131
|
+
"references": {}
|
|
132
|
+
},
|
|
133
|
+
"required": false,
|
|
134
|
+
"optional": false,
|
|
135
|
+
"docs": {
|
|
136
|
+
"tags": [],
|
|
137
|
+
"text": ""
|
|
138
|
+
},
|
|
139
|
+
"getter": false,
|
|
140
|
+
"setter": false,
|
|
141
|
+
"reflect": false,
|
|
142
|
+
"attribute": "value",
|
|
143
|
+
"defaultValue": "''"
|
|
144
|
+
},
|
|
145
|
+
"placeholder": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"mutable": false,
|
|
148
|
+
"complexType": {
|
|
149
|
+
"original": "string",
|
|
150
|
+
"resolved": "string",
|
|
151
|
+
"references": {}
|
|
152
|
+
},
|
|
153
|
+
"required": false,
|
|
154
|
+
"optional": false,
|
|
155
|
+
"docs": {
|
|
156
|
+
"tags": [],
|
|
157
|
+
"text": ""
|
|
158
|
+
},
|
|
159
|
+
"getter": false,
|
|
160
|
+
"setter": false,
|
|
161
|
+
"reflect": false,
|
|
162
|
+
"attribute": "placeholder",
|
|
163
|
+
"defaultValue": "''"
|
|
164
|
+
},
|
|
165
|
+
"required": {
|
|
166
|
+
"type": "boolean",
|
|
167
|
+
"mutable": false,
|
|
168
|
+
"complexType": {
|
|
169
|
+
"original": "boolean",
|
|
170
|
+
"resolved": "boolean",
|
|
171
|
+
"references": {}
|
|
172
|
+
},
|
|
173
|
+
"required": false,
|
|
174
|
+
"optional": false,
|
|
175
|
+
"docs": {
|
|
176
|
+
"tags": [],
|
|
177
|
+
"text": ""
|
|
178
|
+
},
|
|
179
|
+
"getter": false,
|
|
180
|
+
"setter": false,
|
|
181
|
+
"reflect": false,
|
|
182
|
+
"attribute": "required",
|
|
183
|
+
"defaultValue": "false"
|
|
184
|
+
},
|
|
185
|
+
"disabled": {
|
|
186
|
+
"type": "boolean",
|
|
187
|
+
"mutable": false,
|
|
188
|
+
"complexType": {
|
|
189
|
+
"original": "boolean",
|
|
190
|
+
"resolved": "boolean",
|
|
191
|
+
"references": {}
|
|
192
|
+
},
|
|
193
|
+
"required": false,
|
|
194
|
+
"optional": false,
|
|
195
|
+
"docs": {
|
|
196
|
+
"tags": [],
|
|
197
|
+
"text": ""
|
|
198
|
+
},
|
|
199
|
+
"getter": false,
|
|
200
|
+
"setter": false,
|
|
201
|
+
"reflect": false,
|
|
202
|
+
"attribute": "disabled",
|
|
203
|
+
"defaultValue": "false"
|
|
204
|
+
},
|
|
205
|
+
"locale": {
|
|
206
|
+
"type": "string",
|
|
207
|
+
"mutable": false,
|
|
208
|
+
"complexType": {
|
|
209
|
+
"original": "string",
|
|
210
|
+
"resolved": "string",
|
|
211
|
+
"references": {}
|
|
212
|
+
},
|
|
213
|
+
"required": false,
|
|
214
|
+
"optional": false,
|
|
215
|
+
"docs": {
|
|
216
|
+
"tags": [],
|
|
217
|
+
"text": ""
|
|
218
|
+
},
|
|
219
|
+
"getter": false,
|
|
220
|
+
"setter": false,
|
|
221
|
+
"reflect": false,
|
|
222
|
+
"attribute": "locale",
|
|
223
|
+
"defaultValue": "navigator.language"
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
static get states() {
|
|
228
|
+
return {
|
|
229
|
+
"error": {},
|
|
230
|
+
"editorReady": {}
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
static get events() {
|
|
234
|
+
return [{
|
|
235
|
+
"method": "mrdChange",
|
|
236
|
+
"name": "mrdChange",
|
|
237
|
+
"bubbles": true,
|
|
238
|
+
"cancelable": true,
|
|
239
|
+
"composed": true,
|
|
240
|
+
"docs": {
|
|
241
|
+
"tags": [],
|
|
242
|
+
"text": ""
|
|
243
|
+
},
|
|
244
|
+
"complexType": {
|
|
245
|
+
"original": "{ name: string; value: string }",
|
|
246
|
+
"resolved": "{ name: string; value: string; }",
|
|
247
|
+
"references": {}
|
|
248
|
+
}
|
|
249
|
+
}, {
|
|
250
|
+
"method": "mrdBlur",
|
|
251
|
+
"name": "mrdBlur",
|
|
252
|
+
"bubbles": true,
|
|
253
|
+
"cancelable": true,
|
|
254
|
+
"composed": true,
|
|
255
|
+
"docs": {
|
|
256
|
+
"tags": [],
|
|
257
|
+
"text": ""
|
|
258
|
+
},
|
|
259
|
+
"complexType": {
|
|
260
|
+
"original": "{ name: string; value: string }",
|
|
261
|
+
"resolved": "{ name: string; value: string; }",
|
|
262
|
+
"references": {}
|
|
263
|
+
}
|
|
264
|
+
}];
|
|
265
|
+
}
|
|
266
|
+
static get elementRef() { return "el"; }
|
|
267
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.mrd-textarea-field {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: var(--mrd-space-1);
|
|
9
|
+
width: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.mrd-textarea-field__label {
|
|
13
|
+
display: block;
|
|
14
|
+
font-family: var(--mrd-font-family);
|
|
15
|
+
font-size: var(--mrd-label-font-size);
|
|
16
|
+
font-weight: var(--mrd-label-font-weight);
|
|
17
|
+
color: var(--mrd-label-color);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.mrd-textarea-field__label--required::after {
|
|
21
|
+
content: ' *';
|
|
22
|
+
color: var(--mrd-color-danger);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.mrd-textarea-field__container {
|
|
26
|
+
border: var(--mrd-border-width) solid var(--mrd-border-color);
|
|
27
|
+
border-radius: var(--mrd-border-radius);
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
background-color: var(--mrd-input-bg);
|
|
30
|
+
transition: border-color var(--mrd-transition), box-shadow var(--mrd-transition);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.mrd-textarea-field__container:focus-within {
|
|
34
|
+
border-color: var(--mrd-border-color-focus);
|
|
35
|
+
box-shadow: var(--mrd-shadow-focus);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.mrd-textarea-field__container--error {
|
|
39
|
+
border-color: var(--mrd-border-color-error);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.mrd-textarea-field__container--error:focus-within {
|
|
43
|
+
box-shadow: var(--mrd-shadow-focus-error);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.mrd-textarea-field__editor {
|
|
47
|
+
min-height: 150px;
|
|
48
|
+
font-family: var(--mrd-font-family);
|
|
49
|
+
font-size: var(--mrd-font-size-base);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Override Quill borders since container handles them */
|
|
53
|
+
.mrd-textarea-field__editor .ql-toolbar {
|
|
54
|
+
border: none;
|
|
55
|
+
border-bottom: var(--mrd-border-width) solid var(--mrd-border-color);
|
|
56
|
+
font-family: var(--mrd-font-family);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.mrd-textarea-field__editor .ql-container {
|
|
60
|
+
border: none;
|
|
61
|
+
font-family: var(--mrd-font-family);
|
|
62
|
+
font-size: var(--mrd-font-size-base);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.mrd-textarea-field__editor .ql-editor {
|
|
66
|
+
min-height: 120px;
|
|
67
|
+
padding: var(--mrd-input-padding-y) var(--mrd-input-padding-x);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.mrd-textarea-field__editor .ql-editor.ql-blank::before {
|
|
71
|
+
color: var(--mrd-input-placeholder-color);
|
|
72
|
+
font-style: normal;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.mrd-textarea-field__error {
|
|
76
|
+
font-family: var(--mrd-font-family);
|
|
77
|
+
font-size: var(--mrd-error-font-size);
|
|
78
|
+
color: var(--mrd-error-color);
|
|
79
|
+
}
|