Skip to content

Commit 2f4a280

Browse files
Resolve merge conflicts: keep React 19 patterns without forwardRef
- Maintained React 19 patterns in all form components (no forwardRef usage) - Preserved all other changes from medusa-forms branch - Components now use FC<Props> with destructured ref parameter - All form components maintain consistent React 19 ref handling pattern
2 parents d6819ba + a5c0926 commit 2f4a280

60 files changed

Lines changed: 6965 additions & 1747 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cursor/rules/monorepo-organization.mdc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
2-
type: Always
32
description: Monorepo structure and import conventions for the lambda-curry/forms repository
3+
globs:
4+
alwaysApply: false
45
---
56

67
You are an expert in monorepo architecture, package management, and TypeScript module organization.
@@ -169,7 +170,7 @@ src/
169170
{
170171
"peerDependencies": {
171172
"react": "^19.0.0",
172-
"remix-hook-form": "7.0.0"
173+
"remix-hook-form": "7.0.1"
173174
},
174175
"dependencies": {
175176
"@radix-ui/react-slot": "^1.1.2",

.yarn/releases/yarn-4.9.1.cjs

Lines changed: 948 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
nodeLinker: node-modules
2+
3+
yarnPath: .yarn/releases/yarn-4.9.1.cjs

apps/docs/.storybook/main.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ const config: StorybookConfig = {
1212
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
1313
addons: [
1414
getAbsolutePath('@storybook/addon-links'),
15-
getAbsolutePath('@storybook/addon-essentials'),
16-
getAbsolutePath('@storybook/addon-interactions'),
15+
getAbsolutePath("@storybook/addon-docs")
1716
],
1817
framework: {
1918
name: getAbsolutePath('@storybook/react-vite'),

apps/docs/.storybook/preview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Preview } from '@storybook/react';
1+
import type { Preview } from '@storybook/react-vite';
22
import '../src/main.css';
33

44
const preview: Preview = {

apps/docs/package.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,30 @@
1111
"test:local": "test-storybook"
1212
},
1313
"dependencies": {
14+
"@hookform/error-message": "^2.0.0",
15+
"@hookform/resolvers": "^3.9.1",
1416
"@lambdacurry/forms": "*",
15-
"@storybook/addon-essentials": "^8.6.7",
16-
"@storybook/addon-interactions": "^8.6.7",
17-
"@storybook/addon-links": "^8.6.7",
18-
"@storybook/blocks": "^8.6.7",
19-
"@storybook/react": "^8.6.7",
20-
"@storybook/react-vite": "^8.6.7",
21-
"@storybook/test": "^8.6.7",
22-
"storybook": "^8.6.7"
17+
"@lambdacurry/medusa-forms": "*",
18+
"@storybook/addon-links": "^9.0.1",
19+
"@storybook/react-vite": "^9.0.1",
20+
"react": "^19.0.0",
21+
"react-hook-form": "^7.51.0",
22+
"react-router": "^7.6.1",
23+
"remix-hook-form": "^7.0.1",
24+
"storybook": "^9.0.1"
2325
},
2426
"devDependencies": {
2527
"@react-router/dev": "^7.0.0",
28+
"@storybook/addon-docs": "^9.0.1",
2629
"@storybook/test-runner": "^0.22.0",
2730
"@storybook/testing-library": "^0.2.2",
31+
"@tailwindcss/postcss": "^4.1.8",
2832
"@tailwindcss/vite": "^4.0.0",
2933
"@types/react": "^19.0.0",
3034
"@typescript-eslint/eslint-plugin": "^6.21.0",
3135
"@typescript-eslint/parser": "^6.21.0",
3236
"autoprefixer": "^10.4.20",
3337
"http-server": "^14.1.1",
34-
"react": "^19.0.0",
35-
"react-router": "^7.0.0",
36-
"react-router-dom": "^7.0.0",
3738
"start-server-and-test": "^2.0.11",
3839
"tailwindcss": "^4.0.0",
3940
"typescript": "^5.7.2",

apps/docs/src/examples/root-example.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { Outlet } from 'react-router';
12
// Example of setting up the middleware in root.tsx
23
import { unstable_extractFormDataMiddleware } from 'remix-hook-form/middleware';
3-
import { Outlet } from 'react-router-dom';
44

55
// Export the middleware for React Router 7
66
export const unstable_middleware = [unstable_extractFormDataMiddleware()];

apps/docs/src/lib/storybook/react-router-stub.tsx

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,25 @@
1-
import type { Decorator } from '@storybook/react';
1+
import type { Decorator } from '@storybook/react-vite';
22
import type { ComponentType } from 'react';
33
import {
44
type ActionFunction,
5-
type IndexRouteObject,
65
type LinksFunction,
76
type LoaderFunction,
87
type MetaFunction,
9-
type NonIndexRouteObject,
10-
RouterProvider,
11-
createMemoryRouter,
12-
} from 'react-router-dom';
8+
createRoutesStub,
9+
} from 'react-router';
1310

14-
export type StubRouteObject = StubIndexRouteObject | StubNonIndexRouteObject;
15-
16-
interface StubNonIndexRouteObject
17-
extends Omit<NonIndexRouteObject, 'loader' | 'action' | 'element' | 'errorElement' | 'children'> {
11+
export interface StubRouteObject {
12+
path?: string;
13+
index?: boolean;
1814
loader?: LoaderFunction;
1915
action?: ActionFunction;
20-
children?: StubRouteObject[];
2116
meta?: MetaFunction;
2217
links?: LinksFunction;
23-
// biome-ignore lint/suspicious/noExplicitAny: allow any here
18+
// biome-ignore lint/suspicious/noExplicitAny: allow any here for Storybook compatibility
2419
Component?: ComponentType<any>;
25-
}
26-
27-
interface StubIndexRouteObject
28-
extends Omit<IndexRouteObject, 'loader' | 'action' | 'element' | 'errorElement' | 'children'> {
29-
loader?: LoaderFunction;
30-
action?: ActionFunction;
3120
children?: StubRouteObject[];
32-
meta?: MetaFunction;
33-
links?: LinksFunction;
34-
// biome-ignore lint/suspicious/noExplicitAny: allow any here
35-
Component?: ComponentType<any>;
21+
// biome-ignore lint/suspicious/noExplicitAny: allow any here for Storybook compatibility
22+
errorElement?: any;
3623
}
3724

3825
interface RemixStubOptions {
@@ -42,34 +29,28 @@ interface RemixStubOptions {
4229

4330
export const withReactRouterStubDecorator = (options: RemixStubOptions): Decorator => {
4431
const { routes, initialPath = '/' } = options;
45-
// This outer function runs once when Storybook loads the story meta
4632

4733
return (Story, context) => {
48-
// This inner function runs when the story component actually renders
34+
// Map routes to include the Story component if no Component is provided
4935
const mappedRoutes = routes.map((route) => ({
5036
...route,
5137
Component: route.Component ?? (() => <Story {...context.args} />),
5238
}));
5339

5440
// Get the base path (without existing query params from options)
5541
const basePath = initialPath.split('?')[0];
56-
42+
5743
// Get the current search string from the actual browser window, if available
5844
// If not available, use a default search string with parameters needed for the data table
59-
const currentWindowSearch = typeof window !== 'undefined'
60-
? window.location.search
61-
: '?page=0&pageSize=10';
62-
45+
const currentWindowSearch = typeof window !== 'undefined' ? window.location.search : '?page=0&pageSize=10';
46+
6347
// Combine them for the initial entry
6448
const actualInitialPath = `${basePath}${currentWindowSearch}`;
6549

66-
// Create a memory router, initializing it with the path derived from the window's search params
67-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
68-
const router = createMemoryRouter(mappedRoutes as any, {
69-
initialEntries: [actualInitialPath], // Use the path combined with window.location.search
70-
});
50+
// Use React Router's official createRoutesStub
51+
const Stub = createRoutesStub(mappedRoutes);
7152

72-
return <RouterProvider router={router} />;
53+
return <Stub initialEntries={[actualInitialPath]} />;
7354
};
7455
};
7556

0 commit comments

Comments
 (0)