@trackunit/react-form-wizard 2.6.22 → 2.6.24-alpha-3e7014314a8.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/index.cjs.js +4 -7
- package/index.esm.js +4 -7
- package/package.json +5 -5
- package/src/FormWizard/useFormWizard.d.ts +0 -2
- package/migrations/entry.js.map +0 -1
package/index.cjs.js
CHANGED
|
@@ -212,7 +212,6 @@ const cvaFormWizardComponentStepForm = cssClassVarianceUtilities.cvaMerge(["grid
|
|
|
212
212
|
const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, component, nextStepPath, previousStepPath, lastStepPrimaryActionLabel, fullFormSchema, setFullFormState, fullFormState, stepForms, setStepForms, setStepStates, basePath, containerClassName, onPrimaryAction, initialFullFormState, }) => {
|
|
213
213
|
const navigate = reactRouter.useNavigate();
|
|
214
214
|
const [isSubmitting, setIsSubmitting] = react.useState(false);
|
|
215
|
-
const [primaryActionDisabledByStep, setPrimaryActionDisabledByStep] = react.useState(false);
|
|
216
215
|
const [submitHandlerInternal, setSubmitHandlerInternal] = react.useState(null);
|
|
217
216
|
const [beforeSubmitInternal, setBeforeSubmitInternal] = react.useState(null);
|
|
218
217
|
const form = reactHookForm.useForm({
|
|
@@ -298,10 +297,9 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
|
|
|
298
297
|
return isEmptyStep && form.formState.isValid ? emptyStepSubmitHandler : stepSubmitHandler;
|
|
299
298
|
}, [emptyStepSubmitHandler, form.formState.isValid, isEmptyStep, stepSubmitHandler]);
|
|
300
299
|
react.useEffect(() => {
|
|
301
|
-
// submit on cmd/ctrl + enter,
|
|
302
|
-
// primary action — the shortcut must not bypass the footer button's disabled state
|
|
300
|
+
// submit on cmd/ctrl + enter, always
|
|
303
301
|
const handleKeyDown = (event) => {
|
|
304
|
-
if (event.key === "Enter" && (event.ctrlKey || event.metaKey)
|
|
302
|
+
if (event.key === "Enter" && (event.ctrlKey || event.metaKey)) {
|
|
305
303
|
event.preventDefault();
|
|
306
304
|
void stepSubmitHandler();
|
|
307
305
|
}
|
|
@@ -310,7 +308,7 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
|
|
|
310
308
|
return () => {
|
|
311
309
|
document.removeEventListener("keydown", handleKeyDown);
|
|
312
310
|
};
|
|
313
|
-
}, [stepSubmitHandler
|
|
311
|
+
}, [stepSubmitHandler]);
|
|
314
312
|
return (jsxRuntime.jsxs("form", { className: cvaFormWizardComponentStepForm(), noValidate: true, onSubmit: async (e) => {
|
|
315
313
|
e.preventDefault();
|
|
316
314
|
try {
|
|
@@ -326,7 +324,6 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
|
|
|
326
324
|
setSubmitHandler: isLastStep ? setSubmitHandler : null,
|
|
327
325
|
beforeStepSubmit: beforeStepSubmit,
|
|
328
326
|
resetFullFormState,
|
|
329
|
-
setPrimaryActionDisabled: setPrimaryActionDisabledByStep,
|
|
330
327
|
}) }) }), jsxRuntime.jsx(FormWizardFooter, { stepForms,
|
|
331
328
|
onClickBack: previousStepPath
|
|
332
329
|
? () => navigate({ to: basePath, params: { stepPath: previousStepPath } })
|
|
@@ -334,7 +331,7 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
|
|
|
334
331
|
primaryActionLabel: isLastStep ? lastStepPrimaryActionLabel : undefined,
|
|
335
332
|
onClickCancel: handleCancel,
|
|
336
333
|
loading: isLastStep ? isSubmitting : false,
|
|
337
|
-
disablePrimaryAction: isSubmitting
|
|
334
|
+
disablePrimaryAction: isSubmitting })] }, String(stepKey)));
|
|
338
335
|
};
|
|
339
336
|
|
|
340
337
|
const cvaFormWizardContainer = cssClassVarianceUtilities.cvaMerge(["h-full"]);
|
package/index.esm.js
CHANGED
|
@@ -210,7 +210,6 @@ const cvaFormWizardComponentStepForm = cvaMerge(["grid-rows-min-fr-min", "grid",
|
|
|
210
210
|
const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, component, nextStepPath, previousStepPath, lastStepPrimaryActionLabel, fullFormSchema, setFullFormState, fullFormState, stepForms, setStepForms, setStepStates, basePath, containerClassName, onPrimaryAction, initialFullFormState, }) => {
|
|
211
211
|
const navigate = useNavigate();
|
|
212
212
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
213
|
-
const [primaryActionDisabledByStep, setPrimaryActionDisabledByStep] = useState(false);
|
|
214
213
|
const [submitHandlerInternal, setSubmitHandlerInternal] = useState(null);
|
|
215
214
|
const [beforeSubmitInternal, setBeforeSubmitInternal] = useState(null);
|
|
216
215
|
const form = useForm({
|
|
@@ -296,10 +295,9 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
|
|
|
296
295
|
return isEmptyStep && form.formState.isValid ? emptyStepSubmitHandler : stepSubmitHandler;
|
|
297
296
|
}, [emptyStepSubmitHandler, form.formState.isValid, isEmptyStep, stepSubmitHandler]);
|
|
298
297
|
useEffect(() => {
|
|
299
|
-
// submit on cmd/ctrl + enter,
|
|
300
|
-
// primary action — the shortcut must not bypass the footer button's disabled state
|
|
298
|
+
// submit on cmd/ctrl + enter, always
|
|
301
299
|
const handleKeyDown = (event) => {
|
|
302
|
-
if (event.key === "Enter" && (event.ctrlKey || event.metaKey)
|
|
300
|
+
if (event.key === "Enter" && (event.ctrlKey || event.metaKey)) {
|
|
303
301
|
event.preventDefault();
|
|
304
302
|
void stepSubmitHandler();
|
|
305
303
|
}
|
|
@@ -308,7 +306,7 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
|
|
|
308
306
|
return () => {
|
|
309
307
|
document.removeEventListener("keydown", handleKeyDown);
|
|
310
308
|
};
|
|
311
|
-
}, [stepSubmitHandler
|
|
309
|
+
}, [stepSubmitHandler]);
|
|
312
310
|
return (jsxs("form", { className: cvaFormWizardComponentStepForm(), noValidate: true, onSubmit: async (e) => {
|
|
313
311
|
e.preventDefault();
|
|
314
312
|
try {
|
|
@@ -324,7 +322,6 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
|
|
|
324
322
|
setSubmitHandler: isLastStep ? setSubmitHandler : null,
|
|
325
323
|
beforeStepSubmit: beforeStepSubmit,
|
|
326
324
|
resetFullFormState,
|
|
327
|
-
setPrimaryActionDisabled: setPrimaryActionDisabledByStep,
|
|
328
325
|
}) }) }), jsx(FormWizardFooter, { stepForms,
|
|
329
326
|
onClickBack: previousStepPath
|
|
330
327
|
? () => navigate({ to: basePath, params: { stepPath: previousStepPath } })
|
|
@@ -332,7 +329,7 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
|
|
|
332
329
|
primaryActionLabel: isLastStep ? lastStepPrimaryActionLabel : undefined,
|
|
333
330
|
onClickCancel: handleCancel,
|
|
334
331
|
loading: isLastStep ? isSubmitting : false,
|
|
335
|
-
disablePrimaryAction: isSubmitting
|
|
332
|
+
disablePrimaryAction: isSubmitting })] }, String(stepKey)));
|
|
336
333
|
};
|
|
337
334
|
|
|
338
335
|
const cvaFormWizardContainer = cvaMerge(["h-full"]);
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-form-wizard",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.24-alpha-3e7014314a8.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"zod": "^3.25.76",
|
|
8
8
|
"@hookform/resolvers": "^3.3.4",
|
|
9
9
|
"@tanstack/router-core": "1.114.29",
|
|
10
|
-
"@trackunit/shared-utils": "1.16.
|
|
11
|
-
"@trackunit/css-class-variance-utilities": "1.14.
|
|
12
|
-
"@trackunit/react-components": "2.10.
|
|
13
|
-
"@trackunit/i18n-library-translation": "2.4.
|
|
10
|
+
"@trackunit/shared-utils": "1.16.23-alpha-3e7014314a8.0",
|
|
11
|
+
"@trackunit/css-class-variance-utilities": "1.14.20-alpha-3e7014314a8.0",
|
|
12
|
+
"@trackunit/react-components": "2.10.16-alpha-3e7014314a8.0",
|
|
13
|
+
"@trackunit/i18n-library-translation": "2.4.22-alpha-3e7014314a8.0"
|
|
14
14
|
},
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">=24.x",
|
|
@@ -17,8 +17,6 @@ export type StepComponentPropsInner<TStepSchema extends TFullSchemaValue[keyof T
|
|
|
17
17
|
setSubmitHandler: ((onFinalSubmit: (fullFormState: TFullSchemaValue) => void) => void) | null;
|
|
18
18
|
beforeStepSubmit?: ((beforeSubmit: (fullFormState: TFullSchemaValue) => void) => void) | null;
|
|
19
19
|
resetFullFormState?: ((reset: () => void) => void) | null;
|
|
20
|
-
/** Lets the step disable the footer's primary action, e.g. after a completed final submit. */
|
|
21
|
-
setPrimaryActionDisabled?: ((disabled: boolean) => void) | null;
|
|
22
20
|
};
|
|
23
21
|
export interface SimpleStepProps {
|
|
24
22
|
title: string;
|
package/migrations/entry.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../../../../../libs/react/form-wizard/migrations/entry.ts"],"names":[],"mappings":"","sourcesContent":["export {};\n"]}
|