@bouko/react 0.1.4 → 0.1.5
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.
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" width="1em" height="1em">
|
|
2
|
+
<path
|
|
3
|
+
d="M364.2 83.8c-24.4-24.4-64-24.4-88.4 0l-184 184c-42.1 42.1-42.1 110.3 0 152.4s110.3 42.1 152.4 0l152-152c10.9-10.9 28.7-10.9 39.6 0s10.9 28.7 0 39.6l-152 152c-64 64-167.6 64-231.6 0s-64-167.6 0-231.6l184-184c46.3-46.3 121.3-46.3 167.6 0s46.3 121.3 0 167.6l-176 176c-28.6 28.6-75 28.6-103.6 0s-28.6-75 0-103.6l144-144c10.9-10.9 28.7-10.9 39.6 0s10.9 28.7 0 39.6l-144 144c-6.7 6.7-6.7 17.7 0 24.4s17.7 6.7 24.4 0l176-176c24.4-24.4 24.4-64 0-88.4z"
|
|
4
|
+
fill="currentColor"
|
|
5
|
+
/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Dispatch, type SetStateAction } from "react";
|
|
2
|
+
type Props = {
|
|
3
|
+
label?: string;
|
|
4
|
+
style?: string;
|
|
5
|
+
value?: File[];
|
|
6
|
+
required?: boolean;
|
|
7
|
+
update: Dispatch<SetStateAction<File[]>>;
|
|
8
|
+
note?: string;
|
|
9
|
+
};
|
|
10
|
+
export default function Attachment({ style, update, label, required, value, note }: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import PaperClip from "../assets/icons/paperclip.svg";
|
|
4
|
+
import { cn } from "@bouko/style";
|
|
5
|
+
export default function Attachment({ style, update, label, required = true, value, note }) {
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
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)" }) : ""] }), _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: [_jsxs("span", { className: "flex gap-2 items-center font-semibold text-sm", children: [_jsx(PaperClip, {}), "Drag and drop files, paste screenshots, or"] }), _jsx("span", { className: "text-xs text-slate-500", children: "browse" }), _jsx("input", { type: "file", className: "hidden", ref: ref })] }), note && _jsx("span", { className: styles.note, children: note })] }));
|
|
8
|
+
}
|
|
9
|
+
const styles = {
|
|
10
|
+
container: "flex flex-col gap-2 overflow-hidden",
|
|
11
|
+
label: "text-xs text-slate-600",
|
|
12
|
+
input: "px-3 py-2 bg-slate-200/50 border border-slate-300 outline-blue-500 rounded text-sm",
|
|
13
|
+
note: "mt-1 text-xs text-slate-500"
|
|
14
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as Button } from "./components/button";
|
|
2
2
|
export { default as Input } from "./components/input";
|
|
3
3
|
export { default as MultipleChoice } from "./components/mcq";
|
|
4
|
+
export { default as Attachment } from "./components/attachment";
|
|
4
5
|
export * from "./core/types";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as Button } from "./components/button";
|
|
2
2
|
export { default as Input } from "./components/input";
|
|
3
3
|
export { default as MultipleChoice } from "./components/mcq";
|
|
4
|
+
export { default as Attachment } from "./components/attachment";
|
|
4
5
|
export * from "./core/types";
|