@4sh/ui-kit 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/README.fr.md +10 -10
  2. package/README.md +10 -10
  3. package/fesm2022/4sh-ui-kit-actions-ui-button-split.mjs +542 -150
  4. package/fesm2022/4sh-ui-kit-actions-ui-button-split.mjs.map +1 -1
  5. package/fesm2022/4sh-ui-kit-actions-ui-button.mjs +622 -248
  6. package/fesm2022/4sh-ui-kit-actions-ui-button.mjs.map +1 -1
  7. package/fesm2022/4sh-ui-kit-actions-ui-link.mjs +385 -152
  8. package/fesm2022/4sh-ui-kit-actions-ui-link.mjs.map +1 -1
  9. package/fesm2022/4sh-ui-kit-actions-ui-speed-dial.mjs +748 -433
  10. package/fesm2022/4sh-ui-kit-actions-ui-speed-dial.mjs.map +1 -1
  11. package/fesm2022/4sh-ui-kit-base-ui-icon.mjs +227 -135
  12. package/fesm2022/4sh-ui-kit-base-ui-icon.mjs.map +1 -1
  13. package/fesm2022/4sh-ui-kit-base-ui-image.mjs +1200 -633
  14. package/fesm2022/4sh-ui-kit-base-ui-image.mjs.map +1 -1
  15. package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs +1675 -1000
  16. package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs.map +1 -1
  17. package/fesm2022/4sh-ui-kit-forms-ui-checkbox.mjs +243 -117
  18. package/fesm2022/4sh-ui-kit-forms-ui-checkbox.mjs.map +1 -1
  19. package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs +2294 -2048
  20. package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs.map +1 -1
  21. package/fesm2022/4sh-ui-kit-forms-ui-editor.mjs +1058 -1113
  22. package/fesm2022/4sh-ui-kit-forms-ui-editor.mjs.map +1 -1
  23. package/fesm2022/4sh-ui-kit-forms-ui-field-sign.mjs +1108 -0
  24. package/fesm2022/4sh-ui-kit-forms-ui-field-sign.mjs.map +1 -0
  25. package/fesm2022/4sh-ui-kit-forms-ui-field.mjs +397 -141
  26. package/fesm2022/4sh-ui-kit-forms-ui-field.mjs.map +1 -1
  27. package/fesm2022/4sh-ui-kit-forms-ui-file-upload.mjs +1529 -583
  28. package/fesm2022/4sh-ui-kit-forms-ui-file-upload.mjs.map +1 -1
  29. package/fesm2022/4sh-ui-kit-forms-ui-input-date.mjs +383 -224
  30. package/fesm2022/4sh-ui-kit-forms-ui-input-date.mjs.map +1 -1
  31. package/fesm2022/4sh-ui-kit-forms-ui-input-group.mjs +345 -177
  32. package/fesm2022/4sh-ui-kit-forms-ui-input-group.mjs.map +1 -1
  33. package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs +280 -138
  34. package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs.map +1 -1
  35. package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs +507 -257
  36. package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs.map +1 -1
  37. package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs +401 -312
  38. package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs.map +1 -1
  39. package/fesm2022/4sh-ui-kit-forms-ui-input-tags.mjs +1277 -697
  40. package/fesm2022/4sh-ui-kit-forms-ui-input-tags.mjs.map +1 -1
  41. package/fesm2022/4sh-ui-kit-forms-ui-input.mjs +467 -199
  42. package/fesm2022/4sh-ui-kit-forms-ui-input.mjs.map +1 -1
  43. package/fesm2022/4sh-ui-kit-forms-ui-knob.mjs +394 -270
  44. package/fesm2022/4sh-ui-kit-forms-ui-knob.mjs.map +1 -1
  45. package/fesm2022/4sh-ui-kit-forms-ui-label.mjs +140 -60
  46. package/fesm2022/4sh-ui-kit-forms-ui-label.mjs.map +1 -1
  47. package/fesm2022/4sh-ui-kit-forms-ui-nudger.mjs +386 -167
  48. package/fesm2022/4sh-ui-kit-forms-ui-nudger.mjs.map +1 -1
  49. package/fesm2022/4sh-ui-kit-forms-ui-radio.mjs +150 -87
  50. package/fesm2022/4sh-ui-kit-forms-ui-radio.mjs.map +1 -1
  51. package/fesm2022/4sh-ui-kit-forms-ui-rating.mjs +345 -180
  52. package/fesm2022/4sh-ui-kit-forms-ui-rating.mjs.map +1 -1
  53. package/fesm2022/4sh-ui-kit-forms-ui-segment-control.mjs +582 -392
  54. package/fesm2022/4sh-ui-kit-forms-ui-segment-control.mjs.map +1 -1
  55. package/fesm2022/4sh-ui-kit-forms-ui-select.mjs +1552 -888
  56. package/fesm2022/4sh-ui-kit-forms-ui-select.mjs.map +1 -1
  57. package/fesm2022/4sh-ui-kit-forms-ui-slider.mjs +485 -338
  58. package/fesm2022/4sh-ui-kit-forms-ui-slider.mjs.map +1 -1
  59. package/fesm2022/4sh-ui-kit-forms-ui-swatch-picker.mjs +503 -311
  60. package/fesm2022/4sh-ui-kit-forms-ui-swatch-picker.mjs.map +1 -1
  61. package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs +271 -137
  62. package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs.map +1 -1
  63. package/fesm2022/4sh-ui-kit-forms-ui-toggle-block.mjs +457 -214
  64. package/fesm2022/4sh-ui-kit-forms-ui-toggle-block.mjs.map +1 -1
  65. package/fesm2022/4sh-ui-kit-forms-ui-toggle-button.mjs +711 -371
  66. package/fesm2022/4sh-ui-kit-forms-ui-toggle-button.mjs.map +1 -1
  67. package/fesm2022/4sh-ui-kit-forms-ui-toggle.mjs +235 -121
  68. package/fesm2022/4sh-ui-kit-forms-ui-toggle.mjs.map +1 -1
  69. package/fesm2022/4sh-ui-kit-forms.mjs +721 -638
  70. package/fesm2022/4sh-ui-kit-forms.mjs.map +1 -1
  71. package/fesm2022/4sh-ui-kit-informative-ui-accordion.mjs +546 -242
  72. package/fesm2022/4sh-ui-kit-informative-ui-accordion.mjs.map +1 -1
  73. package/fesm2022/4sh-ui-kit-informative-ui-alert.mjs +335 -157
  74. package/fesm2022/4sh-ui-kit-informative-ui-alert.mjs.map +1 -1
  75. package/fesm2022/4sh-ui-kit-informative-ui-avatar-group.mjs +53 -33
  76. package/fesm2022/4sh-ui-kit-informative-ui-avatar-group.mjs.map +1 -1
  77. package/fesm2022/4sh-ui-kit-informative-ui-avatar.mjs +218 -121
  78. package/fesm2022/4sh-ui-kit-informative-ui-avatar.mjs.map +1 -1
  79. package/fesm2022/4sh-ui-kit-informative-ui-badge.mjs +192 -100
  80. package/fesm2022/4sh-ui-kit-informative-ui-badge.mjs.map +1 -1
  81. package/fesm2022/4sh-ui-kit-informative-ui-chip.mjs +456 -204
  82. package/fesm2022/4sh-ui-kit-informative-ui-chip.mjs.map +1 -1
  83. package/fesm2022/4sh-ui-kit-informative-ui-empty-state.mjs +314 -147
  84. package/fesm2022/4sh-ui-kit-informative-ui-empty-state.mjs.map +1 -1
  85. package/fesm2022/4sh-ui-kit-informative-ui-helper.mjs +179 -82
  86. package/fesm2022/4sh-ui-kit-informative-ui-helper.mjs.map +1 -1
  87. package/fesm2022/4sh-ui-kit-informative-ui-progress-bar.mjs +268 -123
  88. package/fesm2022/4sh-ui-kit-informative-ui-progress-bar.mjs.map +1 -1
  89. package/fesm2022/4sh-ui-kit-informative-ui-read-only.mjs +391 -146
  90. package/fesm2022/4sh-ui-kit-informative-ui-read-only.mjs.map +1 -1
  91. package/fesm2022/4sh-ui-kit-informative-ui-separator.mjs +158 -76
  92. package/fesm2022/4sh-ui-kit-informative-ui-separator.mjs.map +1 -1
  93. package/fesm2022/4sh-ui-kit-informative-ui-skeleton.mjs +159 -80
  94. package/fesm2022/4sh-ui-kit-informative-ui-skeleton.mjs.map +1 -1
  95. package/fesm2022/4sh-ui-kit-informative-ui-spinner.mjs +295 -131
  96. package/fesm2022/4sh-ui-kit-informative-ui-spinner.mjs.map +1 -1
  97. package/fesm2022/4sh-ui-kit-informative-ui-tag.mjs +211 -83
  98. package/fesm2022/4sh-ui-kit-informative-ui-tag.mjs.map +1 -1
  99. package/fesm2022/4sh-ui-kit-informative-ui-toast.mjs +784 -414
  100. package/fesm2022/4sh-ui-kit-informative-ui-toast.mjs.map +1 -1
  101. package/fesm2022/4sh-ui-kit-informative-ui-tooltip.mjs +822 -476
  102. package/fesm2022/4sh-ui-kit-informative-ui-tooltip.mjs.map +1 -1
  103. package/fesm2022/4sh-ui-kit-layout-ui-bottom-sheet.mjs +1014 -599
  104. package/fesm2022/4sh-ui-kit-layout-ui-bottom-sheet.mjs.map +1 -1
  105. package/fesm2022/4sh-ui-kit-layout-ui-card.mjs +403 -189
  106. package/fesm2022/4sh-ui-kit-layout-ui-card.mjs.map +1 -1
  107. package/fesm2022/4sh-ui-kit-layout-ui-drawer.mjs +707 -272
  108. package/fesm2022/4sh-ui-kit-layout-ui-drawer.mjs.map +1 -1
  109. package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs +1146 -568
  110. package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs.map +1 -1
  111. package/fesm2022/4sh-ui-kit-layout-ui-popover.mjs +519 -308
  112. package/fesm2022/4sh-ui-kit-layout-ui-popover.mjs.map +1 -1
  113. package/fesm2022/4sh-ui-kit-motion.mjs +252 -150
  114. package/fesm2022/4sh-ui-kit-motion.mjs.map +1 -1
  115. package/fesm2022/4sh-ui-kit-navigation-ui-bottom-tab-bar.mjs +793 -341
  116. package/fesm2022/4sh-ui-kit-navigation-ui-bottom-tab-bar.mjs.map +1 -1
  117. package/fesm2022/4sh-ui-kit-navigation-ui-breadcrumb.mjs +351 -194
  118. package/fesm2022/4sh-ui-kit-navigation-ui-breadcrumb.mjs.map +1 -1
  119. package/fesm2022/4sh-ui-kit-navigation-ui-context-menu.mjs +511 -220
  120. package/fesm2022/4sh-ui-kit-navigation-ui-context-menu.mjs.map +1 -1
  121. package/fesm2022/4sh-ui-kit-navigation-ui-menu.mjs +910 -548
  122. package/fesm2022/4sh-ui-kit-navigation-ui-menu.mjs.map +1 -1
  123. package/fesm2022/4sh-ui-kit-navigation-ui-sidebar.mjs +1128 -555
  124. package/fesm2022/4sh-ui-kit-navigation-ui-sidebar.mjs.map +1 -1
  125. package/fesm2022/4sh-ui-kit-navigation-ui-stepper.mjs +915 -470
  126. package/fesm2022/4sh-ui-kit-navigation-ui-stepper.mjs.map +1 -1
  127. package/fesm2022/4sh-ui-kit-navigation-ui-tabs.mjs +931 -474
  128. package/fesm2022/4sh-ui-kit-navigation-ui-tabs.mjs.map +1 -1
  129. package/fesm2022/4sh-ui-kit-overlay.mjs +26 -109
  130. package/fesm2022/4sh-ui-kit-overlay.mjs.map +1 -1
  131. package/fesm2022/4sh-ui-kit-ripple.mjs +329 -290
  132. package/fesm2022/4sh-ui-kit-ripple.mjs.map +1 -1
  133. package/fesm2022/4sh-ui-kit-table-ui-paginator.mjs +709 -248
  134. package/fesm2022/4sh-ui-kit-table-ui-paginator.mjs.map +1 -1
  135. package/fesm2022/4sh-ui-kit-table-ui-table.mjs +2633 -1370
  136. package/fesm2022/4sh-ui-kit-table-ui-table.mjs.map +1 -1
  137. package/fesm2022/4sh-ui-kit-theming.mjs +112 -113
  138. package/fesm2022/4sh-ui-kit-theming.mjs.map +1 -1
  139. package/fesm2022/4sh-ui-kit-types.mjs +0 -12
  140. package/fesm2022/4sh-ui-kit.mjs +3 -15
  141. package/fesm2022/4sh-ui-kit.mjs.map +1 -1
  142. package/mcp/data/component-api.json +299 -2
  143. package/mcp/data/text-search-docs.json +149 -9
  144. package/mcp/data/ui-config.json +378 -1
  145. package/mcp/index.js +8190 -2876
  146. package/mcp/package.json +1 -1
  147. package/package.json +5 -1
  148. package/styles/component-vars.scss +22 -1
  149. package/types/4sh-ui-kit-actions-ui-button-split.d.ts +198 -87
  150. package/types/4sh-ui-kit-actions-ui-button.d.ts +240 -116
  151. package/types/4sh-ui-kit-actions-ui-link.d.ts +136 -67
  152. package/types/4sh-ui-kit-actions-ui-speed-dial.d.ts +287 -180
  153. package/types/4sh-ui-kit-base-ui-icon.d.ts +92 -58
  154. package/types/4sh-ui-kit-base-ui-image.d.ts +406 -205
  155. package/types/4sh-ui-kit-forms-ui-autocomplete.d.ts +573 -376
  156. package/types/4sh-ui-kit-forms-ui-checkbox.d.ts +77 -42
  157. package/types/4sh-ui-kit-forms-ui-datepicker.d.ts +953 -700
  158. package/types/4sh-ui-kit-forms-ui-editor.d.ts +374 -340
  159. package/types/4sh-ui-kit-forms-ui-field-sign.d.ts +325 -0
  160. package/types/4sh-ui-kit-forms-ui-field.d.ts +150 -64
  161. package/types/4sh-ui-kit-forms-ui-file-upload.d.ts +583 -241
  162. package/types/4sh-ui-kit-forms-ui-input-date.d.ts +152 -103
  163. package/types/4sh-ui-kit-forms-ui-input-group.d.ts +109 -63
  164. package/types/4sh-ui-kit-forms-ui-input-mask.d.ts +93 -59
  165. package/types/4sh-ui-kit-forms-ui-input-number.d.ts +171 -96
  166. package/types/4sh-ui-kit-forms-ui-input-otp.d.ts +137 -104
  167. package/types/4sh-ui-kit-forms-ui-input-tags.d.ts +469 -309
  168. package/types/4sh-ui-kit-forms-ui-input.d.ts +198 -118
  169. package/types/4sh-ui-kit-forms-ui-knob.d.ts +132 -80
  170. package/types/4sh-ui-kit-forms-ui-label.d.ts +47 -22
  171. package/types/4sh-ui-kit-forms-ui-nudger.d.ts +134 -67
  172. package/types/4sh-ui-kit-forms-ui-radio.d.ts +48 -33
  173. package/types/4sh-ui-kit-forms-ui-rating.d.ts +120 -86
  174. package/types/4sh-ui-kit-forms-ui-segment-control.d.ts +221 -147
  175. package/types/4sh-ui-kit-forms-ui-select.d.ts +561 -357
  176. package/types/4sh-ui-kit-forms-ui-slider.d.ts +156 -105
  177. package/types/4sh-ui-kit-forms-ui-swatch-picker.d.ts +133 -97
  178. package/types/4sh-ui-kit-forms-ui-textarea.d.ts +90 -56
  179. package/types/4sh-ui-kit-forms-ui-toggle-block.d.ts +158 -94
  180. package/types/4sh-ui-kit-forms-ui-toggle-button.d.ts +314 -178
  181. package/types/4sh-ui-kit-forms-ui-toggle.d.ts +88 -54
  182. package/types/4sh-ui-kit-forms.d.ts +275 -194
  183. package/types/4sh-ui-kit-informative-ui-accordion.d.ts +162 -92
  184. package/types/4sh-ui-kit-informative-ui-alert.d.ts +128 -62
  185. package/types/4sh-ui-kit-informative-ui-avatar-group.d.ts +8 -8
  186. package/types/4sh-ui-kit-informative-ui-avatar.d.ts +81 -44
  187. package/types/4sh-ui-kit-informative-ui-badge.d.ts +71 -41
  188. package/types/4sh-ui-kit-informative-ui-chip.d.ts +194 -99
  189. package/types/4sh-ui-kit-informative-ui-empty-state.d.ts +105 -65
  190. package/types/4sh-ui-kit-informative-ui-helper.d.ts +64 -34
  191. package/types/4sh-ui-kit-informative-ui-progress-bar.d.ts +120 -65
  192. package/types/4sh-ui-kit-informative-ui-read-only.d.ts +147 -67
  193. package/types/4sh-ui-kit-informative-ui-separator.d.ts +65 -35
  194. package/types/4sh-ui-kit-informative-ui-skeleton.d.ts +62 -32
  195. package/types/4sh-ui-kit-informative-ui-spinner.d.ts +111 -50
  196. package/types/4sh-ui-kit-informative-ui-tag.d.ts +77 -37
  197. package/types/4sh-ui-kit-informative-ui-toast.d.ts +300 -180
  198. package/types/4sh-ui-kit-informative-ui-tooltip.d.ts +269 -141
  199. package/types/4sh-ui-kit-layout-ui-bottom-sheet.d.ts +360 -221
  200. package/types/4sh-ui-kit-layout-ui-card.d.ts +119 -79
  201. package/types/4sh-ui-kit-layout-ui-drawer.d.ts +244 -120
  202. package/types/4sh-ui-kit-layout-ui-modal.d.ts +409 -222
  203. package/types/4sh-ui-kit-layout-ui-popover.d.ts +149 -91
  204. package/types/4sh-ui-kit-motion.d.ts +117 -67
  205. package/types/4sh-ui-kit-navigation-ui-bottom-tab-bar.d.ts +279 -145
  206. package/types/4sh-ui-kit-navigation-ui-breadcrumb.d.ts +134 -96
  207. package/types/4sh-ui-kit-navigation-ui-context-menu.d.ts +148 -89
  208. package/types/4sh-ui-kit-navigation-ui-menu.d.ts +282 -201
  209. package/types/4sh-ui-kit-navigation-ui-sidebar.d.ts +425 -261
  210. package/types/4sh-ui-kit-navigation-ui-stepper.d.ts +279 -183
  211. package/types/4sh-ui-kit-navigation-ui-tabs.d.ts +275 -173
  212. package/types/4sh-ui-kit-overlay.d.ts +6 -6
  213. package/types/4sh-ui-kit-ripple.d.ts +99 -74
  214. package/types/4sh-ui-kit-table-ui-paginator.d.ts +237 -133
  215. package/types/4sh-ui-kit-table-ui-table.d.ts +769 -470
  216. package/types/4sh-ui-kit-theming.d.ts +27 -29
  217. package/types/4sh-ui-kit-types.d.ts +6 -5
  218. package/types/4sh-ui-kit.d.ts +4 -3
  219. package/fesm2022/4sh-ui-kit-types.mjs.map +0 -1
@@ -1,593 +1,1539 @@
1
- import * as i0 from '@angular/core';
2
- import { input, booleanAttribute, output, computed, Component, numberAttribute, inject, ElementRef, DestroyRef, viewChild, signal, effect, isDevMode } from '@angular/core';
3
- import { UiIcon } from '@4sh/ui-kit/base/ui-icon';
4
- import { UiSpinner } from '@4sh/ui-kit/informative/ui-spinner';
5
- import { formatLabel } from '@4sh/ui-kit/forms';
6
- import { NgTemplateOutlet } from '@angular/common';
7
- import { UiButton } from '@4sh/ui-kit/actions/ui-button';
8
-
9
- // =====================================================================
10
- // Shared model for ui-file-upload and its file-row (ui-file-upload-list).
11
- // =====================================================================
12
- /** Human-readable file size (e.g. "2.5 MB"). Base-1024. */
1
+ import * as i0 from "@angular/core";
2
+ import { Component, DestroyRef, ElementRef, booleanAttribute, computed, effect, inject, input, isDevMode, numberAttribute, output, signal, untracked, viewChild } from "@angular/core";
3
+ import { UiIcon } from "@4sh/ui-kit/base/ui-icon";
4
+ import { UiSpinner } from "@4sh/ui-kit/informative/ui-spinner";
5
+ import { formatLabel } from "@4sh/ui-kit/forms";
6
+ import { NgTemplateOutlet } from "@angular/common";
7
+ import { UiButton } from "@4sh/ui-kit/actions/ui-button";
8
+ function isLocalUploadFile(file) {
9
+ return file.file !== void 0;
10
+ }
13
11
  function formatFileSize(bytes) {
14
- if (!bytes || bytes < 0)
15
- return '0 B';
16
- const k = 1024;
17
- const units = ['B', 'KB', 'MB', 'GB', 'TB'];
18
- const i = Math.min(Math.floor(Math.log(bytes) / Math.log(k)), units.length - 1);
19
- const value = bytes / Math.pow(k, i);
20
- const rounded = Math.round(value * 10) / 10;
21
- return `${rounded} ${units[i]}`;
12
+ if (!bytes || bytes < 0) return "0 B";
13
+ const k = 1024;
14
+ const units = [
15
+ "B",
16
+ "KB",
17
+ "MB",
18
+ "GB",
19
+ "TB"
20
+ ];
21
+ const i = Math.min(Math.floor(Math.log(bytes) / Math.log(k)), units.length - 1);
22
+ const value = bytes / Math.pow(k, i);
23
+ return `${Math.round(value * 10) / 10} ${units[i]}`;
22
24
  }
23
- /**
24
- * Whether a File matches an `accept` string (e.g. "image/*,.pdf").
25
- * Empty/absent accept means everything is allowed.
26
- */
27
25
  function isFileTypeAccepted(file, accept) {
28
- if (!accept)
29
- return true;
30
- const patterns = accept
31
- .split(',')
32
- .map((t) => t.trim().toLowerCase())
33
- .filter(Boolean);
34
- if (!patterns.length)
35
- return true;
36
- const name = file.name.toLowerCase();
37
- const mime = (file.type || '').toLowerCase();
38
- return patterns.some((pattern) => {
39
- if (pattern.startsWith('.'))
40
- return name.endsWith(pattern); // extension
41
- if (pattern.endsWith('/*'))
42
- return mime.startsWith(pattern.slice(0, -1)); // "image/"
43
- return mime === pattern; // exact mime
44
- });
26
+ if (!accept) return true;
27
+ const patterns = accept.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean);
28
+ if (!patterns.length) return true;
29
+ const name = file.name.toLowerCase();
30
+ const mime = (file.type || "").toLowerCase();
31
+ return patterns.some((pattern) => {
32
+ if (pattern.startsWith(".")) return name.endsWith(pattern);
33
+ if (pattern.endsWith("/*")) return mime.startsWith(pattern.slice(0, -1));
34
+ return mime === pattern;
35
+ });
45
36
  }
46
- /** Whether a File is a previewable image. */
47
37
  function isImageFile(file) {
48
- return /^image\//.test(file.type);
38
+ return /^image\//.test(file.type);
49
39
  }
50
-
51
- /**
52
- * ui-file-upload-list — a single file row (the repeatable unit of an upload list).
53
- *
54
- * Presentational: shows a leading thumbnail (for images) or file icon, the file
55
- * name + size/status, and a remove button. While the file is uploading it swaps
56
- * the leading icon for a `ui-spinner` and reveals a slim progress bar.
57
- *
58
- * Named to mirror the Figma component; the uploader stacks one row per file.
59
- */
60
- class UiFileUploadList {
61
- constructor() {
62
- /** The file to display (name/size/status/progress/preview). */
63
- this.file = input.required(/* @ts-ignore */
64
- ...(ngDevMode ? [{ debugName: "file" }] : /* istanbul ignore next */ []));
65
- /** Size of the file rows. */
66
- this.size = input('default', /* @ts-ignore */
67
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
68
- /** FontAwesome icon for non-image files. */
69
- this.icon = input('file', /* @ts-ignore */
70
- ...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
71
- /** Whether the remove button is shown. */
72
- this.removable = input(true, { ...(ngDevMode ? { debugName: "removable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
73
- /** Accessible name of the remove button (raw text — the file name is appended in the template). */
74
- this.removeAriaLabel = input('Supprimer le fichier', /* @ts-ignore */
75
- ...(ngDevMode ? [{ debugName: "removeAriaLabel" }] : /* istanbul ignore next */ []));
76
- /** Fallback error text when the file carries no message. */
77
- this.failedLabel = input('Échec', /* @ts-ignore */
78
- ...(ngDevMode ? [{ debugName: "failedLabel" }] : /* istanbul ignore next */ []));
79
- /** Accessible name of the upload spinner — `{0}` is the file name. */
80
- this.uploadingLabel = input('Téléversement de {0}', /* @ts-ignore */
81
- ...(ngDevMode ? [{ debugName: "uploadingLabel" }] : /* istanbul ignore next */ []));
82
- /** Accessible name of the progress bar — `{0}` is the file name. */
83
- this.progressLabel = input('Progression du téléversement de {0}', /* @ts-ignore */
84
- ...(ngDevMode ? [{ debugName: "progressLabel" }] : /* istanbul ignore next */ []));
85
- /** Emitted when the remove button is activated. */
86
- this.remove = output();
87
- /** @ignore Formatted size (e.g. "2.5 MB"). */
88
- this.sizeLabel = computed(() => formatFileSize(this.file().size), /* @ts-ignore */
89
- ...(ngDevMode ? [{ debugName: "sizeLabel" }] : /* istanbul ignore next */ []));
90
- /** @ignore Accessible name of the upload spinner (`{0}` filled with the file name). */
91
- this.uploadingAriaLabel = computed(() => formatLabel(this.uploadingLabel(), this.file().name), /* @ts-ignore */
92
- ...(ngDevMode ? [{ debugName: "uploadingAriaLabel" }] : /* istanbul ignore next */ []));
93
- /** @ignore Accessible name of the progress bar (`{0}` filled with the file name). */
94
- this.progressAriaLabel = computed(() => formatLabel(this.progressLabel(), this.file().name), /* @ts-ignore */
95
- ...(ngDevMode ? [{ debugName: "progressAriaLabel" }] : /* istanbul ignore next */ []));
96
- /** @ignore Uploading in progress → show the spinner + progress bar. */
97
- this.isUploading = computed(() => this.file().status === 'uploading', /* @ts-ignore */
98
- ...(ngDevMode ? [{ debugName: "isUploading" }] : /* istanbul ignore next */ []));
99
- /** @ignore Error state → surface the message + error styling. */
100
- this.isError = computed(() => this.file().status === 'error', /* @ts-ignore */
101
- ...(ngDevMode ? [{ debugName: "isError" }] : /* istanbul ignore next */ []));
102
- /** @ignore Image with a usable preview URL → render a thumbnail. */
103
- this.thumbnail = computed(() => this.file().objectUrl ?? null, /* @ts-ignore */
104
- ...(ngDevMode ? [{ debugName: "thumbnail" }] : /* istanbul ignore next */ []));
105
- /** @ignore Secondary line: error message, else size (+ status hint). */
106
- this.infoLabel = computed(() => {
107
- const f = this.file();
108
- if (f.status === 'error')
109
- return f.error ?? this.failedLabel();
110
- if (f.status === 'uploading')
111
- return `${this.sizeLabel()} · ${Math.round(f.progress)} %`;
112
- return this.sizeLabel();
113
- }, /* @ts-ignore */
114
- ...(ngDevMode ? [{ debugName: "infoLabel" }] : /* istanbul ignore next */ []));
115
- /** @ignore */
116
- this.iconSize = computed(() => (this.size() === 'small' ? 'sm' : 'md'), /* @ts-ignore */
117
- ...(ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []));
118
- /** @ignore */
119
- this.classes = computed(() => {
120
- const c = ['ui-file-upload-list'];
121
- if (this.size() !== 'default')
122
- c.push(`_${this.size()}`);
123
- if (this.isError())
124
- c.push('_error');
125
- if (this.thumbnail())
126
- c.push('_has-thumb');
127
- return c.join(' ');
128
- }, /* @ts-ignore */
129
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
130
- }
131
- /** @ignore */
132
- onRemove() {
133
- this.remove.emit(this.file());
134
- }
135
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiFileUploadList, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
136
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: UiFileUploadList, isStandalone: true, selector: "ui-file-upload-list", inputs: { file: { classPropertyName: "file", publicName: "file", isSignal: true, isRequired: true, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, removeAriaLabel: { classPropertyName: "removeAriaLabel", publicName: "removeAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, failedLabel: { classPropertyName: "failedLabel", publicName: "failedLabel", isSignal: true, isRequired: false, transformFunction: null }, uploadingLabel: { classPropertyName: "uploadingLabel", publicName: "uploadingLabel", isSignal: true, isRequired: false, transformFunction: null }, progressLabel: { classPropertyName: "progressLabel", publicName: "progressLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { remove: "remove" }, ngImport: i0, template: "<div [class]=\"classes()\">\n <div class=\"ui-file-upload-list-file\">\n <span class=\"ui-file-upload-list-media\">\n @if (isUploading()) {\n <ui-spinner size=\"small\" [ariaLabel]=\"uploadingAriaLabel()\" />\n } @else if (thumbnail(); as src) {\n <img class=\"ui-file-upload-list-thumb\" [src]=\"src\" alt=\"\" />\n } @else {\n <ui-icon [name]=\"isError() ? 'triangle-exclamation' : icon()\" [size]=\"iconSize()\" />\n }\n </span>\n\n <span class=\"ui-file-upload-list-infos\">\n <span class=\"ui-file-upload-list-name\" [title]=\"file().name\">{{ file().name }}</span>\n <span class=\"ui-file-upload-list-meta\">{{ infoLabel() }}</span>\n </span>\n </div>\n\n @if (removable()) {\n <button\n type=\"button\"\n class=\"ui-file-upload-list-remove\"\n [attr.aria-label]=\"removeAriaLabel() + ' : ' + file().name\"\n (click)=\"onRemove()\"\n >\n <ui-icon name=\"trash\" [size]=\"iconSize()\" />\n </button>\n }\n\n @if (isUploading()) {\n <div\n class=\"ui-file-upload-list-progress\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"file().progress\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-label]=\"progressAriaLabel()\"\n >\n <span class=\"ui-file-upload-list-progress-bar\" [style.width.%]=\"file().progress\"></span>\n </div>\n }\n</div>\n", styles: [".ui-file-upload-list{position:relative;display:flex;align-items:center;box-sizing:border-box;width:100%;overflow:hidden;background-color:var(--ui-file-upload-list-surface, var(--form-high-surface-default));border:var(--ui-file-upload-item-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-file-upload-list-stroke, var(--form-high-stroke-default));color:var(--ui-file-upload-list-color, var(--form-high-content-default));border-radius:var(--ui-file-upload-item-radius, var(--radius-lg));padding:var(--ui-file-upload-item-padding-y, var(--units-md)) var(--ui-file-upload-item-padding-x, var(--units-default));gap:var(--ui-file-upload-item-gap, var(--units-md))}.ui-file-upload-list .ui-file-upload-list-media{width:var(--ui-file-upload-item-media-size, 2.5rem);height:var(--ui-file-upload-item-media-size, 2.5rem)}.ui-file-upload-list .ui-file-upload-list-name{font-size:var(--ui-file-upload-item-name-font-size, var(--size-typography-title-sm))}.ui-file-upload-list .ui-file-upload-list-meta{font-size:var(--ui-file-upload-item-meta-font-size, var(--size-typography-text-sm))}.ui-file-upload-list._small{border-radius:var(--ui-file-upload-item-radius-small, var(--radius-md));padding:var(--ui-file-upload-item-padding-y-small, var(--units-sm)) var(--ui-file-upload-item-padding-x-small, var(--units-md));gap:var(--ui-file-upload-item-gap-small, var(--units-sm))}.ui-file-upload-list._small .ui-file-upload-list-media{width:var(--ui-file-upload-item-media-size-small, 2rem);height:var(--ui-file-upload-item-media-size-small, 2rem)}.ui-file-upload-list._small .ui-file-upload-list-name{font-size:var(--ui-file-upload-item-name-font-size-small, var(--size-typography-text-md))}.ui-file-upload-list._small .ui-file-upload-list-meta{font-size:var(--ui-file-upload-item-meta-font-size-small, var(--size-typography-text-sm))}.ui-file-upload-list-file{display:flex;align-items:center;gap:var(--ui-file-upload-item-media-gap, var(--units-sm));min-width:0;flex:1 1 auto}.ui-file-upload-list-media{display:inline-flex;align-items:center;justify-content:center;flex:none;line-height:0;color:var(--ui-file-upload-list-color, var(--form-high-content-default))}.ui-file-upload-list-thumb{width:100%;height:100%;object-fit:cover;border-radius:var(--ui-file-upload-item-thumb-radius, var(--radius-sm))}.ui-file-upload-list-infos{display:flex;flex-direction:column;gap:var(--ui-file-upload-item-infos-gap, var(--units-2xs));min-width:0}.ui-file-upload-list-name{font-family:var(--ui-file-upload-font-family, var(--fontfamily-base));font-weight:var(--ui-file-upload-name-weight, var(--weight-bold));line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-file-upload-list-meta{font-family:var(--ui-file-upload-font-family, var(--fontfamily-base));font-weight:var(--ui-file-upload-meta-weight, var(--weight-light));line-height:1.2;color:var(--ui-file-upload-list-color, var(--form-high-content-default))}.ui-file-upload-list-remove{display:inline-flex;align-items:center;justify-content:center;flex:none;padding:var(--ui-file-upload-item-remove-padding, var(--units-2xs));background:transparent;border:none;border-radius:var(--ui-file-upload-item-remove-radius, var(--radius-sm));color:var(--ui-file-upload-list-remove-color, var(--form-high-content-default));cursor:pointer;line-height:0;transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-file-upload-list-remove:hover{color:var(--ui-file-upload-list-remove-color-hover, var(--global-text-default))}.ui-file-upload-list-remove:focus-visible{outline:none;box-shadow:0 0 0 var(--ui-file-upload-item-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-file-upload-list-remove-focus-ring-color, var(--form-high-stroke-focused))}.ui-file-upload-list-progress{position:absolute;left:0;right:0;bottom:0;height:var(--ui-file-upload-item-progress-height, var(--stroke-default));background-color:var(--ui-file-upload-list-progress-surface, var(--form-high-surface-hover))}.ui-file-upload-list-progress-bar{display:block;height:100%;background-color:var(--ui-file-upload-item-progress-color, var(--global-text-default));transition:width var(--ui-control-transition-duration, var(--motion-toggle-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-toggle-easing, var(--transition-easeinout)))}.ui-file-upload-list._error{border-color:var(--ui-file-upload-list-stroke-error, var(--informative-errorhigh-stroke-default))}.ui-file-upload-list._error .ui-file-upload-list-media,.ui-file-upload-list._error .ui-file-upload-list-meta{color:var(--ui-file-upload-list-color-error, var(--form-error-content-default))}\n"], dependencies: [{ kind: "component", type: UiIcon, selector: "ui-icon", inputs: ["name", "size", "type", "family", "decorative", "ariaLabel"] }, { kind: "component", type: UiSpinner, selector: "ui-spinner", inputs: ["size", "orientation", "label", "ariaLabel", "spinnerTemplate", "image", "imageAlt", "icon", "strokeWidth", "fill", "animationDuration", "delay"] }] }); }
137
- }
138
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiFileUploadList, decorators: [{
139
- type: Component,
140
- args: [{ selector: 'ui-file-upload-list', imports: [UiIcon, UiSpinner], template: "<div [class]=\"classes()\">\n <div class=\"ui-file-upload-list-file\">\n <span class=\"ui-file-upload-list-media\">\n @if (isUploading()) {\n <ui-spinner size=\"small\" [ariaLabel]=\"uploadingAriaLabel()\" />\n } @else if (thumbnail(); as src) {\n <img class=\"ui-file-upload-list-thumb\" [src]=\"src\" alt=\"\" />\n } @else {\n <ui-icon [name]=\"isError() ? 'triangle-exclamation' : icon()\" [size]=\"iconSize()\" />\n }\n </span>\n\n <span class=\"ui-file-upload-list-infos\">\n <span class=\"ui-file-upload-list-name\" [title]=\"file().name\">{{ file().name }}</span>\n <span class=\"ui-file-upload-list-meta\">{{ infoLabel() }}</span>\n </span>\n </div>\n\n @if (removable()) {\n <button\n type=\"button\"\n class=\"ui-file-upload-list-remove\"\n [attr.aria-label]=\"removeAriaLabel() + ' : ' + file().name\"\n (click)=\"onRemove()\"\n >\n <ui-icon name=\"trash\" [size]=\"iconSize()\" />\n </button>\n }\n\n @if (isUploading()) {\n <div\n class=\"ui-file-upload-list-progress\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"file().progress\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-label]=\"progressAriaLabel()\"\n >\n <span class=\"ui-file-upload-list-progress-bar\" [style.width.%]=\"file().progress\"></span>\n </div>\n }\n</div>\n", styles: [".ui-file-upload-list{position:relative;display:flex;align-items:center;box-sizing:border-box;width:100%;overflow:hidden;background-color:var(--ui-file-upload-list-surface, var(--form-high-surface-default));border:var(--ui-file-upload-item-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-file-upload-list-stroke, var(--form-high-stroke-default));color:var(--ui-file-upload-list-color, var(--form-high-content-default));border-radius:var(--ui-file-upload-item-radius, var(--radius-lg));padding:var(--ui-file-upload-item-padding-y, var(--units-md)) var(--ui-file-upload-item-padding-x, var(--units-default));gap:var(--ui-file-upload-item-gap, var(--units-md))}.ui-file-upload-list .ui-file-upload-list-media{width:var(--ui-file-upload-item-media-size, 2.5rem);height:var(--ui-file-upload-item-media-size, 2.5rem)}.ui-file-upload-list .ui-file-upload-list-name{font-size:var(--ui-file-upload-item-name-font-size, var(--size-typography-title-sm))}.ui-file-upload-list .ui-file-upload-list-meta{font-size:var(--ui-file-upload-item-meta-font-size, var(--size-typography-text-sm))}.ui-file-upload-list._small{border-radius:var(--ui-file-upload-item-radius-small, var(--radius-md));padding:var(--ui-file-upload-item-padding-y-small, var(--units-sm)) var(--ui-file-upload-item-padding-x-small, var(--units-md));gap:var(--ui-file-upload-item-gap-small, var(--units-sm))}.ui-file-upload-list._small .ui-file-upload-list-media{width:var(--ui-file-upload-item-media-size-small, 2rem);height:var(--ui-file-upload-item-media-size-small, 2rem)}.ui-file-upload-list._small .ui-file-upload-list-name{font-size:var(--ui-file-upload-item-name-font-size-small, var(--size-typography-text-md))}.ui-file-upload-list._small .ui-file-upload-list-meta{font-size:var(--ui-file-upload-item-meta-font-size-small, var(--size-typography-text-sm))}.ui-file-upload-list-file{display:flex;align-items:center;gap:var(--ui-file-upload-item-media-gap, var(--units-sm));min-width:0;flex:1 1 auto}.ui-file-upload-list-media{display:inline-flex;align-items:center;justify-content:center;flex:none;line-height:0;color:var(--ui-file-upload-list-color, var(--form-high-content-default))}.ui-file-upload-list-thumb{width:100%;height:100%;object-fit:cover;border-radius:var(--ui-file-upload-item-thumb-radius, var(--radius-sm))}.ui-file-upload-list-infos{display:flex;flex-direction:column;gap:var(--ui-file-upload-item-infos-gap, var(--units-2xs));min-width:0}.ui-file-upload-list-name{font-family:var(--ui-file-upload-font-family, var(--fontfamily-base));font-weight:var(--ui-file-upload-name-weight, var(--weight-bold));line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-file-upload-list-meta{font-family:var(--ui-file-upload-font-family, var(--fontfamily-base));font-weight:var(--ui-file-upload-meta-weight, var(--weight-light));line-height:1.2;color:var(--ui-file-upload-list-color, var(--form-high-content-default))}.ui-file-upload-list-remove{display:inline-flex;align-items:center;justify-content:center;flex:none;padding:var(--ui-file-upload-item-remove-padding, var(--units-2xs));background:transparent;border:none;border-radius:var(--ui-file-upload-item-remove-radius, var(--radius-sm));color:var(--ui-file-upload-list-remove-color, var(--form-high-content-default));cursor:pointer;line-height:0;transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-file-upload-list-remove:hover{color:var(--ui-file-upload-list-remove-color-hover, var(--global-text-default))}.ui-file-upload-list-remove:focus-visible{outline:none;box-shadow:0 0 0 var(--ui-file-upload-item-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-file-upload-list-remove-focus-ring-color, var(--form-high-stroke-focused))}.ui-file-upload-list-progress{position:absolute;left:0;right:0;bottom:0;height:var(--ui-file-upload-item-progress-height, var(--stroke-default));background-color:var(--ui-file-upload-list-progress-surface, var(--form-high-surface-hover))}.ui-file-upload-list-progress-bar{display:block;height:100%;background-color:var(--ui-file-upload-item-progress-color, var(--global-text-default));transition:width var(--ui-control-transition-duration, var(--motion-toggle-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-toggle-easing, var(--transition-easeinout)))}.ui-file-upload-list._error{border-color:var(--ui-file-upload-list-stroke-error, var(--informative-errorhigh-stroke-default))}.ui-file-upload-list._error .ui-file-upload-list-media,.ui-file-upload-list._error .ui-file-upload-list-meta{color:var(--ui-file-upload-list-color-error, var(--form-error-content-default))}\n"] }]
141
- }], propDecorators: { file: [{ type: i0.Input, args: [{ isSignal: true, alias: "file", required: true }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], removable: [{ type: i0.Input, args: [{ isSignal: true, alias: "removable", required: false }] }], removeAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "removeAriaLabel", required: false }] }], failedLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "failedLabel", required: false }] }], uploadingLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "uploadingLabel", required: false }] }], progressLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "progressLabel", required: false }] }], remove: [{ type: i0.Output, args: ["remove"] }] } });
142
-
40
+ var UiFileUploadList = class UiFileUploadList {
41
+ constructor() {
42
+ this.file = input.required(...ngDevMode ? [{ debugName: "file" }] : /* istanbul ignore next */ []);
43
+ this.size = input("default", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
44
+ this.icon = input("file", ...ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []);
45
+ this.removable = input(true, {
46
+ ...ngDevMode ? { debugName: "removable" } : /* istanbul ignore next */ {},
47
+ transform: booleanAttribute
48
+ });
49
+ this.openable = input(false, {
50
+ ...ngDevMode ? { debugName: "openable" } : /* istanbul ignore next */ {},
51
+ transform: booleanAttribute
52
+ });
53
+ this.openLabel = input("Ouvrir {0}", ...ngDevMode ? [{ debugName: "openLabel" }] : /* istanbul ignore next */ []);
54
+ this.removeAriaLabel = input("Supprimer le fichier", ...ngDevMode ? [{ debugName: "removeAriaLabel" }] : /* istanbul ignore next */ []);
55
+ this.failedLabel = input("Échec", ...ngDevMode ? [{ debugName: "failedLabel" }] : /* istanbul ignore next */ []);
56
+ this.uploadingLabel = input("Téléversement de {0}", ...ngDevMode ? [{ debugName: "uploadingLabel" }] : /* istanbul ignore next */ []);
57
+ this.progressLabel = input("Progression du téléversement de {0}", ...ngDevMode ? [{ debugName: "progressLabel" }] : /* istanbul ignore next */ []);
58
+ this.remove = output();
59
+ this.open = output();
60
+ this.sizeLabel = computed(() => formatFileSize(this.file().size), ...ngDevMode ? [{ debugName: "sizeLabel" }] : /* istanbul ignore next */ []);
61
+ this.openAriaLabel = computed(() => formatLabel(this.openLabel(), this.file().name), ...ngDevMode ? [{ debugName: "openAriaLabel" }] : /* istanbul ignore next */ []);
62
+ this.uploadingAriaLabel = computed(() => formatLabel(this.uploadingLabel(), this.file().name), ...ngDevMode ? [{ debugName: "uploadingAriaLabel" }] : /* istanbul ignore next */ []);
63
+ this.progressAriaLabel = computed(() => formatLabel(this.progressLabel(), this.file().name), ...ngDevMode ? [{ debugName: "progressAriaLabel" }] : /* istanbul ignore next */ []);
64
+ this.isUploading = computed(() => this.file().status === "uploading", ...ngDevMode ? [{ debugName: "isUploading" }] : /* istanbul ignore next */ []);
65
+ this.isError = computed(() => this.file().status === "error", ...ngDevMode ? [{ debugName: "isError" }] : /* istanbul ignore next */ []);
66
+ this.thumbnail = computed(() => this.file().objectUrl ?? null, ...ngDevMode ? [{ debugName: "thumbnail" }] : /* istanbul ignore next */ []);
67
+ this.infoLabel = computed(() => {
68
+ const f = this.file();
69
+ if (f.status === "error") return f.error ?? this.failedLabel();
70
+ if (f.status === "uploading") return `${this.sizeLabel()} · ${Math.round(f.progress)} %`;
71
+ return this.sizeLabel();
72
+ }, ...ngDevMode ? [{ debugName: "infoLabel" }] : /* istanbul ignore next */ []);
73
+ this.iconSize = computed(() => this.size() === "small" ? "sm" : "md", ...ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []);
74
+ this.classes = computed(() => {
75
+ const c = ["ui-file-upload-list"];
76
+ if (this.size() !== "default") c.push(`_${this.size()}`);
77
+ if (this.isError()) c.push("_error");
78
+ if (this.thumbnail()) c.push("_has-thumb");
79
+ return c.join(" ");
80
+ }, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
81
+ }
82
+ onRemove() {
83
+ this.remove.emit(this.file());
84
+ }
85
+ onOpen() {
86
+ this.open.emit(this.file());
87
+ }
88
+ static {
89
+ this.ɵfac = i0.ɵɵngDeclareFactory({
90
+ minVersion: "12.0.0",
91
+ version: "22.3.0",
92
+ ngImport: i0,
93
+ type: UiFileUploadList,
94
+ deps: [],
95
+ target: i0.ɵɵFactoryTarget.Component
96
+ });
97
+ }
98
+ static {
99
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
100
+ minVersion: "17.0.0",
101
+ version: "22.3.0",
102
+ type: UiFileUploadList,
103
+ isStandalone: true,
104
+ selector: "ui-file-upload-list",
105
+ inputs: {
106
+ file: {
107
+ classPropertyName: "file",
108
+ publicName: "file",
109
+ isSignal: true,
110
+ isRequired: true,
111
+ transformFunction: null
112
+ },
113
+ size: {
114
+ classPropertyName: "size",
115
+ publicName: "size",
116
+ isSignal: true,
117
+ isRequired: false,
118
+ transformFunction: null
119
+ },
120
+ icon: {
121
+ classPropertyName: "icon",
122
+ publicName: "icon",
123
+ isSignal: true,
124
+ isRequired: false,
125
+ transformFunction: null
126
+ },
127
+ removable: {
128
+ classPropertyName: "removable",
129
+ publicName: "removable",
130
+ isSignal: true,
131
+ isRequired: false,
132
+ transformFunction: null
133
+ },
134
+ openable: {
135
+ classPropertyName: "openable",
136
+ publicName: "openable",
137
+ isSignal: true,
138
+ isRequired: false,
139
+ transformFunction: null
140
+ },
141
+ openLabel: {
142
+ classPropertyName: "openLabel",
143
+ publicName: "openLabel",
144
+ isSignal: true,
145
+ isRequired: false,
146
+ transformFunction: null
147
+ },
148
+ removeAriaLabel: {
149
+ classPropertyName: "removeAriaLabel",
150
+ publicName: "removeAriaLabel",
151
+ isSignal: true,
152
+ isRequired: false,
153
+ transformFunction: null
154
+ },
155
+ failedLabel: {
156
+ classPropertyName: "failedLabel",
157
+ publicName: "failedLabel",
158
+ isSignal: true,
159
+ isRequired: false,
160
+ transformFunction: null
161
+ },
162
+ uploadingLabel: {
163
+ classPropertyName: "uploadingLabel",
164
+ publicName: "uploadingLabel",
165
+ isSignal: true,
166
+ isRequired: false,
167
+ transformFunction: null
168
+ },
169
+ progressLabel: {
170
+ classPropertyName: "progressLabel",
171
+ publicName: "progressLabel",
172
+ isSignal: true,
173
+ isRequired: false,
174
+ transformFunction: null
175
+ }
176
+ },
177
+ outputs: {
178
+ remove: "remove",
179
+ open: "open"
180
+ },
181
+ ngImport: i0,
182
+ template: "<div [class]=\"classes()\">\n <div class=\"ui-file-upload-list-file\">\n <span class=\"ui-file-upload-list-media\">\n @if (isUploading()) {\n <ui-spinner size=\"small\" [ariaLabel]=\"uploadingAriaLabel()\" />\n } @else if (thumbnail(); as src) {\n <img class=\"ui-file-upload-list-thumb\" [src]=\"src\" alt=\"\" />\n } @else {\n <ui-icon [name]=\"isError() ? 'triangle-exclamation' : icon()\" [size]=\"iconSize()\" />\n }\n </span>\n\n <span class=\"ui-file-upload-list-infos\">\n @if (openable()) {\n <button\n type=\"button\"\n class=\"ui-file-upload-list-name _button\"\n [title]=\"file().name\"\n [attr.aria-label]=\"openAriaLabel() || null\"\n (click)=\"onOpen()\"\n >\n {{ file().name }}\n </button>\n } @else {\n <span class=\"ui-file-upload-list-name\" [title]=\"file().name\">{{ file().name }}</span>\n }\n <span class=\"ui-file-upload-list-meta\">{{ infoLabel() }}</span>\n </span>\n </div>\n\n <ng-content />\n\n @if (removable()) {\n <button\n type=\"button\"\n class=\"ui-file-upload-list-remove\"\n [attr.aria-label]=\"removeAriaLabel() + ' : ' + file().name\"\n (click)=\"onRemove()\"\n >\n <ui-icon name=\"trash\" [size]=\"iconSize()\" />\n </button>\n }\n\n @if (isUploading()) {\n <div\n class=\"ui-file-upload-list-progress\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"file().progress\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-label]=\"progressAriaLabel()\"\n >\n <span class=\"ui-file-upload-list-progress-bar\" [style.width.%]=\"file().progress\"></span>\n </div>\n }\n</div>\n",
183
+ styles: [".ui-file-upload-list{position:relative;display:flex;align-items:center;box-sizing:border-box;width:100%;overflow:hidden;background-color:var(--ui-file-upload-list-surface, var(--form-high-surface-default));border:var(--ui-file-upload-item-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-file-upload-list-stroke, var(--form-high-stroke-default));color:var(--ui-file-upload-list-color, var(--form-high-content-default));border-radius:var(--ui-file-upload-item-radius, var(--radius-lg));padding:var(--ui-file-upload-item-padding-y, var(--units-md)) var(--ui-file-upload-item-padding-x, var(--units-default));gap:var(--ui-file-upload-item-gap, var(--units-md))}.ui-file-upload-list .ui-file-upload-list-media{width:var(--ui-file-upload-item-media-size, 2.5rem);height:var(--ui-file-upload-item-media-size, 2.5rem)}.ui-file-upload-list .ui-file-upload-list-name{font-size:var(--ui-file-upload-item-name-font-size, var(--size-typography-title-sm))}.ui-file-upload-list .ui-file-upload-list-meta{font-size:var(--ui-file-upload-item-meta-font-size, var(--size-typography-text-sm))}.ui-file-upload-list._small{border-radius:var(--ui-file-upload-item-radius-small, var(--radius-md));padding:var(--ui-file-upload-item-padding-y-small, var(--units-sm)) var(--ui-file-upload-item-padding-x-small, var(--units-md));gap:var(--ui-file-upload-item-gap-small, var(--units-sm))}.ui-file-upload-list._small .ui-file-upload-list-media{width:var(--ui-file-upload-item-media-size-small, 2rem);height:var(--ui-file-upload-item-media-size-small, 2rem)}.ui-file-upload-list._small .ui-file-upload-list-name{font-size:var(--ui-file-upload-item-name-font-size-small, var(--size-typography-text-md))}.ui-file-upload-list._small .ui-file-upload-list-meta{font-size:var(--ui-file-upload-item-meta-font-size-small, var(--size-typography-text-sm))}.ui-file-upload-list-file{display:flex;align-items:center;gap:var(--ui-file-upload-item-media-gap, var(--units-sm));min-width:0;flex:1 1 auto}.ui-file-upload-list-media{display:inline-flex;align-items:center;justify-content:center;flex:none;line-height:0;color:var(--ui-file-upload-list-color, var(--form-high-content-default))}.ui-file-upload-list-thumb{width:100%;height:100%;object-fit:cover;border-radius:var(--ui-file-upload-item-thumb-radius, var(--radius-sm))}.ui-file-upload-list-infos{display:flex;flex-direction:column;gap:var(--ui-file-upload-item-infos-gap, var(--units-2xs));min-width:0}.ui-file-upload-list-name{font-family:var(--ui-file-upload-font-family, var(--fontfamily-base));font-weight:var(--ui-file-upload-name-weight, var(--weight-bold));line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-file-upload-list-meta{font-family:var(--ui-file-upload-font-family, var(--fontfamily-base));font-weight:var(--ui-file-upload-meta-weight, var(--weight-light));line-height:1.2;color:var(--ui-file-upload-list-color, var(--form-high-content-default))}.ui-file-upload-list-name._button{align-self:flex-start;max-width:100%;padding:0;background:none;border:none;border-radius:var(--ui-file-upload-item-name-radius, var(--radius-xs));color:var(--ui-file-upload-list-name-color, var(--actions-low-content-default));text-align:start;text-decoration:underline;cursor:pointer;transition:color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-file-upload-list-name._button:hover{color:var(--ui-file-upload-list-name-color-hover, var(--actions-low-content-hover))}.ui-file-upload-list-name._button:focus-visible{outline:none;box-shadow:0 0 0 var(--ui-file-upload-item-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-file-upload-list-name-focus-ring-color, var(--form-high-stroke-focused))}.ui-file-upload-list-remove{display:inline-flex;align-items:center;justify-content:center;flex:none;padding:var(--ui-file-upload-item-remove-padding, var(--units-2xs));background:transparent;border:none;border-radius:var(--ui-file-upload-item-remove-radius, var(--radius-sm));color:var(--ui-file-upload-list-remove-color, var(--form-high-content-default));cursor:pointer;line-height:0;transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-file-upload-list-remove:hover{color:var(--ui-file-upload-list-remove-color-hover, var(--global-text-default))}.ui-file-upload-list-remove:focus-visible{outline:none;box-shadow:0 0 0 var(--ui-file-upload-item-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-file-upload-list-remove-focus-ring-color, var(--form-high-stroke-focused))}.ui-file-upload-list-progress{position:absolute;left:0;right:0;bottom:0;height:var(--ui-file-upload-item-progress-height, var(--stroke-default));background-color:var(--ui-file-upload-list-progress-surface, var(--form-high-surface-hover))}.ui-file-upload-list-progress-bar{display:block;height:100%;background-color:var(--ui-file-upload-item-progress-color, var(--global-text-default));transition:width var(--ui-control-transition-duration, var(--motion-toggle-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-toggle-easing, var(--transition-easeinout)))}.ui-file-upload-list._error{border-color:var(--ui-file-upload-list-stroke-error, var(--informative-errorhigh-stroke-default))}.ui-file-upload-list._error .ui-file-upload-list-media,.ui-file-upload-list._error .ui-file-upload-list-meta{color:var(--ui-file-upload-list-color-error, var(--form-error-content-default))}\n"],
184
+ dependencies: [{
185
+ kind: "component",
186
+ type: UiIcon,
187
+ selector: "ui-icon",
188
+ inputs: [
189
+ "name",
190
+ "size",
191
+ "type",
192
+ "family",
193
+ "decorative",
194
+ "ariaLabel"
195
+ ]
196
+ }, {
197
+ kind: "component",
198
+ type: UiSpinner,
199
+ selector: "ui-spinner",
200
+ inputs: [
201
+ "size",
202
+ "orientation",
203
+ "label",
204
+ "ariaLabel",
205
+ "spinnerTemplate",
206
+ "image",
207
+ "imageAlt",
208
+ "icon",
209
+ "strokeWidth",
210
+ "fill",
211
+ "animationDuration",
212
+ "delay"
213
+ ]
214
+ }]
215
+ });
216
+ }
217
+ };
218
+ i0.ɵɵngDeclareClassMetadata({
219
+ minVersion: "12.0.0",
220
+ version: "22.3.0",
221
+ ngImport: i0,
222
+ type: UiFileUploadList,
223
+ decorators: [{
224
+ type: Component,
225
+ args: [{
226
+ selector: "ui-file-upload-list",
227
+ imports: [UiIcon, UiSpinner],
228
+ template: "<div [class]=\"classes()\">\n <div class=\"ui-file-upload-list-file\">\n <span class=\"ui-file-upload-list-media\">\n @if (isUploading()) {\n <ui-spinner size=\"small\" [ariaLabel]=\"uploadingAriaLabel()\" />\n } @else if (thumbnail(); as src) {\n <img class=\"ui-file-upload-list-thumb\" [src]=\"src\" alt=\"\" />\n } @else {\n <ui-icon [name]=\"isError() ? 'triangle-exclamation' : icon()\" [size]=\"iconSize()\" />\n }\n </span>\n\n <span class=\"ui-file-upload-list-infos\">\n @if (openable()) {\n <button\n type=\"button\"\n class=\"ui-file-upload-list-name _button\"\n [title]=\"file().name\"\n [attr.aria-label]=\"openAriaLabel() || null\"\n (click)=\"onOpen()\"\n >\n {{ file().name }}\n </button>\n } @else {\n <span class=\"ui-file-upload-list-name\" [title]=\"file().name\">{{ file().name }}</span>\n }\n <span class=\"ui-file-upload-list-meta\">{{ infoLabel() }}</span>\n </span>\n </div>\n\n <ng-content />\n\n @if (removable()) {\n <button\n type=\"button\"\n class=\"ui-file-upload-list-remove\"\n [attr.aria-label]=\"removeAriaLabel() + ' : ' + file().name\"\n (click)=\"onRemove()\"\n >\n <ui-icon name=\"trash\" [size]=\"iconSize()\" />\n </button>\n }\n\n @if (isUploading()) {\n <div\n class=\"ui-file-upload-list-progress\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"file().progress\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-label]=\"progressAriaLabel()\"\n >\n <span class=\"ui-file-upload-list-progress-bar\" [style.width.%]=\"file().progress\"></span>\n </div>\n }\n</div>\n",
229
+ styles: [".ui-file-upload-list{position:relative;display:flex;align-items:center;box-sizing:border-box;width:100%;overflow:hidden;background-color:var(--ui-file-upload-list-surface, var(--form-high-surface-default));border:var(--ui-file-upload-item-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-file-upload-list-stroke, var(--form-high-stroke-default));color:var(--ui-file-upload-list-color, var(--form-high-content-default));border-radius:var(--ui-file-upload-item-radius, var(--radius-lg));padding:var(--ui-file-upload-item-padding-y, var(--units-md)) var(--ui-file-upload-item-padding-x, var(--units-default));gap:var(--ui-file-upload-item-gap, var(--units-md))}.ui-file-upload-list .ui-file-upload-list-media{width:var(--ui-file-upload-item-media-size, 2.5rem);height:var(--ui-file-upload-item-media-size, 2.5rem)}.ui-file-upload-list .ui-file-upload-list-name{font-size:var(--ui-file-upload-item-name-font-size, var(--size-typography-title-sm))}.ui-file-upload-list .ui-file-upload-list-meta{font-size:var(--ui-file-upload-item-meta-font-size, var(--size-typography-text-sm))}.ui-file-upload-list._small{border-radius:var(--ui-file-upload-item-radius-small, var(--radius-md));padding:var(--ui-file-upload-item-padding-y-small, var(--units-sm)) var(--ui-file-upload-item-padding-x-small, var(--units-md));gap:var(--ui-file-upload-item-gap-small, var(--units-sm))}.ui-file-upload-list._small .ui-file-upload-list-media{width:var(--ui-file-upload-item-media-size-small, 2rem);height:var(--ui-file-upload-item-media-size-small, 2rem)}.ui-file-upload-list._small .ui-file-upload-list-name{font-size:var(--ui-file-upload-item-name-font-size-small, var(--size-typography-text-md))}.ui-file-upload-list._small .ui-file-upload-list-meta{font-size:var(--ui-file-upload-item-meta-font-size-small, var(--size-typography-text-sm))}.ui-file-upload-list-file{display:flex;align-items:center;gap:var(--ui-file-upload-item-media-gap, var(--units-sm));min-width:0;flex:1 1 auto}.ui-file-upload-list-media{display:inline-flex;align-items:center;justify-content:center;flex:none;line-height:0;color:var(--ui-file-upload-list-color, var(--form-high-content-default))}.ui-file-upload-list-thumb{width:100%;height:100%;object-fit:cover;border-radius:var(--ui-file-upload-item-thumb-radius, var(--radius-sm))}.ui-file-upload-list-infos{display:flex;flex-direction:column;gap:var(--ui-file-upload-item-infos-gap, var(--units-2xs));min-width:0}.ui-file-upload-list-name{font-family:var(--ui-file-upload-font-family, var(--fontfamily-base));font-weight:var(--ui-file-upload-name-weight, var(--weight-bold));line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-file-upload-list-meta{font-family:var(--ui-file-upload-font-family, var(--fontfamily-base));font-weight:var(--ui-file-upload-meta-weight, var(--weight-light));line-height:1.2;color:var(--ui-file-upload-list-color, var(--form-high-content-default))}.ui-file-upload-list-name._button{align-self:flex-start;max-width:100%;padding:0;background:none;border:none;border-radius:var(--ui-file-upload-item-name-radius, var(--radius-xs));color:var(--ui-file-upload-list-name-color, var(--actions-low-content-default));text-align:start;text-decoration:underline;cursor:pointer;transition:color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-file-upload-list-name._button:hover{color:var(--ui-file-upload-list-name-color-hover, var(--actions-low-content-hover))}.ui-file-upload-list-name._button:focus-visible{outline:none;box-shadow:0 0 0 var(--ui-file-upload-item-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-file-upload-list-name-focus-ring-color, var(--form-high-stroke-focused))}.ui-file-upload-list-remove{display:inline-flex;align-items:center;justify-content:center;flex:none;padding:var(--ui-file-upload-item-remove-padding, var(--units-2xs));background:transparent;border:none;border-radius:var(--ui-file-upload-item-remove-radius, var(--radius-sm));color:var(--ui-file-upload-list-remove-color, var(--form-high-content-default));cursor:pointer;line-height:0;transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-file-upload-list-remove:hover{color:var(--ui-file-upload-list-remove-color-hover, var(--global-text-default))}.ui-file-upload-list-remove:focus-visible{outline:none;box-shadow:0 0 0 var(--ui-file-upload-item-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-file-upload-list-remove-focus-ring-color, var(--form-high-stroke-focused))}.ui-file-upload-list-progress{position:absolute;left:0;right:0;bottom:0;height:var(--ui-file-upload-item-progress-height, var(--stroke-default));background-color:var(--ui-file-upload-list-progress-surface, var(--form-high-surface-hover))}.ui-file-upload-list-progress-bar{display:block;height:100%;background-color:var(--ui-file-upload-item-progress-color, var(--global-text-default));transition:width var(--ui-control-transition-duration, var(--motion-toggle-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-toggle-easing, var(--transition-easeinout)))}.ui-file-upload-list._error{border-color:var(--ui-file-upload-list-stroke-error, var(--informative-errorhigh-stroke-default))}.ui-file-upload-list._error .ui-file-upload-list-media,.ui-file-upload-list._error .ui-file-upload-list-meta{color:var(--ui-file-upload-list-color-error, var(--form-error-content-default))}\n"]
230
+ }]
231
+ }],
232
+ propDecorators: {
233
+ file: [{
234
+ type: i0.Input,
235
+ args: [{
236
+ isSignal: true,
237
+ alias: "file",
238
+ required: true
239
+ }]
240
+ }],
241
+ size: [{
242
+ type: i0.Input,
243
+ args: [{
244
+ isSignal: true,
245
+ alias: "size",
246
+ required: false
247
+ }]
248
+ }],
249
+ icon: [{
250
+ type: i0.Input,
251
+ args: [{
252
+ isSignal: true,
253
+ alias: "icon",
254
+ required: false
255
+ }]
256
+ }],
257
+ removable: [{
258
+ type: i0.Input,
259
+ args: [{
260
+ isSignal: true,
261
+ alias: "removable",
262
+ required: false
263
+ }]
264
+ }],
265
+ openable: [{
266
+ type: i0.Input,
267
+ args: [{
268
+ isSignal: true,
269
+ alias: "openable",
270
+ required: false
271
+ }]
272
+ }],
273
+ openLabel: [{
274
+ type: i0.Input,
275
+ args: [{
276
+ isSignal: true,
277
+ alias: "openLabel",
278
+ required: false
279
+ }]
280
+ }],
281
+ removeAriaLabel: [{
282
+ type: i0.Input,
283
+ args: [{
284
+ isSignal: true,
285
+ alias: "removeAriaLabel",
286
+ required: false
287
+ }]
288
+ }],
289
+ failedLabel: [{
290
+ type: i0.Input,
291
+ args: [{
292
+ isSignal: true,
293
+ alias: "failedLabel",
294
+ required: false
295
+ }]
296
+ }],
297
+ uploadingLabel: [{
298
+ type: i0.Input,
299
+ args: [{
300
+ isSignal: true,
301
+ alias: "uploadingLabel",
302
+ required: false
303
+ }]
304
+ }],
305
+ progressLabel: [{
306
+ type: i0.Input,
307
+ args: [{
308
+ isSignal: true,
309
+ alias: "progressLabel",
310
+ required: false
311
+ }]
312
+ }],
313
+ remove: [{
314
+ type: i0.Output,
315
+ args: ["remove"]
316
+ }],
317
+ open: [{
318
+ type: i0.Output,
319
+ args: ["open"]
320
+ }]
321
+ }
322
+ });
143
323
  let nextUploadId = 0;
144
324
  let nextInstanceId = 0;
145
- /**
146
- * ui-file-upload — headless file uploader (field + drag-and-drop).
147
- *
148
- * A native `<input type="file">` (visually hidden) drives selection, so the OS
149
- * picker, keyboard and screen readers work natively; the whole component is also
150
- * a drop target. Selection is validated client-side (type / size / count) and
151
- * files can be uploaded automatically (`auto`), on demand, or via a custom
152
- * handler (`customUpload`). Progress is tracked with `XMLHttpRequest` so no
153
- * global HTTP provider is required.
154
- *
155
- * Security notes: client-side validation is a UX convenience — always re-validate
156
- * server-side. Image previews use object URLs that are revoked on removal/clear.
157
- */
158
- class UiFileUpload {
159
- constructor() {
160
- // --- Layout ----------------------------------------------------------
161
- /** `field` = compact input + Browse button; `drag` = full drop zone. */
162
- this.mode = input('field', /* @ts-ignore */
163
- ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
164
- /** Size of the control, its buttons and its file list. */
165
- this.size = input('default', /* @ts-ignore */
166
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
167
- // --- Selection -------------------------------------------------------
168
- /** Native `name`: a surrounding `<form>` submits the current selection under it. */
169
- this.name = input(/* @ts-ignore */
170
- ...(ngDevMode ? [undefined, { debugName: "name" }] : /* istanbul ignore next */ []));
171
- /** Allow selecting more than one file. */
172
- this.multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
173
- /** Ripple Effect */
174
- this.ripple = input(true, { ...(ngDevMode ? { debugName: "ripple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
175
- /** Native `accept` filter, e.g. "image/*,.pdf". Also enforced on drop. */
176
- this.accept = input(/* @ts-ignore */
177
- ...(ngDevMode ? [undefined, { debugName: "accept" }] : /* istanbul ignore next */ []));
178
- /** Max size per file, in bytes. */
179
- this.maxFileSize = input(undefined, { ...(ngDevMode ? { debugName: "maxFileSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
180
- /** Max number of files kept at once. */
181
- this.fileLimit = input(undefined, { ...(ngDevMode ? { debugName: "fileLimit" } : /* istanbul ignore next */ {}), transform: numberAttribute });
182
- /** Disables selection, drop and upload. */
183
- this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
184
- // --- Upload behaviour ------------------------------------------------
185
- /** Upload each file as soon as it is selected. */
186
- this.auto = input(false, { ...(ngDevMode ? { debugName: "auto" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
187
- /** Delegate uploading to the `uploadHandler` output instead of the built-in XHR. */
188
- this.customUpload = input(false, { ...(ngDevMode ? { debugName: "customUpload" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
189
- /** Endpoint for the built-in uploader. */
190
- this.url = input(/* @ts-ignore */
191
- ...(ngDevMode ? [undefined, { debugName: "url" }] : /* istanbul ignore next */ []));
192
- /** HTTP method for the built-in uploader. */
193
- this.method = input('post', /* @ts-ignore */
194
- ...(ngDevMode ? [{ debugName: "method" }] : /* istanbul ignore next */ []));
195
- /** Field name used for each file in the multipart body. */
196
- this.fieldName = input('files', /* @ts-ignore */
197
- ...(ngDevMode ? [{ debugName: "fieldName" }] : /* istanbul ignore next */ []));
198
- /** Send credentials (cookies) with the built-in upload request. */
199
- this.withCredentials = input(false, { ...(ngDevMode ? { debugName: "withCredentials" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
200
- // --- Presentation / labels ------------------------------------------
201
- /** Show the file list under the control. */
202
- this.showFileList = input(true, { ...(ngDevMode ? { debugName: "showFileList" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
203
- /** Show the Upload/Cancel toolbar buttons (drag mode). */
204
- this.showControls = input(true, { ...(ngDevMode ? { debugName: "showControls" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
205
- /** Label of the Browse button. */
206
- this.browseLabel = input('Parcourir', /* @ts-ignore */
207
- ...(ngDevMode ? [{ debugName: "browseLabel" }] : /* istanbul ignore next */ []));
208
- /** Placeholder shown in field mode before any selection. */
209
- this.chooseLabel = input('Choisir un fichier…', /* @ts-ignore */
210
- ...(ngDevMode ? [{ debugName: "chooseLabel" }] : /* istanbul ignore next */ []));
211
- /** Label of the Upload toolbar button (drag mode). */
212
- this.uploadLabel = input('Téléverser', /* @ts-ignore */
213
- ...(ngDevMode ? [{ debugName: "uploadLabel" }] : /* istanbul ignore next */ []));
214
- /** Label of the toolbar button that clears the selection (drag mode). */
215
- this.cancelLabel = input('Effacer', /* @ts-ignore */
216
- ...(ngDevMode ? [{ debugName: "cancelLabel" }] : /* istanbul ignore next */ []));
217
- /** Drag-zone link + prompt. */
218
- this.dragLinkLabel = input('Cliquer pour téléverser', /* @ts-ignore */
219
- ...(ngDevMode ? [{ debugName: "dragLinkLabel" }] : /* istanbul ignore next */ []));
220
- /** Text after the drag-zone link (drag mode). */
221
- this.dragPromptLabel = input('ou glisser-déposer les fichiers ici', /* @ts-ignore */
222
- ...(ngDevMode ? [{ debugName: "dragPromptLabel" }] : /* istanbul ignore next */ []));
223
- /** Small hint under the drag prompt (e.g. "JPG, PNG (max 5 MB)"). */
224
- this.hint = input(/* @ts-ignore */
225
- ...(ngDevMode ? [undefined, { debugName: "hint" }] : /* istanbul ignore next */ []));
226
- /** Accessible name for the whole control. */
227
- // Composite widget (dropzone + file list), not a single-value CVA control: unlike the other
228
- // form components it doesn't extend BaseFieldControl, so it redeclares its own `ariaLabel`
229
- // here — with a non-undefined default, since the dropzone always needs an accessible name.
230
- this.ariaLabel = input('Téléversement de fichiers', /* @ts-ignore */
231
- ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
232
- /** Multi-file summary in field mode — `{0}` is replaced by the file count. */
233
- this.filesSummaryLabel = input('{0} fichiers', /* @ts-ignore */
234
- ...(ngDevMode ? [{ debugName: "filesSummaryLabel" }] : /* istanbul ignore next */ []));
235
- /** Rejection message: file type not accepted — `{0}` is the file name. */
236
- this.invalidTypeMessage = input('Type de fichier non autorisé : {0}', /* @ts-ignore */
237
- ...(ngDevMode ? [{ debugName: "invalidTypeMessage" }] : /* istanbul ignore next */ []));
238
- /** Rejection message: file too large — `{0}` is the file name. */
239
- this.invalidSizeMessage = input('Fichier trop volumineux : {0}', /* @ts-ignore */
240
- ...(ngDevMode ? [{ debugName: "invalidSizeMessage" }] : /* istanbul ignore next */ []));
241
- /** Rejection message: `fileLimit` reached — `{0}` is the limit. */
242
- this.limitReachedMessage = input('Nombre maximum de fichiers atteint ({0}).', /* @ts-ignore */
243
- ...(ngDevMode ? [{ debugName: "limitReachedMessage" }] : /* istanbul ignore next */ []));
244
- /** Error shown when an upload fails without a server message. */
245
- this.uploadErrorMessage = input('Échec du téléversement', /* @ts-ignore */
246
- ...(ngDevMode ? [{ debugName: "uploadErrorMessage" }] : /* istanbul ignore next */ []));
247
- /** Error shown when the upload request fails at the network level. */
248
- this.networkErrorMessage = input('Erreur réseau', /* @ts-ignore */
249
- ...(ngDevMode ? [{ debugName: "networkErrorMessage" }] : /* istanbul ignore next */ []));
250
- /** Error shown on a non-2xx response — `{0}` is the HTTP status. */
251
- this.httpErrorMessage = input('Erreur {0}', /* @ts-ignore */
252
- ...(ngDevMode ? [{ debugName: "httpErrorMessage" }] : /* istanbul ignore next */ []));
253
- // --- Templates (drag/advanced) --------------------------------------
254
- /** Overrides a single file row (context: `{ $implicit: UiUploadFile, remove }`). */
255
- this.fileTemplate = input(/* @ts-ignore */
256
- ...(ngDevMode ? [undefined, { debugName: "fileTemplate" }] : /* istanbul ignore next */ []));
257
- /** Overrides the content section (context: `{ $implicit: UiUploadFile[], remove, clear }`). */
258
- this.contentTemplate = input(/* @ts-ignore */
259
- ...(ngDevMode ? [undefined, { debugName: "contentTemplate" }] : /* istanbul ignore next */ []));
260
- /** Custom toolbar content (context: `{ $implicit: UiUploadFile[], choose, upload, clear }`). */
261
- this.toolbarTemplate = input(/* @ts-ignore */
262
- ...(ngDevMode ? [undefined, { debugName: "toolbarTemplate" }] : /* istanbul ignore next */ []));
263
- // --- Outputs ---------------------------------------------------------
264
- /** Files added to the selection (validated). */
265
- this.selected = output();
266
- /** The full current selection changed. */
267
- this.filesChange = output();
268
- /** A custom upload was requested (customUpload = true). */
269
- this.uploadHandler = output();
270
- /** Built-in upload completed for a batch. */
271
- this.uploaded = output();
272
- /** A file failed validation or upload. */
273
- this.uploadError = output();
274
- /** A file was removed. */
275
- this.removed = output();
276
- /** The selection was cleared. */
277
- this.cleared = output();
278
- /** @ignore Stable id linking the visible label(s) to the native input. */
279
- this.inputId = `ui-file-upload-${nextInstanceId++}`;
280
- this.host = inject((ElementRef));
281
- this.destroyRef = inject(DestroyRef);
282
- this.fileInput = viewChild.required('fileInput', /* @ts-ignore */
283
- ...(ngDevMode ? [{ debugName: "fileInput" }] : /* istanbul ignore next */ []));
284
- this.formValueInput = viewChild('formValue', /* @ts-ignore */
285
- ...(ngDevMode ? [{ debugName: "formValueInput" }] : /* istanbul ignore next */ []));
286
- /** In-flight requests, keyed by file id, so we can abort. */
287
- this.requests = new Map();
288
- /** @ignore Current selection. */
289
- this.selection = signal([], /* @ts-ignore */
290
- ...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
291
- /** Read-only view of the current files. */
292
- this.files = this.selection.asReadonly();
293
- /** @ignore Drop-zone highlight while dragging over. */
294
- this.dragging = signal(false, /* @ts-ignore */
295
- ...(ngDevMode ? [{ debugName: "dragging" }] : /* istanbul ignore next */ []));
296
- /** @ignore Transient validation messages (rendered in a live region). */
297
- this.messages = signal([], /* @ts-ignore */
298
- ...(ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []));
299
- /** @ignore */
300
- this.hasFiles = computed(() => this.selection().length > 0, /* @ts-ignore */
301
- ...(ngDevMode ? [{ debugName: "hasFiles" }] : /* istanbul ignore next */ []));
302
- /** @ignore */
303
- this.pending = computed(() => this.selection().filter((f) => f.status === 'pending'), /* @ts-ignore */
304
- ...(ngDevMode ? [{ debugName: "pending" }] : /* istanbul ignore next */ []));
305
- /** @ignore Single-file summary shown in field mode. */
306
- this.fieldSummary = computed(() => {
307
- const files = this.selection();
308
- if (!files.length)
309
- return this.chooseLabel();
310
- if (files.length === 1)
311
- return files[0].name;
312
- return formatLabel(this.filesSummaryLabel(), files.length);
313
- }, /* @ts-ignore */
314
- ...(ngDevMode ? [{ debugName: "fieldSummary" }] : /* istanbul ignore next */ []));
315
- /** @ignore */
316
- this.canUpload = computed(() => !this.disabled() && this.pending().length > 0 && (this.customUpload() || !!this.url()), /* @ts-ignore */
317
- ...(ngDevMode ? [{ debugName: "canUpload" }] : /* istanbul ignore next */ []));
318
- /** @ignore */
319
- this.classes = computed(() => {
320
- const c = ['ui-file-upload', `_${this.mode()}`];
321
- if (this.size() !== 'default')
322
- c.push(`_${this.size()}`);
323
- if (this.dragging())
324
- c.push('_dragging');
325
- if (this.disabled())
326
- c.push('_disabled');
327
- return c.join(' ');
328
- }, /* @ts-ignore */
329
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
330
- // --- Bound refs for custom templates (stable identities) -------------
331
- /** @ignore */ this.removeFn = (f) => this.remove(f);
332
- /** @ignore */ this.clearFn = () => this.clear();
333
- /** @ignore */ this.chooseFn = () => this.choose();
334
- /** @ignore */ this.uploadFn = () => this.upload();
335
- // Revoke every object URL when the component is destroyed (no leaks).
336
- this.destroyRef.onDestroy(() => {
337
- for (const f of this.selection())
338
- this.revoke(f);
339
- for (const xhr of this.requests.values())
340
- xhr.abort();
341
- });
342
- // The picker is emptied after each choice: the hidden field carries the selection.
343
- effect(() => {
344
- const el = this.formValueInput()?.nativeElement;
345
- const files = this.selection();
346
- if (!el || typeof DataTransfer === 'undefined')
347
- return;
348
- const data = new DataTransfer();
349
- for (const f of files)
350
- data.items.add(f.file);
351
- el.files = data.files;
352
- });
353
- // A11y safeguard: the control needs an accessible name.
354
- if (isDevMode()) {
355
- effect(() => {
356
- if (!this.ariaLabel()) {
357
- console.warn('[ui-file-upload] Provide `ariaLabel` to name the control.');
358
- }
359
- });
360
- }
361
- }
362
- // --- Public API ------------------------------------------------------
363
- /** Opens the native file picker. */
364
- choose() {
365
- if (this.disabled())
366
- return;
367
- this.fileInput().nativeElement.click();
368
- }
369
- /** Uploads all pending files (built-in XHR, or emits `uploadHandler`). */
370
- upload() {
371
- const pending = this.pending();
372
- if (!pending.length)
373
- return;
374
- if (this.customUpload()) {
375
- this.emitCustomUpload(pending);
376
- return;
377
- }
378
- const endpoint = this.url();
379
- if (!endpoint)
380
- return;
381
- for (const f of pending)
382
- this.xhrUpload(f, endpoint);
383
- }
384
- /** Removes a file (aborts its upload, revokes its preview). */
385
- remove(target) {
386
- this.requests.get(target.id)?.abort();
387
- this.requests.delete(target.id);
388
- this.revoke(target);
389
- this.selection.update((files) => files.filter((f) => f.id !== target.id));
390
- this.removed.emit(target);
391
- this.filesChange.emit(this.selection());
392
- }
393
- /** Clears the whole selection. */
394
- clear() {
395
- for (const xhr of this.requests.values())
396
- xhr.abort();
397
- this.requests.clear();
398
- for (const f of this.selection())
399
- this.revoke(f);
400
- this.selection.set([]);
401
- this.messages.set([]);
402
- this.resetInput();
403
- this.cleared.emit();
404
- this.filesChange.emit([]);
405
- }
406
- // --- Native input / drop --------------------------------------------
407
- /** @ignore */
408
- onInputChange(event) {
409
- const input = event.target;
410
- this.ingest(input.files);
411
- // Reset so selecting the same file again re-triggers `change`.
412
- this.resetInput();
413
- }
414
- /** @ignore */
415
- onDragOver(event) {
416
- if (this.disabled())
417
- return;
418
- event.preventDefault();
419
- event.stopPropagation();
420
- this.dragging.set(true);
421
- }
422
- /** @ignore */
423
- onDragLeave(event) {
424
- if (this.disabled())
425
- return;
426
- event.preventDefault();
427
- // Ignore leave events bubbling from children still inside the zone.
428
- if (this.host.nativeElement.contains(event.relatedTarget))
429
- return;
430
- this.dragging.set(false);
431
- }
432
- /** @ignore */
433
- onDrop(event) {
434
- if (this.disabled())
435
- return;
436
- event.preventDefault();
437
- event.stopPropagation();
438
- this.dragging.set(false);
439
- this.ingest(event.dataTransfer?.files ?? null);
440
- }
441
- // --- Internals -------------------------------------------------------
442
- /** Validate + add a FileList to the selection. */
443
- ingest(list) {
444
- if (!list || !list.length || this.disabled())
445
- return;
446
- const incoming = Array.from(list);
447
- const added = [];
448
- const newMessages = [];
449
- const limit = this.fileLimit();
450
- const maxSize = this.maxFileSize();
451
- for (const file of incoming) {
452
- // Single-file mode: the new file replaces the current one, so only cap the incoming batch.
453
- if (!this.multiple() && added.length >= 1)
454
- break;
455
- const item = this.toUploadFile(file);
456
- if (!isFileTypeAccepted(file, this.accept())) {
457
- this.fail(item, 'type', formatLabel(this.invalidTypeMessage(), file.name), newMessages);
458
- continue;
459
- }
460
- if (maxSize != null && file.size > maxSize) {
461
- this.fail(item, 'size', formatLabel(this.invalidSizeMessage(), file.name), newMessages);
462
- continue;
463
- }
464
- if (limit != null &&
465
- (this.multiple() ? this.selection().length : 0) + added.length >= limit) {
466
- this.fail(item, 'limit', formatLabel(this.limitReachedMessage(), limit), newMessages);
467
- continue;
468
- }
469
- added.push(item);
470
- }
471
- this.messages.set(newMessages);
472
- if (!added.length)
473
- return;
474
- if (!this.multiple()) {
475
- // Replacement: release resources held by the previous selection.
476
- for (const previous of this.selection()) {
477
- this.requests.get(previous.id)?.abort();
478
- this.requests.delete(previous.id);
479
- this.revoke(previous);
480
- }
481
- }
482
- this.selection.update((files) => (this.multiple() ? [...files, ...added] : added));
483
- this.selected.emit(added);
484
- this.filesChange.emit(this.selection());
485
- if (this.auto())
486
- this.upload();
487
- }
488
- toUploadFile(file) {
489
- return {
490
- id: `uifu-${nextUploadId++}`,
491
- file,
492
- name: file.name,
493
- size: file.size,
494
- type: file.type,
495
- status: 'pending',
496
- progress: 0,
497
- objectUrl: isImageFile(file) ? URL.createObjectURL(file) : undefined,
498
- };
499
- }
500
- fail(item, reason, message, sink) {
501
- this.revoke(item);
502
- sink.push(message);
503
- this.uploadError.emit({ file: { ...item, status: 'error', error: message }, reason, message });
504
- }
505
- /** Mutates one file in place (immutably) and pushes a new array reference. */
506
- patch(id, changes) {
507
- this.selection.update((files) => files.map((f) => (f.id === id ? { ...f, ...changes } : f)));
508
- }
509
- emitCustomUpload(pending) {
510
- for (const f of pending)
511
- this.patch(f.id, { status: 'uploading', progress: 0 });
512
- this.uploadHandler.emit({
513
- files: pending,
514
- setProgress: (file, progress) => this.patch(file.id, {
515
- status: 'uploading',
516
- progress: Math.max(0, Math.min(100, progress)),
517
- }),
518
- markUploaded: (file) => {
519
- this.patch(file.id, { status: 'completed', progress: 100 });
520
- this.filesChange.emit(this.selection());
521
- },
522
- markError: (file, msg) => {
523
- this.patch(file.id, { status: 'error', error: msg ?? this.uploadErrorMessage() });
524
- this.uploadError.emit({
525
- file,
526
- reason: 'upload',
527
- message: msg ?? this.uploadErrorMessage(),
528
- });
529
- },
530
- });
531
- }
532
- xhrUpload(item, endpoint) {
533
- const xhr = new XMLHttpRequest();
534
- this.requests.set(item.id, xhr);
535
- this.patch(item.id, { status: 'uploading', progress: 0 });
536
- const body = new FormData();
537
- body.append(this.fieldName(), item.file, item.name);
538
- xhr.upload.addEventListener('progress', (e) => {
539
- if (e.lengthComputable)
540
- this.patch(item.id, { progress: Math.round((e.loaded / e.total) * 100) });
541
- });
542
- xhr.addEventListener('load', () => {
543
- this.requests.delete(item.id);
544
- if (xhr.status >= 200 && xhr.status < 300) {
545
- this.patch(item.id, { status: 'completed', progress: 100 });
546
- this.uploaded.emit({ files: [item], xhr });
547
- this.filesChange.emit(this.selection());
548
- }
549
- else {
550
- this.uploadFailed(item, formatLabel(this.httpErrorMessage(), xhr.status));
551
- }
552
- });
553
- xhr.addEventListener('error', () => this.uploadFailed(item, this.networkErrorMessage()));
554
- xhr.addEventListener('abort', () => this.requests.delete(item.id));
555
- xhr.open(this.method().toUpperCase(), endpoint, true);
556
- xhr.withCredentials = this.withCredentials();
557
- xhr.send(body);
558
- }
559
- uploadFailed(item, message) {
560
- this.requests.delete(item.id);
561
- this.patch(item.id, { status: 'error', error: message });
562
- this.uploadError.emit({ file: item, reason: 'upload', message });
563
- }
564
- revoke(file) {
565
- if (file.objectUrl)
566
- URL.revokeObjectURL(file.objectUrl);
567
- }
568
- resetInput() {
569
- const el = this.fileInput().nativeElement;
570
- if (el)
571
- el.value = '';
572
- }
573
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiFileUpload, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
574
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: UiFileUpload, isStandalone: true, selector: "ui-file-upload", inputs: { mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, ripple: { classPropertyName: "ripple", publicName: "ripple", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, maxFileSize: { classPropertyName: "maxFileSize", publicName: "maxFileSize", isSignal: true, isRequired: false, transformFunction: null }, fileLimit: { classPropertyName: "fileLimit", publicName: "fileLimit", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, auto: { classPropertyName: "auto", publicName: "auto", isSignal: true, isRequired: false, transformFunction: null }, customUpload: { classPropertyName: "customUpload", publicName: "customUpload", isSignal: true, isRequired: false, transformFunction: null }, url: { classPropertyName: "url", publicName: "url", isSignal: true, isRequired: false, transformFunction: null }, method: { classPropertyName: "method", publicName: "method", isSignal: true, isRequired: false, transformFunction: null }, fieldName: { classPropertyName: "fieldName", publicName: "fieldName", isSignal: true, isRequired: false, transformFunction: null }, withCredentials: { classPropertyName: "withCredentials", publicName: "withCredentials", isSignal: true, isRequired: false, transformFunction: null }, showFileList: { classPropertyName: "showFileList", publicName: "showFileList", isSignal: true, isRequired: false, transformFunction: null }, showControls: { classPropertyName: "showControls", publicName: "showControls", isSignal: true, isRequired: false, transformFunction: null }, browseLabel: { classPropertyName: "browseLabel", publicName: "browseLabel", isSignal: true, isRequired: false, transformFunction: null }, chooseLabel: { classPropertyName: "chooseLabel", publicName: "chooseLabel", isSignal: true, isRequired: false, transformFunction: null }, uploadLabel: { classPropertyName: "uploadLabel", publicName: "uploadLabel", isSignal: true, isRequired: false, transformFunction: null }, cancelLabel: { classPropertyName: "cancelLabel", publicName: "cancelLabel", isSignal: true, isRequired: false, transformFunction: null }, dragLinkLabel: { classPropertyName: "dragLinkLabel", publicName: "dragLinkLabel", isSignal: true, isRequired: false, transformFunction: null }, dragPromptLabel: { classPropertyName: "dragPromptLabel", publicName: "dragPromptLabel", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, filesSummaryLabel: { classPropertyName: "filesSummaryLabel", publicName: "filesSummaryLabel", isSignal: true, isRequired: false, transformFunction: null }, invalidTypeMessage: { classPropertyName: "invalidTypeMessage", publicName: "invalidTypeMessage", isSignal: true, isRequired: false, transformFunction: null }, invalidSizeMessage: { classPropertyName: "invalidSizeMessage", publicName: "invalidSizeMessage", isSignal: true, isRequired: false, transformFunction: null }, limitReachedMessage: { classPropertyName: "limitReachedMessage", publicName: "limitReachedMessage", isSignal: true, isRequired: false, transformFunction: null }, uploadErrorMessage: { classPropertyName: "uploadErrorMessage", publicName: "uploadErrorMessage", isSignal: true, isRequired: false, transformFunction: null }, networkErrorMessage: { classPropertyName: "networkErrorMessage", publicName: "networkErrorMessage", isSignal: true, isRequired: false, transformFunction: null }, httpErrorMessage: { classPropertyName: "httpErrorMessage", publicName: "httpErrorMessage", isSignal: true, isRequired: false, transformFunction: null }, fileTemplate: { classPropertyName: "fileTemplate", publicName: "fileTemplate", isSignal: true, isRequired: false, transformFunction: null }, contentTemplate: { classPropertyName: "contentTemplate", publicName: "contentTemplate", isSignal: true, isRequired: false, transformFunction: null }, toolbarTemplate: { classPropertyName: "toolbarTemplate", publicName: "toolbarTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selected", filesChange: "filesChange", uploadHandler: "uploadHandler", uploaded: "uploaded", uploadError: "uploadError", removed: "removed", cleared: "cleared" }, viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }, { propertyName: "formValueInput", first: true, predicate: ["formValue"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n [class]=\"classes()\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (drop)=\"onDrop($event)\"\n>\n <!-- Real native control (visually hidden, keeps keyboard + screen-reader support) -->\n <input\n #fileInput\n class=\"ui-file-upload-input\"\n type=\"file\"\n [id]=\"inputId\"\n [attr.accept]=\"accept() || null\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"ariaLabel() || null\"\n (change)=\"onInputChange($event)\"\n />\n @if (name()) {\n <input\n #formValue\n type=\"file\"\n hidden\n [attr.name]=\"name()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n />\n }\n\n @if (mode() === 'field') {\n <!-- Field mode: compact summary + Browse trigger (whole label opens picker) -->\n <label class=\"ui-file-upload-field\" [attr.for]=\"inputId\" [attr.data-ripple]=\"ripple() ? 'on' : 'off'\">\n <span class=\"ui-file-upload-field-text\" [class._placeholder]=\"!hasFiles()\">{{\n fieldSummary()\n }}</span>\n <span class=\"ui-file-upload-browse\" aria-hidden=\"true\">{{ browseLabel() }}</span>\n </label>\n } @else {\n <!-- Drag mode: full drop zone -->\n <label class=\"ui-file-upload-zone\" [attr.for]=\"inputId\" [attr.data-ripple]=\"ripple() ? 'on' : 'off'\">\n <ui-icon class=\"ui-file-upload-zone-icon\" name=\"cloud-arrow-up\" size=\"lg\" />\n <span class=\"ui-file-upload-zone-content\">\n <span class=\"ui-file-upload-zone-title\">\n <span class=\"ui-file-upload-zone-link\">{{ dragLinkLabel() }}</span>\n <span class=\"ui-file-upload-zone-prompt\">{{ dragPromptLabel() }}</span>\n </span>\n @if (hint(); as h) {\n <span class=\"ui-file-upload-zone-hint\">{{ h }}</span>\n }\n </span>\n </label>\n\n <!-- Toolbar (custom, or default Upload/Clear actions) -->\n @if (toolbarTemplate(); as tpl) {\n <div class=\"ui-file-upload-toolbar\">\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: files(),\n choose: chooseFn,\n upload: uploadFn,\n clear: clearFn,\n }\"\n />\n </div>\n } @else if (showControls() && hasFiles()) {\n <div class=\"ui-file-upload-toolbar\">\n @if (!auto()) {\n <ui-button\n [ripple]=\"ripple()\"\n [label]=\"uploadLabel()\"\n [size]=\"size() === 'small' ? 'small' : 'default'\"\n icon=\"cloud-arrow-up\"\n [disabled]=\"!canUpload()\"\n (buttonClick)=\"upload()\"\n />\n }\n <ui-button\n [ripple]=\"ripple()\"\n [label]=\"cancelLabel()\"\n level=\"low\"\n [size]=\"size() === 'small' ? 'small' : 'default'\"\n icon=\"xmark\"\n (buttonClick)=\"clear()\"\n />\n </div>\n }\n }\n\n <!-- Content section: the file list -->\n @if (contentTemplate(); as tpl) {\n <div class=\"ui-file-upload-content\">\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: files(), remove: removeFn, clear: clearFn }\"\n />\n </div>\n } @else if (showFileList() && hasFiles()) {\n <ul class=\"ui-file-upload-content\" role=\"list\">\n @for (f of files(); track f.id) {\n <li>\n @if (fileTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: f, remove: removeFn }\"\n />\n } @else {\n <ui-file-upload-list [file]=\"f\" [size]=\"size()\" (remove)=\"remove($event)\" />\n }\n </li>\n }\n </ul>\n }\n\n <!-- Validation messages (assertive live region) -->\n @if (messages().length) {\n <div class=\"ui-file-upload-messages\" role=\"alert\" aria-live=\"assertive\">\n @for (msg of messages(); track msg) {\n <p class=\"ui-file-upload-message\">{{ msg }}</p>\n }\n </div>\n }\n</div>\n", styles: [".ui-file-upload{display:flex;flex-direction:column;gap:var(--ui-file-upload-gap, var(--units-default));width:100%;font-family:var(--ui-file-upload-font-family, var(--fontfamily-base))}.ui-file-upload-input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.ui-file-upload-field{display:flex;align-items:center;justify-content:space-between;gap:var(--ui-file-upload-field-gap, var(--units-sm));height:var(--ui-file-upload-field-height, var(--ui-form-field-height, var(--size-components-default)));padding-left:var(--ui-file-upload-field-padding-x, var(--units-md));overflow:hidden;background-color:var(--ui-file-upload-surface, var(--form-high-surface-default));border:var(--ui-file-upload-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-file-upload-stroke, var(--form-high-stroke-default));border-radius:var(--ui-file-upload-radius, var(--ui-form-field-radius, var(--radius-sm)));color:var(--ui-file-upload-color, var(--form-high-content-default));cursor:pointer;transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),border-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),box-shadow var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-file-upload-field:hover{background-color:var(--ui-file-upload-surface-hover, var(--form-high-surface-hover));border-color:var(--ui-file-upload-stroke-hover, var(--form-high-stroke-hover))}.ui-file-upload._small .ui-file-upload-field{height:var(--ui-file-upload-field-height-small, var(--ui-form-field-height-small, var(--size-components-sm)))}.ui-file-upload-field-text{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--ui-file-upload-field-font-size, var(--size-typography-text-default));font-weight:var(--ui-file-upload-field-text-weight, var(--weight-regular))}.ui-file-upload-field-text._placeholder{color:var(--ui-file-upload-color, var(--form-high-content-default));opacity:var(--ui-file-upload-placeholder-opacity, .75)}.ui-file-upload._small .ui-file-upload-field-text{font-size:var(--ui-file-upload-field-font-size-small, var(--size-typography-text-md))}.ui-file-upload-browse{display:inline-flex;align-items:center;align-self:stretch;flex:none;padding:0 var(--ui-file-upload-browse-padding-x, var(--units-default));background-color:var(--ui-file-upload-browse-surface, var(--actions-high-surface-default));color:var(--ui-file-upload-browse-color, var(--actions-high-content-default));font-size:var(--ui-file-upload-browse-font-size, var(--size-typography-text-default));font-weight:var(--ui-file-upload-browse-weight, var(--weight-bold))}.ui-file-upload._small .ui-file-upload-browse{padding:0 var(--ui-file-upload-browse-padding-x-small, var(--units-md));font-size:var(--ui-file-upload-browse-font-size-small, var(--size-typography-text-md))}.ui-file-upload-field:hover .ui-file-upload-browse{background-color:var(--ui-file-upload-browse-surface-hover, var(--actions-high-surface-hover))}.ui-file-upload-zone{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--ui-file-upload-zone-gap, var(--units-lg));min-height:var(--ui-file-upload-zone-min-height, 112px);padding:var(--ui-file-upload-zone-padding, var(--units-default));background-color:var(--ui-file-upload-surface, var(--form-high-surface-default));border:var(--ui-file-upload-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) dashed var(--ui-file-upload-stroke, var(--form-high-stroke-default));border-radius:var(--ui-file-upload-radius, var(--ui-form-field-radius, var(--radius-sm)));color:var(--ui-file-upload-color, var(--form-high-content-default));text-align:center;cursor:pointer;transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),border-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),box-shadow var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-file-upload-zone:hover{background-color:var(--ui-file-upload-surface-hover, var(--form-high-surface-hover));border-color:var(--ui-file-upload-stroke-hover, var(--form-high-stroke-hover))}.ui-file-upload._small .ui-file-upload-zone{gap:var(--ui-file-upload-zone-gap-small, var(--units-sm));min-height:var(--ui-file-upload-zone-min-height-small, 94px)}.ui-file-upload._dragging .ui-file-upload-zone{background-color:var(--ui-file-upload-surface-dragging, var(--form-high-surface-focused));border-style:solid;border-color:var(--ui-file-upload-stroke-dragging, var(--form-high-stroke-focused))}.ui-file-upload-zone-icon{color:var(--ui-file-upload-color, var(--form-high-content-default));line-height:0}.ui-file-upload-zone-content{display:flex;flex-direction:column;align-items:center;gap:var(--ui-file-upload-zone-content-gap, var(--units-xs))}.ui-file-upload-zone-title{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--ui-file-upload-zone-title-gap, var(--units-2xs));font-size:var(--ui-file-upload-zone-title-font-size, var(--size-typography-text-default));font-weight:var(--ui-file-upload-zone-title-weight, var(--weight-regular))}.ui-file-upload._small .ui-file-upload-zone-title{font-size:var(--ui-file-upload-zone-title-font-size-small, var(--size-typography-text-md))}.ui-file-upload-zone-link{color:var(--ui-file-upload-zone-link-color, var(--actions-low-content-default));font-weight:var(--ui-file-upload-zone-link-weight, var(--weight-bold));text-decoration:underline}.ui-file-upload-zone-prompt{color:var(--ui-file-upload-color, var(--form-high-content-default))}.ui-file-upload-zone-hint{color:var(--ui-file-upload-zone-hint-color, var(--global-text-muted));font-size:var(--ui-file-upload-zone-hint-font-size, var(--size-typography-text-md))}.ui-file-upload._small .ui-file-upload-zone-hint{font-size:var(--ui-file-upload-zone-hint-font-size-small, var(--size-typography-text-sm))}.ui-file-upload-input:focus-visible~.ui-file-upload-field,.ui-file-upload-input:focus-visible~.ui-file-upload-zone{outline:none;border-color:var(--ui-file-upload-stroke-focus, var(--form-high-stroke-focused));box-shadow:0 0 0 var(--ui-file-upload-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-file-upload-focus-ring-color, var(--form-high-stroke-focused))}.ui-file-upload-toolbar{display:flex;flex-wrap:wrap;gap:var(--ui-file-upload-toolbar-gap, var(--units-sm))}.ui-file-upload-content{display:flex;flex-direction:column;gap:var(--ui-file-upload-content-gap, var(--units-sm));width:100%;margin:0;padding:0;list-style:none}.ui-file-upload-content li{display:block}.ui-file-upload-messages{display:flex;flex-direction:column;gap:var(--ui-file-upload-messages-gap, var(--units-2xs))}.ui-file-upload-message{margin:0;color:var(--ui-file-upload-message-color, var(--form-error-content-default));font-size:var(--ui-file-upload-message-font-size, var(--size-typography-text-md))}.ui-file-upload._disabled .ui-file-upload-field,.ui-file-upload._disabled .ui-file-upload-zone{background-color:var(--ui-file-upload-surface-disabled, var(--form-high-surface-disabled));border-color:var(--ui-file-upload-stroke-disabled, var(--form-high-stroke-disabled));color:var(--ui-file-upload-color-disabled, var(--form-high-content-disabled));cursor:not-allowed;pointer-events:none}.ui-file-upload._disabled .ui-file-upload-browse{background-color:var(--ui-file-upload-browse-surface-disabled, var(--actions-high-surface-disabled));color:var(--ui-file-upload-browse-color-disabled, var(--actions-high-content-disabled))}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: UiIcon, selector: "ui-icon", inputs: ["name", "size", "type", "family", "decorative", "ariaLabel"] }, { kind: "component", type: UiButton, selector: "ui-button", inputs: ["label", "ariaLabel", "type", "level", "variant", "onColor", "size", "icon", "iconPos", "iconOnly", "loading", "loadingIcon", "expanded", "rounded", "disabled", "ripple", "tabindex", "buttonProps", "iconTemplate", "loadingIconTemplate", "href", "routerLink", "target", "rel"], outputs: ["buttonClick", "buttonFocus", "buttonBlur"] }, { kind: "component", type: UiFileUploadList, selector: "ui-file-upload-list", inputs: ["file", "size", "icon", "removable", "removeAriaLabel", "failedLabel", "uploadingLabel", "progressLabel"], outputs: ["remove"] }] }); }
325
+ function toStoredUploadFile(stored) {
326
+ return {
327
+ id: stored.id,
328
+ name: stored.name,
329
+ size: stored.size,
330
+ type: stored.type ?? "",
331
+ status: "completed",
332
+ progress: 100
333
+ };
575
334
  }
576
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiFileUpload, decorators: [{
577
- type: Component,
578
- args: [{ selector: 'ui-file-upload', imports: [NgTemplateOutlet, UiIcon, UiButton, UiFileUploadList], template: "<div\n [class]=\"classes()\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (drop)=\"onDrop($event)\"\n>\n <!-- Real native control (visually hidden, keeps keyboard + screen-reader support) -->\n <input\n #fileInput\n class=\"ui-file-upload-input\"\n type=\"file\"\n [id]=\"inputId\"\n [attr.accept]=\"accept() || null\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"ariaLabel() || null\"\n (change)=\"onInputChange($event)\"\n />\n @if (name()) {\n <input\n #formValue\n type=\"file\"\n hidden\n [attr.name]=\"name()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n />\n }\n\n @if (mode() === 'field') {\n <!-- Field mode: compact summary + Browse trigger (whole label opens picker) -->\n <label class=\"ui-file-upload-field\" [attr.for]=\"inputId\" [attr.data-ripple]=\"ripple() ? 'on' : 'off'\">\n <span class=\"ui-file-upload-field-text\" [class._placeholder]=\"!hasFiles()\">{{\n fieldSummary()\n }}</span>\n <span class=\"ui-file-upload-browse\" aria-hidden=\"true\">{{ browseLabel() }}</span>\n </label>\n } @else {\n <!-- Drag mode: full drop zone -->\n <label class=\"ui-file-upload-zone\" [attr.for]=\"inputId\" [attr.data-ripple]=\"ripple() ? 'on' : 'off'\">\n <ui-icon class=\"ui-file-upload-zone-icon\" name=\"cloud-arrow-up\" size=\"lg\" />\n <span class=\"ui-file-upload-zone-content\">\n <span class=\"ui-file-upload-zone-title\">\n <span class=\"ui-file-upload-zone-link\">{{ dragLinkLabel() }}</span>\n <span class=\"ui-file-upload-zone-prompt\">{{ dragPromptLabel() }}</span>\n </span>\n @if (hint(); as h) {\n <span class=\"ui-file-upload-zone-hint\">{{ h }}</span>\n }\n </span>\n </label>\n\n <!-- Toolbar (custom, or default Upload/Clear actions) -->\n @if (toolbarTemplate(); as tpl) {\n <div class=\"ui-file-upload-toolbar\">\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: files(),\n choose: chooseFn,\n upload: uploadFn,\n clear: clearFn,\n }\"\n />\n </div>\n } @else if (showControls() && hasFiles()) {\n <div class=\"ui-file-upload-toolbar\">\n @if (!auto()) {\n <ui-button\n [ripple]=\"ripple()\"\n [label]=\"uploadLabel()\"\n [size]=\"size() === 'small' ? 'small' : 'default'\"\n icon=\"cloud-arrow-up\"\n [disabled]=\"!canUpload()\"\n (buttonClick)=\"upload()\"\n />\n }\n <ui-button\n [ripple]=\"ripple()\"\n [label]=\"cancelLabel()\"\n level=\"low\"\n [size]=\"size() === 'small' ? 'small' : 'default'\"\n icon=\"xmark\"\n (buttonClick)=\"clear()\"\n />\n </div>\n }\n }\n\n <!-- Content section: the file list -->\n @if (contentTemplate(); as tpl) {\n <div class=\"ui-file-upload-content\">\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: files(), remove: removeFn, clear: clearFn }\"\n />\n </div>\n } @else if (showFileList() && hasFiles()) {\n <ul class=\"ui-file-upload-content\" role=\"list\">\n @for (f of files(); track f.id) {\n <li>\n @if (fileTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: f, remove: removeFn }\"\n />\n } @else {\n <ui-file-upload-list [file]=\"f\" [size]=\"size()\" (remove)=\"remove($event)\" />\n }\n </li>\n }\n </ul>\n }\n\n <!-- Validation messages (assertive live region) -->\n @if (messages().length) {\n <div class=\"ui-file-upload-messages\" role=\"alert\" aria-live=\"assertive\">\n @for (msg of messages(); track msg) {\n <p class=\"ui-file-upload-message\">{{ msg }}</p>\n }\n </div>\n }\n</div>\n", styles: [".ui-file-upload{display:flex;flex-direction:column;gap:var(--ui-file-upload-gap, var(--units-default));width:100%;font-family:var(--ui-file-upload-font-family, var(--fontfamily-base))}.ui-file-upload-input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.ui-file-upload-field{display:flex;align-items:center;justify-content:space-between;gap:var(--ui-file-upload-field-gap, var(--units-sm));height:var(--ui-file-upload-field-height, var(--ui-form-field-height, var(--size-components-default)));padding-left:var(--ui-file-upload-field-padding-x, var(--units-md));overflow:hidden;background-color:var(--ui-file-upload-surface, var(--form-high-surface-default));border:var(--ui-file-upload-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-file-upload-stroke, var(--form-high-stroke-default));border-radius:var(--ui-file-upload-radius, var(--ui-form-field-radius, var(--radius-sm)));color:var(--ui-file-upload-color, var(--form-high-content-default));cursor:pointer;transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),border-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),box-shadow var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-file-upload-field:hover{background-color:var(--ui-file-upload-surface-hover, var(--form-high-surface-hover));border-color:var(--ui-file-upload-stroke-hover, var(--form-high-stroke-hover))}.ui-file-upload._small .ui-file-upload-field{height:var(--ui-file-upload-field-height-small, var(--ui-form-field-height-small, var(--size-components-sm)))}.ui-file-upload-field-text{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--ui-file-upload-field-font-size, var(--size-typography-text-default));font-weight:var(--ui-file-upload-field-text-weight, var(--weight-regular))}.ui-file-upload-field-text._placeholder{color:var(--ui-file-upload-color, var(--form-high-content-default));opacity:var(--ui-file-upload-placeholder-opacity, .75)}.ui-file-upload._small .ui-file-upload-field-text{font-size:var(--ui-file-upload-field-font-size-small, var(--size-typography-text-md))}.ui-file-upload-browse{display:inline-flex;align-items:center;align-self:stretch;flex:none;padding:0 var(--ui-file-upload-browse-padding-x, var(--units-default));background-color:var(--ui-file-upload-browse-surface, var(--actions-high-surface-default));color:var(--ui-file-upload-browse-color, var(--actions-high-content-default));font-size:var(--ui-file-upload-browse-font-size, var(--size-typography-text-default));font-weight:var(--ui-file-upload-browse-weight, var(--weight-bold))}.ui-file-upload._small .ui-file-upload-browse{padding:0 var(--ui-file-upload-browse-padding-x-small, var(--units-md));font-size:var(--ui-file-upload-browse-font-size-small, var(--size-typography-text-md))}.ui-file-upload-field:hover .ui-file-upload-browse{background-color:var(--ui-file-upload-browse-surface-hover, var(--actions-high-surface-hover))}.ui-file-upload-zone{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--ui-file-upload-zone-gap, var(--units-lg));min-height:var(--ui-file-upload-zone-min-height, 112px);padding:var(--ui-file-upload-zone-padding, var(--units-default));background-color:var(--ui-file-upload-surface, var(--form-high-surface-default));border:var(--ui-file-upload-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) dashed var(--ui-file-upload-stroke, var(--form-high-stroke-default));border-radius:var(--ui-file-upload-radius, var(--ui-form-field-radius, var(--radius-sm)));color:var(--ui-file-upload-color, var(--form-high-content-default));text-align:center;cursor:pointer;transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),border-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),box-shadow var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-file-upload-zone:hover{background-color:var(--ui-file-upload-surface-hover, var(--form-high-surface-hover));border-color:var(--ui-file-upload-stroke-hover, var(--form-high-stroke-hover))}.ui-file-upload._small .ui-file-upload-zone{gap:var(--ui-file-upload-zone-gap-small, var(--units-sm));min-height:var(--ui-file-upload-zone-min-height-small, 94px)}.ui-file-upload._dragging .ui-file-upload-zone{background-color:var(--ui-file-upload-surface-dragging, var(--form-high-surface-focused));border-style:solid;border-color:var(--ui-file-upload-stroke-dragging, var(--form-high-stroke-focused))}.ui-file-upload-zone-icon{color:var(--ui-file-upload-color, var(--form-high-content-default));line-height:0}.ui-file-upload-zone-content{display:flex;flex-direction:column;align-items:center;gap:var(--ui-file-upload-zone-content-gap, var(--units-xs))}.ui-file-upload-zone-title{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--ui-file-upload-zone-title-gap, var(--units-2xs));font-size:var(--ui-file-upload-zone-title-font-size, var(--size-typography-text-default));font-weight:var(--ui-file-upload-zone-title-weight, var(--weight-regular))}.ui-file-upload._small .ui-file-upload-zone-title{font-size:var(--ui-file-upload-zone-title-font-size-small, var(--size-typography-text-md))}.ui-file-upload-zone-link{color:var(--ui-file-upload-zone-link-color, var(--actions-low-content-default));font-weight:var(--ui-file-upload-zone-link-weight, var(--weight-bold));text-decoration:underline}.ui-file-upload-zone-prompt{color:var(--ui-file-upload-color, var(--form-high-content-default))}.ui-file-upload-zone-hint{color:var(--ui-file-upload-zone-hint-color, var(--global-text-muted));font-size:var(--ui-file-upload-zone-hint-font-size, var(--size-typography-text-md))}.ui-file-upload._small .ui-file-upload-zone-hint{font-size:var(--ui-file-upload-zone-hint-font-size-small, var(--size-typography-text-sm))}.ui-file-upload-input:focus-visible~.ui-file-upload-field,.ui-file-upload-input:focus-visible~.ui-file-upload-zone{outline:none;border-color:var(--ui-file-upload-stroke-focus, var(--form-high-stroke-focused));box-shadow:0 0 0 var(--ui-file-upload-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-file-upload-focus-ring-color, var(--form-high-stroke-focused))}.ui-file-upload-toolbar{display:flex;flex-wrap:wrap;gap:var(--ui-file-upload-toolbar-gap, var(--units-sm))}.ui-file-upload-content{display:flex;flex-direction:column;gap:var(--ui-file-upload-content-gap, var(--units-sm));width:100%;margin:0;padding:0;list-style:none}.ui-file-upload-content li{display:block}.ui-file-upload-messages{display:flex;flex-direction:column;gap:var(--ui-file-upload-messages-gap, var(--units-2xs))}.ui-file-upload-message{margin:0;color:var(--ui-file-upload-message-color, var(--form-error-content-default));font-size:var(--ui-file-upload-message-font-size, var(--size-typography-text-md))}.ui-file-upload._disabled .ui-file-upload-field,.ui-file-upload._disabled .ui-file-upload-zone{background-color:var(--ui-file-upload-surface-disabled, var(--form-high-surface-disabled));border-color:var(--ui-file-upload-stroke-disabled, var(--form-high-stroke-disabled));color:var(--ui-file-upload-color-disabled, var(--form-high-content-disabled));cursor:not-allowed;pointer-events:none}.ui-file-upload._disabled .ui-file-upload-browse{background-color:var(--ui-file-upload-browse-surface-disabled, var(--actions-high-surface-disabled));color:var(--ui-file-upload-browse-color-disabled, var(--actions-high-content-disabled))}\n"] }]
579
- }], ctorParameters: () => [], propDecorators: { mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], ripple: [{ type: i0.Input, args: [{ isSignal: true, alias: "ripple", required: false }] }], accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], maxFileSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxFileSize", required: false }] }], fileLimit: [{ type: i0.Input, args: [{ isSignal: true, alias: "fileLimit", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], auto: [{ type: i0.Input, args: [{ isSignal: true, alias: "auto", required: false }] }], customUpload: [{ type: i0.Input, args: [{ isSignal: true, alias: "customUpload", required: false }] }], url: [{ type: i0.Input, args: [{ isSignal: true, alias: "url", required: false }] }], method: [{ type: i0.Input, args: [{ isSignal: true, alias: "method", required: false }] }], fieldName: [{ type: i0.Input, args: [{ isSignal: true, alias: "fieldName", required: false }] }], withCredentials: [{ type: i0.Input, args: [{ isSignal: true, alias: "withCredentials", required: false }] }], showFileList: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFileList", required: false }] }], showControls: [{ type: i0.Input, args: [{ isSignal: true, alias: "showControls", required: false }] }], browseLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "browseLabel", required: false }] }], chooseLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "chooseLabel", required: false }] }], uploadLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "uploadLabel", required: false }] }], cancelLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "cancelLabel", required: false }] }], dragLinkLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragLinkLabel", required: false }] }], dragPromptLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragPromptLabel", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], filesSummaryLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "filesSummaryLabel", required: false }] }], invalidTypeMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalidTypeMessage", required: false }] }], invalidSizeMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalidSizeMessage", required: false }] }], limitReachedMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "limitReachedMessage", required: false }] }], uploadErrorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "uploadErrorMessage", required: false }] }], networkErrorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "networkErrorMessage", required: false }] }], httpErrorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "httpErrorMessage", required: false }] }], fileTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "fileTemplate", required: false }] }], contentTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "contentTemplate", required: false }] }], toolbarTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "toolbarTemplate", required: false }] }], selected: [{ type: i0.Output, args: ["selected"] }], filesChange: [{ type: i0.Output, args: ["filesChange"] }], uploadHandler: [{ type: i0.Output, args: ["uploadHandler"] }], uploaded: [{ type: i0.Output, args: ["uploaded"] }], uploadError: [{ type: i0.Output, args: ["uploadError"] }], removed: [{ type: i0.Output, args: ["removed"] }], cleared: [{ type: i0.Output, args: ["cleared"] }], fileInput: [{ type: i0.ViewChild, args: ['fileInput', { isSignal: true }] }], formValueInput: [{ type: i0.ViewChild, args: ['formValue', { isSignal: true }] }] } });
580
-
581
- /*
582
- * Public API Surface of ui-kit/ui-file-upload
583
- *
584
- * Includes `ui-file-upload-list`: it renders the upload's own file model,
585
- * so the two live in one entry point (a separate one would be a cycle).
586
- */
587
-
588
- /**
589
- * Generated bundle index. Do not edit.
590
- */
335
+ function sameStoredFiles(a, b) {
336
+ return a.length === b.length && a.every((f, i) => f.id === b[i].id && f.name === b[i].name && f.size === b[i].size && f.type === b[i].type);
337
+ }
338
+ var UiFileUpload = class UiFileUpload {
339
+ constructor() {
340
+ this.mode = input("field", ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
341
+ this.size = input("default", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
342
+ this.name = input(...ngDevMode ? [void 0, { debugName: "name" }] : /* istanbul ignore next */ []);
343
+ this.multiple = input(false, {
344
+ ...ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {},
345
+ transform: booleanAttribute
346
+ });
347
+ this.ripple = input(true, {
348
+ ...ngDevMode ? { debugName: "ripple" } : /* istanbul ignore next */ {},
349
+ transform: booleanAttribute
350
+ });
351
+ this.accept = input(...ngDevMode ? [void 0, { debugName: "accept" }] : /* istanbul ignore next */ []);
352
+ this.maxFileSize = input(void 0, {
353
+ ...ngDevMode ? { debugName: "maxFileSize" } : /* istanbul ignore next */ {},
354
+ transform: numberAttribute
355
+ });
356
+ this.maxTotalSize = input(void 0, {
357
+ ...ngDevMode ? { debugName: "maxTotalSize" } : /* istanbul ignore next */ {},
358
+ transform: numberAttribute
359
+ });
360
+ this.fileLimit = input(void 0, {
361
+ ...ngDevMode ? { debugName: "fileLimit" } : /* istanbul ignore next */ {},
362
+ transform: numberAttribute
363
+ });
364
+ this.disabled = input(false, {
365
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
366
+ transform: booleanAttribute
367
+ });
368
+ this.initialFiles = input([], ...ngDevMode ? [{ debugName: "initialFiles" }] : /* istanbul ignore next */ []);
369
+ this.auto = input(false, {
370
+ ...ngDevMode ? { debugName: "auto" } : /* istanbul ignore next */ {},
371
+ transform: booleanAttribute
372
+ });
373
+ this.customUpload = input(false, {
374
+ ...ngDevMode ? { debugName: "customUpload" } : /* istanbul ignore next */ {},
375
+ transform: booleanAttribute
376
+ });
377
+ this.url = input(...ngDevMode ? [void 0, { debugName: "url" }] : /* istanbul ignore next */ []);
378
+ this.method = input("post", ...ngDevMode ? [{ debugName: "method" }] : /* istanbul ignore next */ []);
379
+ this.fieldName = input("files", ...ngDevMode ? [{ debugName: "fieldName" }] : /* istanbul ignore next */ []);
380
+ this.withCredentials = input(false, {
381
+ ...ngDevMode ? { debugName: "withCredentials" } : /* istanbul ignore next */ {},
382
+ transform: booleanAttribute
383
+ });
384
+ this.showFileList = input(true, {
385
+ ...ngDevMode ? { debugName: "showFileList" } : /* istanbul ignore next */ {},
386
+ transform: booleanAttribute
387
+ });
388
+ this.showControls = input(true, {
389
+ ...ngDevMode ? { debugName: "showControls" } : /* istanbul ignore next */ {},
390
+ transform: booleanAttribute
391
+ });
392
+ this.showTotal = input(false, {
393
+ ...ngDevMode ? { debugName: "showTotal" } : /* istanbul ignore next */ {},
394
+ transform: booleanAttribute
395
+ });
396
+ this.openable = input(false, {
397
+ ...ngDevMode ? { debugName: "openable" } : /* istanbul ignore next */ {},
398
+ transform: booleanAttribute
399
+ });
400
+ this.browseLabel = input("Parcourir", ...ngDevMode ? [{ debugName: "browseLabel" }] : /* istanbul ignore next */ []);
401
+ this.chooseLabel = input("Choisir un fichier…", ...ngDevMode ? [{ debugName: "chooseLabel" }] : /* istanbul ignore next */ []);
402
+ this.uploadLabel = input("Téléverser", ...ngDevMode ? [{ debugName: "uploadLabel" }] : /* istanbul ignore next */ []);
403
+ this.cancelLabel = input("Effacer", ...ngDevMode ? [{ debugName: "cancelLabel" }] : /* istanbul ignore next */ []);
404
+ this.dragLinkLabel = input("Cliquer pour téléverser", ...ngDevMode ? [{ debugName: "dragLinkLabel" }] : /* istanbul ignore next */ []);
405
+ this.dragPromptLabel = input("ou glisser-déposer les fichiers ici", ...ngDevMode ? [{ debugName: "dragPromptLabel" }] : /* istanbul ignore next */ []);
406
+ this.hint = input(...ngDevMode ? [void 0, { debugName: "hint" }] : /* istanbul ignore next */ []);
407
+ this.ariaLabel = input("Téléversement de fichiers", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
408
+ this.filesSummaryLabel = input("{0} fichiers", ...ngDevMode ? [{ debugName: "filesSummaryLabel" }] : /* istanbul ignore next */ []);
409
+ this.invalidTypeMessage = input("Type de fichier non autorisé : {0}", ...ngDevMode ? [{ debugName: "invalidTypeMessage" }] : /* istanbul ignore next */ []);
410
+ this.invalidSizeMessage = input("Fichier trop volumineux : {0}", ...ngDevMode ? [{ debugName: "invalidSizeMessage" }] : /* istanbul ignore next */ []);
411
+ this.totalLabel = input("{0} fichiers · {1}", ...ngDevMode ? [{ debugName: "totalLabel" }] : /* istanbul ignore next */ []);
412
+ this.totalSizeExceededMessage = input("Taille totale dépassée ({1} max) : {0}", ...ngDevMode ? [{ debugName: "totalSizeExceededMessage" }] : /* istanbul ignore next */ []);
413
+ this.limitReachedMessage = input("Nombre maximum de fichiers atteint ({0}).", ...ngDevMode ? [{ debugName: "limitReachedMessage" }] : /* istanbul ignore next */ []);
414
+ this.uploadErrorMessage = input("Échec du téléversement", ...ngDevMode ? [{ debugName: "uploadErrorMessage" }] : /* istanbul ignore next */ []);
415
+ this.networkErrorMessage = input("Erreur réseau", ...ngDevMode ? [{ debugName: "networkErrorMessage" }] : /* istanbul ignore next */ []);
416
+ this.httpErrorMessage = input("Erreur {0}", ...ngDevMode ? [{ debugName: "httpErrorMessage" }] : /* istanbul ignore next */ []);
417
+ this.fileTemplate = input(...ngDevMode ? [void 0, { debugName: "fileTemplate" }] : /* istanbul ignore next */ []);
418
+ this.fileActionsTemplate = input(...ngDevMode ? [void 0, { debugName: "fileActionsTemplate" }] : /* istanbul ignore next */ []);
419
+ this.contentTemplate = input(...ngDevMode ? [void 0, { debugName: "contentTemplate" }] : /* istanbul ignore next */ []);
420
+ this.toolbarTemplate = input(...ngDevMode ? [void 0, { debugName: "toolbarTemplate" }] : /* istanbul ignore next */ []);
421
+ this.selected = output();
422
+ this.filesChange = output();
423
+ this.uploadHandler = output();
424
+ this.uploaded = output();
425
+ this.uploadError = output();
426
+ this.removed = output();
427
+ this.cleared = output();
428
+ this.fileOpen = output();
429
+ this.inputId = `ui-file-upload-${nextInstanceId++}`;
430
+ this.host = inject(ElementRef);
431
+ this.destroyRef = inject(DestroyRef);
432
+ this.fileInput = viewChild.required("fileInput", ...ngDevMode ? [{ debugName: "fileInput" }] : /* istanbul ignore next */ []);
433
+ this.formValueInput = viewChild("formValue", ...ngDevMode ? [{ debugName: "formValueInput" }] : /* istanbul ignore next */ []);
434
+ this.requests = /* @__PURE__ */ new Map();
435
+ this.selection = signal([], ...ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []);
436
+ this.files = this.selection.asReadonly();
437
+ this.storedFiles = computed(() => this.initialFiles() ?? [], {
438
+ ...ngDevMode ? { debugName: "storedFiles" } : /* istanbul ignore next */ {},
439
+ equal: sameStoredFiles
440
+ });
441
+ this.dragging = signal(false, ...ngDevMode ? [{ debugName: "dragging" }] : /* istanbul ignore next */ []);
442
+ this.messages = signal([], ...ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []);
443
+ this.hasFiles = computed(() => this.selection().length > 0, ...ngDevMode ? [{ debugName: "hasFiles" }] : /* istanbul ignore next */ []);
444
+ this.hasLocalFiles = computed(() => this.selection().some(isLocalUploadFile), ...ngDevMode ? [{ debugName: "hasLocalFiles" }] : /* istanbul ignore next */ []);
445
+ this.pending = computed(() => this.selection().filter((f) => f.status === "pending" && isLocalUploadFile(f)), ...ngDevMode ? [{ debugName: "pending" }] : /* istanbul ignore next */ []);
446
+ this.totalSummary = computed(() => {
447
+ const files = this.selection();
448
+ return formatLabel(this.totalLabel(), files.length, formatFileSize(totalSize(files)));
449
+ }, ...ngDevMode ? [{ debugName: "totalSummary" }] : /* istanbul ignore next */ []);
450
+ this.fieldSummary = computed(() => {
451
+ const files = this.selection();
452
+ if (!files.length) return this.chooseLabel();
453
+ if (files.length === 1) return files[0].name;
454
+ return formatLabel(this.filesSummaryLabel(), files.length);
455
+ }, ...ngDevMode ? [{ debugName: "fieldSummary" }] : /* istanbul ignore next */ []);
456
+ this.canUpload = computed(() => !this.disabled() && this.pending().length > 0 && (this.customUpload() || !!this.url()), ...ngDevMode ? [{ debugName: "canUpload" }] : /* istanbul ignore next */ []);
457
+ this.classes = computed(() => {
458
+ const c = ["ui-file-upload", `_${this.mode()}`];
459
+ if (this.size() !== "default") c.push(`_${this.size()}`);
460
+ if (this.dragging()) c.push("_dragging");
461
+ if (this.disabled()) c.push("_disabled");
462
+ return c.join(" ");
463
+ }, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
464
+ this.removeFn = (f) => this.remove(f);
465
+ this.clearFn = () => this.clear();
466
+ this.chooseFn = () => this.choose();
467
+ this.uploadFn = () => this.upload();
468
+ this.openFn = (f) => this.fileOpen.emit(f);
469
+ this.destroyRef.onDestroy(() => {
470
+ for (const f of this.selection()) this.revoke(f);
471
+ for (const xhr of this.requests.values()) xhr.abort();
472
+ });
473
+ effect(() => {
474
+ const el = this.formValueInput()?.nativeElement;
475
+ const files = this.selection();
476
+ if (!el || typeof DataTransfer === "undefined") return;
477
+ const data = new DataTransfer();
478
+ for (const f of files) if (isLocalUploadFile(f)) data.items.add(f.file);
479
+ el.files = data.files;
480
+ });
481
+ effect(() => {
482
+ const stored = this.storedFiles().map(toStoredUploadFile);
483
+ untracked(() => this.reset(stored));
484
+ });
485
+ if (isDevMode()) effect(() => {
486
+ if (!this.ariaLabel()) console.warn("[ui-file-upload] Provide `ariaLabel` to name the control.");
487
+ });
488
+ }
489
+ choose() {
490
+ if (this.disabled()) return;
491
+ this.fileInput().nativeElement.click();
492
+ }
493
+ add(files) {
494
+ this.ingest(files);
495
+ }
496
+ upload() {
497
+ const pending = this.pending();
498
+ if (!pending.length) return;
499
+ if (this.customUpload()) {
500
+ this.emitCustomUpload(pending);
501
+ return;
502
+ }
503
+ const endpoint = this.url();
504
+ if (!endpoint) return;
505
+ for (const f of pending) this.xhrUpload(f, endpoint);
506
+ }
507
+ remove(target) {
508
+ this.requests.get(target.id)?.abort();
509
+ this.requests.delete(target.id);
510
+ this.revoke(target);
511
+ this.selection.update((files) => files.filter((f) => f.id !== target.id));
512
+ this.removed.emit(target);
513
+ this.filesChange.emit(this.selection());
514
+ }
515
+ clear() {
516
+ for (const xhr of this.requests.values()) xhr.abort();
517
+ this.requests.clear();
518
+ for (const f of this.selection()) this.revoke(f);
519
+ this.selection.update((files) => files.filter((f) => !isLocalUploadFile(f)));
520
+ this.messages.set([]);
521
+ this.resetInput();
522
+ this.cleared.emit();
523
+ this.filesChange.emit(this.selection());
524
+ }
525
+ onInputChange(event) {
526
+ const input = event.target;
527
+ this.ingest(input.files);
528
+ this.resetInput();
529
+ }
530
+ onDragOver(event) {
531
+ if (this.disabled()) return;
532
+ event.preventDefault();
533
+ event.stopPropagation();
534
+ this.dragging.set(true);
535
+ }
536
+ onDragLeave(event) {
537
+ if (this.disabled()) return;
538
+ event.preventDefault();
539
+ if (this.host.nativeElement.contains(event.relatedTarget)) return;
540
+ this.dragging.set(false);
541
+ }
542
+ onDrop(event) {
543
+ if (this.disabled()) return;
544
+ event.preventDefault();
545
+ event.stopPropagation();
546
+ this.dragging.set(false);
547
+ this.ingest(event.dataTransfer?.files ?? null);
548
+ }
549
+ ingest(list) {
550
+ if (!list || !list.length || this.disabled()) return;
551
+ const incoming = Array.from(list);
552
+ const added = [];
553
+ const newMessages = [];
554
+ const limit = this.fileLimit();
555
+ const maxSize = this.maxFileSize();
556
+ const maxTotal = this.maxTotalSize();
557
+ const keptSize = this.multiple() ? totalSize(this.selection().filter((f) => f.status !== "error")) : 0;
558
+ for (const file of incoming) {
559
+ if (!this.multiple() && added.length >= 1) break;
560
+ const item = this.toUploadFile(file);
561
+ if (!isFileTypeAccepted(file, this.accept())) {
562
+ this.fail(item, "type", formatLabel(this.invalidTypeMessage(), file.name), newMessages);
563
+ continue;
564
+ }
565
+ if (maxSize != null && file.size > maxSize) {
566
+ this.fail(item, "size", formatLabel(this.invalidSizeMessage(), file.name), newMessages);
567
+ continue;
568
+ }
569
+ if (maxTotal != null && keptSize + totalSize(added) + file.size > maxTotal) {
570
+ const message = formatLabel(this.totalSizeExceededMessage(), file.name, formatFileSize(maxTotal));
571
+ this.fail(item, "total-size", message, newMessages);
572
+ continue;
573
+ }
574
+ if (limit != null && (this.multiple() ? this.selection().length : 0) + added.length >= limit) {
575
+ this.fail(item, "limit", formatLabel(this.limitReachedMessage(), limit), newMessages);
576
+ continue;
577
+ }
578
+ added.push(item);
579
+ }
580
+ this.messages.set(newMessages);
581
+ if (!added.length) return;
582
+ const replaced = this.multiple() ? [] : this.selection();
583
+ for (const previous of replaced) {
584
+ this.requests.get(previous.id)?.abort();
585
+ this.requests.delete(previous.id);
586
+ this.revoke(previous);
587
+ }
588
+ this.selection.update((files) => this.multiple() ? [...files, ...added] : added);
589
+ for (const previous of replaced) this.removed.emit(previous);
590
+ this.selected.emit(added);
591
+ this.filesChange.emit(this.selection());
592
+ if (this.auto()) this.upload();
593
+ }
594
+ reset(stored) {
595
+ const unfinished = (f) => isLocalUploadFile(f) && f.status !== "completed";
596
+ const kept = this.selection().filter(unfinished);
597
+ for (const f of this.selection()) if (!unfinished(f)) this.revoke(f);
598
+ this.selection.set(this.multiple() || !kept.length ? [...stored, ...kept] : kept);
599
+ this.messages.set([]);
600
+ }
601
+ toUploadFile(file) {
602
+ return {
603
+ id: `uifu-${nextUploadId++}`,
604
+ file,
605
+ name: file.name,
606
+ size: file.size,
607
+ type: file.type,
608
+ status: "pending",
609
+ progress: 0,
610
+ objectUrl: isImageFile(file) ? URL.createObjectURL(file) : void 0
611
+ };
612
+ }
613
+ fail(item, reason, message, sink) {
614
+ this.revoke(item);
615
+ sink.push(message);
616
+ this.uploadError.emit({
617
+ file: {
618
+ ...item,
619
+ status: "error",
620
+ error: message
621
+ },
622
+ reason,
623
+ message
624
+ });
625
+ }
626
+ patch(id, changes) {
627
+ this.selection.update((files) => files.map((f) => f.id === id ? {
628
+ ...f,
629
+ ...changes
630
+ } : f));
631
+ }
632
+ emitCustomUpload(pending) {
633
+ for (const f of pending) this.patch(f.id, {
634
+ status: "uploading",
635
+ progress: 0
636
+ });
637
+ this.uploadHandler.emit({
638
+ files: pending,
639
+ setProgress: (file, progress) => this.patch(file.id, {
640
+ status: "uploading",
641
+ progress: Math.max(0, Math.min(100, progress))
642
+ }),
643
+ markUploaded: (file) => {
644
+ this.patch(file.id, {
645
+ status: "completed",
646
+ progress: 100
647
+ });
648
+ this.filesChange.emit(this.selection());
649
+ },
650
+ markError: (file, msg) => {
651
+ this.patch(file.id, {
652
+ status: "error",
653
+ error: msg ?? this.uploadErrorMessage()
654
+ });
655
+ this.uploadError.emit({
656
+ file,
657
+ reason: "upload",
658
+ message: msg ?? this.uploadErrorMessage()
659
+ });
660
+ }
661
+ });
662
+ }
663
+ xhrUpload(item, endpoint) {
664
+ const xhr = new XMLHttpRequest();
665
+ this.requests.set(item.id, xhr);
666
+ this.patch(item.id, {
667
+ status: "uploading",
668
+ progress: 0
669
+ });
670
+ const body = new FormData();
671
+ body.append(this.fieldName(), item.file, item.name);
672
+ xhr.upload.addEventListener("progress", (e) => {
673
+ if (e.lengthComputable) this.patch(item.id, { progress: Math.round(e.loaded / e.total * 100) });
674
+ });
675
+ xhr.addEventListener("load", () => {
676
+ this.requests.delete(item.id);
677
+ if (xhr.status >= 200 && xhr.status < 300) {
678
+ this.patch(item.id, {
679
+ status: "completed",
680
+ progress: 100
681
+ });
682
+ this.uploaded.emit({
683
+ files: [item],
684
+ xhr
685
+ });
686
+ this.filesChange.emit(this.selection());
687
+ } else this.uploadFailed(item, formatLabel(this.httpErrorMessage(), xhr.status));
688
+ });
689
+ xhr.addEventListener("error", () => this.uploadFailed(item, this.networkErrorMessage()));
690
+ xhr.addEventListener("abort", () => this.requests.delete(item.id));
691
+ xhr.open(this.method().toUpperCase(), endpoint, true);
692
+ xhr.withCredentials = this.withCredentials();
693
+ xhr.send(body);
694
+ }
695
+ uploadFailed(item, message) {
696
+ this.requests.delete(item.id);
697
+ this.patch(item.id, {
698
+ status: "error",
699
+ error: message
700
+ });
701
+ this.uploadError.emit({
702
+ file: item,
703
+ reason: "upload",
704
+ message
705
+ });
706
+ }
707
+ revoke(file) {
708
+ if (file.objectUrl) URL.revokeObjectURL(file.objectUrl);
709
+ }
710
+ resetInput() {
711
+ const el = this.fileInput().nativeElement;
712
+ if (el) el.value = "";
713
+ }
714
+ static {
715
+ this.ɵfac = i0.ɵɵngDeclareFactory({
716
+ minVersion: "12.0.0",
717
+ version: "22.3.0",
718
+ ngImport: i0,
719
+ type: UiFileUpload,
720
+ deps: [],
721
+ target: i0.ɵɵFactoryTarget.Component
722
+ });
723
+ }
724
+ static {
725
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
726
+ minVersion: "17.0.0",
727
+ version: "22.3.0",
728
+ type: UiFileUpload,
729
+ isStandalone: true,
730
+ selector: "ui-file-upload",
731
+ inputs: {
732
+ mode: {
733
+ classPropertyName: "mode",
734
+ publicName: "mode",
735
+ isSignal: true,
736
+ isRequired: false,
737
+ transformFunction: null
738
+ },
739
+ size: {
740
+ classPropertyName: "size",
741
+ publicName: "size",
742
+ isSignal: true,
743
+ isRequired: false,
744
+ transformFunction: null
745
+ },
746
+ name: {
747
+ classPropertyName: "name",
748
+ publicName: "name",
749
+ isSignal: true,
750
+ isRequired: false,
751
+ transformFunction: null
752
+ },
753
+ multiple: {
754
+ classPropertyName: "multiple",
755
+ publicName: "multiple",
756
+ isSignal: true,
757
+ isRequired: false,
758
+ transformFunction: null
759
+ },
760
+ ripple: {
761
+ classPropertyName: "ripple",
762
+ publicName: "ripple",
763
+ isSignal: true,
764
+ isRequired: false,
765
+ transformFunction: null
766
+ },
767
+ accept: {
768
+ classPropertyName: "accept",
769
+ publicName: "accept",
770
+ isSignal: true,
771
+ isRequired: false,
772
+ transformFunction: null
773
+ },
774
+ maxFileSize: {
775
+ classPropertyName: "maxFileSize",
776
+ publicName: "maxFileSize",
777
+ isSignal: true,
778
+ isRequired: false,
779
+ transformFunction: null
780
+ },
781
+ maxTotalSize: {
782
+ classPropertyName: "maxTotalSize",
783
+ publicName: "maxTotalSize",
784
+ isSignal: true,
785
+ isRequired: false,
786
+ transformFunction: null
787
+ },
788
+ fileLimit: {
789
+ classPropertyName: "fileLimit",
790
+ publicName: "fileLimit",
791
+ isSignal: true,
792
+ isRequired: false,
793
+ transformFunction: null
794
+ },
795
+ disabled: {
796
+ classPropertyName: "disabled",
797
+ publicName: "disabled",
798
+ isSignal: true,
799
+ isRequired: false,
800
+ transformFunction: null
801
+ },
802
+ initialFiles: {
803
+ classPropertyName: "initialFiles",
804
+ publicName: "initialFiles",
805
+ isSignal: true,
806
+ isRequired: false,
807
+ transformFunction: null
808
+ },
809
+ auto: {
810
+ classPropertyName: "auto",
811
+ publicName: "auto",
812
+ isSignal: true,
813
+ isRequired: false,
814
+ transformFunction: null
815
+ },
816
+ customUpload: {
817
+ classPropertyName: "customUpload",
818
+ publicName: "customUpload",
819
+ isSignal: true,
820
+ isRequired: false,
821
+ transformFunction: null
822
+ },
823
+ url: {
824
+ classPropertyName: "url",
825
+ publicName: "url",
826
+ isSignal: true,
827
+ isRequired: false,
828
+ transformFunction: null
829
+ },
830
+ method: {
831
+ classPropertyName: "method",
832
+ publicName: "method",
833
+ isSignal: true,
834
+ isRequired: false,
835
+ transformFunction: null
836
+ },
837
+ fieldName: {
838
+ classPropertyName: "fieldName",
839
+ publicName: "fieldName",
840
+ isSignal: true,
841
+ isRequired: false,
842
+ transformFunction: null
843
+ },
844
+ withCredentials: {
845
+ classPropertyName: "withCredentials",
846
+ publicName: "withCredentials",
847
+ isSignal: true,
848
+ isRequired: false,
849
+ transformFunction: null
850
+ },
851
+ showFileList: {
852
+ classPropertyName: "showFileList",
853
+ publicName: "showFileList",
854
+ isSignal: true,
855
+ isRequired: false,
856
+ transformFunction: null
857
+ },
858
+ showControls: {
859
+ classPropertyName: "showControls",
860
+ publicName: "showControls",
861
+ isSignal: true,
862
+ isRequired: false,
863
+ transformFunction: null
864
+ },
865
+ showTotal: {
866
+ classPropertyName: "showTotal",
867
+ publicName: "showTotal",
868
+ isSignal: true,
869
+ isRequired: false,
870
+ transformFunction: null
871
+ },
872
+ openable: {
873
+ classPropertyName: "openable",
874
+ publicName: "openable",
875
+ isSignal: true,
876
+ isRequired: false,
877
+ transformFunction: null
878
+ },
879
+ browseLabel: {
880
+ classPropertyName: "browseLabel",
881
+ publicName: "browseLabel",
882
+ isSignal: true,
883
+ isRequired: false,
884
+ transformFunction: null
885
+ },
886
+ chooseLabel: {
887
+ classPropertyName: "chooseLabel",
888
+ publicName: "chooseLabel",
889
+ isSignal: true,
890
+ isRequired: false,
891
+ transformFunction: null
892
+ },
893
+ uploadLabel: {
894
+ classPropertyName: "uploadLabel",
895
+ publicName: "uploadLabel",
896
+ isSignal: true,
897
+ isRequired: false,
898
+ transformFunction: null
899
+ },
900
+ cancelLabel: {
901
+ classPropertyName: "cancelLabel",
902
+ publicName: "cancelLabel",
903
+ isSignal: true,
904
+ isRequired: false,
905
+ transformFunction: null
906
+ },
907
+ dragLinkLabel: {
908
+ classPropertyName: "dragLinkLabel",
909
+ publicName: "dragLinkLabel",
910
+ isSignal: true,
911
+ isRequired: false,
912
+ transformFunction: null
913
+ },
914
+ dragPromptLabel: {
915
+ classPropertyName: "dragPromptLabel",
916
+ publicName: "dragPromptLabel",
917
+ isSignal: true,
918
+ isRequired: false,
919
+ transformFunction: null
920
+ },
921
+ hint: {
922
+ classPropertyName: "hint",
923
+ publicName: "hint",
924
+ isSignal: true,
925
+ isRequired: false,
926
+ transformFunction: null
927
+ },
928
+ ariaLabel: {
929
+ classPropertyName: "ariaLabel",
930
+ publicName: "ariaLabel",
931
+ isSignal: true,
932
+ isRequired: false,
933
+ transformFunction: null
934
+ },
935
+ filesSummaryLabel: {
936
+ classPropertyName: "filesSummaryLabel",
937
+ publicName: "filesSummaryLabel",
938
+ isSignal: true,
939
+ isRequired: false,
940
+ transformFunction: null
941
+ },
942
+ invalidTypeMessage: {
943
+ classPropertyName: "invalidTypeMessage",
944
+ publicName: "invalidTypeMessage",
945
+ isSignal: true,
946
+ isRequired: false,
947
+ transformFunction: null
948
+ },
949
+ invalidSizeMessage: {
950
+ classPropertyName: "invalidSizeMessage",
951
+ publicName: "invalidSizeMessage",
952
+ isSignal: true,
953
+ isRequired: false,
954
+ transformFunction: null
955
+ },
956
+ totalLabel: {
957
+ classPropertyName: "totalLabel",
958
+ publicName: "totalLabel",
959
+ isSignal: true,
960
+ isRequired: false,
961
+ transformFunction: null
962
+ },
963
+ totalSizeExceededMessage: {
964
+ classPropertyName: "totalSizeExceededMessage",
965
+ publicName: "totalSizeExceededMessage",
966
+ isSignal: true,
967
+ isRequired: false,
968
+ transformFunction: null
969
+ },
970
+ limitReachedMessage: {
971
+ classPropertyName: "limitReachedMessage",
972
+ publicName: "limitReachedMessage",
973
+ isSignal: true,
974
+ isRequired: false,
975
+ transformFunction: null
976
+ },
977
+ uploadErrorMessage: {
978
+ classPropertyName: "uploadErrorMessage",
979
+ publicName: "uploadErrorMessage",
980
+ isSignal: true,
981
+ isRequired: false,
982
+ transformFunction: null
983
+ },
984
+ networkErrorMessage: {
985
+ classPropertyName: "networkErrorMessage",
986
+ publicName: "networkErrorMessage",
987
+ isSignal: true,
988
+ isRequired: false,
989
+ transformFunction: null
990
+ },
991
+ httpErrorMessage: {
992
+ classPropertyName: "httpErrorMessage",
993
+ publicName: "httpErrorMessage",
994
+ isSignal: true,
995
+ isRequired: false,
996
+ transformFunction: null
997
+ },
998
+ fileTemplate: {
999
+ classPropertyName: "fileTemplate",
1000
+ publicName: "fileTemplate",
1001
+ isSignal: true,
1002
+ isRequired: false,
1003
+ transformFunction: null
1004
+ },
1005
+ fileActionsTemplate: {
1006
+ classPropertyName: "fileActionsTemplate",
1007
+ publicName: "fileActionsTemplate",
1008
+ isSignal: true,
1009
+ isRequired: false,
1010
+ transformFunction: null
1011
+ },
1012
+ contentTemplate: {
1013
+ classPropertyName: "contentTemplate",
1014
+ publicName: "contentTemplate",
1015
+ isSignal: true,
1016
+ isRequired: false,
1017
+ transformFunction: null
1018
+ },
1019
+ toolbarTemplate: {
1020
+ classPropertyName: "toolbarTemplate",
1021
+ publicName: "toolbarTemplate",
1022
+ isSignal: true,
1023
+ isRequired: false,
1024
+ transformFunction: null
1025
+ }
1026
+ },
1027
+ outputs: {
1028
+ selected: "selected",
1029
+ filesChange: "filesChange",
1030
+ uploadHandler: "uploadHandler",
1031
+ uploaded: "uploaded",
1032
+ uploadError: "uploadError",
1033
+ removed: "removed",
1034
+ cleared: "cleared",
1035
+ fileOpen: "fileOpen"
1036
+ },
1037
+ viewQueries: [{
1038
+ propertyName: "fileInput",
1039
+ first: true,
1040
+ predicate: ["fileInput"],
1041
+ descendants: true,
1042
+ isSignal: true
1043
+ }, {
1044
+ propertyName: "formValueInput",
1045
+ first: true,
1046
+ predicate: ["formValue"],
1047
+ descendants: true,
1048
+ isSignal: true
1049
+ }],
1050
+ ngImport: i0,
1051
+ template: "<div\n [class]=\"classes()\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (drop)=\"onDrop($event)\"\n>\n <!-- Real native control (visually hidden, keeps keyboard + screen-reader support) -->\n <input\n #fileInput\n class=\"ui-file-upload-input\"\n type=\"file\"\n [id]=\"inputId\"\n [attr.accept]=\"accept() || null\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"ariaLabel() || null\"\n (change)=\"onInputChange($event)\"\n />\n @if (name()) {\n <input\n #formValue\n type=\"file\"\n hidden\n [attr.name]=\"name()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n />\n }\n\n @if (mode() === 'field') {\n <!-- Field mode: compact summary + Browse trigger (whole label opens picker) -->\n <label class=\"ui-file-upload-field\" [attr.for]=\"inputId\" [attr.data-ripple]=\"ripple() ? 'on' : 'off'\">\n <span class=\"ui-file-upload-field-text\" [class._placeholder]=\"!hasFiles()\">{{\n fieldSummary()\n }}</span>\n <span class=\"ui-file-upload-browse\" aria-hidden=\"true\">{{ browseLabel() }}</span>\n </label>\n } @else {\n <!-- Drag mode: full drop zone -->\n <label class=\"ui-file-upload-zone\" [attr.for]=\"inputId\" [attr.data-ripple]=\"ripple() ? 'on' : 'off'\">\n <ui-icon class=\"ui-file-upload-zone-icon\" name=\"cloud-arrow-up\" size=\"lg\" />\n <span class=\"ui-file-upload-zone-content\">\n <span class=\"ui-file-upload-zone-title\">\n <span class=\"ui-file-upload-zone-link\">{{ dragLinkLabel() }}</span>\n <span class=\"ui-file-upload-zone-prompt\">{{ dragPromptLabel() }}</span>\n </span>\n @if (hint(); as h) {\n <span class=\"ui-file-upload-zone-hint\">{{ h }}</span>\n }\n </span>\n </label>\n\n <!-- Toolbar (custom, or default Upload/Clear actions) -->\n @if (toolbarTemplate(); as tpl) {\n <div class=\"ui-file-upload-toolbar\">\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: files(),\n choose: chooseFn,\n upload: uploadFn,\n clear: clearFn,\n }\"\n />\n </div>\n } @else if (showControls() && hasLocalFiles()) {\n <div class=\"ui-file-upload-toolbar\">\n @if (!auto()) {\n <ui-button\n [ripple]=\"ripple()\"\n [label]=\"uploadLabel()\"\n [size]=\"size() === 'small' ? 'small' : 'default'\"\n icon=\"cloud-arrow-up\"\n [disabled]=\"!canUpload()\"\n (buttonClick)=\"upload()\"\n />\n }\n <ui-button\n [ripple]=\"ripple()\"\n [label]=\"cancelLabel()\"\n level=\"low\"\n [size]=\"size() === 'small' ? 'small' : 'default'\"\n icon=\"xmark\"\n (buttonClick)=\"clear()\"\n />\n </div>\n }\n }\n\n <!-- Content section: the file list -->\n @if (contentTemplate(); as tpl) {\n <div class=\"ui-file-upload-content\">\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: files(), remove: removeFn, clear: clearFn }\"\n />\n </div>\n } @else if (showFileList() && hasFiles()) {\n <ul class=\"ui-file-upload-content\" role=\"list\">\n @for (f of files(); track f.id) {\n <li>\n @if (fileTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: f, remove: removeFn, open: openFn }\"\n />\n } @else {\n <ui-file-upload-list\n [file]=\"f\"\n [size]=\"size()\"\n [openable]=\"openable()\"\n (remove)=\"remove($event)\"\n (open)=\"fileOpen.emit($event)\"\n >\n @if (fileActionsTemplate(); as actions) {\n <ng-container\n [ngTemplateOutlet]=\"actions\"\n [ngTemplateOutletContext]=\"{ $implicit: f, remove: removeFn, open: openFn }\"\n />\n }\n </ui-file-upload-list>\n }\n </li>\n }\n </ul>\n }\n\n @if (showTotal()) {\n <p class=\"ui-file-upload-total\" aria-live=\"polite\">{{ totalSummary() }}</p>\n }\n\n <!-- Validation messages (assertive live region) -->\n @if (messages().length) {\n <div class=\"ui-file-upload-messages\" role=\"alert\" aria-live=\"assertive\">\n @for (msg of messages(); track msg) {\n <p class=\"ui-file-upload-message\">{{ msg }}</p>\n }\n </div>\n }\n</div>\n",
1052
+ styles: [".ui-file-upload{display:flex;flex-direction:column;gap:var(--ui-file-upload-gap, var(--units-default));width:100%;font-family:var(--ui-file-upload-font-family, var(--fontfamily-base))}.ui-file-upload-input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.ui-file-upload-field{display:flex;align-items:center;justify-content:space-between;gap:var(--ui-file-upload-field-gap, var(--units-sm));height:var(--ui-file-upload-field-height, var(--ui-form-field-height, var(--size-components-default)));padding-left:var(--ui-file-upload-field-padding-x, var(--units-md));overflow:hidden;background-color:var(--ui-file-upload-surface, var(--form-high-surface-default));border:var(--ui-file-upload-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-file-upload-stroke, var(--form-high-stroke-default));border-radius:var(--ui-file-upload-radius, var(--ui-form-field-radius, var(--radius-sm)));color:var(--ui-file-upload-color, var(--form-high-content-default));cursor:pointer;transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),border-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),box-shadow var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-file-upload-field:hover{background-color:var(--ui-file-upload-surface-hover, var(--form-high-surface-hover));border-color:var(--ui-file-upload-stroke-hover, var(--form-high-stroke-hover))}.ui-file-upload._small .ui-file-upload-field{height:var(--ui-file-upload-field-height-small, var(--ui-form-field-height-small, var(--size-components-sm)))}.ui-file-upload-field-text{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--ui-file-upload-field-font-size, var(--size-typography-text-default));font-weight:var(--ui-file-upload-field-text-weight, var(--weight-regular))}.ui-file-upload-field-text._placeholder{color:var(--ui-file-upload-color, var(--form-high-content-default));opacity:var(--ui-file-upload-placeholder-opacity, .75)}.ui-file-upload._small .ui-file-upload-field-text{font-size:var(--ui-file-upload-field-font-size-small, var(--size-typography-text-md))}.ui-file-upload-browse{display:inline-flex;align-items:center;align-self:stretch;flex:none;padding:0 var(--ui-file-upload-browse-padding-x, var(--units-default));background-color:var(--ui-file-upload-browse-surface, var(--actions-high-surface-default));color:var(--ui-file-upload-browse-color, var(--actions-high-content-default));font-size:var(--ui-file-upload-browse-font-size, var(--size-typography-text-default));font-weight:var(--ui-file-upload-browse-weight, var(--weight-bold))}.ui-file-upload._small .ui-file-upload-browse{padding:0 var(--ui-file-upload-browse-padding-x-small, var(--units-md));font-size:var(--ui-file-upload-browse-font-size-small, var(--size-typography-text-md))}.ui-file-upload-field:hover .ui-file-upload-browse{background-color:var(--ui-file-upload-browse-surface-hover, var(--actions-high-surface-hover))}.ui-file-upload-zone{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--ui-file-upload-zone-gap, var(--units-lg));min-height:var(--ui-file-upload-zone-min-height, 112px);padding:var(--ui-file-upload-zone-padding, var(--units-default));background-color:var(--ui-file-upload-surface, var(--form-high-surface-default));border:var(--ui-file-upload-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) dashed var(--ui-file-upload-stroke, var(--form-high-stroke-default));border-radius:var(--ui-file-upload-radius, var(--ui-form-field-radius, var(--radius-sm)));color:var(--ui-file-upload-color, var(--form-high-content-default));text-align:center;cursor:pointer;transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),border-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),box-shadow var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-file-upload-zone:hover{background-color:var(--ui-file-upload-surface-hover, var(--form-high-surface-hover));border-color:var(--ui-file-upload-stroke-hover, var(--form-high-stroke-hover))}.ui-file-upload._small .ui-file-upload-zone{gap:var(--ui-file-upload-zone-gap-small, var(--units-sm));min-height:var(--ui-file-upload-zone-min-height-small, 94px)}.ui-file-upload._dragging .ui-file-upload-zone{background-color:var(--ui-file-upload-surface-dragging, var(--form-high-surface-focused));border-style:solid;border-color:var(--ui-file-upload-stroke-dragging, var(--form-high-stroke-focused))}.ui-file-upload-zone-icon{color:var(--ui-file-upload-color, var(--form-high-content-default));line-height:0}.ui-file-upload-zone-content{display:flex;flex-direction:column;align-items:center;gap:var(--ui-file-upload-zone-content-gap, var(--units-xs))}.ui-file-upload-zone-title{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--ui-file-upload-zone-title-gap, var(--units-2xs));font-size:var(--ui-file-upload-zone-title-font-size, var(--size-typography-text-default));font-weight:var(--ui-file-upload-zone-title-weight, var(--weight-regular))}.ui-file-upload._small .ui-file-upload-zone-title{font-size:var(--ui-file-upload-zone-title-font-size-small, var(--size-typography-text-md))}.ui-file-upload-zone-link{color:var(--ui-file-upload-zone-link-color, var(--actions-low-content-default));font-weight:var(--ui-file-upload-zone-link-weight, var(--weight-bold));text-decoration:underline}.ui-file-upload-zone-prompt{color:var(--ui-file-upload-color, var(--form-high-content-default))}.ui-file-upload-zone-hint{color:var(--ui-file-upload-zone-hint-color, var(--global-text-muted));font-size:var(--ui-file-upload-zone-hint-font-size, var(--size-typography-text-md))}.ui-file-upload._small .ui-file-upload-zone-hint{font-size:var(--ui-file-upload-zone-hint-font-size-small, var(--size-typography-text-sm))}.ui-file-upload-input:focus-visible~.ui-file-upload-field,.ui-file-upload-input:focus-visible~.ui-file-upload-zone{outline:none;border-color:var(--ui-file-upload-stroke-focus, var(--form-high-stroke-focused));box-shadow:0 0 0 var(--ui-file-upload-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-file-upload-focus-ring-color, var(--form-high-stroke-focused))}.ui-file-upload-toolbar{display:flex;flex-wrap:wrap;gap:var(--ui-file-upload-toolbar-gap, var(--units-sm))}.ui-file-upload-content{display:flex;flex-direction:column;gap:var(--ui-file-upload-content-gap, var(--units-sm));width:100%;margin:0;padding:0;list-style:none}.ui-file-upload-content li{display:block}.ui-file-upload-total{margin:0;color:var(--ui-file-upload-total-color, var(--global-text-muted));font-size:var(--ui-file-upload-total-font-size, var(--size-typography-text-md))}.ui-file-upload-messages{display:flex;flex-direction:column;gap:var(--ui-file-upload-messages-gap, var(--units-2xs))}.ui-file-upload-message{margin:0;color:var(--ui-file-upload-message-color, var(--form-error-content-default));font-size:var(--ui-file-upload-message-font-size, var(--size-typography-text-md))}.ui-file-upload._disabled .ui-file-upload-field,.ui-file-upload._disabled .ui-file-upload-zone{background-color:var(--ui-file-upload-surface-disabled, var(--form-high-surface-disabled));border-color:var(--ui-file-upload-stroke-disabled, var(--form-high-stroke-disabled));color:var(--ui-file-upload-color-disabled, var(--form-high-content-disabled));cursor:not-allowed;pointer-events:none}.ui-file-upload._disabled .ui-file-upload-browse{background-color:var(--ui-file-upload-browse-surface-disabled, var(--actions-high-surface-disabled));color:var(--ui-file-upload-browse-color-disabled, var(--actions-high-content-disabled))}\n"],
1053
+ dependencies: [
1054
+ {
1055
+ kind: "directive",
1056
+ type: NgTemplateOutlet,
1057
+ selector: "[ngTemplateOutlet]",
1058
+ inputs: [
1059
+ "ngTemplateOutletContext",
1060
+ "ngTemplateOutlet",
1061
+ "ngTemplateOutletInjector"
1062
+ ]
1063
+ },
1064
+ {
1065
+ kind: "component",
1066
+ type: UiIcon,
1067
+ selector: "ui-icon",
1068
+ inputs: [
1069
+ "name",
1070
+ "size",
1071
+ "type",
1072
+ "family",
1073
+ "decorative",
1074
+ "ariaLabel"
1075
+ ]
1076
+ },
1077
+ {
1078
+ kind: "component",
1079
+ type: UiButton,
1080
+ selector: "ui-button",
1081
+ inputs: [
1082
+ "label",
1083
+ "ariaLabel",
1084
+ "type",
1085
+ "level",
1086
+ "variant",
1087
+ "onColor",
1088
+ "size",
1089
+ "icon",
1090
+ "iconPos",
1091
+ "iconOnly",
1092
+ "loading",
1093
+ "loadingIcon",
1094
+ "expanded",
1095
+ "rounded",
1096
+ "disabled",
1097
+ "ripple",
1098
+ "tabindex",
1099
+ "buttonProps",
1100
+ "iconTemplate",
1101
+ "loadingIconTemplate",
1102
+ "href",
1103
+ "routerLink",
1104
+ "target",
1105
+ "rel"
1106
+ ],
1107
+ outputs: [
1108
+ "buttonClick",
1109
+ "buttonFocus",
1110
+ "buttonBlur"
1111
+ ]
1112
+ },
1113
+ {
1114
+ kind: "component",
1115
+ type: UiFileUploadList,
1116
+ selector: "ui-file-upload-list",
1117
+ inputs: [
1118
+ "file",
1119
+ "size",
1120
+ "icon",
1121
+ "removable",
1122
+ "openable",
1123
+ "openLabel",
1124
+ "removeAriaLabel",
1125
+ "failedLabel",
1126
+ "uploadingLabel",
1127
+ "progressLabel"
1128
+ ],
1129
+ outputs: ["remove", "open"]
1130
+ }
1131
+ ]
1132
+ });
1133
+ }
1134
+ };
1135
+ i0.ɵɵngDeclareClassMetadata({
1136
+ minVersion: "12.0.0",
1137
+ version: "22.3.0",
1138
+ ngImport: i0,
1139
+ type: UiFileUpload,
1140
+ decorators: [{
1141
+ type: Component,
1142
+ args: [{
1143
+ selector: "ui-file-upload",
1144
+ imports: [
1145
+ NgTemplateOutlet,
1146
+ UiIcon,
1147
+ UiButton,
1148
+ UiFileUploadList
1149
+ ],
1150
+ template: "<div\n [class]=\"classes()\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (drop)=\"onDrop($event)\"\n>\n <!-- Real native control (visually hidden, keeps keyboard + screen-reader support) -->\n <input\n #fileInput\n class=\"ui-file-upload-input\"\n type=\"file\"\n [id]=\"inputId\"\n [attr.accept]=\"accept() || null\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"ariaLabel() || null\"\n (change)=\"onInputChange($event)\"\n />\n @if (name()) {\n <input\n #formValue\n type=\"file\"\n hidden\n [attr.name]=\"name()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n />\n }\n\n @if (mode() === 'field') {\n <!-- Field mode: compact summary + Browse trigger (whole label opens picker) -->\n <label class=\"ui-file-upload-field\" [attr.for]=\"inputId\" [attr.data-ripple]=\"ripple() ? 'on' : 'off'\">\n <span class=\"ui-file-upload-field-text\" [class._placeholder]=\"!hasFiles()\">{{\n fieldSummary()\n }}</span>\n <span class=\"ui-file-upload-browse\" aria-hidden=\"true\">{{ browseLabel() }}</span>\n </label>\n } @else {\n <!-- Drag mode: full drop zone -->\n <label class=\"ui-file-upload-zone\" [attr.for]=\"inputId\" [attr.data-ripple]=\"ripple() ? 'on' : 'off'\">\n <ui-icon class=\"ui-file-upload-zone-icon\" name=\"cloud-arrow-up\" size=\"lg\" />\n <span class=\"ui-file-upload-zone-content\">\n <span class=\"ui-file-upload-zone-title\">\n <span class=\"ui-file-upload-zone-link\">{{ dragLinkLabel() }}</span>\n <span class=\"ui-file-upload-zone-prompt\">{{ dragPromptLabel() }}</span>\n </span>\n @if (hint(); as h) {\n <span class=\"ui-file-upload-zone-hint\">{{ h }}</span>\n }\n </span>\n </label>\n\n <!-- Toolbar (custom, or default Upload/Clear actions) -->\n @if (toolbarTemplate(); as tpl) {\n <div class=\"ui-file-upload-toolbar\">\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: files(),\n choose: chooseFn,\n upload: uploadFn,\n clear: clearFn,\n }\"\n />\n </div>\n } @else if (showControls() && hasLocalFiles()) {\n <div class=\"ui-file-upload-toolbar\">\n @if (!auto()) {\n <ui-button\n [ripple]=\"ripple()\"\n [label]=\"uploadLabel()\"\n [size]=\"size() === 'small' ? 'small' : 'default'\"\n icon=\"cloud-arrow-up\"\n [disabled]=\"!canUpload()\"\n (buttonClick)=\"upload()\"\n />\n }\n <ui-button\n [ripple]=\"ripple()\"\n [label]=\"cancelLabel()\"\n level=\"low\"\n [size]=\"size() === 'small' ? 'small' : 'default'\"\n icon=\"xmark\"\n (buttonClick)=\"clear()\"\n />\n </div>\n }\n }\n\n <!-- Content section: the file list -->\n @if (contentTemplate(); as tpl) {\n <div class=\"ui-file-upload-content\">\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: files(), remove: removeFn, clear: clearFn }\"\n />\n </div>\n } @else if (showFileList() && hasFiles()) {\n <ul class=\"ui-file-upload-content\" role=\"list\">\n @for (f of files(); track f.id) {\n <li>\n @if (fileTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: f, remove: removeFn, open: openFn }\"\n />\n } @else {\n <ui-file-upload-list\n [file]=\"f\"\n [size]=\"size()\"\n [openable]=\"openable()\"\n (remove)=\"remove($event)\"\n (open)=\"fileOpen.emit($event)\"\n >\n @if (fileActionsTemplate(); as actions) {\n <ng-container\n [ngTemplateOutlet]=\"actions\"\n [ngTemplateOutletContext]=\"{ $implicit: f, remove: removeFn, open: openFn }\"\n />\n }\n </ui-file-upload-list>\n }\n </li>\n }\n </ul>\n }\n\n @if (showTotal()) {\n <p class=\"ui-file-upload-total\" aria-live=\"polite\">{{ totalSummary() }}</p>\n }\n\n <!-- Validation messages (assertive live region) -->\n @if (messages().length) {\n <div class=\"ui-file-upload-messages\" role=\"alert\" aria-live=\"assertive\">\n @for (msg of messages(); track msg) {\n <p class=\"ui-file-upload-message\">{{ msg }}</p>\n }\n </div>\n }\n</div>\n",
1151
+ styles: [".ui-file-upload{display:flex;flex-direction:column;gap:var(--ui-file-upload-gap, var(--units-default));width:100%;font-family:var(--ui-file-upload-font-family, var(--fontfamily-base))}.ui-file-upload-input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.ui-file-upload-field{display:flex;align-items:center;justify-content:space-between;gap:var(--ui-file-upload-field-gap, var(--units-sm));height:var(--ui-file-upload-field-height, var(--ui-form-field-height, var(--size-components-default)));padding-left:var(--ui-file-upload-field-padding-x, var(--units-md));overflow:hidden;background-color:var(--ui-file-upload-surface, var(--form-high-surface-default));border:var(--ui-file-upload-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-file-upload-stroke, var(--form-high-stroke-default));border-radius:var(--ui-file-upload-radius, var(--ui-form-field-radius, var(--radius-sm)));color:var(--ui-file-upload-color, var(--form-high-content-default));cursor:pointer;transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),border-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),box-shadow var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-file-upload-field:hover{background-color:var(--ui-file-upload-surface-hover, var(--form-high-surface-hover));border-color:var(--ui-file-upload-stroke-hover, var(--form-high-stroke-hover))}.ui-file-upload._small .ui-file-upload-field{height:var(--ui-file-upload-field-height-small, var(--ui-form-field-height-small, var(--size-components-sm)))}.ui-file-upload-field-text{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--ui-file-upload-field-font-size, var(--size-typography-text-default));font-weight:var(--ui-file-upload-field-text-weight, var(--weight-regular))}.ui-file-upload-field-text._placeholder{color:var(--ui-file-upload-color, var(--form-high-content-default));opacity:var(--ui-file-upload-placeholder-opacity, .75)}.ui-file-upload._small .ui-file-upload-field-text{font-size:var(--ui-file-upload-field-font-size-small, var(--size-typography-text-md))}.ui-file-upload-browse{display:inline-flex;align-items:center;align-self:stretch;flex:none;padding:0 var(--ui-file-upload-browse-padding-x, var(--units-default));background-color:var(--ui-file-upload-browse-surface, var(--actions-high-surface-default));color:var(--ui-file-upload-browse-color, var(--actions-high-content-default));font-size:var(--ui-file-upload-browse-font-size, var(--size-typography-text-default));font-weight:var(--ui-file-upload-browse-weight, var(--weight-bold))}.ui-file-upload._small .ui-file-upload-browse{padding:0 var(--ui-file-upload-browse-padding-x-small, var(--units-md));font-size:var(--ui-file-upload-browse-font-size-small, var(--size-typography-text-md))}.ui-file-upload-field:hover .ui-file-upload-browse{background-color:var(--ui-file-upload-browse-surface-hover, var(--actions-high-surface-hover))}.ui-file-upload-zone{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--ui-file-upload-zone-gap, var(--units-lg));min-height:var(--ui-file-upload-zone-min-height, 112px);padding:var(--ui-file-upload-zone-padding, var(--units-default));background-color:var(--ui-file-upload-surface, var(--form-high-surface-default));border:var(--ui-file-upload-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) dashed var(--ui-file-upload-stroke, var(--form-high-stroke-default));border-radius:var(--ui-file-upload-radius, var(--ui-form-field-radius, var(--radius-sm)));color:var(--ui-file-upload-color, var(--form-high-content-default));text-align:center;cursor:pointer;transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),border-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),box-shadow var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-file-upload-zone:hover{background-color:var(--ui-file-upload-surface-hover, var(--form-high-surface-hover));border-color:var(--ui-file-upload-stroke-hover, var(--form-high-stroke-hover))}.ui-file-upload._small .ui-file-upload-zone{gap:var(--ui-file-upload-zone-gap-small, var(--units-sm));min-height:var(--ui-file-upload-zone-min-height-small, 94px)}.ui-file-upload._dragging .ui-file-upload-zone{background-color:var(--ui-file-upload-surface-dragging, var(--form-high-surface-focused));border-style:solid;border-color:var(--ui-file-upload-stroke-dragging, var(--form-high-stroke-focused))}.ui-file-upload-zone-icon{color:var(--ui-file-upload-color, var(--form-high-content-default));line-height:0}.ui-file-upload-zone-content{display:flex;flex-direction:column;align-items:center;gap:var(--ui-file-upload-zone-content-gap, var(--units-xs))}.ui-file-upload-zone-title{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--ui-file-upload-zone-title-gap, var(--units-2xs));font-size:var(--ui-file-upload-zone-title-font-size, var(--size-typography-text-default));font-weight:var(--ui-file-upload-zone-title-weight, var(--weight-regular))}.ui-file-upload._small .ui-file-upload-zone-title{font-size:var(--ui-file-upload-zone-title-font-size-small, var(--size-typography-text-md))}.ui-file-upload-zone-link{color:var(--ui-file-upload-zone-link-color, var(--actions-low-content-default));font-weight:var(--ui-file-upload-zone-link-weight, var(--weight-bold));text-decoration:underline}.ui-file-upload-zone-prompt{color:var(--ui-file-upload-color, var(--form-high-content-default))}.ui-file-upload-zone-hint{color:var(--ui-file-upload-zone-hint-color, var(--global-text-muted));font-size:var(--ui-file-upload-zone-hint-font-size, var(--size-typography-text-md))}.ui-file-upload._small .ui-file-upload-zone-hint{font-size:var(--ui-file-upload-zone-hint-font-size-small, var(--size-typography-text-sm))}.ui-file-upload-input:focus-visible~.ui-file-upload-field,.ui-file-upload-input:focus-visible~.ui-file-upload-zone{outline:none;border-color:var(--ui-file-upload-stroke-focus, var(--form-high-stroke-focused));box-shadow:0 0 0 var(--ui-file-upload-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-file-upload-focus-ring-color, var(--form-high-stroke-focused))}.ui-file-upload-toolbar{display:flex;flex-wrap:wrap;gap:var(--ui-file-upload-toolbar-gap, var(--units-sm))}.ui-file-upload-content{display:flex;flex-direction:column;gap:var(--ui-file-upload-content-gap, var(--units-sm));width:100%;margin:0;padding:0;list-style:none}.ui-file-upload-content li{display:block}.ui-file-upload-total{margin:0;color:var(--ui-file-upload-total-color, var(--global-text-muted));font-size:var(--ui-file-upload-total-font-size, var(--size-typography-text-md))}.ui-file-upload-messages{display:flex;flex-direction:column;gap:var(--ui-file-upload-messages-gap, var(--units-2xs))}.ui-file-upload-message{margin:0;color:var(--ui-file-upload-message-color, var(--form-error-content-default));font-size:var(--ui-file-upload-message-font-size, var(--size-typography-text-md))}.ui-file-upload._disabled .ui-file-upload-field,.ui-file-upload._disabled .ui-file-upload-zone{background-color:var(--ui-file-upload-surface-disabled, var(--form-high-surface-disabled));border-color:var(--ui-file-upload-stroke-disabled, var(--form-high-stroke-disabled));color:var(--ui-file-upload-color-disabled, var(--form-high-content-disabled));cursor:not-allowed;pointer-events:none}.ui-file-upload._disabled .ui-file-upload-browse{background-color:var(--ui-file-upload-browse-surface-disabled, var(--actions-high-surface-disabled));color:var(--ui-file-upload-browse-color-disabled, var(--actions-high-content-disabled))}\n"]
1152
+ }]
1153
+ }],
1154
+ ctorParameters: () => [],
1155
+ propDecorators: {
1156
+ mode: [{
1157
+ type: i0.Input,
1158
+ args: [{
1159
+ isSignal: true,
1160
+ alias: "mode",
1161
+ required: false
1162
+ }]
1163
+ }],
1164
+ size: [{
1165
+ type: i0.Input,
1166
+ args: [{
1167
+ isSignal: true,
1168
+ alias: "size",
1169
+ required: false
1170
+ }]
1171
+ }],
1172
+ name: [{
1173
+ type: i0.Input,
1174
+ args: [{
1175
+ isSignal: true,
1176
+ alias: "name",
1177
+ required: false
1178
+ }]
1179
+ }],
1180
+ multiple: [{
1181
+ type: i0.Input,
1182
+ args: [{
1183
+ isSignal: true,
1184
+ alias: "multiple",
1185
+ required: false
1186
+ }]
1187
+ }],
1188
+ ripple: [{
1189
+ type: i0.Input,
1190
+ args: [{
1191
+ isSignal: true,
1192
+ alias: "ripple",
1193
+ required: false
1194
+ }]
1195
+ }],
1196
+ accept: [{
1197
+ type: i0.Input,
1198
+ args: [{
1199
+ isSignal: true,
1200
+ alias: "accept",
1201
+ required: false
1202
+ }]
1203
+ }],
1204
+ maxFileSize: [{
1205
+ type: i0.Input,
1206
+ args: [{
1207
+ isSignal: true,
1208
+ alias: "maxFileSize",
1209
+ required: false
1210
+ }]
1211
+ }],
1212
+ maxTotalSize: [{
1213
+ type: i0.Input,
1214
+ args: [{
1215
+ isSignal: true,
1216
+ alias: "maxTotalSize",
1217
+ required: false
1218
+ }]
1219
+ }],
1220
+ fileLimit: [{
1221
+ type: i0.Input,
1222
+ args: [{
1223
+ isSignal: true,
1224
+ alias: "fileLimit",
1225
+ required: false
1226
+ }]
1227
+ }],
1228
+ disabled: [{
1229
+ type: i0.Input,
1230
+ args: [{
1231
+ isSignal: true,
1232
+ alias: "disabled",
1233
+ required: false
1234
+ }]
1235
+ }],
1236
+ initialFiles: [{
1237
+ type: i0.Input,
1238
+ args: [{
1239
+ isSignal: true,
1240
+ alias: "initialFiles",
1241
+ required: false
1242
+ }]
1243
+ }],
1244
+ auto: [{
1245
+ type: i0.Input,
1246
+ args: [{
1247
+ isSignal: true,
1248
+ alias: "auto",
1249
+ required: false
1250
+ }]
1251
+ }],
1252
+ customUpload: [{
1253
+ type: i0.Input,
1254
+ args: [{
1255
+ isSignal: true,
1256
+ alias: "customUpload",
1257
+ required: false
1258
+ }]
1259
+ }],
1260
+ url: [{
1261
+ type: i0.Input,
1262
+ args: [{
1263
+ isSignal: true,
1264
+ alias: "url",
1265
+ required: false
1266
+ }]
1267
+ }],
1268
+ method: [{
1269
+ type: i0.Input,
1270
+ args: [{
1271
+ isSignal: true,
1272
+ alias: "method",
1273
+ required: false
1274
+ }]
1275
+ }],
1276
+ fieldName: [{
1277
+ type: i0.Input,
1278
+ args: [{
1279
+ isSignal: true,
1280
+ alias: "fieldName",
1281
+ required: false
1282
+ }]
1283
+ }],
1284
+ withCredentials: [{
1285
+ type: i0.Input,
1286
+ args: [{
1287
+ isSignal: true,
1288
+ alias: "withCredentials",
1289
+ required: false
1290
+ }]
1291
+ }],
1292
+ showFileList: [{
1293
+ type: i0.Input,
1294
+ args: [{
1295
+ isSignal: true,
1296
+ alias: "showFileList",
1297
+ required: false
1298
+ }]
1299
+ }],
1300
+ showControls: [{
1301
+ type: i0.Input,
1302
+ args: [{
1303
+ isSignal: true,
1304
+ alias: "showControls",
1305
+ required: false
1306
+ }]
1307
+ }],
1308
+ showTotal: [{
1309
+ type: i0.Input,
1310
+ args: [{
1311
+ isSignal: true,
1312
+ alias: "showTotal",
1313
+ required: false
1314
+ }]
1315
+ }],
1316
+ openable: [{
1317
+ type: i0.Input,
1318
+ args: [{
1319
+ isSignal: true,
1320
+ alias: "openable",
1321
+ required: false
1322
+ }]
1323
+ }],
1324
+ browseLabel: [{
1325
+ type: i0.Input,
1326
+ args: [{
1327
+ isSignal: true,
1328
+ alias: "browseLabel",
1329
+ required: false
1330
+ }]
1331
+ }],
1332
+ chooseLabel: [{
1333
+ type: i0.Input,
1334
+ args: [{
1335
+ isSignal: true,
1336
+ alias: "chooseLabel",
1337
+ required: false
1338
+ }]
1339
+ }],
1340
+ uploadLabel: [{
1341
+ type: i0.Input,
1342
+ args: [{
1343
+ isSignal: true,
1344
+ alias: "uploadLabel",
1345
+ required: false
1346
+ }]
1347
+ }],
1348
+ cancelLabel: [{
1349
+ type: i0.Input,
1350
+ args: [{
1351
+ isSignal: true,
1352
+ alias: "cancelLabel",
1353
+ required: false
1354
+ }]
1355
+ }],
1356
+ dragLinkLabel: [{
1357
+ type: i0.Input,
1358
+ args: [{
1359
+ isSignal: true,
1360
+ alias: "dragLinkLabel",
1361
+ required: false
1362
+ }]
1363
+ }],
1364
+ dragPromptLabel: [{
1365
+ type: i0.Input,
1366
+ args: [{
1367
+ isSignal: true,
1368
+ alias: "dragPromptLabel",
1369
+ required: false
1370
+ }]
1371
+ }],
1372
+ hint: [{
1373
+ type: i0.Input,
1374
+ args: [{
1375
+ isSignal: true,
1376
+ alias: "hint",
1377
+ required: false
1378
+ }]
1379
+ }],
1380
+ ariaLabel: [{
1381
+ type: i0.Input,
1382
+ args: [{
1383
+ isSignal: true,
1384
+ alias: "ariaLabel",
1385
+ required: false
1386
+ }]
1387
+ }],
1388
+ filesSummaryLabel: [{
1389
+ type: i0.Input,
1390
+ args: [{
1391
+ isSignal: true,
1392
+ alias: "filesSummaryLabel",
1393
+ required: false
1394
+ }]
1395
+ }],
1396
+ invalidTypeMessage: [{
1397
+ type: i0.Input,
1398
+ args: [{
1399
+ isSignal: true,
1400
+ alias: "invalidTypeMessage",
1401
+ required: false
1402
+ }]
1403
+ }],
1404
+ invalidSizeMessage: [{
1405
+ type: i0.Input,
1406
+ args: [{
1407
+ isSignal: true,
1408
+ alias: "invalidSizeMessage",
1409
+ required: false
1410
+ }]
1411
+ }],
1412
+ totalLabel: [{
1413
+ type: i0.Input,
1414
+ args: [{
1415
+ isSignal: true,
1416
+ alias: "totalLabel",
1417
+ required: false
1418
+ }]
1419
+ }],
1420
+ totalSizeExceededMessage: [{
1421
+ type: i0.Input,
1422
+ args: [{
1423
+ isSignal: true,
1424
+ alias: "totalSizeExceededMessage",
1425
+ required: false
1426
+ }]
1427
+ }],
1428
+ limitReachedMessage: [{
1429
+ type: i0.Input,
1430
+ args: [{
1431
+ isSignal: true,
1432
+ alias: "limitReachedMessage",
1433
+ required: false
1434
+ }]
1435
+ }],
1436
+ uploadErrorMessage: [{
1437
+ type: i0.Input,
1438
+ args: [{
1439
+ isSignal: true,
1440
+ alias: "uploadErrorMessage",
1441
+ required: false
1442
+ }]
1443
+ }],
1444
+ networkErrorMessage: [{
1445
+ type: i0.Input,
1446
+ args: [{
1447
+ isSignal: true,
1448
+ alias: "networkErrorMessage",
1449
+ required: false
1450
+ }]
1451
+ }],
1452
+ httpErrorMessage: [{
1453
+ type: i0.Input,
1454
+ args: [{
1455
+ isSignal: true,
1456
+ alias: "httpErrorMessage",
1457
+ required: false
1458
+ }]
1459
+ }],
1460
+ fileTemplate: [{
1461
+ type: i0.Input,
1462
+ args: [{
1463
+ isSignal: true,
1464
+ alias: "fileTemplate",
1465
+ required: false
1466
+ }]
1467
+ }],
1468
+ fileActionsTemplate: [{
1469
+ type: i0.Input,
1470
+ args: [{
1471
+ isSignal: true,
1472
+ alias: "fileActionsTemplate",
1473
+ required: false
1474
+ }]
1475
+ }],
1476
+ contentTemplate: [{
1477
+ type: i0.Input,
1478
+ args: [{
1479
+ isSignal: true,
1480
+ alias: "contentTemplate",
1481
+ required: false
1482
+ }]
1483
+ }],
1484
+ toolbarTemplate: [{
1485
+ type: i0.Input,
1486
+ args: [{
1487
+ isSignal: true,
1488
+ alias: "toolbarTemplate",
1489
+ required: false
1490
+ }]
1491
+ }],
1492
+ selected: [{
1493
+ type: i0.Output,
1494
+ args: ["selected"]
1495
+ }],
1496
+ filesChange: [{
1497
+ type: i0.Output,
1498
+ args: ["filesChange"]
1499
+ }],
1500
+ uploadHandler: [{
1501
+ type: i0.Output,
1502
+ args: ["uploadHandler"]
1503
+ }],
1504
+ uploaded: [{
1505
+ type: i0.Output,
1506
+ args: ["uploaded"]
1507
+ }],
1508
+ uploadError: [{
1509
+ type: i0.Output,
1510
+ args: ["uploadError"]
1511
+ }],
1512
+ removed: [{
1513
+ type: i0.Output,
1514
+ args: ["removed"]
1515
+ }],
1516
+ cleared: [{
1517
+ type: i0.Output,
1518
+ args: ["cleared"]
1519
+ }],
1520
+ fileOpen: [{
1521
+ type: i0.Output,
1522
+ args: ["fileOpen"]
1523
+ }],
1524
+ fileInput: [{
1525
+ type: i0.ViewChild,
1526
+ args: ["fileInput", { isSignal: true }]
1527
+ }],
1528
+ formValueInput: [{
1529
+ type: i0.ViewChild,
1530
+ args: ["formValue", { isSignal: true }]
1531
+ }]
1532
+ }
1533
+ });
1534
+ function totalSize(files) {
1535
+ return files.reduce((sum, f) => sum + f.size, 0);
1536
+ }
1537
+ export { UiFileUpload, UiFileUploadList, formatFileSize, isFileTypeAccepted, isImageFile, isLocalUploadFile };
591
1538
 
592
- export { UiFileUpload, UiFileUploadList, formatFileSize, isFileTypeAccepted, isImageFile };
593
- //# sourceMappingURL=4sh-ui-kit-forms-ui-file-upload.mjs.map
1539
+ //# sourceMappingURL=4sh-ui-kit-forms-ui-file-upload.mjs.map