diff --git a/.changeset/two-ghosts-search.md b/.changeset/two-ghosts-search.md new file mode 100644 index 0000000000..93c016e26b --- /dev/null +++ b/.changeset/two-ghosts-search.md @@ -0,0 +1,5 @@ +--- +"@nextui-org/alert": patch +--- + +replace decrepate onClick in Alert diff --git a/packages/components/alert/src/alert.tsx b/packages/components/alert/src/alert.tsx index cc8c9a691d..84f77fd618 100644 --- a/packages/components/alert/src/alert.tsx +++ b/packages/components/alert/src/alert.tsx @@ -73,7 +73,7 @@ const Alert = forwardRef<"div", AlertProps>((props, ref) => { aria-label="Close" radius="full" variant="light" - onClick={handleClose} + onPress={handleClose} {...(getCloseButtonProps() as ButtonProps)} > diff --git a/packages/components/button/__tests__/button-group.test.tsx b/packages/components/button/__tests__/button-group.test.tsx index ce31a5b025..fe4569231f 100644 --- a/packages/components/button/__tests__/button-group.test.tsx +++ b/packages/components/button/__tests__/button-group.test.tsx @@ -26,7 +26,7 @@ describe("ButtonGroup", () => { const handler = jest.fn(); const wrapper = render( - , diff --git a/packages/components/button/stories/button.stories.tsx b/packages/components/button/stories/button.stories.tsx index 8a3e5d3214..7dc1f405ca 100644 --- a/packages/components/button/stories/button.stories.tsx +++ b/packages/components/button/stories/button.stories.tsx @@ -82,7 +82,7 @@ const StateTemplate = (args: ButtonProps) => { {...args} aria-label={isOpen ? "Close" : "Open"} aria-pressed={isOpen} - onClick={handlePress} + onPress={handlePress} > {isOpen ? "Close" : "Open"} diff --git a/packages/components/card/__tests__/card.test.tsx b/packages/components/card/__tests__/card.test.tsx index ab0b9c642c..e963ca0673 100644 --- a/packages/components/card/__tests__/card.test.tsx +++ b/packages/components/card/__tests__/card.test.tsx @@ -41,15 +41,15 @@ describe("Card", () => { expect(onPress).toHaveBeenCalled(); }); - it("should trigger onClick function", async () => { - const onClick = jest.fn(); - const {getByRole} = render(); + it("should trigger onPress function", async () => { + const onPress = jest.fn(); + const {getByRole} = render(); const button = getByRole("button"); await user.click(button); - expect(onClick).toHaveBeenCalled(); + expect(onPress).toHaveBeenCalled(); }); it("should render correctly when nested", () => { diff --git a/packages/components/dropdown/stories/dropdown.stories.tsx b/packages/components/dropdown/stories/dropdown.stories.tsx index 12d1379d23..21e280b4a3 100644 --- a/packages/components/dropdown/stories/dropdown.stories.tsx +++ b/packages/components/dropdown/stories/dropdown.stories.tsx @@ -148,7 +148,7 @@ const Template = ({ - alert("New file")}> + alert("New file")}> New file Copy link diff --git a/packages/components/link/stories/link.stories.tsx b/packages/components/link/stories/link.stories.tsx index 9a56a60a42..578985704b 100644 --- a/packages/components/link/stories/link.stories.tsx +++ b/packages/components/link/stories/link.stories.tsx @@ -58,7 +58,7 @@ const PressableTemplate = (args: LinkProps) => { }; return ( - + {isOpen ? "Open" : "Close"} ); diff --git a/packages/components/listbox/stories/listbox.stories.tsx b/packages/components/listbox/stories/listbox.stories.tsx index 38fb8147e1..3369384bf6 100644 --- a/packages/components/listbox/stories/listbox.stories.tsx +++ b/packages/components/listbox/stories/listbox.stories.tsx @@ -174,7 +174,7 @@ const Template = ({color, variant, ...args}: ListboxProps) => ( onAction={(key: Key) => alert(key)} {...args} > - alert("[onClick] New file")}> + alert("[onPress] New file")}> New file Copy link diff --git a/packages/components/menu/stories/menu.stories.tsx b/packages/components/menu/stories/menu.stories.tsx index 0b026b22f7..ec9560300c 100644 --- a/packages/components/menu/stories/menu.stories.tsx +++ b/packages/components/menu/stories/menu.stories.tsx @@ -45,7 +45,7 @@ const defaultProps = { const Template = ({color, variant, ...args}: MenuProps) => ( - alert("[onClick] New file")}> + alert("[onPress] New file")}> New file Copy link