@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,341 @@
1
+ import { Host, h } from "@stencil/core";
2
+ import { t } from "../../utils/i18n";
3
+ export class MrdFileField {
4
+ constructor() {
5
+ this.name = '';
6
+ this.label = '';
7
+ this.value = null;
8
+ this.required = false;
9
+ this.disabled = false;
10
+ this.locale = navigator.language;
11
+ this.accept = '';
12
+ this.maxSize = 0; // bytes, 0 = no limit
13
+ this.fileName = '';
14
+ this.isDragging = false;
15
+ this.uploading = false;
16
+ this.error = '';
17
+ this.handleInputChange = (e) => {
18
+ var _a;
19
+ const files = e.target.files;
20
+ this.handleFile((_a = files === null || files === void 0 ? void 0 : files[0]) !== null && _a !== void 0 ? _a : null);
21
+ };
22
+ this.handleDragOver = (e) => {
23
+ e.preventDefault();
24
+ this.isDragging = true;
25
+ };
26
+ this.handleDragLeave = () => {
27
+ this.isDragging = false;
28
+ };
29
+ this.handleDrop = (e) => {
30
+ var _a, _b, _c;
31
+ e.preventDefault();
32
+ this.isDragging = false;
33
+ const file = (_c = (_b = (_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : null;
34
+ this.handleFile(file);
35
+ };
36
+ this.handleZoneClick = () => {
37
+ var _a;
38
+ if (!this.disabled && !this.uploading) {
39
+ (_a = this.fileInputRef) === null || _a === void 0 ? void 0 : _a.click();
40
+ }
41
+ };
42
+ this.handleClear = (e) => {
43
+ e.stopPropagation();
44
+ this.fileName = '';
45
+ this.error = '';
46
+ this.uploading = false;
47
+ if (this.fileInputRef)
48
+ this.fileInputRef.value = '';
49
+ this.mrdChange.emit({ name: this.name, value: null });
50
+ };
51
+ }
52
+ /** When the host provides a URI back via setFieldValue, the upload is done. */
53
+ valueChanged(newVal) {
54
+ if (typeof newVal === 'string' && newVal) {
55
+ this.uploading = false;
56
+ }
57
+ else if (!newVal) {
58
+ this.uploading = false;
59
+ this.fileName = '';
60
+ }
61
+ }
62
+ handleFile(file) {
63
+ if (!file) {
64
+ this.fileName = '';
65
+ this.uploading = false;
66
+ this.mrdChange.emit({ name: this.name, value: null });
67
+ return;
68
+ }
69
+ if (this.maxSize > 0 && file.size > this.maxSize) {
70
+ this.error = t('file_too_large', this.locale);
71
+ return;
72
+ }
73
+ this.error = '';
74
+ this.fileName = file.name;
75
+ this.uploading = true;
76
+ this.mrdChange.emit({ name: this.name, value: file });
77
+ this.mrdUpload.emit({ name: this.name, file });
78
+ }
79
+ render() {
80
+ const hasFile = this.uploading || (typeof this.value === 'string' && this.value) || this.fileName;
81
+ const hasError = !!this.error;
82
+ const zoneClass = [
83
+ 'mrd-file-field__zone',
84
+ this.isDragging ? 'mrd-file-field__zone--dragging' : '',
85
+ hasError ? 'mrd-file-field__zone--error' : '',
86
+ this.disabled || this.uploading ? 'mrd-file-field__zone--disabled' : '',
87
+ ].filter(Boolean).join(' ');
88
+ return (h(Host, { key: '2090102df8169226c1e66f87cbc837296e4b55d4' }, h("div", { key: '7a37a09df1bfa2eaf28ed04c806ad5f7c0337bb0', class: "mrd-file-field" }, this.label && (h("label", { key: '8f1fcb8adbb66b792be902c7c548e50db99b6a53', class: `mrd-file-field__label${this.required ? ' mrd-file-field__label--required' : ''}` }, this.label)), h("div", { key: '66d992298f537b24d69ce3ead3dd229f6d124f3d', class: zoneClass, onClick: this.handleZoneClick, onDragOver: this.handleDragOver, onDragLeave: this.handleDragLeave, onDrop: this.handleDrop }, h("input", { key: '95ba6560e71ee08c6b2526802727b29a18cdc454', ref: el => (this.fileInputRef = el), class: "mrd-file-field__input", type: "file", name: this.name, accept: this.accept, disabled: this.disabled || this.uploading, required: this.required && !hasFile, onChange: this.handleInputChange }), hasFile ? (h("div", { class: "mrd-file-field__selected" }, this.uploading ? (h("span", { class: "mrd-file-field__spinner", "aria-label": t('loading', this.locale) })) : (h("svg", { class: "mrd-file-field__icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }), h("polyline", { points: "14 2 14 8 20 8" }))), h("span", { class: "mrd-file-field__filename" }, this.fileName), !this.uploading && (h("button", { class: "mrd-file-field__clear", type: "button", onClick: this.handleClear, "aria-label": t('clear', this.locale) }, "\u2715")))) : (h("div", { class: "mrd-file-field__prompt" }, h("svg", { class: "mrd-file-field__upload-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("polyline", { points: "16 16 12 12 8 16" }), h("line", { x1: "12", y1: "12", x2: "12", y2: "21" }), h("path", { d: "M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3" })), h("span", null, t('drop_file_here', this.locale), ' ', h("span", { class: "mrd-file-field__browse" }, t('browse', this.locale)))))), hasError && h("span", { key: 'a6020e63bebb01e31a980a903f81badd486585aa', class: "mrd-file-field__error" }, this.error))));
89
+ }
90
+ static get is() { return "mrd-file-field"; }
91
+ static get encapsulation() { return "scoped"; }
92
+ static get originalStyleUrls() {
93
+ return {
94
+ "$": ["mrd-file-field.scss"]
95
+ };
96
+ }
97
+ static get styleUrls() {
98
+ return {
99
+ "$": ["mrd-file-field.css"]
100
+ };
101
+ }
102
+ static get properties() {
103
+ return {
104
+ "name": {
105
+ "type": "string",
106
+ "mutable": false,
107
+ "complexType": {
108
+ "original": "string",
109
+ "resolved": "string",
110
+ "references": {}
111
+ },
112
+ "required": false,
113
+ "optional": false,
114
+ "docs": {
115
+ "tags": [],
116
+ "text": ""
117
+ },
118
+ "getter": false,
119
+ "setter": false,
120
+ "reflect": false,
121
+ "attribute": "name",
122
+ "defaultValue": "''"
123
+ },
124
+ "label": {
125
+ "type": "string",
126
+ "mutable": false,
127
+ "complexType": {
128
+ "original": "string",
129
+ "resolved": "string",
130
+ "references": {}
131
+ },
132
+ "required": false,
133
+ "optional": false,
134
+ "docs": {
135
+ "tags": [],
136
+ "text": ""
137
+ },
138
+ "getter": false,
139
+ "setter": false,
140
+ "reflect": false,
141
+ "attribute": "label",
142
+ "defaultValue": "''"
143
+ },
144
+ "value": {
145
+ "type": "unknown",
146
+ "mutable": false,
147
+ "complexType": {
148
+ "original": "unknown",
149
+ "resolved": "unknown",
150
+ "references": {}
151
+ },
152
+ "required": false,
153
+ "optional": false,
154
+ "docs": {
155
+ "tags": [],
156
+ "text": ""
157
+ },
158
+ "getter": false,
159
+ "setter": false,
160
+ "defaultValue": "null"
161
+ },
162
+ "required": {
163
+ "type": "boolean",
164
+ "mutable": false,
165
+ "complexType": {
166
+ "original": "boolean",
167
+ "resolved": "boolean",
168
+ "references": {}
169
+ },
170
+ "required": false,
171
+ "optional": false,
172
+ "docs": {
173
+ "tags": [],
174
+ "text": ""
175
+ },
176
+ "getter": false,
177
+ "setter": false,
178
+ "reflect": false,
179
+ "attribute": "required",
180
+ "defaultValue": "false"
181
+ },
182
+ "disabled": {
183
+ "type": "boolean",
184
+ "mutable": false,
185
+ "complexType": {
186
+ "original": "boolean",
187
+ "resolved": "boolean",
188
+ "references": {}
189
+ },
190
+ "required": false,
191
+ "optional": false,
192
+ "docs": {
193
+ "tags": [],
194
+ "text": ""
195
+ },
196
+ "getter": false,
197
+ "setter": false,
198
+ "reflect": false,
199
+ "attribute": "disabled",
200
+ "defaultValue": "false"
201
+ },
202
+ "locale": {
203
+ "type": "string",
204
+ "mutable": false,
205
+ "complexType": {
206
+ "original": "string",
207
+ "resolved": "string",
208
+ "references": {}
209
+ },
210
+ "required": false,
211
+ "optional": false,
212
+ "docs": {
213
+ "tags": [],
214
+ "text": ""
215
+ },
216
+ "getter": false,
217
+ "setter": false,
218
+ "reflect": false,
219
+ "attribute": "locale",
220
+ "defaultValue": "navigator.language"
221
+ },
222
+ "accept": {
223
+ "type": "string",
224
+ "mutable": false,
225
+ "complexType": {
226
+ "original": "string",
227
+ "resolved": "string",
228
+ "references": {}
229
+ },
230
+ "required": false,
231
+ "optional": false,
232
+ "docs": {
233
+ "tags": [],
234
+ "text": ""
235
+ },
236
+ "getter": false,
237
+ "setter": false,
238
+ "reflect": false,
239
+ "attribute": "accept",
240
+ "defaultValue": "''"
241
+ },
242
+ "maxSize": {
243
+ "type": "number",
244
+ "mutable": false,
245
+ "complexType": {
246
+ "original": "number",
247
+ "resolved": "number",
248
+ "references": {}
249
+ },
250
+ "required": false,
251
+ "optional": false,
252
+ "docs": {
253
+ "tags": [],
254
+ "text": ""
255
+ },
256
+ "getter": false,
257
+ "setter": false,
258
+ "reflect": false,
259
+ "attribute": "max-size",
260
+ "defaultValue": "0"
261
+ }
262
+ };
263
+ }
264
+ static get states() {
265
+ return {
266
+ "fileName": {},
267
+ "isDragging": {},
268
+ "uploading": {},
269
+ "error": {}
270
+ };
271
+ }
272
+ static get events() {
273
+ return [{
274
+ "method": "mrdChange",
275
+ "name": "mrdChange",
276
+ "bubbles": true,
277
+ "cancelable": true,
278
+ "composed": true,
279
+ "docs": {
280
+ "tags": [],
281
+ "text": ""
282
+ },
283
+ "complexType": {
284
+ "original": "{ name: string; value: File | null }",
285
+ "resolved": "{ name: string; value: File | null; }",
286
+ "references": {
287
+ "File": {
288
+ "location": "global",
289
+ "id": "global::File"
290
+ }
291
+ }
292
+ }
293
+ }, {
294
+ "method": "mrdBlur",
295
+ "name": "mrdBlur",
296
+ "bubbles": true,
297
+ "cancelable": true,
298
+ "composed": true,
299
+ "docs": {
300
+ "tags": [],
301
+ "text": ""
302
+ },
303
+ "complexType": {
304
+ "original": "{ name: string; value: File | null }",
305
+ "resolved": "{ name: string; value: File | null; }",
306
+ "references": {
307
+ "File": {
308
+ "location": "global",
309
+ "id": "global::File"
310
+ }
311
+ }
312
+ }
313
+ }, {
314
+ "method": "mrdUpload",
315
+ "name": "mrdUpload",
316
+ "bubbles": true,
317
+ "cancelable": true,
318
+ "composed": true,
319
+ "docs": {
320
+ "tags": [],
321
+ "text": "Emitted when a file is selected and needs to be uploaded.\nHost should upload the file and call form.setFieldValue(name, uri) with the result."
322
+ },
323
+ "complexType": {
324
+ "original": "{ name: string; file: File }",
325
+ "resolved": "{ name: string; file: File; }",
326
+ "references": {
327
+ "File": {
328
+ "location": "global",
329
+ "id": "global::File"
330
+ }
331
+ }
332
+ }
333
+ }];
334
+ }
335
+ static get watchers() {
336
+ return [{
337
+ "propName": "value",
338
+ "methodName": "valueChanged"
339
+ }];
340
+ }
341
+ }
@@ -0,0 +1,153 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ .mrd-file-field {
6
+ display: flex;
7
+ flex-direction: column;
8
+ gap: var(--mrd-space-1);
9
+ width: 100%;
10
+ }
11
+
12
+ .mrd-file-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-file-field__label--required::after {
21
+ content: ' *';
22
+ color: var(--mrd-color-danger);
23
+ }
24
+
25
+ .mrd-file-field__zone {
26
+ display: flex;
27
+ align-items: center;
28
+ justify-content: center;
29
+ padding: var(--mrd-space-6);
30
+ border: 2px dashed var(--mrd-border-color);
31
+ border-radius: var(--mrd-border-radius-md);
32
+ background-color: var(--mrd-color-neutral-50);
33
+ cursor: pointer;
34
+ transition: border-color var(--mrd-transition), background-color var(--mrd-transition);
35
+ min-height: 100px;
36
+ position: relative;
37
+ }
38
+
39
+ .mrd-file-field__zone:hover {
40
+ border-color: var(--mrd-color-primary);
41
+ background-color: var(--mrd-color-primary-light);
42
+ }
43
+
44
+ .mrd-file-field__zone--dragging {
45
+ border-color: var(--mrd-color-primary);
46
+ background-color: var(--mrd-color-primary-light);
47
+ }
48
+
49
+ .mrd-file-field__zone--error {
50
+ border-color: var(--mrd-border-color-error);
51
+ }
52
+
53
+ .mrd-file-field__zone--disabled {
54
+ opacity: 0.6;
55
+ cursor: not-allowed;
56
+ }
57
+
58
+ .mrd-file-field__zone--disabled:hover {
59
+ border-color: var(--mrd-border-color);
60
+ background-color: var(--mrd-color-neutral-50);
61
+ }
62
+
63
+ .mrd-file-field__input {
64
+ position: absolute;
65
+ inset: 0;
66
+ opacity: 0;
67
+ width: 100%;
68
+ height: 100%;
69
+ cursor: pointer;
70
+ pointer-events: none;
71
+ }
72
+
73
+ .mrd-file-field__prompt {
74
+ display: flex;
75
+ flex-direction: column;
76
+ align-items: center;
77
+ gap: var(--mrd-space-2);
78
+ font-family: var(--mrd-font-family);
79
+ font-size: var(--mrd-font-size-sm);
80
+ color: var(--mrd-color-neutral-500);
81
+ text-align: center;
82
+ }
83
+
84
+ .mrd-file-field__upload-icon {
85
+ width: 32px;
86
+ height: 32px;
87
+ color: var(--mrd-color-neutral-400);
88
+ }
89
+
90
+ .mrd-file-field__browse {
91
+ color: var(--mrd-color-primary);
92
+ font-weight: var(--mrd-font-weight-medium);
93
+ text-decoration: underline;
94
+ }
95
+
96
+ .mrd-file-field__selected {
97
+ display: flex;
98
+ align-items: center;
99
+ gap: var(--mrd-space-2);
100
+ font-family: var(--mrd-font-family);
101
+ font-size: var(--mrd-font-size-sm);
102
+ color: var(--mrd-color-neutral-700);
103
+ }
104
+
105
+ .mrd-file-field__icon {
106
+ width: 20px;
107
+ height: 20px;
108
+ color: var(--mrd-color-primary);
109
+ flex-shrink: 0;
110
+ }
111
+
112
+ .mrd-file-field__filename {
113
+ flex: 1;
114
+ overflow: hidden;
115
+ text-overflow: ellipsis;
116
+ white-space: nowrap;
117
+ max-width: 200px;
118
+ }
119
+
120
+ .mrd-file-field__clear {
121
+ background: none;
122
+ border: none;
123
+ cursor: pointer;
124
+ color: var(--mrd-color-neutral-400);
125
+ font-size: var(--mrd-font-size-sm);
126
+ padding: var(--mrd-space-1);
127
+ border-radius: var(--mrd-border-radius-sm);
128
+ line-height: 1;
129
+ }
130
+
131
+ .mrd-file-field__clear:hover {
132
+ color: var(--mrd-color-danger);
133
+ background-color: var(--mrd-color-danger-light);
134
+ }
135
+
136
+ .mrd-file-field__spinner {
137
+ display: inline-block;
138
+ flex-shrink: 0;
139
+ width: 18px;
140
+ height: 18px;
141
+ border: 2px solid var(--mrd-color-neutral-300);
142
+ border-top-color: var(--mrd-color-primary);
143
+ border-radius: 50%;
144
+ animation: mrd-file-spin 0.6s linear infinite;
145
+ }
146
+
147
+ @keyframes mrd-file-spin { to { transform: rotate(360deg); } }
148
+
149
+ .mrd-file-field__error {
150
+ font-family: var(--mrd-font-family);
151
+ font-size: var(--mrd-error-font-size);
152
+ color: var(--mrd-error-color);
153
+ }