Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/f5h6b0cx9ra.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cube-dev/ui-kit": patch
---

Fix form fields to prevent internal `form` prop from being spread to DOM elements
2 changes: 1 addition & 1 deletion .cursor/rules/changeset.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: When user asked to add a changeset
alwaysApply: false
---

Place the changeset in the `/.changeset` folder.
Add changeset manually. Place the changeset in the `/.changeset` folder.

## Version Selection
- Use `patch` for bug fixes and small changes (even with minor breaking changes)
Expand Down
1 change: 1 addition & 0 deletions src/components/fields/TextInput/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const TextInput = forwardRef(function TextInput(
let {
labelProps: userLabelProps,
inputRef: propsInputRef,
form,
...restProps
} = props;
let localInputRef = useRef<HTMLTextAreaElement | HTMLInputElement>(null);
Expand Down
5 changes: 4 additions & 1 deletion src/components/form/Form/use-field/use-field-props.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,12 @@ export function useFieldProps<
? field.field.errors[0]
: undefined;

// Exclude 'form' from field to prevent it from being spread to DOM elements
const { form: _form, ...fieldWithoutForm } = field ?? {};

const result: Props = isOutsideOfForm
? props
: mergeProps(props, field, valueProps, {
: mergeProps(props, fieldWithoutForm, valueProps, {
validateTrigger: field.validateTrigger ?? defaultValidationTrigger,
onBlur: onBlurChained,
errorMessage: compiledErrorMessage,
Expand Down
Loading