@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.
Files changed (161) hide show
  1. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  2. package/dist/cjs/index-BPj2cBXs.js +1570 -0
  3. package/dist/cjs/index.cjs.js +66 -0
  4. package/dist/cjs/loader.cjs.js +13 -0
  5. package/dist/cjs/mosterdcomponents.cjs.js +25 -0
  6. package/dist/cjs/mrd-boolean-field_20.cjs.entry.js +3961 -0
  7. package/dist/cjs/quill-DmFfnC1f.js +16272 -0
  8. package/dist/collection/collection-manifest.json +32 -0
  9. package/dist/collection/components/mrd-boolean-field/mrd-boolean-field.js +199 -0
  10. package/dist/collection/components/mrd-boolean-field/mrd-boolean-field.scss +77 -0
  11. package/dist/collection/components/mrd-currency-field/mrd-currency-field.js +248 -0
  12. package/dist/collection/components/mrd-currency-field/mrd-currency-field.scss +100 -0
  13. package/dist/collection/components/mrd-date-field/mrd-date-field.js +206 -0
  14. package/dist/collection/components/mrd-date-field/mrd-date-field.scss +66 -0
  15. package/dist/collection/components/mrd-datetime-field/mrd-datetime-field.js +240 -0
  16. package/dist/collection/components/mrd-datetime-field/mrd-datetime-field.scss +66 -0
  17. package/dist/collection/components/mrd-email-field/mrd-email-field.js +230 -0
  18. package/dist/collection/components/mrd-email-field/mrd-email-field.scss +69 -0
  19. package/dist/{mosterdcomponents/mrd-field.entry.js → collection/components/mrd-field/mrd-field.js} +179 -28
  20. package/dist/collection/components/mrd-field/mrd-field.scss +118 -0
  21. package/dist/collection/components/mrd-file-field/mrd-file-field.js +341 -0
  22. package/dist/collection/components/mrd-file-field/mrd-file-field.scss +153 -0
  23. package/dist/{mosterdcomponents/mrd-form.entry.js → collection/components/mrd-form/mrd-form.js} +308 -31
  24. package/dist/collection/components/mrd-form/mrd-form.scss +148 -0
  25. package/dist/collection/components/mrd-hyperlink-field/mrd-hyperlink-field.js +291 -0
  26. package/dist/collection/components/mrd-hyperlink-field/mrd-hyperlink-field.scss +91 -0
  27. package/dist/collection/components/mrd-image-field/mrd-image-field.js +356 -0
  28. package/dist/collection/components/mrd-image-field/mrd-image-field.scss +190 -0
  29. package/dist/{mosterdcomponents/mrd-layout-section.entry.js → collection/components/mrd-layout-section/mrd-layout-section.js} +420 -33
  30. package/dist/collection/components/mrd-layout-section/mrd-layout-section.scss +445 -0
  31. package/dist/collection/components/mrd-list-field/mrd-list-field.js +313 -0
  32. package/dist/collection/components/mrd-list-field/mrd-list-field.scss +109 -0
  33. package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.js +227 -0
  34. package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.scss +78 -0
  35. package/dist/collection/components/mrd-number-field/mrd-number-field.js +316 -0
  36. package/dist/collection/components/mrd-number-field/mrd-number-field.scss +77 -0
  37. package/dist/collection/components/mrd-relation-field/mrd-relation-field.js +707 -0
  38. package/dist/collection/components/mrd-relation-field/mrd-relation-field.scss +266 -0
  39. package/dist/collection/components/mrd-secret-field/mrd-secret-field.js +229 -0
  40. package/dist/collection/components/mrd-secret-field/mrd-secret-field.scss +73 -0
  41. package/dist/{mosterdcomponents/mrd-table.entry.js → collection/components/mrd-table/mrd-table.js} +394 -32
  42. package/dist/collection/components/mrd-table/mrd-table.scss +809 -0
  43. package/dist/collection/components/mrd-text-field/mrd-text-field.js +227 -0
  44. package/dist/collection/components/mrd-text-field/mrd-text-field.scss +69 -0
  45. package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.js +267 -0
  46. package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.scss +79 -0
  47. package/dist/collection/components/mrd-time-field/mrd-time-field.js +206 -0
  48. package/dist/collection/components/mrd-time-field/mrd-time-field.scss +66 -0
  49. package/dist/collection/dev/api.js +145 -0
  50. package/dist/collection/dev/app.js +890 -0
  51. package/dist/collection/dev/auth.js +156 -0
  52. package/dist/collection/dev/example-data.js +403 -0
  53. package/dist/collection/dev/sprites.svg +55 -0
  54. package/dist/collection/index.js +1 -0
  55. package/dist/collection/types/client-layout.js +64 -0
  56. package/dist/collection/types/index.js +1 -0
  57. package/dist/{mosterdcomponents/cell-renderer-CbRwLOo8.js → collection/utils/cell-renderer.js} +3 -9
  58. package/dist/{mosterdcomponents/format-BAfsQfy1.js → collection/utils/format.js} +7 -12
  59. package/dist/{mosterdcomponents/i18n-hoGGKbKU.js → collection/utils/i18n.js} +1 -6
  60. package/dist/{mosterdcomponents/validation-ixb43cqU.js → collection/utils/validation.js} +5 -12
  61. package/dist/components/client-layout.js +1 -0
  62. package/dist/components/format.js +1 -0
  63. package/dist/components/i18n.js +1 -0
  64. package/dist/components/index.js +1 -0
  65. package/dist/components/mrd-boolean-field.js +1 -0
  66. package/dist/components/mrd-boolean-field2.js +1 -0
  67. package/dist/components/mrd-currency-field.js +1 -0
  68. package/dist/components/mrd-currency-field2.js +1 -0
  69. package/dist/components/mrd-date-field.js +1 -0
  70. package/dist/components/mrd-date-field2.js +1 -0
  71. package/dist/components/mrd-datetime-field.js +1 -0
  72. package/dist/components/mrd-datetime-field2.js +1 -0
  73. package/dist/components/mrd-email-field.js +1 -0
  74. package/dist/components/mrd-email-field2.js +1 -0
  75. package/dist/components/mrd-field.js +1 -0
  76. package/dist/components/mrd-field2.js +1 -0
  77. package/dist/components/mrd-file-field.js +1 -0
  78. package/dist/components/mrd-file-field2.js +1 -0
  79. package/dist/components/mrd-form.js +1 -0
  80. package/dist/components/mrd-hyperlink-field.js +1 -0
  81. package/dist/components/mrd-hyperlink-field2.js +1 -0
  82. package/dist/components/mrd-image-field.js +1 -0
  83. package/dist/components/mrd-image-field2.js +1 -0
  84. package/dist/components/mrd-layout-section.js +1 -0
  85. package/dist/components/mrd-list-field.js +1 -0
  86. package/dist/components/mrd-list-field2.js +1 -0
  87. package/dist/components/mrd-longtext-field.js +1 -0
  88. package/dist/components/mrd-longtext-field2.js +1 -0
  89. package/dist/components/mrd-number-field.js +1 -0
  90. package/dist/components/mrd-number-field2.js +1 -0
  91. package/dist/components/mrd-relation-field.js +1 -0
  92. package/dist/components/mrd-relation-field2.js +1 -0
  93. package/dist/components/mrd-secret-field.js +1 -0
  94. package/dist/components/mrd-secret-field2.js +1 -0
  95. package/dist/components/mrd-table.js +1 -0
  96. package/dist/components/mrd-table2.js +1 -0
  97. package/dist/components/mrd-text-field.js +1 -0
  98. package/dist/components/mrd-text-field2.js +1 -0
  99. package/dist/components/mrd-textarea-field.js +1 -0
  100. package/dist/components/mrd-textarea-field2.js +1 -0
  101. package/dist/components/mrd-time-field.js +1 -0
  102. package/dist/components/mrd-time-field2.js +1 -0
  103. package/dist/components/quill.js +1 -0
  104. package/dist/components/validation.js +1 -0
  105. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  106. package/dist/esm/index-_tsCCkAi.js +1561 -0
  107. package/dist/{mosterdcomponents/client-layout-D88nn5zf.js → esm/index.js} +1 -4
  108. package/dist/esm/loader.js +11 -0
  109. package/dist/esm/mosterdcomponents.js +21 -0
  110. package/dist/esm/mrd-boolean-field_20.entry.js +3940 -0
  111. package/dist/{mosterdcomponents/quill-C9pgw_k-.js → esm/quill-CiuCgGz_.js} +1347 -16232
  112. package/dist/index.cjs.js +1 -0
  113. package/dist/index.js +1 -0
  114. package/dist/mosterdcomponents/index-6yQUNVww.js.map +1 -0
  115. package/dist/mosterdcomponents/index.esm.js +1 -5
  116. package/dist/mosterdcomponents/mosterdcomponents.css +1 -180
  117. package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -50
  118. package/dist/mosterdcomponents/p-7bfaee51.entry.js +1 -0
  119. package/dist/mosterdcomponents/p-CiuCgGz_.js +1 -0
  120. package/dist/mosterdcomponents/p-DQuL1Twl.js +1 -0
  121. package/dist/mosterdcomponents/p-_tsCCkAi.js +2 -0
  122. package/package.json +1 -1
  123. package/dist/mosterdcomponents/index-B_tPFIvS.js +0 -4585
  124. package/dist/mosterdcomponents/index-B_tPFIvS.js.map +0 -1
  125. package/dist/mosterdcomponents/index-I5SuYv7a.js +0 -4
  126. package/dist/mosterdcomponents/mrd-boolean-field.entry.js +0 -37
  127. package/dist/mosterdcomponents/mrd-boolean-field.entry.js.map +0 -1
  128. package/dist/mosterdcomponents/mrd-currency-field.entry.js +0 -67
  129. package/dist/mosterdcomponents/mrd-currency-field.entry.js.map +0 -1
  130. package/dist/mosterdcomponents/mrd-date-field.entry.js +0 -46
  131. package/dist/mosterdcomponents/mrd-date-field.entry.js.map +0 -1
  132. package/dist/mosterdcomponents/mrd-datetime-field.entry.js +0 -78
  133. package/dist/mosterdcomponents/mrd-datetime-field.entry.js.map +0 -1
  134. package/dist/mosterdcomponents/mrd-email-field.entry.js +0 -50
  135. package/dist/mosterdcomponents/mrd-email-field.entry.js.map +0 -1
  136. package/dist/mosterdcomponents/mrd-field.entry.js.map +0 -1
  137. package/dist/mosterdcomponents/mrd-file-field.entry.js +0 -108
  138. package/dist/mosterdcomponents/mrd-file-field.entry.js.map +0 -1
  139. package/dist/mosterdcomponents/mrd-form.entry.js.map +0 -1
  140. package/dist/mosterdcomponents/mrd-hyperlink-field.entry.js +0 -87
  141. package/dist/mosterdcomponents/mrd-hyperlink-field.entry.js.map +0 -1
  142. package/dist/mosterdcomponents/mrd-image-field.entry.js +0 -122
  143. package/dist/mosterdcomponents/mrd-image-field.entry.js.map +0 -1
  144. package/dist/mosterdcomponents/mrd-layout-section.entry.js.map +0 -1
  145. package/dist/mosterdcomponents/mrd-list-field.entry.js +0 -107
  146. package/dist/mosterdcomponents/mrd-list-field.entry.js.map +0 -1
  147. package/dist/mosterdcomponents/mrd-longtext-field.entry.js +0 -47
  148. package/dist/mosterdcomponents/mrd-longtext-field.entry.js.map +0 -1
  149. package/dist/mosterdcomponents/mrd-number-field.entry.js +0 -87
  150. package/dist/mosterdcomponents/mrd-number-field.entry.js.map +0 -1
  151. package/dist/mosterdcomponents/mrd-relation-field.entry.js +0 -267
  152. package/dist/mosterdcomponents/mrd-relation-field.entry.js.map +0 -1
  153. package/dist/mosterdcomponents/mrd-secret-field.entry.js +0 -49
  154. package/dist/mosterdcomponents/mrd-secret-field.entry.js.map +0 -1
  155. package/dist/mosterdcomponents/mrd-table.entry.js.map +0 -1
  156. package/dist/mosterdcomponents/mrd-text-field.entry.js +0 -47
  157. package/dist/mosterdcomponents/mrd-text-field.entry.js.map +0 -1
  158. package/dist/mosterdcomponents/mrd-textarea-field.entry.js +0 -86
  159. package/dist/mosterdcomponents/mrd-textarea-field.entry.js.map +0 -1
  160. package/dist/mosterdcomponents/mrd-time-field.entry.js +0 -46
  161. package/dist/mosterdcomponents/mrd-time-field.entry.js.map +0 -1
@@ -0,0 +1,313 @@
1
+ import { Host, h } from "@stencil/core";
2
+ import { t } from "../../utils/i18n";
3
+ import { validateRequired } from "../../utils/validation";
4
+ export class MrdListField {
5
+ constructor() {
6
+ this.name = '';
7
+ this.label = '';
8
+ this.value = '';
9
+ this.required = false;
10
+ this.disabled = false;
11
+ this.multiple = false;
12
+ this.locale = navigator.language;
13
+ /** List items from the API. Each item has a `key` (stored value) and `label`. */
14
+ this.listItems = [];
15
+ this.error = '';
16
+ this.selected = [];
17
+ this.handleSelectChange = (e) => {
18
+ const select = e.target;
19
+ if (this.multiple) {
20
+ const vals = Array.from(select.selectedOptions).map(o => o.value);
21
+ this.selected = vals;
22
+ if (this.required && !validateRequired(vals)) {
23
+ this.error = t('required', this.locale);
24
+ }
25
+ else {
26
+ this.error = '';
27
+ }
28
+ this.mrdChange.emit({ name: this.name, value: vals });
29
+ }
30
+ else {
31
+ const val = select.value;
32
+ if (this.required && !validateRequired(val)) {
33
+ this.error = t('required', this.locale);
34
+ }
35
+ else {
36
+ this.error = '';
37
+ }
38
+ this.mrdChange.emit({ name: this.name, value: val });
39
+ }
40
+ };
41
+ this.handleBlur = () => {
42
+ const val = this.multiple ? this.selected : this.value;
43
+ this.mrdBlur.emit({ name: this.name, value: val });
44
+ };
45
+ this.toggleCheckbox = (key) => {
46
+ if (this.selected.includes(key)) {
47
+ this.selected = this.selected.filter(v => v !== key);
48
+ }
49
+ else {
50
+ this.selected = [...this.selected, key];
51
+ }
52
+ if (this.required && !validateRequired(this.selected)) {
53
+ this.error = t('required', this.locale);
54
+ }
55
+ else {
56
+ this.error = '';
57
+ }
58
+ this.mrdChange.emit({ name: this.name, value: this.selected });
59
+ };
60
+ }
61
+ componentWillLoad() {
62
+ if (this.multiple) {
63
+ this.selected = Array.isArray(this.value) ? this.value : this.value ? [this.value] : [];
64
+ }
65
+ }
66
+ getContrastColor(bgColor) {
67
+ if (!bgColor)
68
+ return '#000000';
69
+ const hex = bgColor.replace('#', '');
70
+ const r = parseInt(hex.substr(0, 2), 16);
71
+ const g = parseInt(hex.substr(2, 2), 16);
72
+ const b = parseInt(hex.substr(4, 2), 16);
73
+ const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
74
+ return luminance > 0.5 ? '#000000' : '#ffffff';
75
+ }
76
+ render() {
77
+ var _a, _b;
78
+ const hasError = !!this.error;
79
+ const currentValue = Array.isArray(this.value) ? ((_a = this.value[0]) !== null && _a !== void 0 ? _a : '') : ((_b = this.value) !== null && _b !== void 0 ? _b : '');
80
+ if (this.multiple) {
81
+ return (h(Host, null, h("div", { class: "mrd-list-field" }, this.label && (h("label", { class: `mrd-list-field__label${this.required ? ' mrd-list-field__label--required' : ''}` }, this.label)), h("div", { class: `mrd-list-field__checkbox-list${hasError ? ' mrd-list-field__checkbox-list--error' : ''}` }, this.listItems.map(lv => {
82
+ var _a, _b;
83
+ return (h("label", { key: lv.key, class: "mrd-list-field__checkbox-item" }, h("input", { type: "checkbox", checked: this.selected.includes(lv.key), disabled: this.disabled, onChange: () => this.toggleCheckbox(lv.key) }), (lv.color || lv.backgroundColor) && (h("span", { class: "mrd-list-field__color-dot", style: { backgroundColor: (_b = (_a = lv.backgroundColor) !== null && _a !== void 0 ? _a : lv.color) !== null && _b !== void 0 ? _b : '' } })), h("span", null, lv.label)));
84
+ })), hasError && h("span", { class: "mrd-list-field__error" }, this.error))));
85
+ }
86
+ return (h(Host, null, h("div", { class: "mrd-list-field" }, this.label && (h("label", { class: `mrd-list-field__label${this.required ? ' mrd-list-field__label--required' : ''}` }, this.label)), h("select", { class: `mrd-list-field__select${hasError ? ' mrd-list-field__select--error' : ''}`, name: this.name, required: this.required, disabled: this.disabled, onChange: this.handleSelectChange, onBlur: this.handleBlur }, h("option", { value: "" }, t('select_placeholder', this.locale)), this.listItems.map(lv => {
87
+ var _a, _b;
88
+ const bg = (_b = (_a = lv.backgroundColor) !== null && _a !== void 0 ? _a : lv.color) !== null && _b !== void 0 ? _b : null;
89
+ const style = bg ? { backgroundColor: bg, color: this.getContrastColor(bg) } : {};
90
+ return (h("option", { key: lv.key, value: lv.key, selected: lv.key === currentValue, style: style }, lv.label));
91
+ })), hasError && h("span", { class: "mrd-list-field__error" }, this.error))));
92
+ }
93
+ static get is() { return "mrd-list-field"; }
94
+ static get encapsulation() { return "scoped"; }
95
+ static get originalStyleUrls() {
96
+ return {
97
+ "$": ["mrd-list-field.scss"]
98
+ };
99
+ }
100
+ static get styleUrls() {
101
+ return {
102
+ "$": ["mrd-list-field.css"]
103
+ };
104
+ }
105
+ static get properties() {
106
+ return {
107
+ "name": {
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": "name",
125
+ "defaultValue": "''"
126
+ },
127
+ "label": {
128
+ "type": "string",
129
+ "mutable": false,
130
+ "complexType": {
131
+ "original": "string",
132
+ "resolved": "string",
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": "label",
145
+ "defaultValue": "''"
146
+ },
147
+ "value": {
148
+ "type": "string",
149
+ "mutable": false,
150
+ "complexType": {
151
+ "original": "string | string[]",
152
+ "resolved": "string | string[]",
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": "value",
165
+ "defaultValue": "''"
166
+ },
167
+ "required": {
168
+ "type": "boolean",
169
+ "mutable": false,
170
+ "complexType": {
171
+ "original": "boolean",
172
+ "resolved": "boolean",
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": "required",
185
+ "defaultValue": "false"
186
+ },
187
+ "disabled": {
188
+ "type": "boolean",
189
+ "mutable": false,
190
+ "complexType": {
191
+ "original": "boolean",
192
+ "resolved": "boolean",
193
+ "references": {}
194
+ },
195
+ "required": false,
196
+ "optional": false,
197
+ "docs": {
198
+ "tags": [],
199
+ "text": ""
200
+ },
201
+ "getter": false,
202
+ "setter": false,
203
+ "reflect": false,
204
+ "attribute": "disabled",
205
+ "defaultValue": "false"
206
+ },
207
+ "multiple": {
208
+ "type": "boolean",
209
+ "mutable": false,
210
+ "complexType": {
211
+ "original": "boolean",
212
+ "resolved": "boolean",
213
+ "references": {}
214
+ },
215
+ "required": false,
216
+ "optional": false,
217
+ "docs": {
218
+ "tags": [],
219
+ "text": ""
220
+ },
221
+ "getter": false,
222
+ "setter": false,
223
+ "reflect": false,
224
+ "attribute": "multiple",
225
+ "defaultValue": "false"
226
+ },
227
+ "locale": {
228
+ "type": "string",
229
+ "mutable": false,
230
+ "complexType": {
231
+ "original": "string",
232
+ "resolved": "string",
233
+ "references": {}
234
+ },
235
+ "required": false,
236
+ "optional": false,
237
+ "docs": {
238
+ "tags": [],
239
+ "text": ""
240
+ },
241
+ "getter": false,
242
+ "setter": false,
243
+ "reflect": false,
244
+ "attribute": "locale",
245
+ "defaultValue": "navigator.language"
246
+ },
247
+ "listItems": {
248
+ "type": "unknown",
249
+ "mutable": false,
250
+ "complexType": {
251
+ "original": "ClientListValue[]",
252
+ "resolved": "ClientListValue[]",
253
+ "references": {
254
+ "ClientListValue": {
255
+ "location": "import",
256
+ "path": "../../types",
257
+ "id": "src/types/index.ts::ClientListValue",
258
+ "referenceLocation": "ClientListValue"
259
+ }
260
+ }
261
+ },
262
+ "required": false,
263
+ "optional": false,
264
+ "docs": {
265
+ "tags": [],
266
+ "text": "List items from the API. Each item has a `key` (stored value) and `label`."
267
+ },
268
+ "getter": false,
269
+ "setter": false,
270
+ "defaultValue": "[]"
271
+ }
272
+ };
273
+ }
274
+ static get states() {
275
+ return {
276
+ "error": {},
277
+ "selected": {}
278
+ };
279
+ }
280
+ static get events() {
281
+ return [{
282
+ "method": "mrdChange",
283
+ "name": "mrdChange",
284
+ "bubbles": true,
285
+ "cancelable": true,
286
+ "composed": true,
287
+ "docs": {
288
+ "tags": [],
289
+ "text": ""
290
+ },
291
+ "complexType": {
292
+ "original": "{ name: string; value: string | string[] }",
293
+ "resolved": "{ name: string; value: string | string[]; }",
294
+ "references": {}
295
+ }
296
+ }, {
297
+ "method": "mrdBlur",
298
+ "name": "mrdBlur",
299
+ "bubbles": true,
300
+ "cancelable": true,
301
+ "composed": true,
302
+ "docs": {
303
+ "tags": [],
304
+ "text": ""
305
+ },
306
+ "complexType": {
307
+ "original": "{ name: string; value: string | string[] }",
308
+ "resolved": "{ name: string; value: string | string[]; }",
309
+ "references": {}
310
+ }
311
+ }];
312
+ }
313
+ }
@@ -0,0 +1,109 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ .mrd-list-field {
6
+ display: flex;
7
+ flex-direction: column;
8
+ gap: var(--mrd-space-1);
9
+ width: 100%;
10
+ }
11
+
12
+ .mrd-list-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-list-field__label--required::after {
21
+ content: ' *';
22
+ color: var(--mrd-color-danger);
23
+ }
24
+
25
+ .mrd-list-field__select {
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
+ padding-right: calc(var(--mrd-input-padding-x) + 1.5rem);
31
+ font-family: var(--mrd-font-family);
32
+ font-size: var(--mrd-font-size-base);
33
+ color: var(--mrd-input-color);
34
+ background-color: var(--mrd-input-bg);
35
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
36
+ background-repeat: no-repeat;
37
+ background-position: right var(--mrd-space-3) center;
38
+ border: var(--mrd-border-width) solid var(--mrd-border-color);
39
+ border-radius: var(--mrd-border-radius);
40
+ transition: border-color var(--mrd-transition), box-shadow var(--mrd-transition);
41
+ outline: none;
42
+ appearance: none;
43
+ cursor: pointer;
44
+ box-sizing: border-box;
45
+ }
46
+
47
+ .mrd-list-field__select:focus {
48
+ border-color: var(--mrd-border-color-focus);
49
+ box-shadow: var(--mrd-shadow-focus);
50
+ }
51
+
52
+ .mrd-list-field__select:disabled {
53
+ background-color: var(--mrd-input-bg-disabled);
54
+ cursor: not-allowed;
55
+ opacity: 0.7;
56
+ }
57
+
58
+ .mrd-list-field__select--error {
59
+ border-color: var(--mrd-border-color-error);
60
+ }
61
+
62
+ .mrd-list-field__select--error:focus {
63
+ box-shadow: var(--mrd-shadow-focus-error);
64
+ }
65
+
66
+ .mrd-list-field__checkbox-list {
67
+ display: flex;
68
+ flex-direction: column;
69
+ gap: var(--mrd-space-2);
70
+ padding: var(--mrd-space-3);
71
+ border: var(--mrd-border-width) solid var(--mrd-border-color);
72
+ border-radius: var(--mrd-border-radius);
73
+ background-color: var(--mrd-input-bg);
74
+ }
75
+
76
+ .mrd-list-field__checkbox-list--error {
77
+ border-color: var(--mrd-border-color-error);
78
+ }
79
+
80
+ .mrd-list-field__checkbox-item {
81
+ display: flex;
82
+ align-items: center;
83
+ gap: var(--mrd-space-2);
84
+ font-family: var(--mrd-font-family);
85
+ font-size: var(--mrd-font-size-base);
86
+ color: var(--mrd-input-color);
87
+ cursor: pointer;
88
+ }
89
+
90
+ .mrd-list-field__checkbox-item input[type='checkbox'] {
91
+ width: 1rem;
92
+ height: 1rem;
93
+ cursor: pointer;
94
+ accent-color: var(--mrd-color-primary);
95
+ }
96
+
97
+ .mrd-list-field__color-dot {
98
+ display: inline-block;
99
+ width: 12px;
100
+ height: 12px;
101
+ border-radius: 50%;
102
+ flex-shrink: 0;
103
+ }
104
+
105
+ .mrd-list-field__error {
106
+ font-family: var(--mrd-font-family);
107
+ font-size: var(--mrd-error-font-size);
108
+ color: var(--mrd-error-color);
109
+ }
@@ -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 MrdLongtextField {
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: '10d998b80f54cf7b10be26bf451d808c78579e69' }, h("div", { key: 'af45fe94a41f668bf6ddca670b42e065ee83ef23', class: "mrd-longtext-field" }, this.label && (h("label", { key: '31a08490d695ac9f4bbe5dff6a1ae3bb2a94337d', class: `mrd-longtext-field__label${this.required ? ' mrd-longtext-field__label--required' : ''}` }, this.label)), this.disabled ? (h("pre", { class: "mrd-longtext-field__content" }, this.value)) : (h("textarea", { class: `mrd-longtext-field__input${hasError ? ' mrd-longtext-field__input--error' : ''}`, name: this.name, placeholder: this.placeholder, required: this.required, rows: 10, onInput: this.handleInput, onBlur: this.handleBlur }, this.value)), hasError && h("span", { key: '7f133e72a882a8aaf33245445829754da1e6377b', class: "mrd-longtext-field__error" }, this.error))));
32
+ }
33
+ static get is() { return "mrd-longtext-field"; }
34
+ static get encapsulation() { return "scoped"; }
35
+ static get originalStyleUrls() {
36
+ return {
37
+ "$": ["mrd-longtext-field.scss"]
38
+ };
39
+ }
40
+ static get styleUrls() {
41
+ return {
42
+ "$": ["mrd-longtext-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
+ }