@bouko/react 0.3.0 → 0.3.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.
@@ -3,7 +3,7 @@ type Props = InputHTMLAttributes<HTMLInputElement> & {
3
3
  label?: string;
4
4
  style?: string;
5
5
  required?: boolean;
6
- note?: string;
6
+ note?: ReactNode;
7
7
  children: ReactNode;
8
8
  };
9
9
  export default function Field({ style, label, required, note, children }: Props): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
- import type { Field as FieldProps } from "../core/types";
2
- type Props = FieldProps & {
1
+ import { type Field as FieldProps } from "@bouko/form";
2
+ type Props<T> = FieldProps<T> & {
3
3
  placeholder?: string;
4
4
  };
5
- export default function Input({ style, label, required, note, update, ...props }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export default function Input<T>({ id, style, label, required, note, update, ...props }: Props<T>): import("react/jsx-runtime").JSX.Element;
6
6
  export {};
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import Field from "./field";
3
- export default function Input({ style, label, required = true, note, update, ...props }) {
4
- return (_jsx(Field, { style: style, label: label, required: required, note: note, children: _jsx("input", { className: "px-3 py-2 bg-slate-200/50 border border-slate-300 outline-blue-500 rounded text-sm", onChange: ({ target: { value } }) => update(value), ...props }) }));
3
+ import { setField } from "@bouko/form";
4
+ export default function Input({ id, style, label, required = true, note, update, ...props }) {
5
+ return (_jsx(Field, { style: style, label: label, required: required, note: note, children: _jsx("input", { className: "px-3 py-2 bg-slate-200/50 border border-slate-300 outline-blue-500 rounded text-sm", onChange: ({ target: { value } }) => setField(update, id, value), ...props }) }));
5
6
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
 
3
3
  "name": "@bouko/react",
4
- "version": "0.3.0",
4
+ "version": "0.3.1",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "MIT",