@bouko/react 0.1.6 → 0.1.8

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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import Field from "./field";
3
3
  import { cn } from "@bouko/style";
4
4
  export default function MultipleChoice({ label, options, style, value, update, required = true }) {
5
- return (_jsx(Field, { style: style, label: label, required: required, children: _jsx("div", { className: styles.options, children: options.map((x, i) => (_jsxs("div", { className: styles.item, children: [_jsx(Dot, { ...x, active: x.id === value, select: () => update(x.id) }), label] }, i))) }) }));
5
+ return (_jsx(Field, { style: style, label: label, required: required, children: _jsx("div", { className: styles.options, children: options.map((x, i) => (_jsxs("div", { className: styles.item, children: [_jsx(Dot, { ...x, active: x.id === value, select: () => update(x.id) }), x.label] }, i))) }) }));
6
6
  }
7
7
  const Dot = ({ active, select }) => (_jsx("div", { className: cn(styles.dot, active && "bg-accent border-accent-dark"), onClick: select }));
8
8
  const styles = {
@@ -0,0 +1,8 @@
1
+ import type { ReactNode, TextareaHTMLAttributes } from "react";
2
+ type Props = TextareaHTMLAttributes<HTMLTextAreaElement> & {
3
+ label?: string;
4
+ style?: string;
5
+ note?: ReactNode;
6
+ };
7
+ export default function TextArea({ style, label, required, note, ...props }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "@bouko/style";
3
+ export default function TextArea({ style, label, required = true, note, ...props }) {
4
+ 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)" }) : ""] }), _jsx("textarea", { className: styles.textarea, ...props }), note && _jsx("span", { className: styles.note, children: note })] }));
5
+ }
6
+ const styles = {
7
+ container: "flex flex-col gap-1 overflow-hidden",
8
+ label: "text-xs text-slate-600",
9
+ textarea: "px-3 py-2 bg-slate-200/50 border border-slate-300 outline-blue-500 rounded text-sm resize-none",
10
+ note: "mt-1 text-xs text-slate-500"
11
+ };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as Input } from "./components/input";
2
+ export { default as TextArea } from "./components/textarea";
2
3
  export { default as Select } from "./components/select";
3
4
  export { default as MultipleChoice } from "./components/mcq";
4
5
  export { default as Attachment } from "./components/attachment";
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as Input } from "./components/input";
2
+ export { default as TextArea } from "./components/textarea";
2
3
  export { default as Select } from "./components/select";
3
4
  export { default as MultipleChoice } from "./components/mcq";
4
5
  export { default as Attachment } from "./components/attachment";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
 
3
3
  "name": "@bouko/react",
4
- "version": "0.1.6",
4
+ "version": "0.1.8",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "MIT",