@jfdevelops/react-multi-step-form 1.0.0-alpha.3 → 1.0.0-alpha.30
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/dist/create-context.cjs +92 -0
- package/dist/create-context.cjs.map +1 -0
- package/dist/create-context.d.cts +154 -0
- package/dist/create-context.d.mts +154 -0
- package/dist/create-context.mjs +92 -0
- package/dist/create-context.mjs.map +1 -0
- package/dist/field.cjs +41 -0
- package/dist/field.cjs.map +1 -0
- package/dist/field.d.cts +68 -0
- package/dist/field.d.mts +68 -0
- package/dist/field.mjs +36 -0
- package/dist/field.mjs.map +1 -0
- package/dist/form-config.cjs +32 -0
- package/dist/form-config.cjs.map +1 -0
- package/dist/form-config.d.cts +160 -0
- package/dist/form-config.d.mts +160 -0
- package/dist/form-config.mjs +27 -0
- package/dist/form-config.mjs.map +1 -0
- package/dist/hooks/use-multi-step-form-data.cjs +41 -0
- package/dist/hooks/use-multi-step-form-data.cjs.map +1 -0
- package/dist/hooks/use-multi-step-form-data.d.cts +28 -0
- package/dist/hooks/use-multi-step-form-data.d.mts +28 -0
- package/dist/hooks/use-multi-step-form-data.mjs +39 -0
- package/dist/hooks/use-multi-step-form-data.mjs.map +1 -0
- package/dist/hooks/use-selector.cjs +64 -0
- package/dist/hooks/use-selector.cjs.map +1 -0
- package/dist/hooks/use-selector.d.cts +92 -0
- package/dist/hooks/use-selector.d.mts +92 -0
- package/dist/hooks/use-selector.mjs +64 -0
- package/dist/hooks/use-selector.mjs.map +1 -0
- package/dist/index.cjs +16 -43
- package/dist/index.d.cts +5 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +5 -1415
- package/dist/schema.cjs +45 -0
- package/dist/schema.cjs.map +1 -0
- package/dist/schema.d.cts +34 -0
- package/dist/schema.d.mts +34 -0
- package/dist/schema.mjs +44 -0
- package/dist/schema.mjs.map +1 -0
- package/dist/selector.cjs +53 -0
- package/dist/selector.cjs.map +1 -0
- package/dist/selector.d.cts +56 -0
- package/dist/selector.d.mts +56 -0
- package/dist/selector.mjs +48 -0
- package/dist/selector.mjs.map +1 -0
- package/dist/step-schema.cjs +244 -0
- package/dist/step-schema.cjs.map +1 -0
- package/dist/step-schema.d.cts +164 -0
- package/dist/step-schema.d.mts +164 -0
- package/dist/step-schema.mjs +237 -0
- package/dist/step-schema.mjs.map +1 -0
- package/dist/utils.cjs +34 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.mjs +33 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +15 -11
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/types/create-context.d.ts +0 -156
- package/dist/types/field.d.ts +0 -22
- package/dist/types/form-config.d.ts +0 -161
- package/dist/types/hooks/use-multi-step-form-data.d.ts +0 -26
- package/dist/types/index.d.ts +0 -4
- package/dist/types/schema.d.ts +0 -29
- package/dist/types/step-schema.d.ts +0 -134
- package/dist/types/utils.d.ts +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,44 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const require_step_schema = require('./step-schema.cjs');
|
|
2
|
+
const require_schema = require('./schema.cjs');
|
|
3
|
+
const require_use_multi_step_form_data = require('./hooks/use-multi-step-form-data.cjs');
|
|
4
|
+
const require_create_context = require('./create-context.cjs');
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
*/var ee;function Fe(){if(ee)return D;ee=1;var o=N;function e(u,l){return u===l&&(u!==0||1/u===1/l)||u!==u&&l!==l}var t=typeof Object.is=="function"?Object.is:e,r=o.useState,s=o.useEffect,n=o.useLayoutEffect,i=o.useDebugValue;function p(u,l){var a=l(),c=r({inst:{value:a,getSnapshot:l}}),m=c[0].inst,S=c[1];return n(function(){m.value=a,m.getSnapshot=l,y(m)&&S({inst:m})},[u,a,l]),s(function(){return y(m)&&S({inst:m}),u(function(){y(m)&&S({inst:m})})},[u]),i(a),a}function y(u){var l=u.getSnapshot;u=u.value;try{var a=l();return!t(u,a)}catch{return!0}}function f(u,l){return l()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:p;return D.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:d,D}var k={};/**
|
|
20
|
-
* @license React
|
|
21
|
-
* use-sync-external-store-shim.development.js
|
|
22
|
-
*
|
|
23
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
24
|
-
*
|
|
25
|
-
* This source code is licensed under the MIT license found in the
|
|
26
|
-
* LICENSE file in the root directory of this source tree.
|
|
27
|
-
*/var te;function Ae(){return te||(te=1,process.env.NODE_ENV!=="production"&&(function(){function o(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}function e(a,c){d||s.startTransition===void 0||(d=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=c();if(!u){var S=c();n(m,S)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}S=i({inst:{value:m,getSnapshot:c}});var _=S[0].inst,w=S[1];return y(function(){_.value=m,_.getSnapshot=c,t(_)&&w({inst:_})},[a,m,c]),p(function(){return t(_)&&w({inst:_}),a(function(){t(_)&&w({inst:_})})},[a]),f(m),m}function t(a){var c=a.getSnapshot;a=a.value;try{var m=c();return!n(a,m)}catch{return!0}}function r(a,c){return c()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=N,n=typeof Object.is=="function"?Object.is:o,i=s.useState,p=s.useEffect,y=s.useLayoutEffect,f=s.useDebugValue,d=!1,u=!1,l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:e;k.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:l,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),k}var re;function Se(){return re||(re=1,process.env.NODE_ENV==="production"?j.exports=Fe():j.exports=Ae()),j.exports}/**
|
|
28
|
-
* @license React
|
|
29
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
30
|
-
*
|
|
31
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
32
|
-
*
|
|
33
|
-
* This source code is licensed under the MIT license found in the
|
|
34
|
-
* LICENSE file in the root directory of this source tree.
|
|
35
|
-
*/var ne;function Ne(){if(ne)return L;ne=1;var o=N,e=Se();function t(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}var r=typeof Object.is=="function"?Object.is:t,s=e.useSyncExternalStore,n=o.useRef,i=o.useEffect,p=o.useMemo,y=o.useDebugValue;return L.useSyncExternalStoreWithSelector=function(f,d,u,l,a){var c=n(null);if(c.current===null){var m={hasValue:!1,value:null};c.current=m}else m=c.current;c=p(function(){function _(g){if(!w){if(w=!0,b=g,g=l(g),a!==void 0&&m.hasValue){var v=m.value;if(a(v,g))return O=v}return O=g}if(v=O,r(b,g))return v;var E=l(g);return a!==void 0&&a(v,E)?(b=g,v):(b=g,O=E)}var w=!1,b,O,T=u===void 0?null:u;return[function(){return _(d())},T===null?void 0:function(){return _(T())}]},[d,u,l,a]);var S=s(f,c[0],c[1]);return i(function(){m.hasValue=!0,m.value=S},[S]),y(S),S},L}var M={};/**
|
|
36
|
-
* @license React
|
|
37
|
-
* use-sync-external-store-shim/with-selector.development.js
|
|
38
|
-
*
|
|
39
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
40
|
-
*
|
|
41
|
-
* This source code is licensed under the MIT license found in the
|
|
42
|
-
* LICENSE file in the root directory of this source tree.
|
|
43
|
-
*/var se;function xe(){return se||(se=1,process.env.NODE_ENV!=="production"&&(function(){function o(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=N,t=Se(),r=typeof Object.is=="function"?Object.is:o,s=t.useSyncExternalStore,n=e.useRef,i=e.useEffect,p=e.useMemo,y=e.useDebugValue;M.useSyncExternalStoreWithSelector=function(f,d,u,l,a){var c=n(null);if(c.current===null){var m={hasValue:!1,value:null};c.current=m}else m=c.current;c=p(function(){function _(g){if(!w){if(w=!0,b=g,g=l(g),a!==void 0&&m.hasValue){var v=m.value;if(a(v,g))return O=v}return O=g}if(v=O,r(b,g))return v;var E=l(g);return a!==void 0&&a(v,E)?(b=g,v):(b=g,O=E)}var w=!1,b,O,T=u===void 0?null:u;return[function(){return _(d())},T===null?void 0:function(){return _(T())}]},[d,u,l,a]);var S=s(f,c[0],c[1]);return i(function(){m.hasValue=!0,m.value=S},[S]),y(S),S},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),M}var oe;function Ie(){return oe||(oe=1,process.env.NODE_ENV==="production"?C.exports=Ne():C.exports=xe()),C.exports}var Le=Ie();function H(o,e){h(typeof e=="string",`The target step must be a string, was ${typeof e}`);const{as:t,isValidStepNumber:r}=o.stepSchema.steps,n=new Intl.ListFormat("en",{type:"disjunction",style:"long"}).format(t("array.string.untyped"));h(pe.test(e),`The target step must match the following format: "step{number}". Available steps are ${n}`);const i=Number.parseInt(e.replace("step",""));return h(r(i),`The step number "${i}" is not a valid step number. Valid step numbers include ${n}`,TypeError),i}function be(o){function e(t){return Le.useSyncExternalStoreWithSelector(o.subscribe,()=>o.getSnapshot(),()=>o.getSnapshot(),r=>{if(typeof t=="object"){const s=H(r,t.targetStep);return r.stepSchema.get({step:s}).data}return typeof t=="function"?t(r):r})}return e}function De(o,e){const t=be(o);return typeof e=="object"||typeof e=="function"?t(e):t()}function ie(o){return function(e){return(t=>e(o,t))}}function ke(o){const e=be(o);function t(p){const{targetStep:y,notFoundMessage:f,isDataGuaranteed:d}=p,u=e({targetStep:y}),l=f?i({targetStep:y},f):a=>R.jsxs("div",{...a,children:["No data found for step ",String(y)]});return d?{data:u,NoCurrentData:l}:G.hasData(u)?{data:u,hasData:!0,NoCurrentData:l}:{data:void 0,hasData:!1,NoCurrentData:l}}function r(p){const y=e(S=>S.stepSchema.steps.value.length),{targetStep:f,maxProgressValue:d=100,totalSteps:u=y,progressTextTransformer:l}=p,a=H(o,f),c=a/u*d,m=l?n({targetStep:f,maxProgressValue:d,totalSteps:u},l):S=>R.jsxs("div",{...S,children:["Step ",a,"/",u]});return{value:c,maxProgressValue:d,ProgressText:m}}function s(p){const f=e(u=>u.storage).get(),d=!!(f&&typeof f=="object"&&Object.keys(f).length>0);return p?p(d):d}function n(p,y){const f=o.getSnapshot().stepSchema.steps.value.length,{targetStep:d,maxProgressValue:u=100,totalSteps:l=f}=p;return ie({targetStep:d,maxProgressValue:u,totalSteps:l})(y)}function i(p,y){return H(o,p.targetStep),ie(p)(y)}return{useMultiStepFormData:e,useCurrentStepData:t,useProgress:r,useCanRestartForm:s,withProgressText:n,withNoStepDataFound:i}}exports.MultiStepFormSchema=ye;exports.MultiStepFormStepSchema=me;exports.createDefaultValues=he;exports.createMultiStepFormContext=ke;exports.createMultiStepFormSchema=Ve;exports.useMultiStepFormData=De;
|
|
44
|
-
//# sourceMappingURL=index.cjs.map
|
|
6
|
+
exports.MultiStepFormSchema = require_schema.MultiStepFormSchema;
|
|
7
|
+
exports.MultiStepFormStepSchema = require_step_schema.MultiStepFormStepSchema;
|
|
8
|
+
Object.defineProperty(exports, 'StepSpecificComponent', {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () {
|
|
11
|
+
return require_step_schema.StepSpecificComponent;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
exports.createDefaultValues = require_step_schema.createDefaultValues;
|
|
15
|
+
exports.createMultiStepFormContext = require_create_context.createMultiStepFormContext;
|
|
16
|
+
exports.createMultiStepFormSchema = require_schema.createMultiStepFormSchema;
|
|
17
|
+
exports.useMultiStepFormData = require_use_multi_step_form_data.useMultiStepFormData;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AnyResolvedStep, CreateComponent, CreateComponentCallback, CreateComponentFn, CreateFunction, CreateStepSpecificComponentCallback, CreatedMultiStepFormComponent, ExtractedDefaultValues, HelperFunctions, MultiStepFormSchemaStepConfig, MultiStepFormStepSchema, ResolvedStep, StepSpecificComponent, StepSpecificCreateComponentFn, createDefaultValues } from "./step-schema.cjs";
|
|
2
|
+
import { AnyMultiStepFormSchema, MultiStepFormSchema, MultiStepFormSchemaOptions, createMultiStepFormSchema } from "./schema.cjs";
|
|
3
|
+
import { useMultiStepFormData } from "./hooks/use-multi-step-form-data.cjs";
|
|
4
|
+
import { CreateHOC, MultiStepFormContextResult, UseCurrentStepBaseResult, UseCurrentStepErrorResult, UseCurrentStepOptions, UseCurrentStepResult, UseCurrentStepSuccessResult, UseProgressBaseOptions, UseProgressOptions, UseProgressResult, createMultiStepFormContext } from "./create-context.cjs";
|
|
5
|
+
export { AnyMultiStepFormSchema, AnyResolvedStep, CreateComponent, CreateComponentCallback, CreateComponentFn, CreateFunction, CreateHOC, CreateStepSpecificComponentCallback, CreatedMultiStepFormComponent, ExtractedDefaultValues, HelperFunctions, MultiStepFormContextResult, MultiStepFormSchema, MultiStepFormSchemaOptions, MultiStepFormSchemaStepConfig, MultiStepFormStepSchema, ResolvedStep, StepSpecificComponent, StepSpecificCreateComponentFn, UseCurrentStepBaseResult, UseCurrentStepErrorResult, UseCurrentStepOptions, UseCurrentStepResult, UseCurrentStepSuccessResult, UseProgressBaseOptions, UseProgressOptions, UseProgressResult, createDefaultValues, createMultiStepFormContext, createMultiStepFormSchema, useMultiStepFormData };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AnyResolvedStep, CreateComponent, CreateComponentCallback, CreateComponentFn, CreateFunction, CreateStepSpecificComponentCallback, CreatedMultiStepFormComponent, ExtractedDefaultValues, HelperFunctions, MultiStepFormSchemaStepConfig, MultiStepFormStepSchema, ResolvedStep, StepSpecificComponent, StepSpecificCreateComponentFn, createDefaultValues } from "./step-schema.mjs";
|
|
2
|
+
import { AnyMultiStepFormSchema, MultiStepFormSchema, MultiStepFormSchemaOptions, createMultiStepFormSchema } from "./schema.mjs";
|
|
3
|
+
import { useMultiStepFormData } from "./hooks/use-multi-step-form-data.mjs";
|
|
4
|
+
import { CreateHOC, MultiStepFormContextResult, UseCurrentStepBaseResult, UseCurrentStepErrorResult, UseCurrentStepOptions, UseCurrentStepResult, UseCurrentStepSuccessResult, UseProgressBaseOptions, UseProgressOptions, UseProgressResult, createMultiStepFormContext } from "./create-context.mjs";
|
|
5
|
+
export { AnyMultiStepFormSchema, AnyResolvedStep, CreateComponent, CreateComponentCallback, CreateComponentFn, CreateFunction, CreateHOC, CreateStepSpecificComponentCallback, CreatedMultiStepFormComponent, ExtractedDefaultValues, HelperFunctions, MultiStepFormContextResult, MultiStepFormSchema, MultiStepFormSchemaOptions, MultiStepFormSchemaStepConfig, MultiStepFormStepSchema, ResolvedStep, StepSpecificComponent, StepSpecificCreateComponentFn, UseCurrentStepBaseResult, UseCurrentStepErrorResult, UseCurrentStepOptions, UseCurrentStepResult, UseCurrentStepSuccessResult, UseProgressBaseOptions, UseProgressOptions, UseProgressResult, createDefaultValues, createMultiStepFormContext, createMultiStepFormSchema, useMultiStepFormData };
|