@vielzeug/refine 1.7.0 → 1.8.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 (83) hide show
  1. package/dist/async.cjs +11 -11
  2. package/dist/async.cjs.map +1 -1
  3. package/dist/async.js +1 -2
  4. package/dist/async.js.map +1 -1
  5. package/dist/calendar.cjs +26 -26
  6. package/dist/calendar.cjs.map +1 -1
  7. package/dist/calendar.js +4 -5
  8. package/dist/calendar.js.map +1 -1
  9. package/dist/checkbox-group.cjs +9 -9
  10. package/dist/checkbox-group.cjs.map +1 -1
  11. package/dist/checkbox-group.js +1 -2
  12. package/dist/checkbox-group.js.map +1 -1
  13. package/dist/code-window.cjs +4 -4
  14. package/dist/code-window.cjs.map +1 -1
  15. package/dist/code-window.js +1 -2
  16. package/dist/code-window.js.map +1 -1
  17. package/dist/command-palette.cjs +6 -6
  18. package/dist/command-palette.cjs.map +1 -1
  19. package/dist/command-palette.js +46 -47
  20. package/dist/command-palette.js.map +1 -1
  21. package/dist/content/code-window/code-window.d.ts.map +1 -1
  22. package/dist/content/icon/icon.d.ts.map +1 -1
  23. package/dist/custom-elements.json +3716 -3716
  24. package/dist/datagrid.cjs +2 -2
  25. package/dist/datagrid.js +206 -206
  26. package/dist/datagrid.js.map +1 -1
  27. package/dist/disclosure/tab-panel/tab-panel.d.ts.map +1 -1
  28. package/dist/feedback/async/async.d.ts.map +1 -1
  29. package/dist/feedback/progress/progress.d.ts.map +1 -1
  30. package/dist/file-input.cjs +49 -49
  31. package/dist/file-input.cjs.map +1 -1
  32. package/dist/file-input.js +1 -2
  33. package/dist/file-input.js.map +1 -1
  34. package/dist/icon.cjs +1 -1
  35. package/dist/icon.cjs.map +1 -1
  36. package/dist/icon.js +1 -2
  37. package/dist/icon.js.map +1 -1
  38. package/dist/input.cjs +2 -2
  39. package/dist/input.js +6 -6
  40. package/dist/inputs/calendar/calendar.d.ts.map +1 -1
  41. package/dist/message-composer.cjs +2 -2
  42. package/dist/message-composer.js +6 -6
  43. package/dist/progress.cjs +13 -13
  44. package/dist/progress.cjs.map +1 -1
  45. package/dist/progress.js +3 -4
  46. package/dist/progress.js.map +1 -1
  47. package/dist/radio-group.cjs +11 -11
  48. package/dist/radio-group.cjs.map +1 -1
  49. package/dist/radio-group.js +1 -2
  50. package/dist/radio-group.js.map +1 -1
  51. package/dist/refine.cjs +197 -197
  52. package/dist/refine.cjs.map +1 -1
  53. package/dist/refine.iife.js +258 -258
  54. package/dist/refine.iife.js.map +1 -1
  55. package/dist/refine.js +225 -225
  56. package/dist/refine.js.map +1 -1
  57. package/dist/tab-panel.cjs +7 -7
  58. package/dist/tab-panel.cjs.map +1 -1
  59. package/dist/tab-panel.js +3 -4
  60. package/dist/tab-panel.js.map +1 -1
  61. package/dist/testing/index.d.ts +15 -60
  62. package/dist/testing/index.d.ts.map +1 -1
  63. package/dist/testing.cjs +1 -1
  64. package/dist/testing.cjs.map +1 -1
  65. package/dist/testing.js +7 -24
  66. package/dist/testing.js.map +1 -1
  67. package/dist/textarea.cjs +2 -2
  68. package/dist/textarea.js +6 -6
  69. package/package.json +6 -5
  70. package/dist/keymap/dist/_dev.cjs +0 -2
  71. package/dist/keymap/dist/_dev.cjs.map +0 -1
  72. package/dist/keymap/dist/_dev.js +0 -4
  73. package/dist/keymap/dist/_dev.js.map +0 -1
  74. package/dist/keymap/dist/format.cjs +0 -1
  75. package/dist/keymap/dist/format.js +0 -1
  76. package/dist/keymap/dist/index.cjs +0 -1
  77. package/dist/keymap/dist/index.js +0 -4
  78. package/dist/keymap/dist/keymap.cjs +0 -2
  79. package/dist/keymap/dist/keymap.cjs.map +0 -1
  80. package/dist/keymap/dist/keymap.js +0 -221
  81. package/dist/keymap/dist/keymap.js.map +0 -1
  82. package/dist/keymap/dist/layer.cjs +0 -1
  83. package/dist/keymap/dist/layer.js +0 -1
@@ -1,41 +1,41 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./styles/mixins/shape.css.cjs"),t=require("./styles/mixins/theme.css.cjs"),n=require("./styles/index.cjs"),r=require("./shared/size-presets.cjs"),i=require("./headless/ref-callback.cjs"),a=require("./headless/keyboard.cjs"),o=require("./inputs/shared/form-context.cjs"),s=require("./inputs/file-input/file-input-upload.cjs"),c=require("./inputs/file-input/file-input.css.cjs");let l=require("@vielzeug/ore"),u=require("@vielzeug/ore/directives"),d=require("@vielzeug/ripple"),f=require("@vielzeug/ore/forms"),p=require("@vielzeug/dnd");var m=e=>e.type.startsWith(`image/`),h=`ore-file-input`;(0,l.define)(h,{formAssociated:!0,props:{accept:l.prop.string(),color:l.prop.string(),disabled:l.prop.bool(!1),error:l.prop.string(),gallery:l.prop.bool(!1),helper:l.prop.string(),label:l.prop.string(),"max-files":l.prop.number(0),"max-size":l.prop.number(0),multiple:l.prop.bool(!1),name:l.prop.string(),ref:l.prop.data(),required:l.prop.bool(!1),size:l.prop.string(),upload:l.prop.data()},setup(e){let t=(0,l.useEmit)(),n=(0,d.signal)(!1),r=(0,d.signal)(null),c=o.useFormContext(e,(0,l.inject)(o.FORM_CTX)),h=c.disabled,g=(0,d.computed)(()=>e[`max-files`].value??0),_=(0,d.computed)(()=>e[`max-size`].value??0),v=s.createFileQueue({accept:e.accept,disabled:h,maxFiles:g,maxSize:_,multiple:(0,d.computed)(()=>!!e.multiple.value),onChange:(e,n)=>t(`change`,{files:e,originalEvent:n,value:e}),onRemove:(e,n,r)=>t(`remove`,{file:e,files:n,originalEvent:r,value:n}),onUploadError:(e,n)=>t(`upload-error`,{error:n,file:e}),onUploadProgress:(e,n,r)=>t(`upload-progress`,{file:e,loaded:n,total:r}),onUploadSuccess:e=>t(`upload-success`,{file:e}),upload:(0,d.computed)(()=>e.upload.value??void 0)});(0,l.onCleanup)(()=>v.dispose()),(0,f.useField)({disabled:h,toFormValue:t=>{if(t.length===0)return null;let n=e.name.value||`file`,r=new FormData;for(let e of t)r.append(n,e);return r},value:v.files});let y=(0,d.computed)(()=>!!e.error.value);(0,l.bind)({attr:{"drag-over":()=>n.value?!0:void 0,invalid:()=>y.value?!0:void 0,size:c.size}});let b=(0,l.createStableId)(`file-input`),x=`label-${b}`,S=`helper-${b}`,C=`error-${b}`,w=(0,l.ref)(),T=(0,l.ref)(),E=(0,d.computed)(()=>{let t=[];e.accept.value&&t.push(e.accept.value.split(`,`).map(e=>e.trim()).join(`, `));let n=_.value;n>0&&t.push(`max ${s.formatBytes(n)}`);let r=g.value;return r>0&&t.push(`up to ${r} file${r===1?``:`s`}`),t.join(` · `)});function D(e){r.value=e,T.value?.click()}let O=new Map;function k(e){let t=O.get(e);return t||(t=URL.createObjectURL(e),O.set(e,t)),t}function A(e){let t=new Set(e);for(let[e,n]of O)t.has(e)||(URL.revokeObjectURL(n),O.delete(e))}return(0,d.watch)(v.files,A),(0,l.onCleanup)(()=>{for(let e of O.values())URL.revokeObjectURL(e);O.clear()}),(0,l.onElement)(T,t=>i.bindRefCallback(e.ref,t)),(0,l.onMounted)(()=>{let e=T.value,t=w.value,i=!1,o=a.createInteraction({disabled:h,onPress:()=>{e.click()}});(0,l.onEvent)(e,`change`,e=>{let t=e.target,n=r.value;r.value=null,n&&t.files?.[0]?v.replaceFile(n,t.files[0],e):t.files?.length&&v.addFiles(Array.from(t.files),e),t.value=``}),(0,l.onEvent)(t,`click`,t=>{if(t.target!==e){if(i){i=!1;return}h.value||e.click()}}),(0,l.onEvent)(t,`keydown`,e=>{i=o.handleKeydown(e)&&e.key===`Enter`}),(0,d.watch)(h,e=>{let r=(0,p.createDropZone)({disabled:e,element:t,onDrop:e=>v.addFiles(e),onHoverChange:e=>{n.value=e}});return()=>r.dispose()},{immediate:!0})}),l.html`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./styles/mixins/shape.css.cjs"),t=require("./styles/mixins/theme.css.cjs"),n=require("./styles/index.cjs"),r=require("./shared/size-presets.cjs"),i=require("./headless/ref-callback.cjs"),a=require("./headless/keyboard.cjs"),o=require("./inputs/shared/form-context.cjs"),s=require("./inputs/file-input/file-input-upload.cjs"),c=require("./inputs/file-input/file-input.css.cjs");let l=require("@vielzeug/ore"),u=require("@vielzeug/ripple"),d=require("@vielzeug/ore/forms"),f=require("@vielzeug/dnd");var p=e=>e.type.startsWith(`image/`),m=`ore-file-input`;(0,l.define)(m,{formAssociated:!0,props:{accept:l.prop.string(),color:l.prop.string(),disabled:l.prop.bool(!1),error:l.prop.string(),gallery:l.prop.bool(!1),helper:l.prop.string(),label:l.prop.string(),"max-files":l.prop.number(0),"max-size":l.prop.number(0),multiple:l.prop.bool(!1),name:l.prop.string(),ref:l.prop.data(),required:l.prop.bool(!1),size:l.prop.string(),upload:l.prop.data()},setup(e){let t=(0,l.useEmit)(),n=(0,u.signal)(!1),r=(0,u.signal)(null),c=o.useFormContext(e,(0,l.inject)(o.FORM_CTX)),m=c.disabled,h=(0,u.computed)(()=>e[`max-files`].value??0),g=(0,u.computed)(()=>e[`max-size`].value??0),_=s.createFileQueue({accept:e.accept,disabled:m,maxFiles:h,maxSize:g,multiple:(0,u.computed)(()=>!!e.multiple.value),onChange:(e,n)=>t(`change`,{files:e,originalEvent:n,value:e}),onRemove:(e,n,r)=>t(`remove`,{file:e,files:n,originalEvent:r,value:n}),onUploadError:(e,n)=>t(`upload-error`,{error:n,file:e}),onUploadProgress:(e,n,r)=>t(`upload-progress`,{file:e,loaded:n,total:r}),onUploadSuccess:e=>t(`upload-success`,{file:e}),upload:(0,u.computed)(()=>e.upload.value??void 0)});(0,l.onCleanup)(()=>_.dispose()),(0,d.useField)({disabled:m,toFormValue:t=>{if(t.length===0)return null;let n=e.name.value||`file`,r=new FormData;for(let e of t)r.append(n,e);return r},value:_.files});let v=(0,u.computed)(()=>!!e.error.value);(0,l.bind)({attr:{"drag-over":()=>n.value?!0:void 0,invalid:()=>v.value?!0:void 0,size:c.size}});let y=(0,l.createStableId)(`file-input`),b=`label-${y}`,x=`helper-${y}`,S=`error-${y}`,C=(0,l.ref)(),w=(0,l.ref)(),T=(0,u.computed)(()=>{let t=[];e.accept.value&&t.push(e.accept.value.split(`,`).map(e=>e.trim()).join(`, `));let n=g.value;n>0&&t.push(`max ${s.formatBytes(n)}`);let r=h.value;return r>0&&t.push(`up to ${r} file${r===1?``:`s`}`),t.join(` · `)});function E(e){r.value=e,w.value?.click()}let D=new Map;function O(e){let t=D.get(e);return t||(t=URL.createObjectURL(e),D.set(e,t)),t}function k(e){let t=new Set(e);for(let[e,n]of D)t.has(e)||(URL.revokeObjectURL(n),D.delete(e))}return(0,u.watch)(_.files,k),(0,l.onCleanup)(()=>{for(let e of D.values())URL.revokeObjectURL(e);D.clear()}),(0,l.onElement)(w,t=>i.bindRefCallback(e.ref,t)),(0,l.onMounted)(()=>{let e=w.value,t=C.value,i=!1,o=a.createInteraction({disabled:m,onPress:()=>{e.click()}});(0,l.onEvent)(e,`change`,e=>{let t=e.target,n=r.value;r.value=null,n&&t.files?.[0]?_.replaceFile(n,t.files[0],e):t.files?.length&&_.addFiles(Array.from(t.files),e),t.value=``}),(0,l.onEvent)(t,`click`,t=>{if(t.target!==e){if(i){i=!1;return}m.value||e.click()}}),(0,l.onEvent)(t,`keydown`,e=>{i=o.handleKeydown(e)&&e.key===`Enter`}),(0,u.watch)(m,e=>{let r=(0,f.createDropZone)({disabled:e,element:t,onDrop:e=>_.addFiles(e),onHoverChange:e=>{n.value=e}});return()=>r.dispose()},{immediate:!0})}),l.html`
2
2
  <div class="file-input-wrapper" part="wrapper">
3
- <label class="label-outside" id="${x}" part="label" ?hidden=${()=>!e.label.value}
3
+ <label class="label-outside" id="${b}" part="label" ?hidden=${()=>!e.label.value}
4
4
  >${e.label}</label
5
5
  >
6
6
  <div
7
7
  class="dropzone"
8
8
  part="dropzone"
9
- ref=${w}
9
+ ref=${C}
10
10
  role="button"
11
- :tabindex="${()=>h.value?`-1`:`0`}"
12
- :aria-disabled="${()=>String(h.value)}"
11
+ :tabindex="${()=>m.value?`-1`:`0`}"
12
+ :aria-disabled="${()=>String(m.value)}"
13
13
  :aria-label="${()=>e.label.value?null:`File upload drop zone`}"
14
- :aria-labelledby="${()=>e.label.value?x:null}"
15
- aria-describedby="${S}">
14
+ :aria-labelledby="${()=>e.label.value?b:null}"
15
+ aria-describedby="${x}">
16
16
  <input
17
17
  type="file"
18
- ref=${T}
18
+ ref=${w}
19
19
  part="input"
20
- id="${b}"
20
+ id="${y}"
21
21
  :accept="${e.accept}"
22
22
  ?multiple="${e.multiple}"
23
23
  ?required="${e.required}"
24
- ?disabled="${h}"
24
+ ?disabled="${m}"
25
25
  :name="${e.name}"
26
26
  hidden
27
27
  inert
28
28
  tabindex="-1" />
29
29
  <div class="dropzone-content">
30
- <span class="dropzone-icon" aria-hidden="true" :data-status="${()=>y.value?`error`:null}">
31
- ${()=>y.value?l.html`<ore-icon name="alert-circle" size="36" stroke-width="1.5" aria-hidden="true"></ore-icon>`:l.html`<ore-icon name="upload" size="36" stroke-width="1.5" aria-hidden="true"></ore-icon>`}
30
+ <span class="dropzone-icon" aria-hidden="true" :data-status="${()=>v.value?`error`:null}">
31
+ ${()=>v.value?l.html`<ore-icon name="alert-circle" size="36" stroke-width="1.5" aria-hidden="true"></ore-icon>`:l.html`<ore-icon name="upload" size="36" stroke-width="1.5" aria-hidden="true"></ore-icon>`}
32
32
  </span>
33
33
  <!-- Signal 01: the copy itself shifts on drag-entry (not just border/glow) — a
34
34
  static "Drop files here" during an active drag reads as if the drop target
35
35
  hasn't noticed the file yet. -->
36
- ${(0,u.when)(()=>n.value,()=>l.html`<span class="dropzone-title dropzone-title-active">Release to upload</span>`)}
37
- ${(0,u.when)(()=>!n.value,()=>l.html`<span class="dropzone-title">Drop files here or <u>click to browse</u></span>`)}
38
- <span class="dropzone-hint" ?hidden=${()=>!E.value}>${E}</span>
36
+ ${(0,l.when)(()=>n.value,()=>l.html`<span class="dropzone-title dropzone-title-active">Release to upload</span>`)}
37
+ ${(0,l.when)(()=>!n.value,()=>l.html`<span class="dropzone-title">Drop files here or <u>click to browse</u></span>`)}
38
+ <span class="dropzone-hint" ?hidden=${()=>!T.value}>${T}</span>
39
39
  </div>
40
40
  </div>
41
41
  <ul
@@ -43,116 +43,116 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
43
43
  part="${()=>e.gallery.value?`gallery`:null}"
44
44
  role="list"
45
45
  aria-label="Selected files"
46
- ?hidden=${()=>v.files.value.length===0}>
47
- ${()=>v.files.value.map(t=>e.gallery.value?l.html`
48
- <li class="file-card" data-status=${()=>v.fileState(t).status}>
46
+ ?hidden=${()=>_.files.value.length===0}>
47
+ ${()=>_.files.value.map(t=>e.gallery.value?l.html`
48
+ <li class="file-card" data-status=${()=>_.fileState(t).status}>
49
49
  <span class="file-thumb-frame">
50
- ${m(t)?l.html`<img
50
+ ${p(t)?l.html`<img
51
51
  class="file-thumb"
52
52
  alt=""
53
- ref="${e=>{e&&(e.src=k(t))}}" />`:l.html`<span class="file-thumb file-thumb-generic" aria-hidden="true">
53
+ ref="${e=>{e&&(e.src=O(t))}}" />`:l.html`<span class="file-thumb file-thumb-generic" aria-hidden="true">
54
54
  <ore-icon name="file" size="28" stroke-width="1.5" aria-hidden="true"></ore-icon>
55
55
  </span>`}
56
- ${(0,u.when)(()=>v.fileState(t).status===`success`,()=>l.html`<span class="file-status-badge file-status-badge-success" aria-hidden="true">
56
+ ${(0,l.when)(()=>_.fileState(t).status===`success`,()=>l.html`<span class="file-status-badge file-status-badge-success" aria-hidden="true">
57
57
  <ore-icon name="check" size="11" stroke-width="3" aria-hidden="true"></ore-icon>
58
58
  </span>`)}
59
- ${(0,u.when)(()=>v.fileState(t).status===`error`,()=>l.html`<span class="file-status-badge file-status-badge-error" aria-hidden="true">
59
+ ${(0,l.when)(()=>_.fileState(t).status===`error`,()=>l.html`<span class="file-status-badge file-status-badge-error" aria-hidden="true">
60
60
  <ore-icon name="alert-circle" size="12" stroke-width="2.5" aria-hidden="true"></ore-icon>
61
61
  </span>`)}
62
62
  <span class="file-card-actions">
63
- ${(0,u.when)(()=>v.fileState(t).status===`error`,()=>l.html`<button
63
+ ${(0,l.when)(()=>_.fileState(t).status===`error`,()=>l.html`<button
64
64
  class="file-card-action"
65
65
  type="button"
66
66
  aria-label="${`Retry uploading ${t.name}`}"
67
- @click=${()=>v.retryUpload(t)}>
67
+ @click=${()=>_.retryUpload(t)}>
68
68
  <ore-icon name="refresh-cw" size="12" stroke-width="2.5" aria-hidden="true"></ore-icon>
69
69
  </button>`)}
70
- ${(0,u.when)(()=>v.fileState(t).status===`success`&&!!e.multiple.value&&!!e.upload.value,()=>l.html`<button
70
+ ${(0,l.when)(()=>_.fileState(t).status===`success`&&!!e.multiple.value&&!!e.upload.value,()=>l.html`<button
71
71
  class="file-card-action"
72
72
  type="button"
73
73
  aria-label="${`Replace ${t.name}`}"
74
- @click=${()=>D(t)}>
74
+ @click=${()=>E(t)}>
75
75
  <ore-icon name="upload" size="12" stroke-width="2.5" aria-hidden="true"></ore-icon>
76
76
  </button>`)}
77
77
  <button
78
78
  class="file-card-action file-card-remove"
79
79
  type="button"
80
80
  aria-label="${`Remove ${t.name}`}"
81
- @click=${e=>v.removeFile(t,e)}>
81
+ @click=${e=>_.removeFile(t,e)}>
82
82
  <ore-icon name="x" size="12" stroke-width="2.5" aria-hidden="true"></ore-icon>
83
83
  </button>
84
84
  </span>
85
85
  </span>
86
86
  <span class="file-card-name" title="${t.name}">${t.name}</span>
87
- ${(0,u.when)(()=>v.fileState(t).status===`uploading`,()=>l.html`
87
+ ${(0,l.when)(()=>_.fileState(t).status===`uploading`,()=>l.html`
88
88
  <ore-progress
89
89
  type="linear"
90
90
  size="sm"
91
- :value=${()=>v.uploadPercent(t)}
92
- label=${()=>`${v.uploadPercent(t)}%`}></ore-progress>
93
- <span class="file-progress-meta">${()=>v.uploadMetaText(t)}</span>
91
+ :value=${()=>_.uploadPercent(t)}
92
+ label=${()=>`${_.uploadPercent(t)}%`}></ore-progress>
93
+ <span class="file-progress-meta">${()=>_.uploadMetaText(t)}</span>
94
94
  `)}
95
- ${(0,u.when)(()=>v.fileState(t).status===`error`,()=>l.html`<span class="file-error-text">${()=>v.fileState(t).error}</span>`)}
95
+ ${(0,l.when)(()=>_.fileState(t).status===`error`,()=>l.html`<span class="file-error-text">${()=>_.fileState(t).error}</span>`)}
96
96
  </li>
97
97
  `:l.html`
98
- <li class="file-item" data-status=${()=>v.fileState(t).status}>
98
+ <li class="file-item" data-status=${()=>_.fileState(t).status}>
99
99
  <span class="file-icon" aria-hidden="true">
100
100
  <ore-icon
101
- name=${()=>v.statusIconName(t)}
101
+ name=${()=>_.statusIconName(t)}
102
102
  size="18"
103
103
  stroke-width="1.75"
104
104
  aria-hidden="true"></ore-icon>
105
105
  </span>
106
106
  <span class="file-meta">
107
107
  <span class="file-name" title="${t.name}">${t.name}</span>
108
- ${(0,u.when)(()=>v.fileState(t).status===`uploading`,()=>l.html`
108
+ ${(0,l.when)(()=>_.fileState(t).status===`uploading`,()=>l.html`
109
109
  <ore-progress
110
110
  type="linear"
111
111
  size="sm"
112
- :value=${()=>v.uploadPercent(t)}
113
- label=${()=>`${v.uploadPercent(t)}%`}></ore-progress>
114
- <span class="file-progress-meta">${()=>v.uploadMetaText(t)}</span>
112
+ :value=${()=>_.uploadPercent(t)}
113
+ label=${()=>`${_.uploadPercent(t)}%`}></ore-progress>
114
+ <span class="file-progress-meta">${()=>_.uploadMetaText(t)}</span>
115
115
  `)}
116
- ${(0,u.when)(()=>v.fileState(t).status===`error`,()=>l.html`<span class="file-error-text">${()=>v.fileState(t).error}</span>`)}
117
- ${(0,u.when)(()=>v.fileState(t).status===`idle`||v.fileState(t).status===`success`,()=>l.html`<span class="file-size">${s.formatBytes(t.size)}</span>`)}
116
+ ${(0,l.when)(()=>_.fileState(t).status===`error`,()=>l.html`<span class="file-error-text">${()=>_.fileState(t).error}</span>`)}
117
+ ${(0,l.when)(()=>_.fileState(t).status===`idle`||_.fileState(t).status===`success`,()=>l.html`<span class="file-size">${s.formatBytes(t.size)}</span>`)}
118
118
  </span>
119
119
  <span class="file-actions">
120
- ${(0,u.when)(()=>v.fileState(t).status===`error`,()=>l.html`<button
120
+ ${(0,l.when)(()=>_.fileState(t).status===`error`,()=>l.html`<button
121
121
  class="file-action"
122
122
  type="button"
123
123
  aria-label="${`Retry uploading ${t.name}`}"
124
- @click=${()=>v.retryUpload(t)}>
124
+ @click=${()=>_.retryUpload(t)}>
125
125
  <ore-icon name="refresh-cw" size="14" stroke-width="2" aria-hidden="true"></ore-icon>
126
126
  </button>`)}
127
- ${(0,u.when)(()=>v.fileState(t).status===`success`&&!!e.multiple.value&&!!e.upload.value,()=>l.html`<button
127
+ ${(0,l.when)(()=>_.fileState(t).status===`success`&&!!e.multiple.value&&!!e.upload.value,()=>l.html`<button
128
128
  class="file-action"
129
129
  type="button"
130
130
  aria-label="${`Replace ${t.name}`}"
131
- @click=${()=>D(t)}>
131
+ @click=${()=>E(t)}>
132
132
  <ore-icon name="upload" size="14" stroke-width="2" aria-hidden="true"></ore-icon>
133
133
  </button>`)}
134
134
  <button
135
135
  class="file-remove"
136
136
  type="button"
137
137
  aria-label="${`Remove ${t.name}`}"
138
- @click=${e=>v.removeFile(t,e)}>
138
+ @click=${e=>_.removeFile(t,e)}>
139
139
  <ore-icon name="x" size="12" stroke-width="2.5" aria-hidden="true"></ore-icon>
140
140
  </button>
141
141
  </span>
142
142
  </li>
143
143
  `)}
144
144
  </ul>
145
- <div class="helper-text" id="${S}" part="helper" ?hidden=${()=>y.value||!e.helper.value}>
145
+ <div class="helper-text" id="${x}" part="helper" ?hidden=${()=>v.value||!e.helper.value}>
146
146
  ${e.helper}
147
147
  </div>
148
148
  <div
149
149
  class="helper-text helper-text-error"
150
- id="${C}"
150
+ id="${S}"
151
151
  role="alert"
152
152
  part="error"
153
- ?hidden=${()=>!y.value}>
153
+ ?hidden=${()=>!v.value}>
154
154
  ${()=>e.error.value??``}
155
155
  </div>
156
156
  </div>
157
- `},shadow:{delegatesFocus:!0},styles:[...n.fieldMixins,e.sizeVariantMixin(r.FILE_INPUT_SIZE_PRESET),t.forcedColorsFocusMixin(`.dropzone`),c.default]}),exports.FILE_INPUT_TAG=h;
157
+ `},shadow:{delegatesFocus:!0},styles:[...n.fieldMixins,e.sizeVariantMixin(r.FILE_INPUT_SIZE_PRESET),t.forcedColorsFocusMixin(`.dropzone`),c.default]}),exports.FILE_INPUT_TAG=m;
158
158
  //# sourceMappingURL=file-input.cjs.map
@@ -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 createStableId,\n define,\n html,\n inject,\n prop,\n ref,\n bind,\n onCleanup,\n onElement,\n onEvent,\n onMounted,\n useEmit,\n} from '@vielzeug/ore';\nimport { when } from '@vielzeug/ore/directives';\nimport { useField } from '@vielzeug/ore/forms';\nimport { computed, signal, watch } from '@vielzeug/ripple';\n\nimport '../../content/icon/icon';\nimport '../../feedback/progress/progress';\nimport { bindRefCallback, createInteraction } from '../../headless';\nimport { FILE_INPUT_SIZE_PRESET } from '../../shared';\nimport { fieldMixins, forcedColorsFocusMixin, sizeVariantMixin } from '../../styles';\nimport { FORM_CTX, useFormContext } from '../shared/form-context';\nimport { createFileQueue, formatBytes, type FileUploadFn } from './file-input-upload';\nimport componentStyles from './file-input.css?inline';\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 formCtx = inject(FORM_CTX);\n const fCtxProps = useFormContext(props, formCtx);\n const isDisabled = fCtxProps.disabled;\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: fCtxProps.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}</label\n >\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`<ore-icon name=\"alert-circle\" size=\"36\" stroke-width=\"1.5\" aria-hidden=\"true\"></ore-icon>`\n : html`<ore-icon name=\"upload\" size=\"36\" stroke-width=\"1.5\" aria-hidden=\"true\"></ore-icon>`}\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`<span class=\"dropzone-title dropzone-title-active\">Release to upload</span>`,\n )}\n ${when(\n () => !isDragging.value,\n () => html`<span class=\"dropzone-title\">Drop files here or <u>click to browse</u></span>`,\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`<img\n class=\"file-thumb\"\n alt=\"\"\n ref=\"${(el: HTMLImageElement | null) => {\n if (el) el.src = getPreviewUrl(file);\n }}\" />`\n : html`<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 ${when(\n () => queue.fileState(file).status === 'success',\n () =>\n html`<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 ${when(\n () => queue.fileState(file).status === 'error',\n () =>\n html`<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 <span class=\"file-card-actions\">\n ${when(\n () => queue.fileState(file).status === 'error',\n () =>\n html`<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 ${when(\n () =>\n queue.fileState(file).status === 'success' &&\n Boolean(props.multiple.value) &&\n Boolean(props.upload.value),\n () =>\n html`<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 <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`<span class=\"file-error-text\">${() => queue.fileState(file).error}</span>`,\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`<span class=\"file-error-text\">${() => queue.fileState(file).error}</span>`,\n )}\n ${when(\n () => queue.fileState(file).status === 'idle' || queue.fileState(file).status === 'success',\n () => html`<span class=\"file-size\">${formatBytes(file.size)}</span>`,\n )}\n </span>\n <span class=\"file-actions\">\n ${when(\n () => queue.fileState(file).status === 'error',\n () =>\n html`<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 ${when(\n () =>\n queue.fileState(file).status === 'success' &&\n Boolean(props.multiple.value) &&\n Boolean(props.upload.value),\n () =>\n html`<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 <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 ...fieldMixins,\n sizeVariantMixin(FILE_INPUT_SI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gC,EAAU,OAAS,CAAC,EAAM,OAAO,MAAM;YAC3G,EAAM,OAAO;;;;gBAIT,EAAQ;;;wBAGE,CAAC,EAAU,MAAM;gBACzB,EAAM,MAAM,OAAS,GAAG;;;KAIxC,EACA,OAAQ,CAAE,eAAgB,EAAK,EAC/B,OAAQ,CACN,GAAG,EAAA,YACH,EAAA,iBAAiB,EAAA,sBAAsB,EACvC,EAAA,uBAAuB,WAAW,EAClC,EAAA,OACF,CACF,CAAC"}
1
+ {"version":3,"file":"file-input.cjs","names":[],"sources":["../src/inputs/file-input/file-input.ts"],"sourcesContent":["import { createDropZone } from '@vielzeug/dnd';\nimport {\n createStableId,\n define,\n html,\n inject,\n prop,\n ref,\n bind,\n onCleanup,\n onElement,\n onEvent,\n onMounted,\n useEmit,\n when,\n} from '@vielzeug/ore';\nimport { useField } from '@vielzeug/ore/forms';\nimport { computed, signal, watch } from '@vielzeug/ripple';\n\nimport '../../content/icon/icon';\nimport '../../feedback/progress/progress';\nimport { bindRefCallback, createInteraction } from '../../headless';\nimport { FILE_INPUT_SIZE_PRESET } from '../../shared';\nimport { fieldMixins, forcedColorsFocusMixin, sizeVariantMixin } from '../../styles';\nimport { FORM_CTX, useFormContext } from '../shared/form-context';\nimport { createFileQueue, formatBytes, type FileUploadFn } from './file-input-upload';\nimport componentStyles from './file-input.css?inline';\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 formCtx = inject(FORM_CTX);\n const fCtxProps = useFormContext(props, formCtx);\n const isDisabled = fCtxProps.disabled;\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: fCtxProps.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}</label\n >\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`<ore-icon name=\"alert-circle\" size=\"36\" stroke-width=\"1.5\" aria-hidden=\"true\"></ore-icon>`\n : html`<ore-icon name=\"upload\" size=\"36\" stroke-width=\"1.5\" aria-hidden=\"true\"></ore-icon>`}\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`<span class=\"dropzone-title dropzone-title-active\">Release to upload</span>`,\n )}\n ${when(\n () => !isDragging.value,\n () => html`<span class=\"dropzone-title\">Drop files here or <u>click to browse</u></span>`,\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`<img\n class=\"file-thumb\"\n alt=\"\"\n ref=\"${(el: HTMLImageElement | null) => {\n if (el) el.src = getPreviewUrl(file);\n }}\" />`\n : html`<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 ${when(\n () => queue.fileState(file).status === 'success',\n () =>\n html`<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 ${when(\n () => queue.fileState(file).status === 'error',\n () =>\n html`<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 <span class=\"file-card-actions\">\n ${when(\n () => queue.fileState(file).status === 'error',\n () =>\n html`<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 ${when(\n () =>\n queue.fileState(file).status === 'success' &&\n Boolean(props.multiple.value) &&\n Boolean(props.upload.value),\n () =>\n html`<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 <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`<span class=\"file-error-text\">${() => queue.fileState(file).error}</span>`,\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`<span class=\"file-error-text\">${() => queue.fileState(file).error}</span>`,\n )}\n ${when(\n () => queue.fileState(file).status === 'idle' || queue.fileState(file).status === 'success',\n () => html`<span class=\"file-size\">${formatBytes(file.size)}</span>`,\n )}\n </span>\n <span class=\"file-actions\">\n ${when(\n () => queue.fileState(file).status === 'error',\n () =>\n html`<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 ${when(\n () =>\n queue.fileState(file).status === 'success' &&\n Boolean(props.multiple.value) &&\n Boolean(props.upload.value),\n () =>\n html`<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 <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 ...fieldMixins,\n sizeVariantMixin(FILE_INPUT_SIZE_PRESET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OAAS,CAAC,EAAM,OAAO,MAAM;YAC3G,EAAM,OAAO;;;;gBAIT,EAAQ;;;wBAGE,CAAC,EAAU,MAAM;gBACzB,EAAM,MAAM,OAAS,GAAG;;;KAIxC,EACA,OAAQ,CAAE,eAAgB,EAAK,EAC/B,OAAQ,CACN,GAAG,EAAA,YACH,EAAA,iBAAiB,EAAA,sBAAsB,EACvC,EAAA,uBAAuB,WAAW,EAClC,EAAA,OACF,CACF,CAAC"}
@@ -7,8 +7,7 @@ import { createInteraction as a } from "./headless/keyboard.js";
7
7
  import { FORM_CTX as o, useFormContext as s } from "./inputs/shared/form-context.js";
8
8
  import { createFileQueue as c, formatBytes as l } from "./inputs/file-input/file-input-upload.js";
9
9
  import u from "./inputs/file-input/file-input.css.js";
10
- import { bind as d, createStableId as f, define as p, html as m, inject as h, onCleanup as g, onElement as _, onEvent as v, onMounted as y, prop as b, ref as x, useEmit as S } from "@vielzeug/ore";
11
- import { when as C } from "@vielzeug/ore/directives";
10
+ import { bind as d, createStableId as f, define as p, html as m, inject as h, onCleanup as g, onElement as _, onEvent as v, onMounted as y, prop as b, ref as x, useEmit as S, when as C } from "@vielzeug/ore";
12
11
  import { computed as w, signal as T, watch as E } from "@vielzeug/ripple";
13
12
  import { useField as D } from "@vielzeug/ore/forms";
14
13
  import { createDropZone as O } from "@vielzeug/dnd";