@trackunit/react-form-wizard 1.6.37 → 1.6.39
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 -9
- package/index.esm.js +4 -9
- package/package.json +6 -6
package/index.cjs.js
CHANGED
|
@@ -267,7 +267,6 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
|
|
|
267
267
|
submitHandlerInternal?.(fullFormState);
|
|
268
268
|
}
|
|
269
269
|
else if (nextStepPath) {
|
|
270
|
-
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
271
270
|
navigate({ to: basePath, params: { stepPath: nextStepPath } });
|
|
272
271
|
}
|
|
273
272
|
}, [basePath, beforeSubmitInternal, fullFormState, isLastStep, navigate, nextStepPath, submitHandlerInternal]);
|
|
@@ -280,7 +279,6 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
|
|
|
280
279
|
await submitHandlerInternal?.({ ...fullFormState, [stepKey]: data });
|
|
281
280
|
}
|
|
282
281
|
else if (nextStepPath) {
|
|
283
|
-
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
284
282
|
navigate({ to: basePath, params: { stepPath: nextStepPath } });
|
|
285
283
|
}
|
|
286
284
|
}), [
|
|
@@ -316,7 +314,7 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
|
|
|
316
314
|
try {
|
|
317
315
|
await onPrimaryAction?.(form);
|
|
318
316
|
}
|
|
319
|
-
catch
|
|
317
|
+
catch {
|
|
320
318
|
sharedUtils.doNothing();
|
|
321
319
|
}
|
|
322
320
|
handleSubmit();
|
|
@@ -328,7 +326,7 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
|
|
|
328
326
|
resetFullFormState,
|
|
329
327
|
}) }) }), jsxRuntime.jsx(FormWizardFooter, { stepForms,
|
|
330
328
|
onBack: previousStepPath
|
|
331
|
-
?
|
|
329
|
+
?
|
|
332
330
|
() => navigate({ to: basePath, params: { stepPath: previousStepPath } })
|
|
333
331
|
: null,
|
|
334
332
|
primaryActionLabel: isLastStep ? lastStepPrimaryActionLabel : undefined,
|
|
@@ -366,9 +364,7 @@ const cvaStepContainer = cssClassVarianceUtilities.cvaMerge(["h-full", "grid", "
|
|
|
366
364
|
const FormWizard = ({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema, onCancel, className, dataTestId, basePath, }) => {
|
|
367
365
|
const navigate = reactRouter.useNavigate();
|
|
368
366
|
const { stepPath, subStepPath } = reactRouter.useParams({ strict: false });
|
|
369
|
-
const initialFullFormState = react.useMemo(() =>
|
|
370
|
-
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
371
|
-
sharedUtils.objectFromEntries(sharedUtils.objectEntries(steps)
|
|
367
|
+
const initialFullFormState = react.useMemo(() => sharedUtils.objectFromEntries(sharedUtils.objectEntries(steps)
|
|
372
368
|
.filter(([_, { defaultValues }]) => defaultValues)
|
|
373
369
|
.map(([key, { defaultValues }]) => [key, defaultValues])), [steps]);
|
|
374
370
|
const [stepStates, setStepStates] = react.useState({});
|
|
@@ -394,7 +390,7 @@ const FormWizard = ({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema,
|
|
|
394
390
|
*/
|
|
395
391
|
const hasShouldRenderProperty = react.useCallback((obj) => {
|
|
396
392
|
// TODO: remove this check if we can figure out a way to make TypeScript infer the type correctly
|
|
397
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
393
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
398
394
|
return typeof obj.shouldRender === "function";
|
|
399
395
|
}, []);
|
|
400
396
|
const currentVisibleStepKey = subStepPath ? `${stepPath}/${subStepPath}` : stepPath;
|
|
@@ -565,7 +561,6 @@ const FormWizard = ({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema,
|
|
|
565
561
|
const useFormWizard = (props) => {
|
|
566
562
|
return react.useMemo(() => ({
|
|
567
563
|
...props,
|
|
568
|
-
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
569
564
|
steps: sharedUtils.objectFromEntries(sharedUtils.objectEntries(props.steps).map(([key, step]) => [key, { ...step, formSchema: props.fullFormSchema.shape[key] }])), // TODO: find a work around for string | number | symbol,
|
|
570
565
|
}), [props]);
|
|
571
566
|
};
|
package/index.esm.js
CHANGED
|
@@ -265,7 +265,6 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
|
|
|
265
265
|
submitHandlerInternal?.(fullFormState);
|
|
266
266
|
}
|
|
267
267
|
else if (nextStepPath) {
|
|
268
|
-
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
269
268
|
navigate({ to: basePath, params: { stepPath: nextStepPath } });
|
|
270
269
|
}
|
|
271
270
|
}, [basePath, beforeSubmitInternal, fullFormState, isLastStep, navigate, nextStepPath, submitHandlerInternal]);
|
|
@@ -278,7 +277,6 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
|
|
|
278
277
|
await submitHandlerInternal?.({ ...fullFormState, [stepKey]: data });
|
|
279
278
|
}
|
|
280
279
|
else if (nextStepPath) {
|
|
281
|
-
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
282
280
|
navigate({ to: basePath, params: { stepPath: nextStepPath } });
|
|
283
281
|
}
|
|
284
282
|
}), [
|
|
@@ -314,7 +312,7 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
|
|
|
314
312
|
try {
|
|
315
313
|
await onPrimaryAction?.(form);
|
|
316
314
|
}
|
|
317
|
-
catch
|
|
315
|
+
catch {
|
|
318
316
|
doNothing();
|
|
319
317
|
}
|
|
320
318
|
handleSubmit();
|
|
@@ -326,7 +324,7 @@ const FormWizardStepWrapper = ({ stepKey, onCancel, description, title, componen
|
|
|
326
324
|
resetFullFormState,
|
|
327
325
|
}) }) }), jsx(FormWizardFooter, { stepForms,
|
|
328
326
|
onBack: previousStepPath
|
|
329
|
-
?
|
|
327
|
+
?
|
|
330
328
|
() => navigate({ to: basePath, params: { stepPath: previousStepPath } })
|
|
331
329
|
: null,
|
|
332
330
|
primaryActionLabel: isLastStep ? lastStepPrimaryActionLabel : undefined,
|
|
@@ -364,9 +362,7 @@ const cvaStepContainer = cvaMerge(["h-full", "grid", "bg-white", "overflow-hidde
|
|
|
364
362
|
const FormWizard = ({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema, onCancel, className, dataTestId, basePath, }) => {
|
|
365
363
|
const navigate = useNavigate();
|
|
366
364
|
const { stepPath, subStepPath } = useParams({ strict: false });
|
|
367
|
-
const initialFullFormState = useMemo(() =>
|
|
368
|
-
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
369
|
-
objectFromEntries(objectEntries(steps)
|
|
365
|
+
const initialFullFormState = useMemo(() => objectFromEntries(objectEntries(steps)
|
|
370
366
|
.filter(([_, { defaultValues }]) => defaultValues)
|
|
371
367
|
.map(([key, { defaultValues }]) => [key, defaultValues])), [steps]);
|
|
372
368
|
const [stepStates, setStepStates] = useState({});
|
|
@@ -392,7 +388,7 @@ const FormWizard = ({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema,
|
|
|
392
388
|
*/
|
|
393
389
|
const hasShouldRenderProperty = useCallback((obj) => {
|
|
394
390
|
// TODO: remove this check if we can figure out a way to make TypeScript infer the type correctly
|
|
395
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
391
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
396
392
|
return typeof obj.shouldRender === "function";
|
|
397
393
|
}, []);
|
|
398
394
|
const currentVisibleStepKey = subStepPath ? `${stepPath}/${subStepPath}` : stepPath;
|
|
@@ -563,7 +559,6 @@ const FormWizard = ({ lastStepPrimaryActionLabel, isEdit, steps, fullFormSchema,
|
|
|
563
559
|
const useFormWizard = (props) => {
|
|
564
560
|
return useMemo(() => ({
|
|
565
561
|
...props,
|
|
566
|
-
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
567
562
|
steps: objectFromEntries(objectEntries(props.steps).map(([key, step]) => [key, { ...step, formSchema: props.fullFormSchema.shape[key] }])), // TODO: find a work around for string | number | symbol,
|
|
568
563
|
}), [props]);
|
|
569
564
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-form-wizard",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.39",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"dependencies": {
|
|
@@ -10,11 +10,11 @@
|
|
|
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.8.
|
|
14
|
-
"@trackunit/css-class-variance-utilities": "1.6.
|
|
15
|
-
"@trackunit/react-components": "1.7.
|
|
16
|
-
"@trackunit/i18n-library-translation": "1.6.
|
|
17
|
-
"@trackunit/react-test-setup": "1.3.
|
|
13
|
+
"@trackunit/shared-utils": "1.8.27",
|
|
14
|
+
"@trackunit/css-class-variance-utilities": "1.6.27",
|
|
15
|
+
"@trackunit/react-components": "1.7.36",
|
|
16
|
+
"@trackunit/i18n-library-translation": "1.6.30",
|
|
17
|
+
"@trackunit/react-test-setup": "1.3.27"
|
|
18
18
|
},
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=22.x",
|