@douglasneuroinformatics/libui 3.6.5 → 3.7.0
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.
- package/dist/components.d.ts +5 -1
- package/dist/components.js +6 -3
- package/dist/components.js.map +1 -1
- package/dist/douglasneuroinformatics-libui-3.7.0.tgz +0 -0
- package/package.json +1 -1
- package/src/components/Form/Form.stories.tsx +42 -17
- package/src/components/Form/Form.tsx +9 -2
- package/dist/douglasneuroinformatics-libui-3.6.5.tgz +0 -0
package/dist/components.d.ts
CHANGED
|
@@ -1231,6 +1231,10 @@ declare const FileDropzone: ({ acceptedFileTypes, className, description, file,
|
|
|
1231
1231
|
|
|
1232
1232
|
type FormProps<TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<TSchema> = z.TypeOf<TSchema>> = {
|
|
1233
1233
|
[key: `data-${string}`]: unknown;
|
|
1234
|
+
additionalButtons?: {
|
|
1235
|
+
left?: React.ReactNode;
|
|
1236
|
+
right?: React.ReactNode;
|
|
1237
|
+
};
|
|
1234
1238
|
className?: string;
|
|
1235
1239
|
content: FormContent<TData>;
|
|
1236
1240
|
fieldsFooter?: React.ReactNode;
|
|
@@ -1245,7 +1249,7 @@ type FormProps<TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<T
|
|
|
1245
1249
|
submitBtnLabel?: string;
|
|
1246
1250
|
validationSchema: z.ZodType<TData>;
|
|
1247
1251
|
};
|
|
1248
|
-
declare const Form: <TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<TSchema> = z.TypeOf<TSchema>>({ className, content, fieldsFooter, id, initialValues, onError, onSubmit, preventResetValuesOnReset, readOnly, resetBtn, revalidateOnBlur, submitBtnLabel, validationSchema, ...props }: FormProps<TSchema, TData>) => react_jsx_runtime.JSX.Element;
|
|
1252
|
+
declare const Form: <TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<TSchema> = z.TypeOf<TSchema>>({ additionalButtons, className, content, fieldsFooter, id, initialValues, onError, onSubmit, preventResetValuesOnReset, readOnly, resetBtn, revalidateOnBlur, submitBtnLabel, validationSchema, ...props }: FormProps<TSchema, TData>) => react_jsx_runtime.JSX.Element;
|
|
1249
1253
|
|
|
1250
1254
|
type HeadingProps = {
|
|
1251
1255
|
children: string;
|
package/dist/components.js
CHANGED
|
@@ -2069,7 +2069,7 @@ var FileDropzone = ({
|
|
|
2069
2069
|
};
|
|
2070
2070
|
|
|
2071
2071
|
// src/components/Form/Form.tsx
|
|
2072
|
-
import { useEffect as useEffect10,
|
|
2072
|
+
import { useEffect as useEffect10, useState as useState8 } from "react";
|
|
2073
2073
|
import { get, set } from "lodash-es";
|
|
2074
2074
|
import { twMerge } from "tailwind-merge";
|
|
2075
2075
|
import "zod";
|
|
@@ -3414,6 +3414,7 @@ function getInitialValues(values) {
|
|
|
3414
3414
|
// src/components/Form/Form.tsx
|
|
3415
3415
|
import { jsx as jsx136, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
3416
3416
|
var Form = ({
|
|
3417
|
+
additionalButtons,
|
|
3417
3418
|
className,
|
|
3418
3419
|
content,
|
|
3419
3420
|
fieldsFooter,
|
|
@@ -3484,7 +3485,7 @@ var Form = ({
|
|
|
3484
3485
|
useEffect10(() => {
|
|
3485
3486
|
revalidate();
|
|
3486
3487
|
}, [resolvedLanguage]);
|
|
3487
|
-
|
|
3488
|
+
useEffect10(() => {
|
|
3488
3489
|
if (initialValues) {
|
|
3489
3490
|
setValues(getInitialValues(initialValues));
|
|
3490
3491
|
}
|
|
@@ -3530,6 +3531,7 @@ var Form = ({
|
|
|
3530
3531
|
),
|
|
3531
3532
|
fieldsFooter,
|
|
3532
3533
|
/* @__PURE__ */ jsxs47("div", { className: "flex w-full gap-3", children: [
|
|
3534
|
+
additionalButtons?.left,
|
|
3533
3535
|
/* @__PURE__ */ jsx136(Button, { "aria-label": "Submit", className: "block w-full", disabled: readOnly, type: "submit", variant: "primary", children: submitBtnLabel ?? t("form.submit") }),
|
|
3534
3536
|
resetBtn && /* @__PURE__ */ jsx136(
|
|
3535
3537
|
Button,
|
|
@@ -3542,7 +3544,8 @@ var Form = ({
|
|
|
3542
3544
|
onClick: reset,
|
|
3543
3545
|
children: t("form.reset")
|
|
3544
3546
|
}
|
|
3545
|
-
)
|
|
3547
|
+
),
|
|
3548
|
+
additionalButtons?.right
|
|
3546
3549
|
] }),
|
|
3547
3550
|
Boolean(rootErrors.length) && /* @__PURE__ */ jsx136(ErrorMessage, { error: rootErrors })
|
|
3548
3551
|
]
|