Skip to content

Commit c5811da

Browse files
Copilotjaruesink
andcommitted
Fix FormError component to make name prop truly optional with default '_form'
Co-authored-by: jaruesink <4207065+jaruesink@users.noreply.github.com>
1 parent 16c472a commit c5811da

5 files changed

Lines changed: 11 additions & 14 deletions

File tree

apps/docs/src/remix-hook-form/password-field.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ const testDefaultValues = ({ canvas }: StoryContext) => {
123123

124124
const testPasswordVisibilityToggle = async ({ canvas }: StoryContext) => {
125125
const passwordInput = canvas.getByLabelText('Password');
126-
126+
127127
// Find the toggle button within the same form item as the password input
128128
const formItem =
129129
passwordInput.closest('[class*="FormItem"], .form-item, [data-testid="form-item"]') ||
@@ -136,15 +136,15 @@ const testPasswordVisibilityToggle = async ({ canvas }: StoryContext) => {
136136
// Click toggle to show password
137137
await userEvent.click(toggleButton);
138138
expect(passwordInput).toHaveAttribute('type', 'text');
139-
139+
140140
// Find the hide button for the same field
141141
const hideButton = formItem?.querySelector('button[aria-label="Hide password"]') as HTMLElement;
142142
expect(hideButton).toBeInTheDocument();
143143

144144
// Click toggle to hide password again
145145
await userEvent.click(hideButton);
146146
expect(passwordInput).toHaveAttribute('type', 'password');
147-
147+
148148
// Verify show button is back
149149
const showButtonAgain = formItem?.querySelector('button[aria-label="Show password"]') as HTMLElement;
150150
expect(showButtonAgain).toBeInTheDocument();

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
"name": "forms",
33
"version": "0.2.0",
44
"private": true,
5-
"workspaces": [
6-
"apps/*",
7-
"packages/*"
8-
],
5+
"workspaces": ["apps/*", "packages/*"],
96
"scripts": {
107
"start": "yarn dev",
118
"dev": "turbo run dev",

packages/components/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
"import": "./dist/ui/index.js"
1919
}
2020
},
21-
"files": [
22-
"dist"
23-
],
21+
"files": ["dist"],
2422
"scripts": {
2523
"prepublishOnly": "yarn run build",
2624
"build": "vite build",

packages/components/src/remix-hook-form/form-error.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { useRemixFormContext } from 'remix-hook-form';
2+
import type { FieldComponents } from '../ui/form';
23
import { FormErrorField } from '../ui/form-error-field';
3-
import type { FormErrorFieldProps } from '../ui/form-error-field';
44

5-
export type FormErrorProps = Omit<FormErrorFieldProps, 'control'> & {
5+
export type FormErrorProps = {
66
name?: string;
7+
className?: string;
8+
components?: Partial<FieldComponents>;
79
};
810

911
export function FormError({ name = '_form', ...props }: FormErrorProps) {

packages/components/src/ui/calendar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ function Calendar({
1717
}: React.ComponentProps<typeof DayPicker> & {
1818
buttonVariant?: React.ComponentProps<typeof Button>['variant'];
1919
}) {
20-
2120
return (
2221
<DayPicker
2322
showOutsideDays={showOutsideDays}
@@ -47,7 +46,8 @@ function Calendar({
4746
),
4847
month_caption: 'flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)',
4948
dropdowns: 'w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5',
50-
dropdown_root: 'relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md',
49+
dropdown_root:
50+
'relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md',
5151
dropdown: 'absolute inset-0 opacity-0',
5252
caption_label: cn(
5353
'select-none font-medium',

0 commit comments

Comments
 (0)