@trackunit/react-form-wizard 1.7.116 → 1.7.119
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 +5 -5
- package/index.esm.js +5 -5
- package/package.json +5 -5
- package/src/FormWizard/FormWizard.d.ts +1 -1
- package/src/FormWizard/FormWizard.stories.d.ts +1 -1
- package/src/FormWizardHeader/FormWizardHeader.d.ts +1 -1
- package/src/FormWizardSidebar/FormWizardSidebar.d.ts +1 -1
- package/src/FormWizardSidebarStep/FormWizardSidebarStep.d.ts +1 -1
package/index.cjs.js
CHANGED
|
@@ -74,7 +74,7 @@ const cvaSidebar = cssClassVarianceUtilities.cvaMerge([
|
|
|
74
74
|
* Displays the sidebar with steps for the wizard.
|
|
75
75
|
* Prefer using the FormWizard component instead of this directly.
|
|
76
76
|
*/
|
|
77
|
-
function FormWizardSidebar({ dataTestId, children, className }) {
|
|
77
|
+
function FormWizardSidebar({ "data-testid": dataTestId, children, className }) {
|
|
78
78
|
return (jsxRuntime.jsxs("aside", { className: cvaSidebar({ className }), "data-testid": dataTestId, children: [children, jsxRuntime.jsx("div", { className: cvaFillSection() })] }));
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -169,7 +169,7 @@ const getStateIcon = (state) => {
|
|
|
169
169
|
* A sidebar step component used by the FormWizard component to render each step.
|
|
170
170
|
* This component is generally used internally by the FormWizard component.
|
|
171
171
|
*/
|
|
172
|
-
const FormWizardSidebarStep = ({ stepNumber, state, basePath, title, subTitle, path, dataTestId, onNavigate, isSubStep, }) => {
|
|
172
|
+
const FormWizardSidebarStep = ({ stepNumber, state, basePath, title, subTitle, path, "data-testid": dataTestId, onNavigate, isSubStep, }) => {
|
|
173
173
|
const stateIcon = getStateIcon(state);
|
|
174
174
|
return (jsxRuntime.jsx(reactRouter.Link, { className: cvaFormWizardSidebarStep({ state, isSubStep }), "data-testid": dataTestId ?? `form-wizard-sidebar-step-${path}`, onClick: () => onNavigate(), params: prev => ({ ...prev, stepPath: path }), search: prev => ({ ...prev }), to: basePath, children: jsxRuntime.jsxs("div", { className: cvaSectionHeaderContainer({ state }), children: [jsxRuntime.jsx("div", { className: cvaStepNumberContainer(), children: stateIcon ?? (jsxRuntime.jsx("span", { className: cvaStepNumber({ state, isSubStep }), "data-testid": isSubStep ? `form-wizard-sidebar-substep` : `form-wizard-sidebar-step-number-${stepNumber}`, children: stepNumber })) }), jsxRuntime.jsxs("div", { className: cvaTitleAndDescription(), children: [jsxRuntime.jsx("h3", { className: cvaHeader(), children: title }), subTitle ? jsxRuntime.jsx("p", { className: cvaSubtitle(), children: subTitle }) : null] })] }) }));
|
|
175
175
|
};
|
|
@@ -193,7 +193,7 @@ const cvaNavigationContainer = cssClassVarianceUtilities.cvaMerge(["flex", "gap-
|
|
|
193
193
|
*/
|
|
194
194
|
const FormWizardFooter = ({ disablePrimaryAction = false, onBack, onCancel, primaryActionLabel, }) => {
|
|
195
195
|
const [t] = useTranslation();
|
|
196
|
-
return (jsxRuntime.jsxs("div", { className: cvaFooterContainer(), children: [jsxRuntime.jsx(reactComponents.Button, {
|
|
196
|
+
return (jsxRuntime.jsxs("div", { className: cvaFooterContainer(), children: [jsxRuntime.jsx(reactComponents.Button, { "data-testid": "wizard-cancel", onClick: onCancel, variant: "ghost-neutral", children: t("wizard.defaults.cancel") }), jsxRuntime.jsxs("div", { className: cvaNavigationContainer(), children: [onBack ? (jsxRuntime.jsx(reactComponents.Button, { "data-testid": "wizard-back", onClick: onBack, variant: "secondary", children: t("wizard.defaults.back") })) : null, jsxRuntime.jsx(reactComponents.Button, { "data-testid": "wizard-next", disabled: disablePrimaryAction, type: "submit", children: primaryActionLabel ? primaryActionLabel : t("wizard.defaults.next") })] })] }));
|
|
197
197
|
};
|
|
198
198
|
|
|
199
199
|
const cvaFormWizardHeader = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -208,7 +208,7 @@ const cvaFormWizardHeader = cssClassVarianceUtilities.cvaMerge([
|
|
|
208
208
|
* The header component for the FormWizard.
|
|
209
209
|
* In most cases you should not be using this component directly, but rather use the FormWizard component.
|
|
210
210
|
*/
|
|
211
|
-
const FormWizardHeader = ({ title, description, className, dataTestId }) => {
|
|
211
|
+
const FormWizardHeader = ({ title, description, className, "data-testid": dataTestId, }) => {
|
|
212
212
|
return (jsxRuntime.jsxs("div", { className: cvaFormWizardHeader({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx(reactComponents.Heading, { variant: "secondary", children: title }), description ? (jsxRuntime.jsx(reactComponents.Heading, { subtle: true, variant: "subtitle", children: description })) : null] }));
|
|
213
213
|
};
|
|
214
214
|
|
|
@@ -371,7 +371,7 @@ const cvaStepContainer = cssClassVarianceUtilities.cvaMerge(["h-full", "grid", "
|
|
|
371
371
|
*
|
|
372
372
|
* ** In production code, the schema should be returned from a hook, to allow the use of translations for error messages in the schema. **
|
|
373
373
|
*/
|
|
374
|
-
const FormWizard = ({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema, onCancel, className, dataTestId, basePath, }) => {
|
|
374
|
+
const FormWizard = ({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema, onCancel, className, "data-testid": dataTestId, basePath, }) => {
|
|
375
375
|
const navigate = reactRouter.useNavigate();
|
|
376
376
|
const { stepPath, subStepPath } = reactRouter.useParams({ strict: false });
|
|
377
377
|
const initialFullFormState = react.useMemo(() => sharedUtils.objectFromEntries(sharedUtils.objectEntries(steps)
|
package/index.esm.js
CHANGED
|
@@ -72,7 +72,7 @@ const cvaSidebar = cvaMerge([
|
|
|
72
72
|
* Displays the sidebar with steps for the wizard.
|
|
73
73
|
* Prefer using the FormWizard component instead of this directly.
|
|
74
74
|
*/
|
|
75
|
-
function FormWizardSidebar({ dataTestId, children, className }) {
|
|
75
|
+
function FormWizardSidebar({ "data-testid": dataTestId, children, className }) {
|
|
76
76
|
return (jsxs("aside", { className: cvaSidebar({ className }), "data-testid": dataTestId, children: [children, jsx("div", { className: cvaFillSection() })] }));
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -167,7 +167,7 @@ const getStateIcon = (state) => {
|
|
|
167
167
|
* A sidebar step component used by the FormWizard component to render each step.
|
|
168
168
|
* This component is generally used internally by the FormWizard component.
|
|
169
169
|
*/
|
|
170
|
-
const FormWizardSidebarStep = ({ stepNumber, state, basePath, title, subTitle, path, dataTestId, onNavigate, isSubStep, }) => {
|
|
170
|
+
const FormWizardSidebarStep = ({ stepNumber, state, basePath, title, subTitle, path, "data-testid": dataTestId, onNavigate, isSubStep, }) => {
|
|
171
171
|
const stateIcon = getStateIcon(state);
|
|
172
172
|
return (jsx(Link, { className: cvaFormWizardSidebarStep({ state, isSubStep }), "data-testid": dataTestId ?? `form-wizard-sidebar-step-${path}`, onClick: () => onNavigate(), params: prev => ({ ...prev, stepPath: path }), search: prev => ({ ...prev }), to: basePath, children: jsxs("div", { className: cvaSectionHeaderContainer({ state }), children: [jsx("div", { className: cvaStepNumberContainer(), children: stateIcon ?? (jsx("span", { className: cvaStepNumber({ state, isSubStep }), "data-testid": isSubStep ? `form-wizard-sidebar-substep` : `form-wizard-sidebar-step-number-${stepNumber}`, children: stepNumber })) }), jsxs("div", { className: cvaTitleAndDescription(), children: [jsx("h3", { className: cvaHeader(), children: title }), subTitle ? jsx("p", { className: cvaSubtitle(), children: subTitle }) : null] })] }) }));
|
|
173
173
|
};
|
|
@@ -191,7 +191,7 @@ const cvaNavigationContainer = cvaMerge(["flex", "gap-2"]);
|
|
|
191
191
|
*/
|
|
192
192
|
const FormWizardFooter = ({ disablePrimaryAction = false, onBack, onCancel, primaryActionLabel, }) => {
|
|
193
193
|
const [t] = useTranslation();
|
|
194
|
-
return (jsxs("div", { className: cvaFooterContainer(), children: [jsx(Button, {
|
|
194
|
+
return (jsxs("div", { className: cvaFooterContainer(), children: [jsx(Button, { "data-testid": "wizard-cancel", onClick: onCancel, variant: "ghost-neutral", children: t("wizard.defaults.cancel") }), jsxs("div", { className: cvaNavigationContainer(), children: [onBack ? (jsx(Button, { "data-testid": "wizard-back", onClick: onBack, variant: "secondary", children: t("wizard.defaults.back") })) : null, jsx(Button, { "data-testid": "wizard-next", disabled: disablePrimaryAction, type: "submit", children: primaryActionLabel ? primaryActionLabel : t("wizard.defaults.next") })] })] }));
|
|
195
195
|
};
|
|
196
196
|
|
|
197
197
|
const cvaFormWizardHeader = cvaMerge([
|
|
@@ -206,7 +206,7 @@ const cvaFormWizardHeader = cvaMerge([
|
|
|
206
206
|
* The header component for the FormWizard.
|
|
207
207
|
* In most cases you should not be using this component directly, but rather use the FormWizard component.
|
|
208
208
|
*/
|
|
209
|
-
const FormWizardHeader = ({ title, description, className, dataTestId }) => {
|
|
209
|
+
const FormWizardHeader = ({ title, description, className, "data-testid": dataTestId, }) => {
|
|
210
210
|
return (jsxs("div", { className: cvaFormWizardHeader({ className }), "data-testid": dataTestId, children: [jsx(Heading, { variant: "secondary", children: title }), description ? (jsx(Heading, { subtle: true, variant: "subtitle", children: description })) : null] }));
|
|
211
211
|
};
|
|
212
212
|
|
|
@@ -369,7 +369,7 @@ const cvaStepContainer = cvaMerge(["h-full", "grid", "bg-white", "overflow-hidde
|
|
|
369
369
|
*
|
|
370
370
|
* ** In production code, the schema should be returned from a hook, to allow the use of translations for error messages in the schema. **
|
|
371
371
|
*/
|
|
372
|
-
const FormWizard = ({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema, onCancel, className, dataTestId, basePath, }) => {
|
|
372
|
+
const FormWizard = ({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema, onCancel, className, "data-testid": dataTestId, basePath, }) => {
|
|
373
373
|
const navigate = useNavigate();
|
|
374
374
|
const { stepPath, subStepPath } = useParams({ strict: false });
|
|
375
375
|
const initialFullFormState = useMemo(() => objectFromEntries(objectEntries(steps)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-form-wizard",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.119",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"dependencies": {
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"react-hook-form": "7.62.0",
|
|
11
11
|
"@tanstack/react-router": "1.114.29",
|
|
12
12
|
"@tanstack/router-core": "1.114.29",
|
|
13
|
-
"@trackunit/shared-utils": "1.9.
|
|
14
|
-
"@trackunit/css-class-variance-utilities": "1.7.
|
|
15
|
-
"@trackunit/react-components": "1.10.
|
|
16
|
-
"@trackunit/i18n-library-translation": "1.7.
|
|
13
|
+
"@trackunit/shared-utils": "1.9.77",
|
|
14
|
+
"@trackunit/css-class-variance-utilities": "1.7.77",
|
|
15
|
+
"@trackunit/react-components": "1.10.52",
|
|
16
|
+
"@trackunit/i18n-library-translation": "1.7.95"
|
|
17
17
|
},
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">=22.x",
|
|
@@ -20,4 +20,4 @@ export type FormWizardStepFormReturnMap<TFullSchema extends AnyZodObject> = Part
|
|
|
20
20
|
*
|
|
21
21
|
* ** In production code, the schema should be returned from a hook, to allow the use of translations for error messages in the schema. **
|
|
22
22
|
*/
|
|
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;
|
|
23
|
+
export declare const FormWizard: <TFullSchema extends AnyZodObject, TComponentStepDefinitions extends StepDefinitions<TFullSchema>>({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema, onCancel, className, "data-testid": dataTestId, basePath, }: FromWizardComponentProps<TFullSchema, TComponentStepDefinitions>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { ReactElement } from "react";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
declare const meta: {
|
|
5
5
|
title: string;
|
|
6
|
-
component: <TFullSchema extends z.AnyZodObject, TComponentStepDefinitions extends import("./useFormWizard").StepDefinitions<TFullSchema>>({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema, onCancel, className, dataTestId, basePath, }: import("./useFormWizard").FromWizardComponentProps<TFullSchema, TComponentStepDefinitions>) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
component: <TFullSchema extends z.AnyZodObject, TComponentStepDefinitions extends import("./useFormWizard").StepDefinitions<TFullSchema>>({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema, onCancel, className, "data-testid": dataTestId, basePath, }: import("./useFormWizard").FromWizardComponentProps<TFullSchema, TComponentStepDefinitions>) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
tags: string[];
|
|
8
8
|
parameters: {
|
|
9
9
|
docs: {
|
|
@@ -7,5 +7,5 @@ interface FormWizardHeaderProps extends CommonProps {
|
|
|
7
7
|
* The header component for the FormWizard.
|
|
8
8
|
* In most cases you should not be using this component directly, but rather use the FormWizard component.
|
|
9
9
|
*/
|
|
10
|
-
export declare const FormWizardHeader: ({ title, description, className, dataTestId }: FormWizardHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const FormWizardHeader: ({ title, description, className, "data-testid": dataTestId, }: FormWizardHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -10,5 +10,5 @@ interface FormWizardSidebarProps extends CommonProps {
|
|
|
10
10
|
* Displays the sidebar with steps for the wizard.
|
|
11
11
|
* Prefer using the FormWizard component instead of this directly.
|
|
12
12
|
*/
|
|
13
|
-
export declare function FormWizardSidebar({ dataTestId, children, className }: FormWizardSidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function FormWizardSidebar({ "data-testid": dataTestId, children, className }: FormWizardSidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export {};
|
|
@@ -15,5 +15,5 @@ interface FormWizardSidebarStepProps extends CommonProps {
|
|
|
15
15
|
* A sidebar step component used by the FormWizard component to render each step.
|
|
16
16
|
* This component is generally used internally by the FormWizard component.
|
|
17
17
|
*/
|
|
18
|
-
export declare const FormWizardSidebarStep: ({ stepNumber, state, basePath, title, subTitle, path, dataTestId, onNavigate, isSubStep, }: FormWizardSidebarStepProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare const FormWizardSidebarStep: ({ stepNumber, state, basePath, title, subTitle, path, "data-testid": dataTestId, onNavigate, isSubStep, }: FormWizardSidebarStepProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
19
|
export {};
|