@picked/react 0.0.1-dev.1775004084041 → 0.0.1-dev.1775015576394

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.
@@ -0,0 +1,23 @@
1
+ import { ComponentType, default as React } from 'react';
2
+ interface StepProps {
3
+ /** The step key used for registration and lookup. */
4
+ readonly stepKey: string;
5
+ readonly component?: ComponentType<Record<string, unknown>> | Promise<ComponentType<Record<string, unknown>>> | Promise<{
6
+ default: ComponentType<Record<string, unknown>>;
7
+ }>;
8
+ readonly children?: React.ReactNode;
9
+ }
10
+ /**
11
+ * Registers a step with the router and renders its component or children.
12
+ *
13
+ * @param {StepProps} props - The step props.
14
+ * @param {string} props.stepKey - The step key used for registration and lookup.
15
+ * @param {ComponentType | Promise<ComponentType> | Promise<{default: ComponentType}>} [props.component] - An optional component (sync or async) to render for this step.
16
+ * @param {React.ReactNode} [props.children] - Optional children to render when no component is provided.
17
+ * @returns {React.JSX.Element | null} The rendered step content wrapped in a step context provider.
18
+ * @example
19
+ * <Step stepKey="welcome" component={WelcomeStep} />
20
+ */
21
+ declare function Step({ stepKey, component, children }: StepProps): import("react/jsx-runtime").JSX.Element | null;
22
+ export default Step;
23
+ //# sourceMappingURL=Step.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Step.d.ts","sourceRoot":"","sources":["../../src/router/Step.tsx"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAuC,MAAM,OAAO,CAAA;AAI3D,UAAU,SAAS;IACjB,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,SAAS,CAAC,EACf,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACtC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,GAC/C,OAAO,CAAC;QAAE,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;KAAE,CAAC,CAAA;IAChE,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACpC;AAED;;;;;;;;;;GAUG;AACH,iBAAS,IAAI,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,SAAS,kDAmDxD;AAED,eAAe,IAAI,CAAA"}
@@ -1 +1 @@
1
- import{useStepRouter as e}from"./context.js";import{StepContextProvider as t,useSetStepContext as n}from"../hooks/step.js";import{useEffect as r,useMemo as i,useState as a}from"react";import{jsx as o}from"react/jsx-runtime";function s({stepKey:s,id:c,component:l,children:u}){let d=s??c??``,f=i(()=>({id:d,key:d}),[d]),{registerStep:p,unregisterStep:m}=e(),h=i(()=>typeof l==`function`?l:null,[l]),[g,_]=a(null),v=n(d);r(()=>(p(f),()=>m(f)),[p,m,f]),r(()=>{l&&typeof l!=`function`&&Promise.resolve(l).then(e=>{typeof e==`object`&&`default`in e?_(()=>e.default):typeof e==`function`&&_(()=>e)})},[l]);let y=h??g;return l?y?o(t.Provider,{value:v,children:o(y,{})}):null:o(t.Provider,{value:v,children:u})}export{s as default};
1
+ import{useStepRouter as e}from"./context.js";import{StepContextProvider as t,useSetStepContext as n}from"../hooks/step.js";import{useEffect as r,useMemo as i,useState as a}from"react";import{jsx as o}from"react/jsx-runtime";function s({stepKey:s,component:c,children:l}){let u=i(()=>({key:s}),[s]),{registerStep:d,unregisterStep:f}=e(),p=i(()=>typeof c==`function`?c:null,[c]),[m,h]=a(null),g=n(s);r(()=>(d(u),()=>f(u)),[d,f,u]),r(()=>{c&&typeof c!=`function`&&Promise.resolve(c).then(e=>{typeof e==`object`&&`default`in e?h(()=>e.default):typeof e==`function`&&h(()=>e)})},[c]);let _=p??m;return c?_?o(t.Provider,{value:g,children:o(_,{})}):null:o(t.Provider,{value:g,children:l})}export{s as default};
@@ -0,0 +1,15 @@
1
+ import { default as React } from 'react';
2
+ interface StepRouterProps {
3
+ readonly children: React.ReactNode;
4
+ }
5
+ /**
6
+ * Manages step registration and renders children within a step router context.
7
+ *
8
+ * @param props - The router props containing children to render.
9
+ * @param props.children
10
+ * @example
11
+ * <StepRouter><Step key="welcome" /></StepRouter>
12
+ */
13
+ declare function StepRouter({ children }: StepRouterProps): import("react/jsx-runtime").JSX.Element | null;
14
+ export default StepRouter;
15
+ //# sourceMappingURL=StepRouter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StepRouter.d.ts","sourceRoot":"","sources":["../../src/router/StepRouter.tsx"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,OAAO,KAAiD,MAAM,OAAO,CAAA;AAMrE,UAAU,eAAe;IACvB,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CACnC;AAED;;;;;;;GAOG;AACH,iBAAS,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE,eAAe,kDAiDhD;AAED,eAAe,UAAU,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=StepRouter.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StepRouter.test.d.ts","sourceRoot":"","sources":["../../src/router/StepRouter.test.tsx"],"names":[],"mappings":""}
@@ -1,5 +1,4 @@
1
1
  export interface Step {
2
- id: string;
3
2
  key: string;
4
3
  }
5
4
  interface ContextOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/router/context.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,UAAU,cAAc;IACtB,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IACxB,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IACpC,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;CACnC;AAID,eAAO,MAAM,kBAAkB,iDAA6B,CAAA;AAE5D,eAAO,MAAM,aAAa,sBAOzB,CAAA"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/router/context.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,IAAI;IACnB,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,UAAU,cAAc;IACtB,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IACxB,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IACpC,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;CACnC;AAID,eAAO,MAAM,kBAAkB,iDAA6B,CAAA;AAE5D,eAAO,MAAM,aAAa,sBAOzB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picked/react",
3
- "version": "0.0.1-dev.1775004084041",
3
+ "version": "0.0.1-dev.1775015576394",
4
4
  "devDependencies": {
5
5
  "@picked/client": "workspace:*",
6
6
  "@repo/eslint-config": "workspace:*",
@@ -85,7 +85,7 @@
85
85
  },
86
86
  "module": "./dist/index.js",
87
87
  "peerDependencies": {
88
- "@picked/client": "0.0.1-dev.1775004084041",
88
+ "@picked/client": "0.0.1-dev.1775015576394",
89
89
  "effector": "^23.3.0",
90
90
  "effector-react": "^23.3.0",
91
91
  "react": "19.2.2",