@bouko/react 1.8.7 → 1.8.9
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.
|
@@ -22,9 +22,9 @@ export function FormBuilder({ fields, validator, data, styles, update, submit, c
|
|
|
22
22
|
await submit.action(data);
|
|
23
23
|
setLoading(false);
|
|
24
24
|
};
|
|
25
|
-
return (_jsxs("div", { className: cn("flex flex-col w-full gap-4", styles?.container), children: [fields.map((row, i) => (_jsx(RowBox, { style: "w-full gap-5 overflow-hidden", children: row.map(({ element, id, rows, label, placeholder, options, required, note }) => {
|
|
25
|
+
return (_jsxs("div", { className: cn("flex flex-col w-full gap-4", styles?.container), children: [fields.map((row, i) => (_jsx(RowBox, { style: "w-full gap-5 overflow-hidden", children: row.map(({ element, id, rows, label, placeholder, disabled, options, required, note }) => {
|
|
26
26
|
if (element === "input")
|
|
27
|
-
return (_jsx(Input, { id: id, styles: { container: "flex-1" }, label: label, placeholder: placeholder, value: data[id], update: update, note: note, required: required }, id));
|
|
27
|
+
return (_jsx(Input, { id: id, styles: { container: "flex-1" }, label: label, placeholder: placeholder, value: data[id], update: update, disabled: disabled, note: note, required: required }, id));
|
|
28
28
|
else if (element === "select")
|
|
29
29
|
return (_jsx(Select, { id: id, label: label, placeholder: placeholder, options: options || [], value: data[id], update: update, note: note, required: required }, id));
|
|
30
30
|
else if (element === "textarea")
|
|
@@ -5,6 +5,7 @@ type Props<T> = FieldProps<T> & {
|
|
|
5
5
|
container?: string;
|
|
6
6
|
input?: string;
|
|
7
7
|
};
|
|
8
|
+
disabled?: boolean;
|
|
8
9
|
};
|
|
9
10
|
export default function Input<T>({ id, styles, style, label, required, note, update, ...props }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export {};
|
package/dist/components/input.js
CHANGED
|
@@ -3,5 +3,5 @@ import Field from "./field";
|
|
|
3
3
|
import { cn } from "@bouko/style";
|
|
4
4
|
import { setField } from "./form";
|
|
5
5
|
export default function Input({ id, styles, style, label, required = true, note, update, ...props }) {
|
|
6
|
-
return (_jsx(Field, { style: styles?.container, label: label, required: required, note: note, children: _jsx("input", { className: cn("px-3 py-2 bg-input border border-outline duration-200 focus:border-outline-light outline-none rounded text-sm", styles?.input), onChange: ({ target: { value } }) => setField(update, id, value), ...props }) }));
|
|
6
|
+
return (_jsx(Field, { style: styles?.container, label: label, required: required, note: note, children: _jsx("input", { className: cn("px-3 py-2 bg-input border border-outline duration-200 focus:border-outline-light outline-none rounded text-sm disabled:brightness-80 disabled:cursor-not-allowed", styles?.input), onChange: ({ target: { value } }) => setField(update, id, value), ...props }) }));
|
|
7
7
|
}
|