@bouko/react 2.4.0 → 2.4.1

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.
@@ -6,9 +6,9 @@ export default function Attachment({ id, style, label, value, update, required =
6
6
  const ref = useRef(null);
7
7
  const handleFileChange = (e) => {
8
8
  if (e.target.files && id)
9
- update([e.target.files[0]]);
9
+ update(Array.from(e.target.files));
10
10
  };
11
- return (_jsxs("div", { className: cn(styles.container, style), children: [label && _jsxs("span", { className: styles.label, children: [label, " ", !required ? _jsx("span", { className: "italic text-slate-400", children: "(optional)" }, void 0) : ""] }, void 0), _jsxs("div", { onClick: () => ref.current?.click(), className: "flex flex-col justify-center items-center py-3 gap-1 w-full cursor-pointer duration-200 hover:bg-slate-200/40 rounded border-2 border-slate-300 border-dashed", children: [!value || value.length === 0 && (_jsxs(_Fragment, { children: [_jsxs("span", { className: "flex gap-2 items-center font-semibold text-sm", children: [_jsx(PaperClip, {}, void 0), "Drag and drop files, paste screenshots, or"] }, void 0), _jsx("span", { className: "text-xs text-slate-500", children: "browse" }, void 0), _jsx("input", { type: "file", className: "hidden", onChange: handleFileChange, ref: ref }, void 0)] }, void 0)), value && value.length > 0 && value.map((x, i) => (_jsx("span", { className: "text-xs text-slate-500", children: x.name }, i)))] }, void 0), note && _jsx("span", { className: styles.note, children: note }, void 0)] }, void 0));
11
+ return (_jsxs("div", { className: cn(styles.container, style), children: [label && _jsxs("span", { className: styles.label, children: [label, " ", !required ? _jsx("span", { className: "italic text-slate-400", children: "(optional)" }, void 0) : ""] }, void 0), _jsxs("div", { onClick: () => ref.current?.click(), className: "flex flex-col justify-center items-center py-3 gap-1 w-full cursor-pointer duration-200 hover:bg-slate-200/40 rounded border-2 border-slate-300 border-dashed", children: [!value || value.length === 0 && (_jsxs(_Fragment, { children: [_jsxs("span", { className: "flex gap-2 items-center font-semibold text-sm", children: [_jsx(PaperClip, {}, void 0), "Drag and drop files, paste screenshots, or"] }, void 0), _jsx("span", { className: "text-xs text-slate-500", children: "browse" }, void 0), _jsx("input", { type: "file", className: "hidden", onChange: handleFileChange, multiple: true, ref: ref }, void 0)] }, void 0)), value && value.length > 0 && value.map((x, i) => (_jsx("span", { className: "text-xs text-slate-500", children: x.name }, i)))] }, void 0), note && _jsx("span", { className: styles.note, children: note }, void 0)] }, void 0));
12
12
  }
13
13
  const styles = {
14
14
  container: "flex flex-col gap-2 w-full shrink-0 overflow-hidden",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
 
3
3
  "name": "@bouko/react",
4
- "version": "2.4.0",
4
+ "version": "2.4.1",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "MIT",