@trackunit/react-form-wizard 1.13.28 → 1.13.29

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 CHANGED
@@ -169,9 +169,9 @@ 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, "data-testid": dataTestId, onNavigate, isSubStep, }) => {
172
+ const FormWizardSidebarStep = ({ stepNumber, state, basePath, title, subTitle, path, "data-testid": dataTestId, onClickNavigate, isSubStep, }) => {
173
173
  const stateIcon = getStateIcon(state);
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] })] }) }));
174
+ return (jsxRuntime.jsx(reactRouter.Link, { className: cvaFormWizardSidebarStep({ state, isSubStep }), "data-testid": dataTestId ?? `form-wizard-sidebar-step-${path}`, onClick: onClickNavigate, 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
  };
176
176
 
177
177
  const cvaFooterContainer = cssClassVarianceUtilities.cvaMerge([
@@ -191,9 +191,9 @@ const cvaNavigationContainer = cssClassVarianceUtilities.cvaMerge(["flex", "gap-
191
191
  * The footer component for the FormWizard.
192
192
  * In most cases you should not be using this component directly, but rather use the FormWizard component.
193
193
  */
194
- const FormWizardFooter = ({ disablePrimaryAction = false, loading = false, onBack, onCancel, primaryActionLabel, }) => {
194
+ const FormWizardFooter = ({ disablePrimaryAction = false, loading = false, onClickBack, onClickCancel, primaryActionLabel, }) => {
195
195
  const [t] = useTranslation();
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, loading: loading, type: "submit", children: primaryActionLabel ? primaryActionLabel : t("wizard.defaults.next") })] })] }));
196
+ return (jsxRuntime.jsxs("div", { className: cvaFooterContainer(), children: [jsxRuntime.jsx(reactComponents.Button, { "data-testid": "wizard-cancel", onClick: onClickCancel, variant: "ghost-neutral", children: t("wizard.defaults.cancel") }), jsxRuntime.jsxs("div", { className: cvaNavigationContainer(), children: [onClickBack ? (jsxRuntime.jsx(reactComponents.Button, { "data-testid": "wizard-back", onClick: onClickBack, variant: "secondary", children: t("wizard.defaults.back") })) : null, jsxRuntime.jsx(reactComponents.Button, { "data-testid": "wizard-next", disabled: disablePrimaryAction, loading: loading, type: "submit", children: primaryActionLabel ? primaryActionLabel : t("wizard.defaults.next") })] })] }));
197
197
  };
198
198
 
199
199
  const cvaFormWizardHeader = cssClassVarianceUtilities.cvaMerge([
@@ -335,11 +335,11 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
335
335
  beforeStepSubmit: beforeStepSubmit,
336
336
  resetFullFormState,
337
337
  }) }) }), jsxRuntime.jsx(FormWizardFooter, { stepForms,
338
- onBack: previousStepPath
338
+ onClickBack: previousStepPath
339
339
  ? () => navigate({ to: basePath, params: { stepPath: previousStepPath } })
340
340
  : null,
341
341
  primaryActionLabel: isLastStep ? lastStepPrimaryActionLabel : undefined,
342
- onCancel: handleCancel,
342
+ onClickCancel: handleCancel,
343
343
  loading: isLastStep ? isSubmitting : false,
344
344
  disablePrimaryAction: isSubmitting })] }, String(stepKey)));
345
345
  };
@@ -542,7 +542,7 @@ const FormWizard = ({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema,
542
542
  return (jsxRuntime.jsx(FormWizardSidebarStep, { state: stepState(),
543
543
  stepNumber: isSubStep ? undefined : rootSteps.indexOf(key) + 1,
544
544
  title,
545
- onNavigate: () => {
545
+ onClickNavigate: () => {
546
546
  if (previousStepKey) {
547
547
  const previousStepForm = stepForms[previousStepKey];
548
548
  setFullFormState(prev => ({
package/index.esm.js CHANGED
@@ -167,9 +167,9 @@ 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, "data-testid": dataTestId, onNavigate, isSubStep, }) => {
170
+ const FormWizardSidebarStep = ({ stepNumber, state, basePath, title, subTitle, path, "data-testid": dataTestId, onClickNavigate, isSubStep, }) => {
171
171
  const stateIcon = getStateIcon(state);
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] })] }) }));
172
+ return (jsx(Link, { className: cvaFormWizardSidebarStep({ state, isSubStep }), "data-testid": dataTestId ?? `form-wizard-sidebar-step-${path}`, onClick: onClickNavigate, 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
  };
174
174
 
175
175
  const cvaFooterContainer = cvaMerge([
@@ -189,9 +189,9 @@ const cvaNavigationContainer = cvaMerge(["flex", "gap-2"]);
189
189
  * The footer component for the FormWizard.
190
190
  * In most cases you should not be using this component directly, but rather use the FormWizard component.
191
191
  */
192
- const FormWizardFooter = ({ disablePrimaryAction = false, loading = false, onBack, onCancel, primaryActionLabel, }) => {
192
+ const FormWizardFooter = ({ disablePrimaryAction = false, loading = false, onClickBack, onClickCancel, primaryActionLabel, }) => {
193
193
  const [t] = useTranslation();
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, loading: loading, type: "submit", children: primaryActionLabel ? primaryActionLabel : t("wizard.defaults.next") })] })] }));
194
+ return (jsxs("div", { className: cvaFooterContainer(), children: [jsx(Button, { "data-testid": "wizard-cancel", onClick: onClickCancel, variant: "ghost-neutral", children: t("wizard.defaults.cancel") }), jsxs("div", { className: cvaNavigationContainer(), children: [onClickBack ? (jsx(Button, { "data-testid": "wizard-back", onClick: onClickBack, variant: "secondary", children: t("wizard.defaults.back") })) : null, jsx(Button, { "data-testid": "wizard-next", disabled: disablePrimaryAction, loading: loading, type: "submit", children: primaryActionLabel ? primaryActionLabel : t("wizard.defaults.next") })] })] }));
195
195
  };
196
196
 
197
197
  const cvaFormWizardHeader = cvaMerge([
@@ -333,11 +333,11 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
333
333
  beforeStepSubmit: beforeStepSubmit,
334
334
  resetFullFormState,
335
335
  }) }) }), jsx(FormWizardFooter, { stepForms,
336
- onBack: previousStepPath
336
+ onClickBack: previousStepPath
337
337
  ? () => navigate({ to: basePath, params: { stepPath: previousStepPath } })
338
338
  : null,
339
339
  primaryActionLabel: isLastStep ? lastStepPrimaryActionLabel : undefined,
340
- onCancel: handleCancel,
340
+ onClickCancel: handleCancel,
341
341
  loading: isLastStep ? isSubmitting : false,
342
342
  disablePrimaryAction: isSubmitting })] }, String(stepKey)));
343
343
  };
@@ -540,7 +540,7 @@ const FormWizard = ({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema,
540
540
  return (jsx(FormWizardSidebarStep, { state: stepState(),
541
541
  stepNumber: isSubStep ? undefined : rootSteps.indexOf(key) + 1,
542
542
  title,
543
- onNavigate: () => {
543
+ onClickNavigate: () => {
544
544
  if (previousStepKey) {
545
545
  const previousStepForm = stepForms[previousStepKey];
546
546
  setFullFormState(prev => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-form-wizard",
3
- "version": "1.13.28",
3
+ "version": "1.13.29",
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.13.43",
14
- "@trackunit/css-class-variance-utilities": "1.11.43",
15
- "@trackunit/react-components": "1.17.25",
16
- "@trackunit/i18n-library-translation": "1.12.28"
13
+ "@trackunit/shared-utils": "1.13.44",
14
+ "@trackunit/css-class-variance-utilities": "1.11.44",
15
+ "@trackunit/react-components": "1.17.26",
16
+ "@trackunit/i18n-library-translation": "1.12.29"
17
17
  },
18
18
  "engines": {
19
19
  "node": ">=24.x",
@@ -1,9 +1,9 @@
1
1
  import { CommonProps } from "@trackunit/react-components";
2
- import { ReactElement } from "react";
2
+ import { ReactElement, MouseEventHandler } from "react";
3
3
  interface FormWizardFooterProps extends CommonProps {
4
4
  primaryActionLabel?: string;
5
- onCancel: () => void;
6
- onBack: (() => void) | null;
5
+ onClickCancel: MouseEventHandler<HTMLElement>;
6
+ onClickBack: (() => void) | null;
7
7
  disablePrimaryAction?: boolean;
8
8
  loading: boolean;
9
9
  }
@@ -11,5 +11,5 @@ interface FormWizardFooterProps extends CommonProps {
11
11
  * The footer component for the FormWizard.
12
12
  * In most cases you should not be using this component directly, but rather use the FormWizard component.
13
13
  */
14
- export declare const FormWizardFooter: ({ disablePrimaryAction, loading, onBack, onCancel, primaryActionLabel, }: FormWizardFooterProps) => ReactElement;
14
+ export declare const FormWizardFooter: ({ disablePrimaryAction, loading, onClickBack, onClickCancel, primaryActionLabel, }: FormWizardFooterProps) => ReactElement;
15
15
  export {};
@@ -1,5 +1,6 @@
1
1
  import { RegisteredRouter, RouteIds } from "@tanstack/react-router";
2
2
  import { CommonProps } from "@trackunit/react-components";
3
+ import { MouseEventHandler } from "react";
3
4
  import { StepState, StringWithStepKey } from "../FormWizard/useFormWizard";
4
5
  interface FormWizardSidebarStepProps extends CommonProps {
5
6
  state: StepState;
@@ -8,12 +9,12 @@ interface FormWizardSidebarStepProps extends CommonProps {
8
9
  basePath: StringWithStepKey<`${RouteIds<RegisteredRouter["routeTree"]>}`>;
9
10
  subTitle?: string;
10
11
  path: string;
11
- onNavigate: () => void;
12
+ onClickNavigate: MouseEventHandler<HTMLElement>;
12
13
  isSubStep?: boolean;
13
14
  }
14
15
  /**
15
16
  * A sidebar step component used by the FormWizard component to render each step.
16
17
  * This component is generally used internally by the FormWizard component.
17
18
  */
18
- export declare const FormWizardSidebarStep: ({ stepNumber, state, basePath, title, subTitle, path, "data-testid": dataTestId, onNavigate, isSubStep, }: FormWizardSidebarStepProps) => import("react/jsx-runtime").JSX.Element;
19
+ export declare const FormWizardSidebarStep: ({ stepNumber, state, basePath, title, subTitle, path, "data-testid": dataTestId, onClickNavigate, isSubStep, }: FormWizardSidebarStepProps) => import("react/jsx-runtime").JSX.Element;
19
20
  export {};