Skip to content

Commit

Permalink
fix(snippet): invalid props (#1546)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrgarciadev authored Sep 1, 2023
1 parent cac56fa commit faf26ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/moody-socks-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/snippet": patch
---

Snippet invalid props fixed
7 changes: 5 additions & 2 deletions packages/components/snippet/src/use-snippet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type {SnippetVariantProps, SnippetSlots, SlotsToClasses} from "@nextui-or

import {snippet} from "@nextui-org/theme";
import {HTMLNextUIProps, mapPropsVariants, PropGetter} from "@nextui-org/system";
import {useDOMRef} from "@nextui-org/react-utils";
import {useDOMRef, filterDOMProps} from "@nextui-org/react-utils";
import {clsx, dataAttr} from "@nextui-org/shared-utils";
import {ReactRef} from "@nextui-org/react-utils";
import {useClipboard} from "@nextui-org/use-clipboard";
Expand Down Expand Up @@ -141,6 +141,7 @@ export function useSnippet(originalProps: UseSnippetProps) {
} = props;

const Component = as || "div";
const shouldFilterDOMProps = typeof Component === "string";

const tooltipProps: Partial<TooltipProps> = {
offset: 15,
Expand Down Expand Up @@ -184,7 +185,9 @@ export function useSnippet(originalProps: UseSnippetProps) {
className: slots.base({
class: baseStyles,
}),
...otherProps,
...filterDOMProps(otherProps, {
enabled: shouldFilterDOMProps,
}),
}),
[slots, baseStyles, isMultiLine, otherProps],
);
Expand Down

2 comments on commit faf26ac

@vercel
Copy link

@vercel vercel bot commented on faf26ac Sep 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on faf26ac Sep 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.