@trackunit/react-form-wizard 1.0.48 → 1.0.49
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/index.cjs.js +12 -0
- package/index.esm.js +12 -0
- package/package.json +5 -5
- package/src/FormWizard/FormWizard.d.ts +12 -0
- package/src/FormWizard/FormWizard.stories.d.ts +7 -0
package/index.cjs.js
CHANGED
|
@@ -350,6 +350,18 @@ const cvaStepContainer = cssClassVarianceUtilities.cvaMerge(["h-full", "grid", "
|
|
|
350
350
|
/**
|
|
351
351
|
* The FormWizard component is used for forms in multiple steps.
|
|
352
352
|
* Use the useFormWizard hook to generate the props for this component.
|
|
353
|
+
*
|
|
354
|
+
* The useFormWizard hook takes a form schema which is a zod schema that contains all the steps.
|
|
355
|
+
* Each step will get a prop that is the form for that step and can be used to register inputs.
|
|
356
|
+
* This allows for a coherent form structure that can be used to validate the form as steps and as a whole.
|
|
357
|
+
*
|
|
358
|
+
* The FormWizard component is a wrapper that renders the sidebar and the step wrapper.
|
|
359
|
+
* The sidebar is a list of steps that can be navigated to.
|
|
360
|
+
* The step wrapper is a list of steps that are rendered.
|
|
361
|
+
*
|
|
362
|
+
* The FormWizard component also handles the navigation between steps.
|
|
363
|
+
*
|
|
364
|
+
* ** In production code, the schema should be returned from a hook, to allow the use of translations for error messages in the schema. **
|
|
353
365
|
*/
|
|
354
366
|
const FormWizard = ({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema, onCancel, className, dataTestId, basePath, }) => {
|
|
355
367
|
const navigate = reactRouter.useNavigate();
|
package/index.esm.js
CHANGED
|
@@ -348,6 +348,18 @@ const cvaStepContainer = cvaMerge(["h-full", "grid", "bg-white", "overflow-hidde
|
|
|
348
348
|
/**
|
|
349
349
|
* The FormWizard component is used for forms in multiple steps.
|
|
350
350
|
* Use the useFormWizard hook to generate the props for this component.
|
|
351
|
+
*
|
|
352
|
+
* The useFormWizard hook takes a form schema which is a zod schema that contains all the steps.
|
|
353
|
+
* Each step will get a prop that is the form for that step and can be used to register inputs.
|
|
354
|
+
* This allows for a coherent form structure that can be used to validate the form as steps and as a whole.
|
|
355
|
+
*
|
|
356
|
+
* The FormWizard component is a wrapper that renders the sidebar and the step wrapper.
|
|
357
|
+
* The sidebar is a list of steps that can be navigated to.
|
|
358
|
+
* The step wrapper is a list of steps that are rendered.
|
|
359
|
+
*
|
|
360
|
+
* The FormWizard component also handles the navigation between steps.
|
|
361
|
+
*
|
|
362
|
+
* ** In production code, the schema should be returned from a hook, to allow the use of translations for error messages in the schema. **
|
|
351
363
|
*/
|
|
352
364
|
const FormWizard = ({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema, onCancel, className, dataTestId, basePath, }) => {
|
|
353
365
|
const navigate = useNavigate();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-form-wizard",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.49",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"dependencies": {
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"@hookform/resolvers": "^3.3.4",
|
|
10
10
|
"react-hook-form": "7.53.1",
|
|
11
11
|
"@tanstack/react-router": "1.47.1",
|
|
12
|
-
"@trackunit/shared-utils": "1.2.
|
|
13
|
-
"@trackunit/css-class-variance-utilities": "1.0.
|
|
14
|
-
"@trackunit/react-components": "1.1.
|
|
15
|
-
"@trackunit/i18n-library-translation": "1.0.
|
|
12
|
+
"@trackunit/shared-utils": "1.2.22",
|
|
13
|
+
"@trackunit/css-class-variance-utilities": "1.0.25",
|
|
14
|
+
"@trackunit/react-components": "1.1.31",
|
|
15
|
+
"@trackunit/i18n-library-translation": "1.0.34"
|
|
16
16
|
},
|
|
17
17
|
"engines": {
|
|
18
18
|
"node": ">=20.x",
|
|
@@ -7,5 +7,17 @@ export type FormWizardStepFormReturnMap<TFullSchema extends AnyZodObject> = Part
|
|
|
7
7
|
/**
|
|
8
8
|
* The FormWizard component is used for forms in multiple steps.
|
|
9
9
|
* Use the useFormWizard hook to generate the props for this component.
|
|
10
|
+
*
|
|
11
|
+
* The useFormWizard hook takes a form schema which is a zod schema that contains all the steps.
|
|
12
|
+
* Each step will get a prop that is the form for that step and can be used to register inputs.
|
|
13
|
+
* This allows for a coherent form structure that can be used to validate the form as steps and as a whole.
|
|
14
|
+
*
|
|
15
|
+
* The FormWizard component is a wrapper that renders the sidebar and the step wrapper.
|
|
16
|
+
* The sidebar is a list of steps that can be navigated to.
|
|
17
|
+
* The step wrapper is a list of steps that are rendered.
|
|
18
|
+
*
|
|
19
|
+
* The FormWizard component also handles the navigation between steps.
|
|
20
|
+
*
|
|
21
|
+
* ** In production code, the schema should be returned from a hook, to allow the use of translations for error messages in the schema. **
|
|
10
22
|
*/
|
|
11
23
|
export declare const FormWizard: <TFullSchema extends AnyZodObject, TComponentStepDefinitions extends StepDefinitions<TFullSchema>>({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema, onCancel, className, dataTestId, basePath, }: FromWizardComponentProps<TFullSchema, TComponentStepDefinitions>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { FormWizard } from "./FormWizard";
|
|
3
|
+
type Story = StoryObj<typeof FormWizard>;
|
|
4
|
+
declare const meta: Meta<typeof FormWizard>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const packageName: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const Default: Story;
|