@bouko/react 1.8.5 → 1.8.6
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.
|
@@ -2,7 +2,7 @@ import type { SetState } from "../form";
|
|
|
2
2
|
type Props = {
|
|
3
3
|
style?: string;
|
|
4
4
|
accept?: string[];
|
|
5
|
-
update: SetState<File
|
|
5
|
+
update: SetState<File>;
|
|
6
6
|
};
|
|
7
7
|
export default function FileUploader({ style, accept, update }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -5,7 +5,7 @@ import PaperClip from "../../assets/icons/paperclip.svg";
|
|
|
5
5
|
export default function FileUploader({ style, accept = [], update }) {
|
|
6
6
|
const ref = useRef(null);
|
|
7
7
|
const upload = () => ref.current?.click();
|
|
8
|
-
const save = (e) => update(
|
|
8
|
+
const save = (e) => update((e.target.files ?? [])[0]);
|
|
9
9
|
return (_jsxs("div", { className: cn(styles.container, style), onClick: upload, children: [_jsxs("span", { className: styles.title, children: [_jsx(PaperClip, {}), "Drag and drop a file, or"] }), _jsx("span", { className: styles.subtitle, children: "browse" }), _jsx("input", { type: "file", className: "hidden", onChange: save, accept: accept.join(","), multiple: false, ref: ref })] }));
|
|
10
10
|
}
|
|
11
11
|
const styles = {
|