@bouko/react 0.2.3 → 0.2.4

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="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"
4
+ fill="currentColor"
5
+ />
6
+ </svg>
@@ -0,0 +1,8 @@
1
+ type Props = {
2
+ style?: string;
3
+ label: string;
4
+ value: boolean;
5
+ update: (x: boolean) => void;
6
+ };
7
+ export default function Checkbox({ style, label, value, update }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Check from "@/assets/icons/check.svg";
3
+ import { cn } from "@bouko/style";
4
+ export default function Checkbox({ style, label, value, update }) {
5
+ const isChecked = !!value;
6
+ return (_jsxs("div", { className: cn(styles.container, style), children: [_jsx("div", { className: cn(styles.box, isChecked && "bg-accent"), onClick: () => update(!isChecked), children: isChecked && _jsx(Check, { className: styles.check }) }), _jsx("span", { className: styles.label, children: label })] }));
7
+ }
8
+ const styles = {
9
+ container: "flex gap-3 items-center",
10
+ box: "flex justify-center items-center size-4 min-w-4 hover:bg-accent border rounded border-border-light duration-200 cursor-pointer",
11
+ check: "size-2 text-background",
12
+ label: "text-xs text-primary-dark"
13
+ };
package/dist/index.d.ts CHANGED
@@ -4,5 +4,6 @@ export { default as Select } from "./components/select";
4
4
  export { default as MultipleChoice } from "./components/mcq";
5
5
  export { default as Attachment } from "./components/attachment";
6
6
  export { default as Button } from "./components/button";
7
+ export { default as CheckBox } from "./components/checkbox";
7
8
  export * from "./components/flex";
8
9
  export * from "./core/types";
package/dist/index.js CHANGED
@@ -4,5 +4,6 @@ export { default as Select } from "./components/select";
4
4
  export { default as MultipleChoice } from "./components/mcq";
5
5
  export { default as Attachment } from "./components/attachment";
6
6
  export { default as Button } from "./components/button";
7
+ export { default as CheckBox } from "./components/checkbox";
7
8
  export * from "./components/flex";
8
9
  export * from "./core/types";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
 
3
3
  "name": "@bouko/react",
4
- "version": "0.2.3",
4
+ "version": "0.2.4",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "MIT",