@vielzeug/refine 2.2.5 → 2.4.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 (223) hide show
  1. package/dist/accordion-item.cjs +1 -1
  2. package/dist/accordion-item.cjs.map +1 -1
  3. package/dist/accordion-item.js +1 -1
  4. package/dist/accordion-item.js.map +1 -1
  5. package/dist/card.cjs +1 -1
  6. package/dist/card.cjs.map +1 -1
  7. package/dist/card.js +1 -1
  8. package/dist/card.js.map +1 -1
  9. package/dist/carousel.cjs +1 -1
  10. package/dist/carousel.cjs.map +1 -1
  11. package/dist/carousel.js +1 -1
  12. package/dist/carousel.js.map +1 -1
  13. package/dist/chat-message.cjs +9 -9
  14. package/dist/chat-message.cjs.map +1 -1
  15. package/dist/chat-message.js +41 -38
  16. package/dist/chat-message.js.map +1 -1
  17. package/dist/combobox.cjs +9 -7
  18. package/dist/combobox.cjs.map +1 -1
  19. package/dist/combobox.js +55 -48
  20. package/dist/combobox.js.map +1 -1
  21. package/dist/command-palette.cjs +1 -1
  22. package/dist/command-palette.cjs.map +1 -1
  23. package/dist/command-palette.js +1 -1
  24. package/dist/command-palette.js.map +1 -1
  25. package/dist/content/index.d.ts +2 -0
  26. package/dist/content/index.d.ts.map +1 -1
  27. package/dist/content/list/list-item.css.cjs +1 -1
  28. package/dist/content/list/list-item.css.cjs.map +1 -1
  29. package/dist/content/list/list-item.css.js +1 -1
  30. package/dist/content/list/list-item.css.js.map +1 -1
  31. package/dist/content/list/list-item.d.ts +9 -0
  32. package/dist/content/list/list-item.d.ts.map +1 -1
  33. package/dist/content/stats/stats.css.cjs +2 -0
  34. package/dist/content/stats/stats.css.cjs.map +1 -0
  35. package/dist/content/stats/stats.css.js +6 -0
  36. package/dist/content/stats/stats.css.js.map +1 -0
  37. package/dist/content/stats/stats.d.ts +72 -0
  38. package/dist/content/stats/stats.d.ts.map +1 -0
  39. package/dist/core/announcer.cjs +1 -1
  40. package/dist/core/announcer.cjs.map +1 -1
  41. package/dist/core/announcer.d.ts +13 -3
  42. package/dist/core/announcer.d.ts.map +1 -1
  43. package/dist/core/announcer.js +16 -9
  44. package/dist/core/announcer.js.map +1 -1
  45. package/dist/core/auto-resize.cjs +1 -1
  46. package/dist/core/auto-resize.cjs.map +1 -1
  47. package/dist/core/auto-resize.js +1 -1
  48. package/dist/core/auto-resize.js.map +1 -1
  49. package/dist/custom-elements.json +4457 -4161
  50. package/dist/datagrid.cjs +199 -179
  51. package/dist/datagrid.cjs.map +1 -1
  52. package/dist/datagrid.js +435 -321
  53. package/dist/datagrid.js.map +1 -1
  54. package/dist/disclosure/tab-item/tab-item.css.cjs +1 -1
  55. package/dist/disclosure/tab-item/tab-item.css.cjs.map +1 -1
  56. package/dist/disclosure/tab-item/tab-item.css.js +1 -1
  57. package/dist/disclosure/tab-item/tab-item.css.js.map +1 -1
  58. package/dist/disclosure/tab-item/tab-item.d.ts +3 -0
  59. package/dist/disclosure/tab-item/tab-item.d.ts.map +1 -1
  60. package/dist/disclosure/tabs/tabs.css.cjs +1 -1
  61. package/dist/disclosure/tabs/tabs.css.cjs.map +1 -1
  62. package/dist/disclosure/tabs/tabs.css.js +1 -1
  63. package/dist/disclosure/tabs/tabs.css.js.map +1 -1
  64. package/dist/disclosure/tabs/tabs.d.ts +4 -0
  65. package/dist/disclosure/tabs/tabs.d.ts.map +1 -1
  66. package/dist/feedback/typing-indicator/typing-indicator.d.ts +2 -2
  67. package/dist/file-input.cjs +49 -49
  68. package/dist/file-input.cjs.map +1 -1
  69. package/dist/file-input.js +128 -127
  70. package/dist/file-input.js.map +1 -1
  71. package/dist/frameworks/elements.d.ts +2 -1
  72. package/dist/icon.cjs +1 -1
  73. package/dist/icon.cjs.map +1 -1
  74. package/dist/icon.js +1 -1
  75. package/dist/icon.js.map +1 -1
  76. package/dist/input.cjs +5 -4
  77. package/dist/input.cjs.map +1 -1
  78. package/dist/input.js +14 -8
  79. package/dist/input.js.map +1 -1
  80. package/dist/inputs/combobox/combobox-options.cjs +1 -1
  81. package/dist/inputs/combobox/combobox-options.cjs.map +1 -1
  82. package/dist/inputs/combobox/combobox-options.d.ts.map +1 -1
  83. package/dist/inputs/combobox/combobox-options.js +1 -0
  84. package/dist/inputs/combobox/combobox-options.js.map +1 -1
  85. package/dist/inputs/combobox/combobox.css.cjs +1 -1
  86. package/dist/inputs/combobox/combobox.css.cjs.map +1 -1
  87. package/dist/inputs/combobox/combobox.css.js +1 -1
  88. package/dist/inputs/combobox/combobox.css.js.map +1 -1
  89. package/dist/inputs/combobox/combobox.d.ts +1 -0
  90. package/dist/inputs/combobox/combobox.d.ts.map +1 -1
  91. package/dist/inputs/combobox/combobox.types.d.ts +7 -0
  92. package/dist/inputs/combobox/combobox.types.d.ts.map +1 -1
  93. package/dist/inputs/datagrid/datagrid-model.cjs +1 -1
  94. package/dist/inputs/datagrid/datagrid-model.cjs.map +1 -1
  95. package/dist/inputs/datagrid/datagrid-model.d.ts +17 -3
  96. package/dist/inputs/datagrid/datagrid-model.d.ts.map +1 -1
  97. package/dist/inputs/datagrid/datagrid-model.js +93 -70
  98. package/dist/inputs/datagrid/datagrid-model.js.map +1 -1
  99. package/dist/inputs/datagrid/datagrid.css.cjs +1 -1
  100. package/dist/inputs/datagrid/datagrid.css.cjs.map +1 -1
  101. package/dist/inputs/datagrid/datagrid.css.js +1 -1
  102. package/dist/inputs/datagrid/datagrid.css.js.map +1 -1
  103. package/dist/inputs/datagrid/datagrid.d.ts +54 -4
  104. package/dist/inputs/datagrid/datagrid.d.ts.map +1 -1
  105. package/dist/inputs/file-input/file-input-upload.cjs +1 -1
  106. package/dist/inputs/file-input/file-input-upload.cjs.map +1 -1
  107. package/dist/inputs/file-input/file-input-upload.d.ts +2 -0
  108. package/dist/inputs/file-input/file-input-upload.d.ts.map +1 -1
  109. package/dist/inputs/file-input/file-input-upload.js +5 -2
  110. package/dist/inputs/file-input/file-input-upload.js.map +1 -1
  111. package/dist/inputs/file-input/file-input.d.ts.map +1 -1
  112. package/dist/inputs/index.d.ts +1 -1
  113. package/dist/inputs/index.d.ts.map +1 -1
  114. package/dist/inputs/input/input.css.cjs +1 -1
  115. package/dist/inputs/input/input.css.cjs.map +1 -1
  116. package/dist/inputs/input/input.css.js +1 -1
  117. package/dist/inputs/input/input.css.js.map +1 -1
  118. package/dist/inputs/input/input.d.ts +3 -0
  119. package/dist/inputs/input/input.d.ts.map +1 -1
  120. package/dist/inputs/select/select.css.cjs +1 -1
  121. package/dist/inputs/select/select.css.cjs.map +1 -1
  122. package/dist/inputs/select/select.css.js +1 -1
  123. package/dist/inputs/select/select.css.js.map +1 -1
  124. package/dist/inputs/select/select.d.ts +5 -0
  125. package/dist/inputs/select/select.d.ts.map +1 -1
  126. package/dist/layout/navbar/navbar.d.ts +2 -0
  127. package/dist/layout/navbar/navbar.d.ts.map +1 -1
  128. package/dist/layout/sidebar/sidebar.css.cjs +1 -1
  129. package/dist/layout/sidebar/sidebar.css.cjs.map +1 -1
  130. package/dist/layout/sidebar/sidebar.css.js +1 -1
  131. package/dist/layout/sidebar/sidebar.css.js.map +1 -1
  132. package/dist/layout/sidebar/sidebar.d.ts +8 -0
  133. package/dist/layout/sidebar/sidebar.d.ts.map +1 -1
  134. package/dist/list-item.cjs +6 -5
  135. package/dist/list-item.cjs.map +1 -1
  136. package/dist/list-item.js +23 -17
  137. package/dist/list-item.js.map +1 -1
  138. package/dist/list.cjs +1 -1
  139. package/dist/list.cjs.map +1 -1
  140. package/dist/list.js +1 -1
  141. package/dist/list.js.map +1 -1
  142. package/dist/menu.cjs +1 -1
  143. package/dist/menu.cjs.map +1 -1
  144. package/dist/menu.js +1 -1
  145. package/dist/menu.js.map +1 -1
  146. package/dist/navbar.cjs +2 -2
  147. package/dist/navbar.cjs.map +1 -1
  148. package/dist/navbar.js +7 -5
  149. package/dist/navbar.js.map +1 -1
  150. package/dist/navigation-menu.cjs +1 -1
  151. package/dist/navigation-menu.cjs.map +1 -1
  152. package/dist/navigation-menu.js +1 -1
  153. package/dist/navigation-menu.js.map +1 -1
  154. package/dist/overlay/popover/popover.css.cjs +1 -1
  155. package/dist/overlay/popover/popover.css.cjs.map +1 -1
  156. package/dist/overlay/popover/popover.css.js +1 -1
  157. package/dist/overlay/popover/popover.css.js.map +1 -1
  158. package/dist/overlay/popover/popover.d.ts +1 -0
  159. package/dist/overlay/popover/popover.d.ts.map +1 -1
  160. package/dist/overlay/shared/use-dialog.cjs +1 -1
  161. package/dist/overlay/shared/use-dialog.cjs.map +1 -1
  162. package/dist/overlay/shared/use-dialog.js +1 -1
  163. package/dist/overlay/shared/use-dialog.js.map +1 -1
  164. package/dist/overlay/shared/use-floating-trigger.cjs +1 -1
  165. package/dist/overlay/shared/use-floating-trigger.cjs.map +1 -1
  166. package/dist/overlay/shared/use-floating-trigger.js +1 -1
  167. package/dist/overlay/shared/use-floating-trigger.js.map +1 -1
  168. package/dist/popover.cjs.map +1 -1
  169. package/dist/popover.js.map +1 -1
  170. package/dist/radio.cjs +1 -1
  171. package/dist/radio.cjs.map +1 -1
  172. package/dist/radio.js +10 -8
  173. package/dist/radio.js.map +1 -1
  174. package/dist/rating.cjs +1 -1
  175. package/dist/rating.cjs.map +1 -1
  176. package/dist/rating.js +1 -1
  177. package/dist/rating.js.map +1 -1
  178. package/dist/refine.cjs +428 -379
  179. package/dist/refine.cjs.map +1 -1
  180. package/dist/refine.iife.js +428 -379
  181. package/dist/refine.iife.js.map +1 -1
  182. package/dist/refine.js +458 -409
  183. package/dist/refine.js.map +1 -1
  184. package/dist/select.cjs +16 -14
  185. package/dist/select.cjs.map +1 -1
  186. package/dist/select.js +118 -112
  187. package/dist/select.js.map +1 -1
  188. package/dist/sidebar.cjs +28 -23
  189. package/dist/sidebar.cjs.map +1 -1
  190. package/dist/sidebar.js +112 -77
  191. package/dist/sidebar.js.map +1 -1
  192. package/dist/slider.cjs +1 -1
  193. package/dist/slider.cjs.map +1 -1
  194. package/dist/slider.js +1 -1
  195. package/dist/slider.js.map +1 -1
  196. package/dist/stats.cjs +18 -0
  197. package/dist/stats.cjs.map +1 -0
  198. package/dist/stats.js +88 -0
  199. package/dist/stats.js.map +1 -0
  200. package/dist/stepper.cjs +1 -1
  201. package/dist/stepper.cjs.map +1 -1
  202. package/dist/stepper.js +1 -1
  203. package/dist/stepper.js.map +1 -1
  204. package/dist/styles/mixins/animation.css.cjs +2 -0
  205. package/dist/styles/mixins/animation.css.cjs.map +1 -1
  206. package/dist/styles/mixins/animation.css.d.ts.map +1 -1
  207. package/dist/styles/mixins/animation.css.js +2 -0
  208. package/dist/styles/mixins/animation.css.js.map +1 -1
  209. package/dist/tab-item.cjs +1 -1
  210. package/dist/tab-item.cjs.map +1 -1
  211. package/dist/tab-item.js +3 -2
  212. package/dist/tab-item.js.map +1 -1
  213. package/dist/tabs.cjs +1 -1
  214. package/dist/tabs.cjs.map +1 -1
  215. package/dist/tabs.js +3 -1
  216. package/dist/tabs.js.map +1 -1
  217. package/dist/toast.cjs.map +1 -1
  218. package/dist/toast.js.map +1 -1
  219. package/dist/typing-indicator.cjs +1 -1
  220. package/dist/typing-indicator.cjs.map +1 -1
  221. package/dist/typing-indicator.js +8 -7
  222. package/dist/typing-indicator.js.map +1 -1
  223. package/package.json +66 -58
@@ -1 +1 @@
1
- {"version":3,"file":"file-input.cjs","names":[],"sources":["../src/inputs/file-input/file-input.ts"],"sourcesContent":["import { createDropZone } from '@vielzeug/dnd';\nimport {\n bind,\n createStableId,\n define,\n html,\n onCleanup,\n onElement,\n onEvent,\n onMounted,\n prop,\n ref,\n useEmit,\n useField,\n when,\n} from '@vielzeug/ore';\nimport { computed, signal, watch } from '@vielzeug/ripple';\n\nimport '../../content/icon/icon';\nimport '../../feedback/progress/progress';\nimport { bindRefCallback, createInteraction } from '../../core';\nimport { FILE_INPUT_SIZE_PRESET } from '../../shared';\nimport {\n coarsePointerMixin,\n colorThemeMixin,\n disabledLoadingMixin,\n forcedColorsFocusMixin,\n reducedMotionMixin,\n roundedVariantMixin,\n sizeVariantMixin,\n} from '../../styles';\nimport componentStyles from './file-input.css?inline';\nimport { createFileQueue, type FileUploadFn, formatBytes } from './file-input-upload';\n\nexport type { FileUploadFn, FileUploadState, FileUploadStatus } from './file-input-upload';\n\nconst isImageFile = (file: File): boolean => file.type.startsWith('image/');\n\n/** File input component properties */\nexport type OreFileInputProps = {\n /** Accepted file types (comma-separated, e.g. '.jpg, .png, image/*') */\n accept?: string;\n /** Theme color tint */\n color?: string;\n /** Disabled state */\n disabled?: boolean;\n /** Error message text */\n error?: string;\n /**\n * Render selected files as a grid of image thumbnails/previews instead of the default\n * single-column list. Non-image files fall back to a generic file icon in the same grid.\n */\n gallery?: boolean;\n /** Helper text displayed below the input */\n helper?: string;\n /** Input label text */\n label?: string;\n /** Max number of files allowed (only used if multiple is true) */\n 'max-files'?: number;\n /** Max size of a single file in bytes */\n 'max-size'?: number;\n /** Allow multiple files selection */\n multiple?: boolean;\n /** Form field name */\n name?: string;\n /**\n * JS-only callback fired with the inner `<input type=\"file\">` element when it\n * mounts, and with `null` when it unmounts. Intended for composed components\n * that need imperative access to the raw element.\n * Set as a JS property: `bitFileInput.ref = (el) => { ... }`.\n */\n ref?: ((el: HTMLInputElement | null) => void) | null;\n /** Required field */\n required?: boolean;\n /** Field size preset */\n size?: string;\n /**\n * JS-only upload transport (see `FileUploadFn`). When set, every newly added file starts\n * uploading immediately and independently — progress/speed/ETA, retry-on-failure, and a\n * success confirmation card are all driven from here. Omit it to keep the component in its\n * original picker-only mode (select files, no upload lifecycle).\n * Set as a JS property: `fileInput.upload = async (file, { onProgress, signal }) => { ... }`.\n */\n upload?: FileUploadFn | null;\n};\n\n/** Events emitted by the file-input component */\nexport type OreFileInputEvents = {\n /** Emitted when files are added or removed */\n change: { files: File[]; originalEvent?: Event; value: File[] };\n /** Emitted when a specific file is removed */\n remove: { file: File; files: File[]; originalEvent?: Event; value: File[] };\n /** Emitted when `upload` rejects for a file (after a fresh attempt or a retry) */\n 'upload-error': { error: unknown; file: File };\n /** Emitted whenever `upload`'s `onProgress` reports new bytes for a file */\n 'upload-progress': { file: File; loaded: number; total: number };\n /** Emitted when `upload` resolves for a file */\n 'upload-success': { file: File };\n};\n\n/**\n * A file upload field with drag-and-drop support, built-in validation messaging, and — once a\n * `upload` transport is wired up — a full per-file upload lifecycle: live progress/speed/ETA,\n * retry-on-failure, a success confirmation card, and fully independent handling of concurrent\n * files (one failing never blocks or cancels the others). Picking files with no `upload` set\n * keeps the original, upload-free selection-only behavior.\n *\n * @element ore-file-input\n *\n * @attr {string} accept - Comma-separated file extensions or MIME types\n * @attr {boolean} multiple - Enable multiple files selection\n * @attr {boolean} gallery - Show selected files as an image thumbnail/preview grid\n * @attr {number} max-files - Max number of files allowed\n * @attr {number} max-size - Max size of each file in bytes\n * @attr {boolean} disabled - Disable interaction\n * @attr {string} error - Show an error state/message\n * @attr {string} helper - Provide helper context below the dropzone\n *\n * @fires change - detail: { files: File[], value: File[] }\n * @fires remove - detail: { file: File, files: File[] }\n * @fires upload-progress - detail: { file: File, loaded: number, total: number }\n * @fires upload-success - detail: { file: File }\n * @fires upload-error - detail: { file: File, error: unknown }\n *\n * @cssprop --file-input-bg - Dropzone background color\n * @cssprop --file-input-border-color - Dropzone border color\n * @cssprop --file-input-font-size - Font size\n * @cssprop --file-input-radius - Dropzone border radius\n * @cssprop --file-input-min-height - Minimum dropzone height\n * @cssprop --file-input-hover-bg - Dropzone background on hover (flat/ghost variants)\n * @cssprop --file-input-hover-border-color - Dropzone border on hover (flat/bordered variants)\n * @cssprop --file-input-focus-bg - Dropzone background when focused/drag-over (flat variant)\n * @cssprop --file-input-focus-border-color - Dropzone border when focused/drag-over (flat variant)\n * @cssprop --file-input-thumb-size - Gallery thumbnail width/height\n * @part wrapper - Root wrapper around the file input field\n * @part label - Visible label rendered above the dropzone\n * @part dropzone - Interactive drag-and-drop target\n * @part input - Native file input element\n * @part gallery - Gallery grid container (rendered instead of `file-list` when `gallery` is set)\n * @part helper - Helper text shown beneath the dropzone\n * @part error - Error message shown beneath the field\n * @example\n * ```html\n * <ore-file-input label=\"Upload files\" accept=\"image/*\" multiple />\n * <ore-file-input label=\"Photos\" accept=\"image/*\" multiple gallery />\n * <ore-file-input label=\"Resume\" accept=\".pdf,.doc,.docx\" max-size=\"5242880\" />\n * <ore-file-input variant=\"bordered\" color=\"primary\" />\n * ```\n * ```ts\n * // Wire up a real upload transport — progress/retry/success are then handled automatically.\n * // `XMLHttpRequest` is used here (not `fetch`) because it's the only browser API that reports\n * // upload progress; swap in whatever transport the app already uses.\n * const input = document.querySelector('ore-file-input');\n * input.upload = (file, { onProgress, signal, resumeFrom }) =>\n * new Promise((resolve, reject) => {\n * const xhr = new XMLHttpRequest();\n *\n * xhr.upload.addEventListener('progress', (e) => onProgress(resumeFrom + e.loaded, file.size));\n * xhr.addEventListener('load', () => (xhr.status < 400 ? resolve() : reject(new Error(xhr.statusText))));\n * xhr.addEventListener('error', () => reject(new Error('Network error')));\n * signal.addEventListener('abort', () => xhr.abort());\n *\n * xhr.open('PUT', '/uploads');\n * if (resumeFrom > 0) xhr.setRequestHeader('Content-Range', `bytes ${resumeFrom}-/${file.size}`);\n * xhr.send(file);\n * });\n * ```\n */\nexport const FILE_INPUT_TAG = 'ore-file-input' as const;\ndefine<OreFileInputProps>(FILE_INPUT_TAG, {\n formAssociated: true,\n props: {\n accept: prop.string(),\n color: prop.string(),\n disabled: prop.bool(false),\n error: prop.string(),\n gallery: prop.bool(false),\n helper: prop.string(),\n label: prop.string(),\n 'max-files': prop.number(0),\n 'max-size': prop.number(0),\n multiple: prop.bool(false),\n name: prop.string(),\n ref: prop.data<((el: HTMLInputElement | null) => void) | null>(),\n required: prop.bool(false),\n size: prop.string(),\n upload: prop.data<FileUploadFn>(),\n },\n setup(props) {\n const emit = useEmit<OreFileInputEvents>();\n\n // ============================================\n // State\n // ============================================\n\n const isDragging = signal(false);\n // Set while a \"Replace\" action is waiting for the (shared) native file input's next\n // `change` — routes that selection into `queue.replaceFile()` instead of `queue.addFiles()`.\n const replaceTarget = signal<File | null>(null);\n\n const isDisabled = computed(() => Boolean(props.disabled.value));\n const maxFilesLimit = computed(() => props['max-files'].value ?? 0);\n const maxSizeLimit = computed(() => props['max-size'].value ?? 0);\n\n // File selection + the opt-in upload lifecycle (progress, retry, replace, per-file\n // isolation) live in `createFileQueue` — see file-input-upload.ts for why they're one unit.\n const queue = createFileQueue({\n accept: props.accept,\n disabled: isDisabled,\n maxFiles: maxFilesLimit,\n maxSize: maxSizeLimit,\n multiple: computed(() => Boolean(props.multiple.value)),\n onChange: (changedFiles, originalEvent) =>\n emit('change', { files: changedFiles, originalEvent, value: changedFiles }),\n onRemove: (file, remainingFiles, originalEvent) =>\n emit('remove', { file, files: remainingFiles, originalEvent, value: remainingFiles }),\n onUploadError: (file, error) => emit('upload-error', { error, file }),\n onUploadProgress: (file, loaded, total) => emit('upload-progress', { file, loaded, total }),\n onUploadSuccess: (file) => emit('upload-success', { file }),\n upload: computed(() => props.upload.value ?? undefined),\n });\n\n onCleanup(() => queue.dispose());\n\n // ============================================\n // Form Integration\n // ============================================\n\n useField({\n disabled: isDisabled,\n toFormValue: (fi: File[]) => {\n if (fi.length === 0) return null;\n\n const name = props.name.value || 'file';\n const fd = new FormData();\n\n for (const file of fi) fd.append(name, file);\n\n return fd;\n },\n value: queue.files,\n });\n\n // Sync host attributes for CSS selectors\n const isInvalid = computed(() => Boolean(props.error.value));\n\n bind({\n attr: {\n 'drag-over': () => (isDragging.value ? true : undefined),\n invalid: () => (isInvalid.value ? true : undefined),\n size: props.size,\n },\n });\n\n // ============================================\n // IDs\n // ============================================\n const fileInputId = createStableId('file-input');\n const labelId = `label-${fileInputId}`;\n const helperId = `helper-${fileInputId}`;\n const errorId = `error-${fileInputId}`;\n\n // ============================================\n // Refs\n // ============================================\n const dropzoneRef = ref<HTMLDivElement>();\n const inputRef = ref<HTMLInputElement>();\n const hintText = computed(() => {\n const parts: string[] = [];\n\n if (props.accept.value) {\n parts.push(\n props.accept.value\n .split(',')\n .map((s: string) => s.trim())\n .join(', '),\n );\n }\n\n const maxSize = maxSizeLimit.value;\n\n if (maxSize > 0) parts.push(`max ${formatBytes(maxSize)}`);\n\n const maxFiles = maxFilesLimit.value;\n\n if (maxFiles > 0) parts.push(`up to ${maxFiles} file${maxFiles !== 1 ? 's' : ''}`);\n\n return parts.join(' · ');\n });\n\n // ============================================\n // Replace (\"swap this one file\" — see file-input-upload.ts's `replaceFile`)\n // ============================================\n function beginReplace(file: File): void {\n replaceTarget.value = file;\n inputRef.value?.click();\n }\n\n // ============================================\n // Gallery Preview URLs\n // ============================================\n // Object URLs are created lazily (only while `gallery` is enabled) and revoked as soon\n // as their file is no longer selected, plus unconditionally on disconnect — otherwise\n // each preview leaks its backing blob for the life of the page.\n const previewUrls = new Map<File, string>();\n\n function getPreviewUrl(file: File): string {\n let url = previewUrls.get(file);\n\n if (!url) {\n url = URL.createObjectURL(file);\n previewUrls.set(file, url);\n }\n\n return url;\n }\n\n function revokeStalePreviewUrls(activeFiles: File[]): void {\n const keep = new Set(activeFiles);\n\n for (const [file, url] of previewUrls) {\n if (!keep.has(file)) {\n URL.revokeObjectURL(url);\n previewUrls.delete(file);\n }\n }\n }\n\n watch(queue.files, revokeStalePreviewUrls);\n\n onCleanup(() => {\n for (const url of previewUrls.values()) URL.revokeObjectURL(url);\n\n previewUrls.clear();\n });\n\n // ============================================\n // Mount\n // ============================================\n // ============================================\n // Template\n // ============================================\n onElement(inputRef, (inp) => bindRefCallback(props.ref, inp));\n\n onMounted(() => {\n const inp = inputRef.value!;\n const dz = dropzoneRef.value!;\n let skipNextClick = false;\n const pressControl = createInteraction({\n disabled: isDisabled,\n onPress: () => {\n inp.click();\n },\n });\n\n // Native input → add files, or — if a \"Replace\" action opened the picker — swap the one\n // file it targeted instead of appending a new entry.\n onEvent(inp, 'change', (e: Event) => {\n const input = e.target as HTMLInputElement;\n const target = replaceTarget.value;\n\n replaceTarget.value = null;\n\n if (target && input.files?.[0]) queue.replaceFile(target, input.files[0], e);\n else if (input.files?.length) queue.addFiles(Array.from(input.files), e);\n\n input.value = ''; // reset so the same file triggers change again\n });\n // Click dropzone → open file picker\n onEvent(dz, 'click', (e: MouseEvent) => {\n if (e.target === inp) return;\n\n if (skipNextClick) {\n skipNextClick = false;\n\n return;\n }\n\n if (!isDisabled.value) inp.click();\n });\n // Keyboard: Enter / Space → open picker\n onEvent(dz, 'keydown', (e: KeyboardEvent) => {\n skipNextClick = pressControl.handleKeydown(e) && e.key === 'Enter';\n });\n\n // `createDropZone` has no way to update `disabled` after creation — recreate the zone\n // whenever the prop changes instead of capturing a stale snapshot from this one `onMounted`\n // run. `watch`'s own returned cleanup (not a second `onCleanup`) disposes the current zone\n // both on the next toggle and on final teardown.\n watch(\n isDisabled,\n (disabled) => {\n const dropZone = createDropZone({\n disabled,\n element: dz,\n onDrop: (droppedFiles) => queue.addFiles(droppedFiles),\n onHoverChange: (hovered) => {\n isDragging.value = hovered;\n },\n });\n\n return () => dropZone.dispose();\n },\n { immediate: true },\n );\n });\n\n return html`\n <div class=\"file-input-wrapper\" part=\"wrapper\">\n <label class=\"label-outside\" id=\"${labelId}\" part=\"label\" ?hidden=${() => !props.label.value}>\n ${props.label}\n </label>\n <div\n class=\"dropzone\"\n part=\"dropzone\"\n ref=${dropzoneRef}\n role=\"button\"\n tabindex=\"${() => (isDisabled.value ? '-1' : '0')}\"\n aria-disabled=\"${() => String(isDisabled.value)}\"\n aria-label=\"${() => (!props.label.value ? 'File upload drop zone' : null)}\"\n aria-labelledby=\"${() => (props.label.value ? labelId : null)}\"\n aria-describedby=\"${helperId}\">\n <input\n type=\"file\"\n ref=${inputRef}\n part=\"input\"\n id=\"${fileInputId}\"\n accept=\"${props.accept}\"\n ?multiple=\"${props.multiple}\"\n ?required=\"${props.required}\"\n ?disabled=\"${isDisabled}\"\n name=\"${props.name}\"\n hidden\n inert\n tabindex=\"-1\" />\n <div class=\"dropzone-content\">\n <span class=\"dropzone-icon\" aria-hidden=\"true\" data-status=\"${() => (isInvalid.value ? 'error' : null)}\">\n ${() =>\n isInvalid.value\n ? html`\n <ore-icon name=\"alert-circle\" size=\"36\" stroke-width=\"1.5\" aria-hidden=\"true\"></ore-icon>\n `\n : html`\n <ore-icon name=\"upload\" size=\"36\" stroke-width=\"1.5\" aria-hidden=\"true\"></ore-icon>\n `}\n </span>\n <!-- Signal 01: the copy itself shifts on drag-entry (not just border/glow) — a\n static \"Drop files here\" during an active drag reads as if the drop target\n hasn't noticed the file yet. -->\n ${when(\n () => isDragging.value,\n () => html`\n <span class=\"dropzone-title dropzone-title-active\">Release to upload</span>\n `,\n )}\n ${when(\n () => !isDragging.value,\n () => html`\n <span class=\"dropzone-title\">\n Drop files here or\n <u>click to browse</u>\n </span>\n `,\n )}\n <span class=\"dropzone-hint\" ?hidden=${() => !hintText.value}>${hintText}</span>\n </div>\n </div>\n <ul\n class=\"${() => (props.gallery.value ? 'file-grid' : 'file-list')}\"\n part=\"${() => (props.gallery.value ? 'gallery' : null)}\"\n role=\"list\"\n aria-label=\"Selected files\"\n ?hidden=${() => queue.files.value.length === 0}>\n ${() =>\n queue.files.value.map((file: File) =>\n props.gallery.value\n ? html`\n <li class=\"file-card\" data-status=${() => queue.fileState(file).status}>\n <span class=\"file-thumb-frame\">\n ${\n // Decorative: the file name is already announced via the visible\n // `.file-card-name` caption below — repeating it as `alt` text would\n // duplicate it (and often trips redundant-alt checks, since real\n // filenames commonly contain words like \"photo\" or \"image\").\n isImageFile(file)\n ? // Object URLs use the `blob:` scheme, which ore's attribute-level\n // XSS guard blocks unconditionally on `src` (and other\n // URL-accepting attributes) — set it as a DOM property via `ref`\n // instead, bypassing that string-based check. Safe here: the value\n // comes from `URL.createObjectURL(file)` on a real `File` object we\n // control, never from untrusted text.\n html`\n <img\n class=\"file-thumb\"\n alt=\"\"\n ref=\"${(el: HTMLImageElement | null) => {\n if (el) el.src = getPreviewUrl(file);\n }}\" />\n `\n : html`\n <span class=\"file-thumb file-thumb-generic\" aria-hidden=\"true\">\n <ore-icon name=\"file\" size=\"28\" stroke-width=\"1.5\" aria-hidden=\"true\"></ore-icon>\n </span>\n `\n }\n ${when(\n () => queue.fileState(file).status === 'success',\n () => html`\n <span class=\"file-status-badge file-status-badge-success\" aria-hidden=\"true\">\n <ore-icon name=\"check\" size=\"11\" stroke-width=\"3\" aria-hidden=\"true\"></ore-icon>\n </span>\n `,\n )}\n ${when(\n () => queue.fileState(file).status === 'error',\n () => html`\n <span class=\"file-status-badge file-status-badge-error\" aria-hidden=\"true\">\n <ore-icon name=\"alert-circle\" size=\"12\" stroke-width=\"2.5\" aria-hidden=\"true\"></ore-icon>\n </span>\n `,\n )}\n <span class=\"file-card-actions\">\n ${when(\n () => queue.fileState(file).status === 'error',\n () => html`\n <button\n class=\"file-card-action\"\n type=\"button\"\n aria-label=\"${`Retry uploading ${file.name}`}\"\n @click=${() => queue.retryUpload(file)}>\n <ore-icon name=\"refresh-cw\" size=\"12\" stroke-width=\"2.5\" aria-hidden=\"true\"></ore-icon>\n </button>\n `,\n )}\n ${when(\n () =>\n queue.fileState(file).status === 'success' &&\n Boolean(props.multiple.value) &&\n Boolean(props.upload.value),\n () => html`\n <button\n class=\"file-card-action\"\n type=\"button\"\n aria-label=\"${`Replace ${file.name}`}\"\n @click=${() => beginReplace(file)}>\n <ore-icon name=\"upload\" size=\"12\" stroke-width=\"2.5\" aria-hidden=\"true\"></ore-icon>\n </button>\n `,\n )}\n <button\n class=\"file-card-action file-card-remove\"\n type=\"button\"\n aria-label=\"${`Remove ${file.name}`}\"\n @click=${(e: Event) => queue.removeFile(file, e)}>\n <ore-icon name=\"x\" size=\"12\" stroke-width=\"2.5\" aria-hidden=\"true\"></ore-icon>\n </button>\n </span>\n </span>\n <span class=\"file-card-name\" title=\"${file.name}\">${file.name}</span>\n ${when(\n () => queue.fileState(file).status === 'uploading',\n () => html`\n <ore-progress\n type=\"linear\"\n size=\"sm\"\n value=${() => queue.uploadPercent(file)}\n label=${() => `${queue.uploadPercent(file)}%`}></ore-progress>\n <span class=\"file-progress-meta\">${() => queue.uploadMetaText(file)}</span>\n `,\n )}\n ${when(\n () => queue.fileState(file).status === 'error',\n () => html`\n <span class=\"file-error-text\">${() => queue.fileState(file).error}</span>\n `,\n )}\n </li>\n `\n : html`\n <li class=\"file-item\" data-status=${() => queue.fileState(file).status}>\n <span class=\"file-icon\" aria-hidden=\"true\">\n <ore-icon\n name=${() => queue.statusIconName(file)}\n size=\"18\"\n stroke-width=\"1.75\"\n aria-hidden=\"true\"></ore-icon>\n </span>\n <span class=\"file-meta\">\n <span class=\"file-name\" title=\"${file.name}\">${file.name}</span>\n ${when(\n () => queue.fileState(file).status === 'uploading',\n () => html`\n <ore-progress\n type=\"linear\"\n size=\"sm\"\n value=${() => queue.uploadPercent(file)}\n label=${() => `${queue.uploadPercent(file)}%`}></ore-progress>\n <span class=\"file-progress-meta\">${() => queue.uploadMetaText(file)}</span>\n `,\n )}\n ${when(\n () => queue.fileState(file).status === 'error',\n () => html`\n <span class=\"file-error-text\">${() => queue.fileState(file).error}</span>\n `,\n )}\n ${when(\n () => queue.fileState(file).status === 'idle' || queue.fileState(file).status === 'success',\n () => html`\n <span class=\"file-size\">${formatBytes(file.size)}</span>\n `,\n )}\n </span>\n <span class=\"file-actions\">\n ${when(\n () => queue.fileState(file).status === 'error',\n () => html`\n <button\n class=\"file-action\"\n type=\"button\"\n aria-label=\"${`Retry uploading ${file.name}`}\"\n @click=${() => queue.retryUpload(file)}>\n <ore-icon name=\"refresh-cw\" size=\"14\" stroke-width=\"2\" aria-hidden=\"true\"></ore-icon>\n </button>\n `,\n )}\n ${when(\n () =>\n queue.fileState(file).status === 'success' &&\n Boolean(props.multiple.value) &&\n Boolean(props.upload.value),\n () => html`\n <button\n class=\"file-action\"\n type=\"button\"\n aria-label=\"${`Replace ${file.name}`}\"\n @click=${() => beginReplace(file)}>\n <ore-icon name=\"upload\" size=\"14\" stroke-width=\"2\" aria-hidden=\"true\"></ore-icon>\n </button>\n `,\n )}\n <button\n class=\"file-remove\"\n type=\"button\"\n aria-label=\"${`Remove ${file.name}`}\"\n @click=${(e: Event) => queue.removeFile(file, e)}>\n <ore-icon name=\"x\" size=\"12\" stroke-width=\"2.5\" aria-hidden=\"true\"></ore-icon>\n </button>\n </span>\n </li>\n `,\n )}\n </ul>\n <div class=\"helper-text\" id=\"${helperId}\" part=\"helper\" ?hidden=${() => isInvalid.value || !props.helper.value}>\n ${props.helper}\n </div>\n <div\n class=\"helper-text helper-text-error\"\n id=\"${errorId}\"\n role=\"alert\"\n part=\"error\"\n ?hidden=${() => !isInvalid.value}>\n ${() => props.error.value ?? ''}\n </div>\n </div>\n `;\n },\n shadow: { delegatesFocus: true },\n styles: [\n colorThemeMixin,\n coarsePointerMixin,\n reducedMotionMixin,\n roundedVariantMixin,\n disabledLoadingMixin,\n sizeVariantMixin(FILE_INPUT_SIZE_PRESET),\n forcedColorsFocusMixin('.dropzone'),\n componentStyles,\n ],\n});\n"],"mappings":"8iBAoCA,IAAM,EAAe,GAAwB,EAAK,KAAK,WAAW,QAAQ,EAoI7D,EAAiB,kBAC9B,EAAA,EAAA,OAAA,CAA0B,EAAgB,CACxC,eAAgB,GAChB,MAAO,CACL,OAAQ,EAAA,KAAK,OAAO,EACpB,MAAO,EAAA,KAAK,OAAO,EACnB,SAAU,EAAA,KAAK,KAAK,EAAK,EACzB,MAAO,EAAA,KAAK,OAAO,EACnB,QAAS,EAAA,KAAK,KAAK,EAAK,EACxB,OAAQ,EAAA,KAAK,OAAO,EACpB,MAAO,EAAA,KAAK,OAAO,EACnB,YAAa,EAAA,KAAK,OAAO,CAAC,EAC1B,WAAY,EAAA,KAAK,OAAO,CAAC,EACzB,SAAU,EAAA,KAAK,KAAK,EAAK,EACzB,KAAM,EAAA,KAAK,OAAO,EAClB,IAAK,EAAA,KAAK,KAAqD,EAC/D,SAAU,EAAA,KAAK,KAAK,EAAK,EACzB,KAAM,EAAA,KAAK,OAAO,EAClB,OAAQ,EAAA,KAAK,KAAmB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/inputs/file-input/file-input.ts"],"sourcesContent":["import { createDropZone } from '@vielzeug/dnd';\nimport {\n bind,\n createStableId,\n define,\n getHost,\n html,\n onCleanup,\n onElement,\n onEvent,\n onMounted,\n prop,\n ref,\n useEmit,\n useField,\n when,\n} from '@vielzeug/ore';\nimport { computed, signal, watch } from '@vielzeug/ripple';\n\nimport '../../content/icon/icon';\nimport '../../feedback/progress/progress';\nimport { bindRefCallback, createInteraction } from '../../core';\nimport { FILE_INPUT_SIZE_PRESET } from '../../shared';\nimport {\n coarsePointerMixin,\n colorThemeMixin,\n disabledLoadingMixin,\n forcedColorsFocusMixin,\n reducedMotionMixin,\n roundedVariantMixin,\n sizeVariantMixin,\n} from '../../styles';\nimport componentStyles from './file-input.css?inline';\nimport { createFileQueue, type FileUploadFn, formatBytes } from './file-input-upload';\n\nexport type { FileUploadFn, FileUploadState, FileUploadStatus } from './file-input-upload';\n\nconst isImageFile = (file: File): boolean => file.type.startsWith('image/');\n\n/** File input component properties */\nexport type OreFileInputProps = {\n /** Accepted file types (comma-separated, e.g. '.jpg, .png, image/*') */\n accept?: string;\n /** Theme color tint */\n color?: string;\n /** Disabled state */\n disabled?: boolean;\n /** Error message text */\n error?: string;\n /**\n * Render selected files as a grid of image thumbnails/previews instead of the default\n * single-column list. Non-image files fall back to a generic file icon in the same grid.\n */\n gallery?: boolean;\n /** Helper text displayed below the input */\n helper?: string;\n /** Input label text */\n label?: string;\n /** Max number of files allowed (only used if multiple is true) */\n 'max-files'?: number;\n /** Max size of a single file in bytes */\n 'max-size'?: number;\n /** Allow multiple files selection */\n multiple?: boolean;\n /** Form field name */\n name?: string;\n /**\n * JS-only callback fired with the inner `<input type=\"file\">` element when it\n * mounts, and with `null` when it unmounts. Intended for composed components\n * that need imperative access to the raw element.\n * Set as a JS property: `bitFileInput.ref = (el) => { ... }`.\n */\n ref?: ((el: HTMLInputElement | null) => void) | null;\n /** Required field */\n required?: boolean;\n /** Field size preset */\n size?: string;\n /**\n * JS-only upload transport (see `FileUploadFn`). When set, every newly added file starts\n * uploading immediately and independently — progress/speed/ETA, retry-on-failure, and a\n * success confirmation card are all driven from here. Omit it to keep the component in its\n * original picker-only mode (select files, no upload lifecycle).\n * Set as a JS property: `fileInput.upload = async (file, { onProgress, signal }) => { ... }`.\n */\n upload?: FileUploadFn | null;\n};\n\n/** Events emitted by the file-input component */\nexport type OreFileInputEvents = {\n /** Emitted when files are added or removed */\n change: { files: File[]; originalEvent?: Event; value: File[] };\n /** Emitted when a specific file is removed */\n remove: { file: File; files: File[]; originalEvent?: Event; value: File[] };\n /** Emitted when `upload` rejects for a file (after a fresh attempt or a retry) */\n 'upload-error': { error: unknown; file: File };\n /** Emitted whenever `upload`'s `onProgress` reports new bytes for a file */\n 'upload-progress': { file: File; loaded: number; total: number };\n /** Emitted when `upload` resolves for a file */\n 'upload-success': { file: File };\n};\n\n/**\n * A file upload field with drag-and-drop support, built-in validation messaging, and — once a\n * `upload` transport is wired up — a full per-file upload lifecycle: live progress/speed/ETA,\n * retry-on-failure, a success confirmation card, and fully independent handling of concurrent\n * files (one failing never blocks or cancels the others). Picking files with no `upload` set\n * keeps the original, upload-free selection-only behavior.\n *\n * @element ore-file-input\n *\n * @attr {string} accept - Comma-separated file extensions or MIME types\n * @attr {boolean} multiple - Enable multiple files selection\n * @attr {boolean} gallery - Show selected files as an image thumbnail/preview grid\n * @attr {number} max-files - Max number of files allowed\n * @attr {number} max-size - Max size of each file in bytes\n * @attr {boolean} disabled - Disable interaction\n * @attr {string} error - Show an error state/message\n * @attr {string} helper - Provide helper context below the dropzone\n *\n * @fires change - detail: { files: File[], value: File[] }\n * @fires remove - detail: { file: File, files: File[] }\n * @fires upload-progress - detail: { file: File, loaded: number, total: number }\n * @fires upload-success - detail: { file: File }\n * @fires upload-error - detail: { file: File, error: unknown }\n *\n * @cssprop --file-input-bg - Dropzone background color\n * @cssprop --file-input-border-color - Dropzone border color\n * @cssprop --file-input-font-size - Font size\n * @cssprop --file-input-radius - Dropzone border radius\n * @cssprop --file-input-min-height - Minimum dropzone height\n * @cssprop --file-input-hover-bg - Dropzone background on hover (flat/ghost variants)\n * @cssprop --file-input-hover-border-color - Dropzone border on hover (flat/bordered variants)\n * @cssprop --file-input-focus-bg - Dropzone background when focused/drag-over (flat variant)\n * @cssprop --file-input-focus-border-color - Dropzone border when focused/drag-over (flat variant)\n * @cssprop --file-input-thumb-size - Gallery thumbnail width/height\n * @part wrapper - Root wrapper around the file input field\n * @part label - Visible label rendered above the dropzone\n * @part dropzone - Interactive drag-and-drop target\n * @part input - Native file input element\n * @part gallery - Gallery grid container (rendered instead of `file-list` when `gallery` is set)\n * @part helper - Helper text shown beneath the dropzone\n * @part error - Error message shown beneath the field\n * @example\n * ```html\n * <ore-file-input label=\"Upload files\" accept=\"image/*\" multiple />\n * <ore-file-input label=\"Photos\" accept=\"image/*\" multiple gallery />\n * <ore-file-input label=\"Resume\" accept=\".pdf,.doc,.docx\" max-size=\"5242880\" />\n * <ore-file-input variant=\"bordered\" color=\"primary\" />\n * ```\n * ```ts\n * // Wire up a real upload transport — progress/retry/success are then handled automatically.\n * // `XMLHttpRequest` is used here (not `fetch`) because it's the only browser API that reports\n * // upload progress; swap in whatever transport the app already uses.\n * const input = document.querySelector('ore-file-input');\n * input.upload = (file, { onProgress, signal, resumeFrom }) =>\n * new Promise((resolve, reject) => {\n * const xhr = new XMLHttpRequest();\n *\n * xhr.upload.addEventListener('progress', (e) => onProgress(resumeFrom + e.loaded, file.size));\n * xhr.addEventListener('load', () => (xhr.status < 400 ? resolve() : reject(new Error(xhr.statusText))));\n * xhr.addEventListener('error', () => reject(new Error('Network error')));\n * signal.addEventListener('abort', () => xhr.abort());\n *\n * xhr.open('PUT', '/uploads');\n * if (resumeFrom > 0) xhr.setRequestHeader('Content-Range', `bytes ${resumeFrom}-/${file.size}`);\n * xhr.send(file);\n * });\n * ```\n */\nexport const FILE_INPUT_TAG = 'ore-file-input' as const;\ndefine<OreFileInputProps>(FILE_INPUT_TAG, {\n formAssociated: true,\n props: {\n accept: prop.string(),\n color: prop.string(),\n disabled: prop.bool(false),\n error: prop.string(),\n gallery: prop.bool(false),\n helper: prop.string(),\n label: prop.string(),\n 'max-files': prop.number(0),\n 'max-size': prop.number(0),\n multiple: prop.bool(false),\n name: prop.string(),\n ref: prop.data<((el: HTMLInputElement | null) => void) | null>(),\n required: prop.bool(false),\n size: prop.string(),\n upload: prop.data<FileUploadFn>(),\n },\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreFileInputEvents>();\n\n // ============================================\n // State\n // ============================================\n\n const isDragging = signal(false);\n // Set while a \"Replace\" action is waiting for the (shared) native file input's next\n // `change` — routes that selection into `queue.replaceFile()` instead of `queue.addFiles()`.\n const replaceTarget = signal<File | null>(null);\n\n const isDisabled = computed(() => Boolean(props.disabled.value));\n const maxFilesLimit = computed(() => props['max-files'].value ?? 0);\n const maxSizeLimit = computed(() => props['max-size'].value ?? 0);\n\n // File selection + the opt-in upload lifecycle (progress, retry, replace, per-file\n // isolation) live in `createFileQueue` — see file-input-upload.ts for why they're one unit.\n const queue = createFileQueue({\n accept: props.accept,\n disabled: isDisabled,\n document: el.ownerDocument,\n maxFiles: maxFilesLimit,\n maxSize: maxSizeLimit,\n multiple: computed(() => Boolean(props.multiple.value)),\n onChange: (changedFiles, originalEvent) =>\n emit('change', { files: changedFiles, originalEvent, value: changedFiles }),\n onRemove: (file, remainingFiles, originalEvent) =>\n emit('remove', { file, files: remainingFiles, originalEvent, value: remainingFiles }),\n onUploadError: (file, error) => emit('upload-error', { error, file }),\n onUploadProgress: (file, loaded, total) => emit('upload-progress', { file, loaded, total }),\n onUploadSuccess: (file) => emit('upload-success', { file }),\n upload: computed(() => props.upload.value ?? undefined),\n });\n\n onCleanup(() => queue.dispose());\n\n // ============================================\n // Form Integration\n // ============================================\n\n useField({\n disabled: isDisabled,\n toFormValue: (fi: File[]) => {\n if (fi.length === 0) return null;\n\n const name = props.name.value || 'file';\n const fd = new FormData();\n\n for (const file of fi) fd.append(name, file);\n\n return fd;\n },\n value: queue.files,\n });\n\n // Sync host attributes for CSS selectors\n const isInvalid = computed(() => Boolean(props.error.value));\n\n bind({\n attr: {\n 'drag-over': () => (isDragging.value ? true : undefined),\n invalid: () => (isInvalid.value ? true : undefined),\n size: props.size,\n },\n });\n\n // ============================================\n // IDs\n // ============================================\n const fileInputId = createStableId('file-input');\n const labelId = `label-${fileInputId}`;\n const helperId = `helper-${fileInputId}`;\n const errorId = `error-${fileInputId}`;\n\n // ============================================\n // Refs\n // ============================================\n const dropzoneRef = ref<HTMLDivElement>();\n const inputRef = ref<HTMLInputElement>();\n const hintText = computed(() => {\n const parts: string[] = [];\n\n if (props.accept.value) {\n parts.push(\n props.accept.value\n .split(',')\n .map((s: string) => s.trim())\n .join(', '),\n );\n }\n\n const maxSize = maxSizeLimit.value;\n\n if (maxSize > 0) parts.push(`max ${formatBytes(maxSize)}`);\n\n const maxFiles = maxFilesLimit.value;\n\n if (maxFiles > 0) parts.push(`up to ${maxFiles} file${maxFiles !== 1 ? 's' : ''}`);\n\n return parts.join(' · ');\n });\n\n // ============================================\n // Replace (\"swap this one file\" — see file-input-upload.ts's `replaceFile`)\n // ============================================\n function beginReplace(file: File): void {\n replaceTarget.value = file;\n inputRef.value?.click();\n }\n\n // ============================================\n // Gallery Preview URLs\n // ============================================\n // Object URLs are created lazily (only while `gallery` is enabled) and revoked as soon\n // as their file is no longer selected, plus unconditionally on disconnect — otherwise\n // each preview leaks its backing blob for the life of the page.\n const previewUrls = new Map<File, string>();\n\n function getPreviewUrl(file: File): string {\n let url = previewUrls.get(file);\n\n if (!url) {\n url = URL.createObjectURL(file);\n previewUrls.set(file, url);\n }\n\n return url;\n }\n\n function revokeStalePreviewUrls(activeFiles: File[]): void {\n const keep = new Set(activeFiles);\n\n for (const [file, url] of previewUrls) {\n if (!keep.has(file)) {\n URL.revokeObjectURL(url);\n previewUrls.delete(file);\n }\n }\n }\n\n watch(queue.files, revokeStalePreviewUrls);\n\n onCleanup(() => {\n for (const url of previewUrls.values()) URL.revokeObjectURL(url);\n\n previewUrls.clear();\n });\n\n // ============================================\n // Mount\n // ============================================\n // ============================================\n // Template\n // ============================================\n onElement(inputRef, (inp) => bindRefCallback(props.ref, inp));\n\n onMounted(() => {\n const inp = inputRef.value!;\n const dz = dropzoneRef.value!;\n let skipNextClick = false;\n const pressControl = createInteraction({\n disabled: isDisabled,\n onPress: () => {\n inp.click();\n },\n });\n\n // Native input → add files, or — if a \"Replace\" action opened the picker — swap the one\n // file it targeted instead of appending a new entry.\n onEvent(inp, 'change', (e: Event) => {\n const input = e.target as HTMLInputElement;\n const target = replaceTarget.value;\n\n replaceTarget.value = null;\n\n if (target && input.files?.[0]) queue.replaceFile(target, input.files[0], e);\n else if (input.files?.length) queue.addFiles(Array.from(input.files), e);\n\n input.value = ''; // reset so the same file triggers change again\n });\n // Click dropzone → open file picker\n onEvent(dz, 'click', (e: MouseEvent) => {\n if (e.target === inp) return;\n\n if (skipNextClick) {\n skipNextClick = false;\n\n return;\n }\n\n if (!isDisabled.value) inp.click();\n });\n // Keyboard: Enter / Space → open picker\n onEvent(dz, 'keydown', (e: KeyboardEvent) => {\n skipNextClick = pressControl.handleKeydown(e) && e.key === 'Enter';\n });\n\n // `createDropZone` has no way to update `disabled` after creation — recreate the zone\n // whenever the prop changes instead of capturing a stale snapshot from this one `onMounted`\n // run. `watch`'s own returned cleanup (not a second `onCleanup`) disposes the current zone\n // both on the next toggle and on final teardown.\n watch(\n isDisabled,\n (disabled) => {\n const dropZone = createDropZone({\n disabled,\n element: dz,\n onDrop: (droppedFiles) => queue.addFiles(droppedFiles),\n onHoverChange: (hovered) => {\n isDragging.value = hovered;\n },\n });\n\n return () => dropZone.dispose();\n },\n { immediate: true },\n );\n });\n\n return html`\n <div class=\"file-input-wrapper\" part=\"wrapper\">\n <label class=\"label-outside\" id=\"${labelId}\" part=\"label\" ?hidden=${() => !props.label.value}>\n ${props.label}\n </label>\n <div\n class=\"dropzone\"\n part=\"dropzone\"\n ref=${dropzoneRef}\n role=\"button\"\n tabindex=\"${() => (isDisabled.value ? '-1' : '0')}\"\n aria-disabled=\"${() => String(isDisabled.value)}\"\n aria-label=\"${() => (!props.label.value ? 'File upload drop zone' : null)}\"\n aria-labelledby=\"${() => (props.label.value ? labelId : null)}\"\n aria-describedby=\"${helperId}\">\n <input\n type=\"file\"\n ref=${inputRef}\n part=\"input\"\n id=\"${fileInputId}\"\n accept=\"${props.accept}\"\n ?multiple=\"${props.multiple}\"\n ?required=\"${props.required}\"\n ?disabled=\"${isDisabled}\"\n name=\"${props.name}\"\n hidden\n inert\n tabindex=\"-1\" />\n <div class=\"dropzone-content\">\n <span class=\"dropzone-icon\" aria-hidden=\"true\" data-status=\"${() => (isInvalid.value ? 'error' : null)}\">\n ${() =>\n isInvalid.value\n ? html`\n <ore-icon name=\"alert-circle\" size=\"36\" stroke-width=\"1.5\" aria-hidden=\"true\"></ore-icon>\n `\n : html`\n <ore-icon name=\"upload\" size=\"36\" stroke-width=\"1.5\" aria-hidden=\"true\"></ore-icon>\n `}\n </span>\n <!-- Signal 01: the copy itself shifts on drag-entry (not just border/glow) — a\n static \"Drop files here\" during an active drag reads as if the drop target\n hasn't noticed the file yet. -->\n ${when(\n () => isDragging.value,\n () => html`\n <span class=\"dropzone-title dropzone-title-active\">Release to upload</span>\n `,\n )}\n ${when(\n () => !isDragging.value,\n () => html`\n <span class=\"dropzone-title\">\n Drop files here or\n <u>click to browse</u>\n </span>\n `,\n )}\n <span class=\"dropzone-hint\" ?hidden=${() => !hintText.value}>${hintText}</span>\n </div>\n </div>\n <ul\n class=\"${() => (props.gallery.value ? 'file-grid' : 'file-list')}\"\n part=\"${() => (props.gallery.value ? 'gallery' : null)}\"\n role=\"list\"\n aria-label=\"Selected files\"\n ?hidden=${() => queue.files.value.length === 0}>\n ${() =>\n queue.files.value.map((file: File) =>\n props.gallery.value\n ? html`\n <li class=\"file-card\" data-status=${() => queue.fileState(file).status}>\n <span class=\"file-thumb-frame\">\n ${\n // Decorative: the file name is already announced via the visible\n // `.file-card-name` caption below — repeating it as `alt` text would\n // duplicate it (and often trips redundant-alt checks, since real\n // filenames commonly contain words like \"photo\" or \"image\").\n isImageFile(file)\n ? // Object URLs use the `blob:` scheme, which ore's attribute-level\n // XSS guard blocks unconditionally on `src` (and other\n // URL-accepting attributes) — set it as a DOM property via `ref`\n // instead, bypassing that string-based check. Safe here: the value\n // comes from `URL.createObjectURL(file)` on a real `File` object we\n // control, never from untrusted text.\n html`\n <img\n class=\"file-thumb\"\n alt=\"\"\n ref=\"${(el: HTMLImageElement | null) => {\n if (el) el.src = getPreviewUrl(file);\n }}\" />\n `\n : html`\n <span class=\"file-thumb file-thumb-generic\" aria-hidden=\"true\">\n <ore-icon name=\"file\" size=\"28\" stroke-width=\"1.5\" aria-hidden=\"true\"></ore-icon>\n </span>\n `\n }\n ${when(\n () => queue.fileState(file).status === 'success',\n () => html`\n <span class=\"file-status-badge file-status-badge-success\" aria-hidden=\"true\">\n <ore-icon name=\"check\" size=\"11\" stroke-width=\"3\" aria-hidden=\"true\"></ore-icon>\n </span>\n `,\n )}\n ${when(\n () => queue.fileState(file).status === 'error',\n () => html`\n <span class=\"file-status-badge file-status-badge-error\" aria-hidden=\"true\">\n <ore-icon name=\"alert-circle\" size=\"12\" stroke-width=\"2.5\" aria-hidden=\"true\"></ore-icon>\n </span>\n `,\n )}\n <span class=\"file-card-actions\">\n ${when(\n () => queue.fileState(file).status === 'error',\n () => html`\n <button\n class=\"file-card-action\"\n type=\"button\"\n aria-label=\"${`Retry uploading ${file.name}`}\"\n @click=${() => queue.retryUpload(file)}>\n <ore-icon name=\"refresh-cw\" size=\"12\" stroke-width=\"2.5\" aria-hidden=\"true\"></ore-icon>\n </button>\n `,\n )}\n ${when(\n () =>\n queue.fileState(file).status === 'success' &&\n Boolean(props.multiple.value) &&\n Boolean(props.upload.value),\n () => html`\n <button\n class=\"file-card-action\"\n type=\"button\"\n aria-label=\"${`Replace ${file.name}`}\"\n @click=${() => beginReplace(file)}>\n <ore-icon name=\"upload\" size=\"12\" stroke-width=\"2.5\" aria-hidden=\"true\"></ore-icon>\n </button>\n `,\n )}\n <button\n class=\"file-card-action file-card-remove\"\n type=\"button\"\n aria-label=\"${`Remove ${file.name}`}\"\n @click=${(e: Event) => queue.removeFile(file, e)}>\n <ore-icon name=\"x\" size=\"12\" stroke-width=\"2.5\" aria-hidden=\"true\"></ore-icon>\n </button>\n </span>\n </span>\n <span class=\"file-card-name\" title=\"${file.name}\">${file.name}</span>\n ${when(\n () => queue.fileState(file).status === 'uploading',\n () => html`\n <ore-progress\n type=\"linear\"\n size=\"sm\"\n value=${() => queue.uploadPercent(file)}\n label=${() => `${queue.uploadPercent(file)}%`}></ore-progress>\n <span class=\"file-progress-meta\">${() => queue.uploadMetaText(file)}</span>\n `,\n )}\n ${when(\n () => queue.fileState(file).status === 'error',\n () => html`\n <span class=\"file-error-text\">${() => queue.fileState(file).error}</span>\n `,\n )}\n </li>\n `\n : html`\n <li class=\"file-item\" data-status=${() => queue.fileState(file).status}>\n <span class=\"file-icon\" aria-hidden=\"true\">\n <ore-icon\n name=${() => queue.statusIconName(file)}\n size=\"18\"\n stroke-width=\"1.75\"\n aria-hidden=\"true\"></ore-icon>\n </span>\n <span class=\"file-meta\">\n <span class=\"file-name\" title=\"${file.name}\">${file.name}</span>\n ${when(\n () => queue.fileState(file).status === 'uploading',\n () => html`\n <ore-progress\n type=\"linear\"\n size=\"sm\"\n value=${() => queue.uploadPercent(file)}\n label=${() => `${queue.uploadPercent(file)}%`}></ore-progress>\n <span class=\"file-progress-meta\">${() => queue.uploadMetaText(file)}</span>\n `,\n )}\n ${when(\n () => queue.fileState(file).status === 'error',\n () => html`\n <span class=\"file-error-text\">${() => queue.fileState(file).error}</span>\n `,\n )}\n ${when(\n () => queue.fileState(file).status === 'idle' || queue.fileState(file).status === 'success',\n () => html`\n <span class=\"file-size\">${formatBytes(file.size)}</span>\n `,\n )}\n </span>\n <span class=\"file-actions\">\n ${when(\n () => queue.fileState(file).status === 'error',\n () => html`\n <button\n class=\"file-action\"\n type=\"button\"\n aria-label=\"${`Retry uploading ${file.name}`}\"\n @click=${() => queue.retryUpload(file)}>\n <ore-icon name=\"refresh-cw\" size=\"14\" stroke-width=\"2\" aria-hidden=\"true\"></ore-icon>\n </button>\n `,\n )}\n ${when(\n () =>\n queue.fileState(file).status === 'success' &&\n Boolean(props.multiple.value) &&\n Boolean(props.upload.value),\n () => html`\n <button\n class=\"file-action\"\n type=\"button\"\n aria-label=\"${`Replace ${file.name}`}\"\n @click=${() => beginReplace(file)}>\n <ore-icon name=\"upload\" size=\"14\" stroke-width=\"2\" aria-hidden=\"true\"></ore-icon>\n </button>\n `,\n )}\n <button\n class=\"file-remove\"\n type=\"button\"\n aria-label=\"${`Remove ${file.name}`}\"\n @click=${(e: Event) => queue.removeFile(file, e)}>\n <ore-icon name=\"x\" size=\"12\" stroke-width=\"2.5\" aria-hidden=\"true\"></ore-icon>\n </button>\n </span>\n </li>\n `,\n )}\n </ul>\n <div class=\"helper-text\" id=\"${helperId}\" part=\"helper\" ?hidden=${() => isInvalid.value || !props.helper.value}>\n ${props.helper}\n </div>\n <div\n class=\"helper-text helper-text-error\"\n id=\"${errorId}\"\n role=\"alert\"\n part=\"error\"\n ?hidden=${() => !isInvalid.value}>\n ${() => props.error.value ?? ''}\n </div>\n </div>\n `;\n },\n shadow: { delegatesFocus: true },\n styles: [\n colorThemeMixin,\n coarsePointerMixin,\n reducedMotionMixin,\n roundedVariantMixin,\n disabledLoadingMixin,\n sizeVariantMixin(FILE_INPUT_SIZE_PRESET),\n forcedColorsFocusMixin('.dropzone'),\n componentStyles,\n ],\n});\n"],"mappings":"8iBAqCA,IAAM,EAAe,GAAwB,EAAK,KAAK,WAAW,QAAQ,EAoI7D,EAAiB,kBAC9B,EAAA,EAAA,OAAA,CAA0B,EAAgB,CACxC,eAAgB,GAChB,MAAO,CACL,OAAQ,EAAA,KAAK,OAAO,EACpB,MAAO,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